AFS
view release on metacpan or search on metacpan
sprintf(buffer, "VLDB: a read terminated too early\n");
break;
case VL_NAMEEXIST:
sprintf(buffer, "VLDB: volume entry exists in the vldb\n");
break;
case VL_CREATEFAIL:
sprintf(buffer, "VLDB: internal creation failure\n");
break;
case VL_NOENT:
sprintf(buffer, "VLDB: no such entry\n");
break;
case VL_EMPTY:
sprintf(buffer, "VLDB: vldb database is empty\n");
break;
case VL_ENTDELETED:
sprintf(buffer, "VLDB: entry is deleted (soft delete)\n");
break;
case VL_BADNAME:
sprintf(buffer, "VLDB: volume name is illegal\n");
break;
case VL_BADINDEX:
sprintf(buffer, "VLDB: index was out of range\n");
break;
case VL_BADVOLTYPE:
sprintf(buffer, "VLDB: bad volume type\n");
break;
case VL_BADSERVER:
sprintf(buffer, "VLDB: illegal server number (not within limits)\n");
break;
case VL_BADPARTITION:
sprintf(buffer, "VLDB: bad partition number\n");
break;
case VL_REPSFULL:
sprintf(buffer, "VLDB: run out of space for replication sites\n");
break;
case VL_NOREPSERVER:
sprintf(buffer, "VLDB: no such repsite server exists\n");
break;
case VL_DUPREPSERVER:
sprintf(buffer, "VLDB: replication site server already exists\n");
break;
case VL_RWNOTFOUND:
sprintf(buffer, "VLDB: parent r/w entry not found\n");
break;
case VL_BADREFCOUNT:
sprintf(buffer, "VLDB: illegal reference count number\n");
break;
case VL_SIZEEXCEEDED:
sprintf(buffer, "VLDB: vldb size for attributes exceeded\n");
break;
case VL_BADENTRY:
sprintf(buffer, "VLDB: bad incoming vldb entry\n");
break;
case VL_BADVOLIDBUMP:
sprintf(buffer, "VLDB: illegal max volid increment\n");
break;
case VL_IDALREADYHASHED:
sprintf(buffer, "VLDB: (RO/BACK) Id already hashed\n");
break;
case VL_ENTRYLOCKED:
sprintf(buffer, "VLDB: vldb entry is already locked\n");
break;
case VL_BADVOLOPER:
sprintf(buffer, "VLDB: bad volume operation code\n");
break;
case VL_BADRELLOCKTYPE:
sprintf(buffer, "VLDB: bad release lock type\n");
break;
case VL_RERELEASE:
sprintf(buffer, "VLDB: status report: last release was aborted\n");
break;
case VL_BADSERVERFLAG:
sprintf(buffer, "VLDB: invalid replication site server flag\n");
break;
case VL_PERM:
sprintf(buffer, "VLDB: no permission access for call\n");
break;
case VOLSERREAD_DUMPERROR:
sprintf(buffer, "VOLSER: Problems encountered in reading the dump file !\n");
break;
case VOLSERDUMPERROR:
sprintf(buffer, "VOLSER: Problems encountered in doing the dump !\n");
break;
case VOLSERATTACH_ERROR:
sprintf(buffer, "VOLSER: Could not attach the volume\n");
break;
case VOLSERDETACH_ERROR:
sprintf(buffer, "VOLSER: Could not detach the volume\n");
break;
case VOLSERILLEGAL_PARTITION:
sprintf(buffer, "VOLSER: encountered illegal partition number\n");
break;
case VOLSERBAD_ACCESS:
sprintf(buffer, "VOLSER: permission denied, not a super user\n");
break;
case VOLSERVLDB_ERROR:
sprintf(buffer, "VOLSER: error detected in the VLDB\n");
break;
case VOLSERBADNAME:
sprintf(buffer, "VOLSER: error in volume name\n");
break;
case VOLSERVOLMOVED:
sprintf(buffer, "VOLSER: volume has moved\n");
break;
case VOLSERBADOP:
sprintf(buffer, "VOLSER: illegal operation\n");
break;
case VOLSERBADRELEASE:
sprintf(buffer, "VOLSER: release could not be completed\n");
break;
case VOLSERVOLBUSY:
sprintf(buffer, "VOLSER: volume is busy\n");
break;
case VOLSERNO_MEMORY:
sprintf(buffer, "VOLSER: volume server is out of memory\n");
break;
case VOLSERNOVOL:
sprintf(buffer,
"VOLSER: no such volume - location specified incorrectly or volume does not exist\n");
break;
case VOLSERMULTIRWVOL:
/* helper functions for VLDB class: */
void myEnumerateEntry(stats, entry)
HV *stats;
struct nvldbentry *entry;
{
int i;
char pname[10];
char hostname[256];
int isMixed = 0;
AV *av = (AV *) sv_2mortal((SV *) newAV());
if (entry->flags & RW_EXISTS)
safe_hv_store(stats, "RWrite", 6, newSViv(entry->volumeId[RWVOL]), 0);
if (entry->flags & RO_EXISTS)
safe_hv_store(stats, "ROnly", 5, newSViv(entry->volumeId[ROVOL]), 0);
if (entry->flags & BACK_EXISTS)
safe_hv_store(stats, "Backup", 6, newSViv(entry->volumeId[BACKVOL]), 0);
if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS))
safe_hv_store(stats, "cloneId", 7, newSViv(entry->cloneId), 0);
safe_hv_store(stats, "nServers", 8, newSViv(entry->nServers), 0);
for (i = 0; i < entry->nServers; i++) {
if (entry->serverFlags[i] & NEW_REPSITE)
isMixed = 1;
}
for (i = 0; i < entry->nServers; i++) {
HV *server = (HV *) sv_2mortal((SV *) newHV());
MapPartIdIntoName(entry->serverPartition[i], pname);
strcpy(hostname, (char *) hostutil_GetNameByINet(entry->serverNumber[i]));
safe_hv_store(server, "name", 4, newSVpv(hostname, strlen((char *) hostname)), 0);
safe_hv_store(server, "partition", 9, newSVpv(pname, strlen((char *) pname)), 0);
safe_hv_store(server, "serverFlags", 11, newSViv(entry->serverFlags[i]), 0);
if (entry->serverFlags[i] & ITSRWVOL)
safe_hv_store(server, "type", 4, newSVpv("RW", 2), 0);
else
safe_hv_store(server, "type", 4, newSVpv("RO", 2), 0);
if (isMixed) {
if (entry->serverFlags[i] & NEW_REPSITE)
safe_hv_store(server, "release", 7, newSVpv("New release", 11), 0);
else
safe_hv_store(server, "release", 7, newSVpv("Old release", 11), 0);
}
else {
if (entry->serverFlags[i] & RO_DONTUSE)
safe_hv_store(server, "release", 7, newSVpv("Not released", 12), 0);
}
av_push(av, newRV_inc((SV *) (server)));
}
safe_hv_store(stats, "server", 6, newRV_inc((SV *) (av)), 0);
safe_hv_store(stats, "flags", 5, newSViv(entry->flags), 0);
if (entry->flags & VLOP_ALLOPERS)
safe_hv_store(stats, "locked", 6, newSViv(entry->flags & VLOP_ALLOPERS), 0);
return;
}
static int VolumeInfoCmd(stats, name)
HV *stats;
char *name;
{
struct nvldbentry entry;
afs_int32 vcode;
/* printf("DEBUG-1-VolumeInfoCmd %s \n", name); */
/* The vlserver will handle names with the .readonly
* and .backup extension as well as volume ids.
*/
vcode = VLDB_GetEntryByName(name, &entry);
/* printf("DEBUG-2-VolumeInfoCmd %d \n", vcode); */
if (vcode)
return (vcode);
/* printf("DEBUG-3-VolumeInfoCmd \n"); */
MapHostToNetwork(&entry);
/* printf("DEBUG-4-VolumeInfoCmd \n"); */
myEnumerateEntry(stats, &entry);
/* printf("DEBUG-5-VolumeInfoCmd \n"); */
return 0;
}
/* static void PostVolumeStats_ZZZ(volinfo, entry) */
/* HV *volinfo; */
/* struct nvldbentry *entry; */
/* { */
/* myEnumerateEntry(volinfo, entry); */
/* /\* Check for VLOP_ALLOPERS *\/ */
/* if (entry->flags & VLOP_ALLOPERS) */
/* fprintf(STDOUT, " Volume is currently LOCKED \n"); */
/* return; */
/* } */
static void myprint_addrs(addr, addrs, m_uuid, nentries, print, noresolve)
HV * addr;
const bulkaddrs * addrs;
const afsUUID * m_uuid;
int nentries;
int print;
int noresolve;
{
afs_int32 vcode;
afs_int32 i;
afs_int32 *addrp;
bulkaddrs m_addrs;
ListAddrByAttributes m_attrs;
afs_int32 m_unique, m_nentries, *m_addrp;
afs_int32 base, index;
char buf[1024];
#ifdef OpenAFS
if (print) {
afsUUID_to_string(m_uuid, buf, sizeof(buf));
VSETCODE(code, "changeloc");
goto done;
}
SETCODE(0);
RETVAL = 1;
done:
;
#else
not_here("AFS::VLDB::changeloc");
#endif
}
OUTPUT:
RETVAL
void
vldb__listvldb(cstruct, name=NULL, servername=NULL, parti=NULL, lock=0)
AFS::VLDB cstruct
char *name
char *servername
char *parti
int lock
PREINIT:
afs_int32 apart;
afs_int32 aserver, code;
afs_int32 vcode;
struct VldbListByAttributes attributes;
nbulkentries arrayEntries;
struct nvldbentry *vllist;
afs_int32 centries, nentries = 0;
int j;
afs_int32 thisindex, nextindex;
HV *status, *stats;
PPCODE:
{
status = (HV *) sv_2mortal((SV *) newHV());
if (name && strlen(name) == 0)
name = NULL;
if (servername && strlen(servername) == 0)
servername = NULL;
if (parti && strlen(parti) == 0)
parti = NULL;
/* printf("DEBUG-0 name %s, server %s, part %s lock %d \n", name, servername, parti, */
aserver = 0;
apart = 0;
attributes.Mask = 0;
/* printf("DEBUG-1 \n"); */
/* If the volume name is given, Use VolumeInfoCmd to look it up
* and not ListAttributes.
*/
if (name) {
/* printf("DEBUG-2 \n"); */
if (lock) {
char buffer[256];
/* printf("DEBUG-3 \n"); */
sprintf(buffer,
"AFS::VLDB: illegal use of '-locked' switch, need to specify server and/or partition\n");
VSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
/* printf("DEBUG-4 \n"); */
stats = (HV *) sv_2mortal((SV *) newHV());
code = VolumeInfoCmd(stats, name);
if (code) {
char buffer[256];
set_errbuff(buffer, code);
VSETCODE(code, buffer);
XSRETURN_UNDEF;
}
/* printf("DEBUG-5 \n"); */
safe_hv_store(status, name, strlen(name), newRV_inc((SV *) (stats)), 0);
goto finish;
}
/* Server specified */
/* printf("DEBUG-6 \n"); */
if (servername) {
/* printf("DEBUG-7 \n"); */
aserver = GetServer(servername);
if (aserver == 0) {
char buffer[256];
sprintf(buffer, "AFS::VLDB: server '%s' not found in host table\n", servername);
VSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
attributes.server = ntohl(aserver);
attributes.Mask |= VLLIST_SERVER;
}
/* Partition specified */
/* printf("DEBUG-8 \n"); */
if (parti) {
/* printf("DEBUG-9 \n"); */
apart = volutil_GetPartitionID(parti);
if (apart < 0) {
char buffer[256];
sprintf(buffer, "AFS::VLDB: could not interpret partition name '%s'\n", parti);
VSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
attributes.partition = apart;
attributes.Mask |= VLLIST_PARTITION;
}
/* printf("DEBUG-10 \n"); */
if (lock) {
/* printf("DEBUG-11 \n"); */
attributes.Mask |= VLLIST_FLAG;
attributes.flag = VLOP_ALLOPERS;
}
/* printf("DEBUG-12 \n"); */
for (thisindex = 0; (thisindex != -1); thisindex = nextindex) {
/* printf("DEBUG-13 \n"); */
/* memset(&arrayEntries, 0, sizeof(arrayEntries)); */
/* Zero(&arrayEntries, sizeof(arrayEntries), nbulkentries); ??? nog ??? */
Zero(&arrayEntries, 1, nbulkentries);
if (server && (strlen(server) != 0)) { /* server specified */
aserver = GetServer(server);
if (aserver == 0) {
char buffer[256];
sprintf(buffer, "AFS::VLDB: server '%s' not found in host table\n", server);
VSETCODE(-1, buffer);
goto done;
}
attributes.server = ntohl(aserver);
attributes.Mask |= VLLIST_SERVER;
}
if (partition && (strlen(partition) != 0)) { /* partition specified */
apart = volutil_GetPartitionID(partition);
if (apart < 0) {
char buffer[256];
sprintf(buffer, "AFS::VLDB: could not interpret partition name '%s'\n",
partition);
VSETCODE(-1, buffer);
goto done;
}
if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
char buffer[256];
if (code)
set_errbuff(buffer, code);
else
sprintf(buffer, "AFS::VLDB: partition %s does not exist on the server\n",
partition);
VSETCODE(code ? code : -1, buffer);
goto done;
}
attributes.partition = apart;
attributes.Mask |= VLLIST_PARTITION;
}
attributes.flag = VLOP_ALLOPERS;
attributes.Mask |= VLLIST_FLAG;
Zero(&arrayEntries, 1, nbulkentries); /*initialize to hint the stub to alloc space */
vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
if (vcode) {
char buffer[256];
sprintf(buffer, "Could not access the VLDB for attributes\n");
VSETCODE(vcode, buffer);
goto done;
}
for (j = 0; j < nentries; j++) { /* process each entry */
vllist = &arrayEntries.nbulkentries_val[j];
volid = vllist->volumeId[RWVOL];
vcode =
ubik_Call(VL_ReleaseLock, cstruct, 0, volid, -1,
LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
if (vcode) {
char buffer[256];
sprintf(buffer, "Could not unlock entry for volume %s\n", vllist->name);
VSETCODE(vcode, buffer);
totalE++;
}
}
if (totalE)
fprintf(STDOUT, "Could not unlock %u VLDB entries of %u locked entries\n", totalE,
nentries);
if (arrayEntries.nbulkentries_val)
free(arrayEntries.nbulkentries_val);
SETCODE(0);
RETVAL = 1;
done:
;
}
OUTPUT:
RETVAL
int32
vldb__syncvldb(cstruct, server=NULL, partition=NULL, volname=NULL)
AFS::VLDB cstruct
char *server
char *partition
char *volname
PREINIT:
afs_int32 pname = 0, code; /* part name */
int flags = 0;
afs_int32 tserver = 0;
CODE:
{
RETVAL = 0;
/* printf("server %s, part %s volume %s \n", server, partition, volname); */
if (server && (strlen(server) != 0)) {
tserver = GetServer(server);
if (!tserver) {
char buffer[256];
sprintf(buffer, "AFS::VLDB: host '%s' not found in host table\n", server);
VSETCODE(-1, buffer);
goto done;
}
}
if (partition && (strlen(partition) != 0)) {
pname = volutil_GetPartitionID(partition);
if (pname < 0) {
char buffer[256];
sprintf(buffer, "AFS::VLDB: could not interpret partition name '%s'\n",
partition);
VSETCODE(-1, buffer);
goto done;
}
if (!tserver) {
char buffer[256];
sprintf(buffer, "The PARTITION argument requires a SERVER argument\n");
VSETCODE(-1, buffer);
goto done;
}
if (!IsPartValid(pname, tserver, &code)) { /*check for validity of the partition */
char buffer[256];
if (code)
set_errbuff(buffer, code);
else
sprintf(buffer, "AFS::VLDB: partition %s does not exist on the server\n",
( run in 1.233 second using v1.01-cache-2.11-cpan-f56aa216473 )