#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
#include <sys/types.h>
#include <stdio.h>
+#include <string.h>
#include <lock.h>
#include <afs/afsutil.h>
#include <ubik.h>
#include <rx/xdr.h>
#include <rx/rx.h>
+#include <rx/rxkad.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#else
#include <netinet/in.h>
#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
#include <afs/keys.h>
+#include <afs/cellconfig.h>
#include "vlserver.h"
+#include "vlserver_internal.h"
#include "afs/audit.h"
#ifndef AFS_NT40_ENV
#include <unistd.h>
#endif
extern int smallMem;
-extern extent_mod;
+extern int extent_mod;
extern struct afsconf_dir *vldb_confdir;
extern struct ubik_dbase *VL_dbase;
struct vlheader cheader; /* kept in network byte order */
#define VLDBALLOCLIMIT 10000
#define VLDBALLOCINCR 2048
-static int put_attributeentry();
-static int put_nattributeentry();
-static int RemoveEntry();
-static ReleaseEntry();
-static int check_vldbentry();
-static int check_nvldbentry();
-static int vldbentry_to_vlentry();
-static int nvldbentry_to_vlentry();
-static get_vldbupdateentry();
-static int repsite_exists();
-static repsite_compress();
-static vlentry_to_vldbentry();
-static vlentry_to_nvldbentry();
-static vlentry_to_uvldbentry();
-static int InvalidVolname();
-static int InvalidVoltype();
-static int InvalidOperation();
-static int InvalidReleasetype();
-static int IpAddrToRelAddr();
-static int ChangeIPAddr();
+static int put_attributeentry(struct vldbentry **, struct vldbentry **,
+ struct vldbentry **, bulkentries *,
+ struct nvlentry *, afs_int32 *, afs_int32 *);
+static int put_nattributeentry(struct nvldbentry **, struct nvldbentry **,
+ struct nvldbentry **, nbulkentries *,
+ struct nvlentry *, afs_int32, afs_int32,
+ afs_int32 *, afs_int32 *);
+static int RemoveEntry(struct ubik_trans *trans, afs_int32 entryptr,
+ struct nvlentry *tentry);
+static void ReleaseEntry(struct nvlentry *tentry, afs_int32 releasetype);
+static int check_vldbentry(struct vldbentry *aentry);
+static int check_nvldbentry(struct nvldbentry *aentry);
+static int vldbentry_to_vlentry(struct ubik_trans *atrans,
+ struct vldbentry *VldbEntry,
+ struct nvlentry *VlEntry);
+static int nvldbentry_to_vlentry(struct ubik_trans *atrans,
+ struct nvldbentry *VldbEntry,
+ struct nvlentry *VlEntry);
+static int get_vldbupdateentry(struct ubik_trans *trans, afs_int32 blockindex,
+ struct VldbUpdateEntry *updateentry,
+ struct nvlentry *VlEntry);
+static int repsite_exists(struct nvlentry *VlEntry, int server, int partition);
+static void repsite_compress(struct nvlentry *VlEntry, int offset);
+static void vlentry_to_vldbentry(struct nvlentry *VlEntry,
+ struct vldbentry *VldbEntry);
+static void vlentry_to_nvldbentry(struct nvlentry *VlEntry,
+ struct nvldbentry *VldbEntry);
+static void vlentry_to_uvldbentry(struct nvlentry *VlEntry,
+ struct uvldbentry *VldbEntry);
+static int InvalidVolname(char *volname);
+static int InvalidVoltype(afs_int32 voltype);
+static int InvalidOperation(afs_int32 voloper);
+static int InvalidReleasetype(afs_int32 releasetype);
+static int IpAddrToRelAddr(afs_uint32 ipaddr, struct ubik_trans *atrans);
+static int ChangeIPAddr(afs_uint32 ipaddr1, afs_uint32 ipaddr2,
+ struct ubik_trans *atrans);
char *
-rxinfo(rxcall)
- struct rx_call *rxcall;
+rxinfo(struct rx_call *rxcall)
{
int code;
register struct rx_connection *tconn;
- char tname[64];
- char tinst[64];
- char tcell[64];
+ char tname[64] = "";
+ char tinst[64] = "";
+ char tcell[64] = "";
afs_uint32 exp;
struct in_addr hostAddr;
NULL);
if (!code)
sprintf(rxinfo_str, "%s %s%s%s%s%s", inet_ntoa(hostAddr), tname,
- tinst?".":"", tinst?tinst:"", tcell?"@":"", tcell?tcell:"");
+ (tinst[0] == '\0') ? "" : ".",
+ (tinst[0] == '\0') ? "" : tinst,
+ (tcell[0] == '\0') ? "" : "@",
+ (tcell[0] == '\0') ? "" : tcell);
else
sprintf(rxinfo_str, "%s noauth", inet_ntoa(hostAddr));
return (rxinfo_str);
/* This is called to initialize the database, set the appropriate locks and make sure that the vldb header is valid */
int
-Init_VLdbase(trans, locktype, this_op)
- struct ubik_trans **trans;
- int locktype; /* indicate read or write transaction */
- int this_op;
+Init_VLdbase(struct ubik_trans **trans,
+ int locktype, /* indicate read or write transaction */
+ int this_op)
{
int errorcode = 0, pass, wl;
}
-/* Create a new vldb entry; both new volume id and name must be unique (non-existant in vldb). */
+/* Create a new vldb entry; both new volume id and name must be unique
+ * (non-existant in vldb).
+ */
afs_int32
-SVL_CreateEntry(rxcall, newentry)
- struct rx_call *rxcall;
- struct vldbentry *newentry;
+SVL_CreateEntry(struct rx_call *rxcall, struct vldbentry *newentry)
{
struct ubik_trans *trans;
afs_int32 errorcode, blockindex;
memset(&tentry, 0, sizeof(struct nvlentry));
/* Convert to its internal representation; both in host byte order */
- if (errorcode = vldbentry_to_vlentry(trans, newentry, &tentry)) {
+ if ((errorcode = vldbentry_to_vlentry(trans, newentry, &tentry))) {
FreeBlock(trans, blockindex);
goto abort;
}
afs_int32
-SVL_CreateEntryN(rxcall, newentry)
- struct rx_call *rxcall;
- struct nvldbentry *newentry;
+SVL_CreateEntryN(struct rx_call *rxcall, struct nvldbentry *newentry)
{
struct ubik_trans *trans;
afs_int32 errorcode, blockindex;
memset(&tentry, 0, sizeof(struct nvlentry));
/* Convert to its internal representation; both in host byte order */
- if (errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry)) {
+ if ((errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry))) {
FreeBlock(trans, blockindex);
goto abort;
}
afs_int32
-SVL_ChangeAddr(rxcall, ip1, ip2)
- struct rx_call *rxcall;
- afs_int32 ip1, ip2;
+SVL_ChangeAddr(struct rx_call *rxcall, afs_uint32 ip1, afs_uint32 ip2)
{
struct ubik_trans *trans;
afs_int32 errorcode;
goto end;
}
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
- VLog(1, ("Change Addr %d -> %d %s\n", ip1, ip2, rxinfo(rxcall)));
- if (errorcode = ChangeIPAddr(ip1, ip2, trans))
+ VLog(1, ("Change Addr %u -> %u %s\n", ip1, ip2, rxinfo(rxcall)));
+ if ((errorcode = ChangeIPAddr(ip1, ip2, trans)))
goto abort;
else {
errorcode = ubik_EndTrans(trans);
/* Delete a vldb entry given the volume id. */
afs_int32
-SVL_DeleteEntry(rxcall, volid, voltype)
- struct rx_call *rxcall;
- afs_int32 volid;
- afs_int32 voltype;
+SVL_DeleteEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype)
{
struct ubik_trans *trans;
afs_int32 blockindex, errorcode;
if ((voltype != -1) && (InvalidVoltype(voltype)))
END(VL_BADVOLTYPE);
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
- VLog(1, ("Delete Volume %d %s\n", volid, rxinfo(rxcall)));
+ VLog(1, ("Delete Volume %u %s\n", volid, rxinfo(rxcall)));
blockindex = FindByID(trans, volid, voltype, &tentry, &errorcode);
if (blockindex == 0) { /* volid not found */
if (!errorcode)
if (tentry.flags & VLDELETED) { /* Already deleted; return */
ABORT(VL_ENTDELETED);
}
- if (errorcode = RemoveEntry(trans, blockindex, &tentry)) {
+ if ((errorcode = RemoveEntry(trans, blockindex, &tentry))) {
goto abort;
}
errorcode = (ubik_EndTrans(trans));
/* Get a vldb entry given its volume id; make sure it's not a deleted entry. */
-GetEntryByID(rxcall, volid, voltype, aentry, new, this_op)
- struct rx_call *rxcall;
- afs_int32 volid;
- afs_int32 voltype, new, this_op;
- char *aentry; /* entry data copied here */
+int
+GetEntryByID(struct rx_call *rxcall,
+ afs_uint32 volid,
+ afs_int32 voltype,
+ char *aentry, /* entry data copied here */
+ afs_int32 new,
+ afs_int32 this_op)
{
struct ubik_trans *trans;
afs_int32 blockindex, errorcode;
if ((voltype != -1) && (InvalidVoltype(voltype)))
return VL_BADVOLTYPE;
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
- VLog(5, ("GetVolumeByID %d (%d) %s\n", volid, new, rxinfo(rxcall)));
+ VLog(5, ("GetVolumeByID %u (%d) %s\n", volid, new, rxinfo(rxcall)));
blockindex = FindByID(trans, volid, voltype, &tentry, &errorcode);
if (blockindex == 0) { /* entry not found */
if (!errorcode)
}
afs_int32
-SVL_GetEntryByID(rxcall, volid, voltype, aentry)
- struct rx_call *rxcall;
- afs_int32 volid, voltype;
- vldbentry *aentry; /* entry data copied here */
+SVL_GetEntryByID(struct rx_call *rxcall,
+ afs_uint32 volid,
+ afs_int32 voltype,
+ vldbentry *aentry) /* entry data copied here */
{
COUNT_REQ(VLGETENTRYBYID);
return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 0, this_op));
}
afs_int32
-SVL_GetEntryByIDN(rxcall, volid, voltype, aentry)
- struct rx_call *rxcall;
- afs_int32 volid, voltype;
- nvldbentry *aentry; /* entry data copied here */
+SVL_GetEntryByIDN(struct rx_call *rxcall,
+ afs_uint32 volid,
+ afs_int32 voltype,
+ nvldbentry *aentry) /* entry data copied here */
{
COUNT_REQ(VLGETENTRYBYIDN);
return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 1, this_op));
}
afs_int32
-SVL_GetEntryByIDU(rxcall, volid, voltype, aentry)
- struct rx_call *rxcall;
- afs_int32 volid, voltype;
- uvldbentry *aentry; /* entry data copied here */
+SVL_GetEntryByIDU(struct rx_call *rxcall,
+ afs_uint32 volid,
+ afs_int32 voltype,
+ uvldbentry *aentry) /* entry data copied here */
{
COUNT_REQ(VLGETENTRYBYIDU);
return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 2, this_op));
-/* returns true if the id is a decimal integer, in which case we interpret it
- as an id. make the cache manager much simpler */
+/* returns true if the id is a decimal integer, in which case we interpret
+ * it as an id. make the cache manager much simpler */
static int
-NameIsId(aname)
- register char *aname;
+NameIsId(char *aname)
{
register int tc;
- while (tc = *aname++) {
+ while ((tc = *aname++)) {
if (tc > '9' || tc < '0')
return 0;
}
return 1;
}
-/* Get a vldb entry given the volume's name; of course, very similar to VLGetEntryByID() above. */
-GetEntryByName(rxcall, volname, aentry, new, this_op)
- struct rx_call *rxcall;
- char *volname;
- char *aentry; /* entry data copied here */
- int new, this_op;
+/* Get a vldb entry given the volume's name; of course, very similar to
+ * VLGetEntryByID() above. */
+afs_int32
+GetEntryByName(struct rx_call *rxcall,
+ char *volname,
+ char *aentry, /* entry data copied here */
+ int new,
+ int this_op)
{
struct ubik_trans *trans;
afs_int32 blockindex, errorcode;
}
if (InvalidVolname(volname))
return VL_BADNAME;
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
VLog(5, ("GetVolumeByName %s (%d) %s\n", volname, new, rxinfo(rxcall)));
blockindex = FindByName(trans, volname, &tentry, &errorcode);
}
afs_int32
-SVL_GetEntryByNameO(rxcall, volname, aentry)
- struct rx_call *rxcall;
- char *volname;
- struct vldbentry *aentry; /* entry data copied here */
+SVL_GetEntryByNameO(struct rx_call *rxcall,
+ char *volname,
+ struct vldbentry *aentry) /* entry data copied here */
{
COUNT_REQ(VLGETENTRYBYNAME);
return (GetEntryByName(rxcall, volname, (char *)aentry, 0, this_op));
afs_int32
-SVL_GetEntryByNameN(rxcall, volname, aentry)
- struct rx_call *rxcall;
- char *volname;
- struct nvldbentry *aentry; /* entry data copied here */
+SVL_GetEntryByNameN(struct rx_call *rxcall,
+ char *volname,
+ struct nvldbentry *aentry) /* entry data copied here */
{
COUNT_REQ(VLGETENTRYBYNAMEN);
return (GetEntryByName(rxcall, volname, (char *)aentry, 1, this_op));
}
afs_int32
-SVL_GetEntryByNameU(rxcall, volname, aentry)
- struct rx_call *rxcall;
- char *volname;
- struct uvldbentry *aentry; /* entry data copied here */
+SVL_GetEntryByNameU(struct rx_call *rxcall,
+ char *volname,
+ struct uvldbentry *aentry) /* entry data copied here */
{
COUNT_REQ(VLGETENTRYBYNAMEU);
return (GetEntryByName(rxcall, volname, (char *)aentry, 2, this_op));
/* Get the current value of the maximum volume id and bump the volume id counter by Maxvolidbump. */
afs_int32
-SVL_GetNewVolumeId(rxcall, Maxvolidbump, newvolumeid)
- struct rx_call *rxcall;
- afs_int32 Maxvolidbump;
- afs_int32 *newvolumeid;
+SVL_GetNewVolumeId(struct rx_call *rxcall, afs_uint32 Maxvolidbump,
+ afs_uint32 *newvolumeid)
{
- register afs_int32 errorcode, maxvolumeid;
+ register afs_int32 errorcode;
+ afs_uint32 maxvolumeid;
struct ubik_trans *trans;
COUNT_REQ(VLGETNEWVOLUMEID);
if (Maxvolidbump < 0 || Maxvolidbump > MAXBUMPCOUNT)
END(VL_BADVOLIDBUMP);
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
*newvolumeid = maxvolumeid = ntohl(cheader.vital_header.MaxVolumeId);
maxvolumeid += Maxvolidbump;
- VLog(1, ("GetNewVolid newmax=%d %s\n", maxvolumeid, rxinfo(rxcall)));
+ VLog(1, ("GetNewVolid newmax=%u %s\n", maxvolumeid, rxinfo(rxcall)));
cheader.vital_header.MaxVolumeId = htonl(maxvolumeid);
if (write_vital_vlheader(trans)) {
ABORT(VL_IO);
* VLUpdateEntry) is done. */
afs_int32
-SVL_ReplaceEntry(rxcall, volid, voltype, newentry, releasetype)
- struct rx_call *rxcall;
- afs_int32 volid;
- afs_int32 voltype;
- struct vldbentry *newentry;
- afs_int32 releasetype;
+SVL_ReplaceEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
+ struct vldbentry *newentry, afs_int32 releasetype)
{
struct ubik_trans *trans;
afs_int32 blockindex, errorcode, typeindex;
if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
END(VL_PERM);
- if (errorcode = check_vldbentry(newentry))
+ if ((errorcode = check_vldbentry(newentry)))
goto end;
if (voltype != -1 && InvalidVoltype(voltype))
if (releasetype && InvalidReleasetype(releasetype))
END(VL_BADRELLOCKTYPE);
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
- VLog(1, ("OReplace Volume %d %s\n", volid, rxinfo(rxcall)));
+ VLog(1, ("OReplace Volume %u %s\n", volid, rxinfo(rxcall)));
/* find vlentry we're changing */
blockindex = FindByID(trans, volid, voltype, &tentry, &errorcode);
if (blockindex == 0) { /* entry not found */
for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
if (tentry.volumeId[typeindex] != newentry->volumeId[typeindex]) {
if (tentry.volumeId[typeindex])
- if (errorcode =
- UnhashVolid(trans, typeindex, blockindex, &tentry)) {
+ if ((errorcode =
+ UnhashVolid(trans, typeindex, blockindex, &tentry))) {
goto abort;
}
/* we must rehash new id if the id is different and the ID is nonzero */
/* Rehash volname if it changes */
if (strcmp(newentry->name, tentry.name)) { /* Name changes; redo hashing */
- if (errorcode = UnhashVolname(trans, blockindex, &tentry)) {
+ if ((errorcode = UnhashVolname(trans, blockindex, &tentry))) {
goto abort;
}
hashnewname = 1;
/* after this, tentry is new entry, not old one. vldbentry_to_vlentry
* doesn't touch hash chains */
- if (errorcode = vldbentry_to_vlentry(trans, newentry, &tentry)) {
+ if ((errorcode = vldbentry_to_vlentry(trans, newentry, &tentry))) {
goto abort;
}
for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
if (hashVol[typeindex] && tentry.volumeId[typeindex]) {
- if (errorcode = HashVolid(trans, typeindex, blockindex, &tentry)) {
+ if ((errorcode = HashVolid(trans, typeindex, blockindex, &tentry))) {
goto abort;
}
}
}
afs_int32
-SVL_ReplaceEntryN(rxcall, volid, voltype, newentry, releasetype)
- struct rx_call *rxcall;
- afs_int32 volid;
- afs_int32 voltype;
- struct nvldbentry *newentry;
- afs_int32 releasetype;
+SVL_ReplaceEntryN(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
+ struct nvldbentry *newentry, afs_int32 releasetype)
{
struct ubik_trans *trans;
afs_int32 blockindex, errorcode, typeindex;
if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
END(VL_PERM);
- if (errorcode = check_nvldbentry(newentry))
+ if ((errorcode = check_nvldbentry(newentry)))
goto end;
if (voltype != -1 && InvalidVoltype(voltype))
if (releasetype && InvalidReleasetype(releasetype))
END(VL_BADRELLOCKTYPE);
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
- VLog(1, ("Replace Volume %d %s\n", volid, rxinfo(rxcall)));
+ VLog(1, ("Replace Volume %u %s\n", volid, rxinfo(rxcall)));
/* find vlentry we're changing */
blockindex = FindByID(trans, volid, voltype, &tentry, &errorcode);
if (blockindex == 0) { /* entry not found */
for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
if (tentry.volumeId[typeindex] != newentry->volumeId[typeindex]) {
if (tentry.volumeId[typeindex])
- if (errorcode =
- UnhashVolid(trans, typeindex, blockindex, &tentry)) {
+ if ((errorcode =
+ UnhashVolid(trans, typeindex, blockindex, &tentry))) {
goto abort;
}
/* we must rehash new id if the id is different and the ID is nonzero */
/* Rehash volname if it changes */
if (strcmp(newentry->name, tentry.name)) { /* Name changes; redo hashing */
- if (errorcode = UnhashVolname(trans, blockindex, &tentry)) {
+ if ((errorcode = UnhashVolname(trans, blockindex, &tentry))) {
goto abort;
}
hashnewname = 1;
/* after this, tentry is new entry, not old one. vldbentry_to_vlentry
* doesn't touch hash chains */
- if (errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry)) {
+ if ((errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry))) {
goto abort;
}
for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
if (hashVol[typeindex] && tentry.volumeId[typeindex]) {
- if (errorcode = HashVolid(trans, typeindex, blockindex, &tentry)) {
+ if ((errorcode = HashVolid(trans, typeindex, blockindex, &tentry))) {
goto abort;
}
}
}
-/* Update a vldb entry (accessed thru its volume id). Almost all of the entry's fields can be modified in a single call by setting the appropriate bits in the Mask field in VldbUpdateentry. */
-/* this routine may never have been tested; use replace entry instead unless you're brave */
+/* Update a vldb entry (accessed thru its volume id). Almost all of the
+ * entry's fields can be modified in a single call by setting the
+ * appropriate bits in the Mask field in VldbUpdateentry. */
+/* this routine may never have been tested; use replace entry instead
+ * unless you're brave */
afs_int32
-SVL_UpdateEntry(rxcall, volid, voltype, updateentry, releasetype)
- struct rx_call *rxcall;
- afs_int32 volid;
- afs_int32 voltype;
- afs_int32 releasetype;
- struct VldbUpdateEntry *updateentry; /* Update entry copied here */
+SVL_UpdateEntry(struct rx_call *rxcall,
+ afs_uint32 volid,
+ afs_int32 voltype,
+ struct VldbUpdateEntry *updateentry, /* Update entry copied here */
+ afs_int32 releasetype)
{
struct ubik_trans *trans;
afs_int32 blockindex, errorcode;
END(VL_BADVOLTYPE);
if (releasetype && InvalidReleasetype(releasetype))
END(VL_BADRELLOCKTYPE);
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
- VLog(1, ("Update Volume %d %s\n", volid, rxinfo(rxcall)));
+ VLog(1, ("Update Volume %u %s\n", volid, rxinfo(rxcall)));
blockindex = FindByID(trans, volid, voltype, &tentry, &errorcode);
if (blockindex == 0) { /* entry not found */
if (!errorcode)
}
/* Do the actual updating of the entry, tentry. */
- if (errorcode =
- get_vldbupdateentry(trans, blockindex, updateentry, &tentry)) {
+ if ((errorcode =
+ get_vldbupdateentry(trans, blockindex, updateentry, &tentry))) {
goto abort;
}
if (releasetype)
afs_int32
-SVL_UpdateEntryByName(rxcall, volname, updateentry, releasetype)
- struct rx_call *rxcall;
- char *volname;
- afs_int32 releasetype;
- struct VldbUpdateEntry *updateentry; /* Update entry copied here */
+SVL_UpdateEntryByName(struct rx_call *rxcall,
+ char *volname,
+ struct VldbUpdateEntry *updateentry, /* Update entry copied here */
+ afs_int32 releasetype)
{
struct ubik_trans *trans;
afs_int32 blockindex, errorcode;
END(VL_PERM);
if (releasetype && InvalidReleasetype(releasetype))
END(VL_BADRELLOCKTYPE);
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
blockindex = FindByName(trans, volname, &tentry, &errorcode);
}
/* Do the actual updating of the entry, tentry. */
- if (errorcode =
- get_vldbupdateentry(trans, blockindex, updateentry, &tentry)) {
+ if ((errorcode =
+ get_vldbupdateentry(trans, blockindex, updateentry, &tentry))) {
goto abort;
}
if (releasetype)
/* Set a lock to the vldb entry for volid (of type voltype if not -1). */
afs_int32
-SVL_SetLock(rxcall, volid, voltype, voloper)
- struct rx_call *rxcall;
- afs_int32 volid;
- afs_int32 voltype;
- afs_int32 voloper;
+SVL_SetLock(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
+ afs_int32 voloper)
{
afs_int32 timestamp, blockindex, errorcode;
struct ubik_trans *trans;
END(VL_BADVOLTYPE);
if (InvalidOperation(voloper))
END(VL_BADVOLOPER);
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
- VLog(1, ("SetLock Volume %d %s\n", volid, rxinfo(rxcall)));
+ VLog(1, ("SetLock Volume %u %s\n", volid, rxinfo(rxcall)));
blockindex = FindByID(trans, volid, voltype, &tentry, &errorcode);
if (blockindex == NULLO) {
if (!errorcode)
* the lock time stamp. */
afs_int32
-SVL_ReleaseLock(rxcall, volid, voltype, releasetype)
- struct rx_call *rxcall;
- afs_int32 volid;
- afs_int32 voltype;
- afs_int32 releasetype;
+SVL_ReleaseLock(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
+ afs_int32 releasetype)
{
afs_int32 blockindex, errorcode;
struct ubik_trans *trans;
END(VL_BADVOLTYPE);
if (releasetype && InvalidReleasetype(releasetype))
END(VL_BADRELLOCKTYPE);
- if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
goto end;
- VLog(1, ("ReleaseLock Volume %d %s\n", volid, rxinfo(rxcall)));
+ VLog(1, ("ReleaseLock Volume %u %s\n", volid, rxinfo(rxcall)));
blockindex = FindByID(trans, volid, voltype, &tentry, &errorcode);
if (blockindex == NULLO) {
if (!errorcode)
}
-/* ListEntry returns a single vldb entry, aentry, with offset previous_index; the remaining parameters (i.e. next_index) are used so that sequential calls to this routine will get the next (all) vldb entries. */
+/* ListEntry returns a single vldb entry, aentry, with offset previous_index;
+ * the remaining parameters (i.e. next_index) are used so that sequential
+ * calls to this routine will get the next (all) vldb entries.
+ */
afs_int32
-SVL_ListEntry(rxcall, previous_index, count, next_index, aentry)
- struct rx_call *rxcall;
- afs_int32 previous_index;
- afs_int32 *count;
- afs_int32 *next_index;
- struct vldbentry *aentry;
+SVL_ListEntry(struct rx_call *rxcall, afs_int32 previous_index,
+ afs_int32 *count, afs_int32 *next_index,
+ struct vldbentry *aentry)
{
int errorcode;
struct ubik_trans *trans;
struct nvlentry tentry;
COUNT_REQ(VLLISTENTRY);
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
VLog(25, ("OListEntry index=%d %s\n", previous_index, rxinfo(rxcall)));
*next_index = NextEntry(trans, previous_index, &tentry, count);
return (ubik_EndTrans(trans));
}
-/* ListEntry returns a single vldb entry, aentry, with offset previous_index; the remaining parameters (i.e. next_index) are used so that sequential calls to this routine will get the next (all) vldb entries. */
+/* ListEntry returns a single vldb entry, aentry, with offset previous_index;
+ * the remaining parameters (i.e. next_index) are used so that sequential
+ * calls to this routine will get the next (all) vldb entries.
+ */
afs_int32
-SVL_ListEntryN(rxcall, previous_index, count, next_index, aentry)
- struct rx_call *rxcall;
- afs_int32 previous_index;
- afs_int32 *count;
- afs_int32 *next_index;
- struct nvldbentry *aentry;
+SVL_ListEntryN(struct rx_call *rxcall, afs_int32 previous_index,
+ afs_int32 *count, afs_int32 *next_index,
+ struct nvldbentry *aentry)
{
int errorcode;
struct ubik_trans *trans;
struct nvlentry tentry;
COUNT_REQ(VLLISTENTRYN);
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
VLog(25, ("ListEntry index=%d %s\n", previous_index, rxinfo(rxcall)));
*next_index = NextEntry(trans, previous_index, &tentry, count);
}
-/* Retrieves in vldbentries all vldb entries that match the specified attributes (by server number, partition, volume type, and flag); if volume id is specified then the associated list for that entry is returned. CAUTION: This could be a very expensive call since in most cases sequential search of all vldb entries is performed. */
+/* Retrieves in vldbentries all vldb entries that match the specified
+ * attributes (by server number, partition, volume type, and flag); if volume
+ * id is specified then the associated list for that entry is returned.
+ * CAUTION: This could be a very expensive call since in most cases
+ * sequential search of all vldb entries is performed.
+ */
afs_int32
-SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
- struct rx_call *rxcall;
- struct VldbListByAttributes *attributes;
- afs_int32 *nentries;
- bulkentries *vldbentries;
+SVL_ListAttributes(struct rx_call *rxcall,
+ struct VldbListByAttributes *attributes,
+ afs_int32 *nentries,
+ bulkentries *vldbentries)
{
int errorcode, allocCount = 0;
struct ubik_trans *trans;
COUNT_REQ(VLLISTATTRIBUTES);
vldbentries->bulkentries_val = 0;
vldbentries->bulkentries_len = *nentries = 0;
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
allocCount = VLDBALLOCCOUNT;
Vldbentry = VldbentryFirst = vldbentries->bulkentries_val =
return VL_NOMEM;
}
VldbentryLast = VldbentryFirst + allocCount;
- /* Handle the attribute by volume id totally separate of the rest (thus additional Mask values are ignored if VLLIST_VOLUMEID is set!) */
+ /* Handle the attribute by volume id totally separate of the rest
+ * (thus additional Mask values are ignored if VLLIST_VOLUMEID is set!) */
if (attributes->Mask & VLLIST_VOLUMEID) {
afs_int32 blockindex;
vldbentries->bulkentries_len = 0;
return errorcode;
}
- if (errorcode =
+ if ((errorcode =
put_attributeentry(&Vldbentry, &VldbentryFirst, &VldbentryLast,
- vldbentries, &tentry, nentries, &allocCount)) {
+ vldbentries, &tentry, nentries, &allocCount))) {
COUNT_ABO;
ubik_AbortTrans(trans);
if (vldbentries->bulkentries_val)
return VL_SIZEEXCEEDED;
}
} else {
- afs_int32 nextblockindex = 0, count = 0, k, match = 0;
- while (nextblockindex =
- NextEntry(trans, nextblockindex, &tentry, &count)) {
+ afs_int32 nextblockindex = 0, count = 0, k = 0, match = 0;
+ while ((nextblockindex =
+ NextEntry(trans, nextblockindex, &tentry, &count))) {
if (++pollcount > 50) {
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
pollcount = 0;
}
match = 0;
if (attributes->Mask & VLLIST_SERVER) {
int serverindex;
if ((serverindex =
- IpAddrToRelAddr(attributes->server,
- (struct ubik_trans *)0)) == -1)
+ IpAddrToRelAddr(attributes->server, NULL)) == -1)
continue;
for (k = 0; k < OMAXNSERVERS; k++) {
if (tentry.serverNumber[k] == BADSERVERID)
if (!(tentry.flags & attributes->flag))
continue;
}
- if (errorcode =
+ if ((errorcode =
put_attributeentry(&Vldbentry, &VldbentryFirst,
&VldbentryLast, vldbentries, &tentry,
- nentries, &allocCount)) {
+ nentries, &allocCount))) {
COUNT_ABO;
ubik_AbortTrans(trans);
if (vldbentries->bulkentries_val)
}
afs_int32
-SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
- struct rx_call *rxcall;
- struct VldbListByAttributes *attributes;
- afs_int32 *nentries;
- nbulkentries *vldbentries;
+SVL_ListAttributesN(struct rx_call *rxcall,
+ struct VldbListByAttributes *attributes,
+ afs_int32 *nentries,
+ nbulkentries *vldbentries)
{
int errorcode, allocCount = 0;
struct ubik_trans *trans;
COUNT_REQ(VLLISTATTRIBUTESN);
vldbentries->nbulkentries_val = 0;
vldbentries->nbulkentries_len = *nentries = 0;
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
allocCount = VLDBALLOCCOUNT;
Vldbentry = VldbentryFirst = vldbentries->nbulkentries_val =
return VL_NOMEM;
}
VldbentryLast = VldbentryFirst + allocCount;
- /* Handle the attribute by volume id totally separate of the rest (thus additional Mask values are ignored if VLLIST_VOLUMEID is set!) */
+ /* Handle the attribute by volume id totally separate of the rest
+ * (thus additional Mask values are ignored if VLLIST_VOLUMEID is set!) */
if (attributes->Mask & VLLIST_VOLUMEID) {
afs_int32 blockindex;
vldbentries->nbulkentries_len = 0;
return errorcode;
}
- if (errorcode =
+ if ((errorcode =
put_nattributeentry(&Vldbentry, &VldbentryFirst, &VldbentryLast,
vldbentries, &tentry, 0, 0, nentries,
- &allocCount)) {
+ &allocCount))) {
COUNT_ABO;
ubik_AbortTrans(trans);
if (vldbentries->nbulkentries_val)
return VL_SIZEEXCEEDED;
}
} else {
- afs_int32 nextblockindex = 0, count = 0, k, match = 0;
- while (nextblockindex =
- NextEntry(trans, nextblockindex, &tentry, &count)) {
+ afs_int32 nextblockindex = 0, count = 0, k = 0, match = 0;
+ while ((nextblockindex =
+ NextEntry(trans, nextblockindex, &tentry, &count))) {
if (++pollcount > 50) {
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
pollcount = 0;
}
if (attributes->Mask & VLLIST_SERVER) {
int serverindex;
if ((serverindex =
- IpAddrToRelAddr(attributes->server,
- (struct ubik_trans *)0)) == -1)
+ IpAddrToRelAddr(attributes->server, NULL)) == -1)
continue;
for (k = 0; k < NMAXNSERVERS; k++) {
if (tentry.serverNumber[k] == BADSERVERID)
if (!(tentry.flags & attributes->flag))
continue;
}
- if (errorcode =
+ if ((errorcode =
put_nattributeentry(&Vldbentry, &VldbentryFirst,
&VldbentryLast, vldbentries, &tentry, 0,
- 0, nentries, &allocCount)) {
+ 0, nentries, &allocCount))) {
COUNT_ABO;
ubik_AbortTrans(trans);
if (vldbentries->nbulkentries_val)
afs_int32
-SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries,
- vldbentries, nextstartindex)
- struct rx_call *rxcall;
- struct VldbListByAttributes *attributes;
- char *name; /* Wildcarded volume name */
- afs_int32 startindex;
- afs_int32 *nentries;
- nbulkentries *vldbentries;
- afs_int32 *nextstartindex;
+SVL_ListAttributesN2(struct rx_call *rxcall,
+ struct VldbListByAttributes *attributes,
+ char *name, /* Wildcarded volume name */
+ afs_int32 startindex,
+ afs_int32 *nentries,
+ nbulkentries *vldbentries,
+ afs_int32 *nextstartindex)
{
int errorcode = 0, maxCount = VLDBALLOCCOUNT;
struct ubik_trans *trans;
struct nvlentry tentry;
struct nvldbentry *Vldbentry = 0, *VldbentryFirst = 0, *VldbentryLast = 0;
- afs_int32 blockindex = 0, count = 0, k, match, matchindex;
+ afs_int32 blockindex = 0, count = 0, k, match;
+ afs_int32 matchindex = 0;
int serverindex = -1; /* no server found */
int findserver = 0, findpartition = 0, findflag = 0, findname = 0;
- char *t;
int pollcount = 0;
- int namematchRWBK, namematchRO, thismatch, matchtype;
+ int namematchRWBK, namematchRO, thismatch;
+ int matchtype = 0;
char volumename[VL_MAXNAMELEN];
#ifdef HAVE_POSIX_REGEX
regex_t re;
int need_regfree = 0;
+#else
+ char *t;
#endif
COUNT_REQ(VLLISTATTRIBUTESN2);
/* Get the server index for matching server address */
if (attributes->Mask & VLLIST_SERVER) {
serverindex =
- IpAddrToRelAddr(attributes->server, (struct ubik_trans *)0);
+ IpAddrToRelAddr(attributes->server, NULL);
if (serverindex == -1)
goto done;
findserver = 1;
/* Read each entry and see if it is the one we want */
blockindex = startindex;
- while (blockindex = NextEntry(trans, blockindex, &tentry, &count)) {
+ while ((blockindex = NextEntry(trans, blockindex, &tentry, &count))) {
if (++pollcount > 50) {
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
pollcount = 0;
}
* cases sequential search of all vldb entries is performed.
*/
afs_int32
-SVL_LinkedList(rxcall, attributes, nentries, vldbentries)
- struct rx_call *rxcall;
- struct VldbListByAttributes *attributes;
- afs_int32 *nentries;
- vldb_list *vldbentries;
+SVL_LinkedList(struct rx_call *rxcall,
+ struct VldbListByAttributes *attributes,
+ afs_int32 *nentries,
+ vldb_list *vldbentries)
{
int errorcode;
struct ubik_trans *trans;
struct nvlentry tentry;
vldblist vllist, *vllistptr;
- afs_int32 blockindex, count, k, match;
+ afs_int32 blockindex, count, match;
+ afs_int32 k = 0;
int serverindex;
int pollcount = 0;
COUNT_REQ(VLLINKEDLIST);
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
*nentries = 0;
match = 0;
if (++pollcount > 50) {
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
pollcount = 0;
}
/* Does this volume exist on the desired server */
if (attributes->Mask & VLLIST_SERVER) {
serverindex =
- IpAddrToRelAddr(attributes->server,
- (struct ubik_trans *)0);
+ IpAddrToRelAddr(attributes->server, NULL);
if (serverindex == -1)
continue;
for (k = 0; k < OMAXNSERVERS; k++) {
}
afs_int32
-SVL_LinkedListN(rxcall, attributes, nentries, vldbentries)
- struct rx_call *rxcall;
- struct VldbListByAttributes *attributes;
- afs_int32 *nentries;
- nvldb_list *vldbentries;
+SVL_LinkedListN(struct rx_call *rxcall,
+ struct VldbListByAttributes *attributes,
+ afs_int32 *nentries,
+ nvldb_list *vldbentries)
{
int errorcode;
struct ubik_trans *trans;
struct nvlentry tentry;
nvldblist vllist, *vllistptr;
- afs_int32 blockindex, count, k, match;
+ afs_int32 blockindex, count, match;
+ afs_int32 k = 0;
int serverindex;
int pollcount = 0;
COUNT_REQ(VLLINKEDLISTN);
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
*nentries = 0;
match = 0;
if (++pollcount > 50) {
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
pollcount = 0;
}
/* Does this volume exist on the desired server */
if (attributes->Mask & VLLIST_SERVER) {
serverindex =
- IpAddrToRelAddr(attributes->server,
- (struct ubik_trans *)0);
+ IpAddrToRelAddr(attributes->server, NULL);
if (serverindex == -1)
continue;
for (k = 0; k < NMAXNSERVERS; k++) {
return (ubik_EndTrans(trans));
}
-/* Get back vldb header statistics (allocs, frees, maxvolumeid, totalentries, etc) and dynamic statistics (number of requests and/or aborts per remote procedure call, etc) */
+/* Get back vldb header statistics (allocs, frees, maxvolumeid,
+ * totalentries, etc) and dynamic statistics (number of requests and/or
+ * aborts per remote procedure call, etc)
+ */
afs_int32
-SVL_GetStats(rxcall, stats, vital_header)
- struct rx_call *rxcall;
- vldstats *stats;
- vital_vlheader *vital_header;
+SVL_GetStats(struct rx_call *rxcall,
+ vldstats *stats,
+ vital_vlheader *vital_header)
{
register afs_int32 errorcode;
struct ubik_trans *trans;
if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL)) /* Must be in 'UserList' to use */
return VL_PERM;
#endif
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
VLog(5, ("GetStats %s\n", rxinfo(rxcall)));
memcpy((char *)vital_header, (char *)&cheader.vital_header,
* through the VLDB, but that's life.
*/
afs_int32
-SVL_GetAddrs(rxcall, Handle, spare2, spare3, nentries, addrsp)
- struct rx_call *rxcall;
- afs_int32 Handle, spare2;
- struct VLCallBack *spare3;
- afs_int32 *nentries;
- bulkaddrs *addrsp;
+SVL_GetAddrs(struct rx_call *rxcall,
+ afs_int32 Handle,
+ afs_int32 spare2,
+ struct VLCallBack *spare3,
+ afs_int32 *nentries,
+ bulkaddrs *addrsp)
{
register afs_int32 errorcode;
struct ubik_trans *trans;
addrsp->bulkaddrs_val = 0;
memset(spare3, 0, sizeof(struct VLCallBack));
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
VLog(5, ("GetAddrs\n"));
}
for (i = 0; i <= MAXSERVERID; i++) {
- if (*taddrp = ntohl(cheader.IpMappedAddr[i])) {
+ if ((*taddrp = ntohl(cheader.IpMappedAddr[i]))) {
taddrp++;
nservers++;
}
#define PADDR(addr) VLog(0,("%d.%d.%d.%d", (addr>>24)&0xff, (addr>>16)&0xff, (addr>>8) &0xff, addr&0xff));
afs_int32
-SVL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
- struct rx_call *rxcall;
- afsUUID *uuidp;
- afs_int32 spare1;
- bulkaddrs *addrsp;
+SVL_RegisterAddrs(struct rx_call *rxcall, afsUUID *uuidp, afs_int32 spare1,
+ bulkaddrs *addrsp)
{
afs_int32 code;
struct ubik_trans *trans;
afs_uint32 addrs[VL_MAXIPADDRS_PERMH];
afs_int32 fbase;
int count, willChangeEntry, foundUuidEntry, willReplaceCnt;
- int WillReplaceEntry, WillChange[MAXSERVERID + 1], FoundUuid,
- ReplaceEntry;
+ int WillReplaceEntry, WillChange[MAXSERVERID + 1];
+ int FoundUuid = 0;
+ int ReplaceEntry = 0;
int srvidx, mhidx;
COUNT_REQ(VLREGADDR);
if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
return (VL_PERM);
- if (code = Init_VLdbase(&trans, LOCKWRITE, this_op))
+ if ((code = Init_VLdbase(&trans, LOCKWRITE, this_op)))
return code;
/* Eliminate duplicates from IP address list */
}
afs_int32
-SVL_GetAddrsU(rxcall, attributes, uuidpo, uniquifier, nentries, addrsp)
- struct rx_call *rxcall;
- struct ListAddrByAttributes *attributes;
- afsUUID *uuidpo;
- afs_int32 *uniquifier, *nentries;
- bulkaddrs *addrsp;
+SVL_GetAddrsU(struct rx_call *rxcall,
+ struct ListAddrByAttributes *attributes,
+ afsUUID *uuidpo,
+ afs_int32 *uniquifier,
+ afs_int32 *nentries,
+ bulkaddrs *addrsp)
{
register afs_int32 errorcode, index = -1, offset;
struct ubik_trans *trans;
addrsp->bulkaddrs_len = *nentries = 0;
addrsp->bulkaddrs_val = 0;
VLog(5, ("GetAddrsU %s\n", rxinfo(rxcall)));
- if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+ if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
return errorcode;
if (attributes->Mask & VLADDR_IPADDR) {
ubik_AbortTrans(trans);
return VL_NOENT;
}
- if (errorcode =
- FindExtentBlock(trans, &attributes->uuid, 0, -1, &exp, &base)) {
+ if ((errorcode =
+ FindExtentBlock(trans, &attributes->uuid, 0, -1, &exp, &base))) {
ubik_AbortTrans(trans);
return errorcode;
}
/* Routine that copies the given vldb entry to the output buffer, vldbentries. */
static int
-put_attributeentry(Vldbentry, VldbentryFirst, VldbentryLast, vldbentries,
- entry, nentries, alloccnt)
- struct vldbentry **Vldbentry, **VldbentryFirst, **VldbentryLast;
- bulkentries *vldbentries;
- struct nvlentry *entry;
- afs_int32 *nentries, *alloccnt;
+put_attributeentry(struct vldbentry **Vldbentry,
+ struct vldbentry **VldbentryFirst,
+ struct vldbentry **VldbentryLast,
+ bulkentries *vldbentries,
+ struct nvlentry *entry,
+ afs_int32 *nentries,
+ afs_int32 *alloccnt)
{
vldbentry *reall;
afs_int32 allo;
}
static int
-put_nattributeentry(Vldbentry, VldbentryFirst, VldbentryLast, vldbentries,
- entry, matchtype, matchindex, nentries, alloccnt)
- struct nvldbentry **Vldbentry, **VldbentryFirst, **VldbentryLast;
- nbulkentries *vldbentries;
- struct nvlentry *entry;
- afs_int32 matchtype, matchindex, *nentries, *alloccnt;
+put_nattributeentry(struct nvldbentry **Vldbentry,
+ struct nvldbentry **VldbentryFirst,
+ struct nvldbentry **VldbentryLast,
+ nbulkentries *vldbentries,
+ struct nvlentry *entry,
+ afs_int32 matchtype,
+ afs_int32 matchindex,
+ afs_int32 *nentries,
+ afs_int32 *alloccnt)
{
nvldbentry *reall;
afs_int32 allo;
/* Common code to actually remove a vldb entry from the database. */
static int
-RemoveEntry(trans, entryptr, tentry)
- struct ubik_trans *trans;
- afs_int32 entryptr;
- struct nvlentry *tentry;
+RemoveEntry(struct ubik_trans *trans, afs_int32 entryptr,
+ struct nvlentry *tentry)
{
register int errorcode;
- if (errorcode = UnthreadVLentry(trans, entryptr, tentry))
+ if ((errorcode = UnthreadVLentry(trans, entryptr, tentry)))
return errorcode;
- if (errorcode = FreeBlock(trans, entryptr))
+ if ((errorcode = FreeBlock(trans, entryptr)))
return errorcode;
return 0;
}
-static
-ReleaseEntry(tentry, releasetype)
- struct nvlentry *tentry;
- afs_int32 releasetype;
+static void
+ReleaseEntry(struct nvlentry *tentry, afs_int32 releasetype)
{
if (releasetype & LOCKREL_TIMESTAMP)
tentry->LockTimestamp = 0;
}
-/* Verify that the incoming vldb entry is valid; multi type of error codes are returned. */
+/* Verify that the incoming vldb entry is valid; multi type of error codes
+ * are returned. */
static int
-check_vldbentry(aentry)
- struct vldbentry *aentry;
+check_vldbentry(struct vldbentry *aentry)
{
afs_int32 i;
}
static int
-check_nvldbentry(aentry)
- struct nvldbentry *aentry;
+check_nvldbentry(struct nvldbentry *aentry)
{
afs_int32 i;
/* Convert from the external vldb entry representation to its internal
(more compact) form. This call should not change the hash chains! */
static int
-vldbentry_to_vlentry(atrans, VldbEntry, VlEntry)
- struct ubik_trans *atrans;
- struct vldbentry *VldbEntry;
- struct nvlentry *VlEntry;
+vldbentry_to_vlentry(struct ubik_trans *atrans,
+ struct vldbentry *VldbEntry,
+ struct nvlentry *VlEntry)
{
int i, serverindex;
}
static int
-nvldbentry_to_vlentry(atrans, VldbEntry, VlEntry)
- struct ubik_trans *atrans;
- struct nvldbentry *VldbEntry;
- struct nvlentry *VlEntry;
+nvldbentry_to_vlentry(struct ubik_trans *atrans,
+ struct nvldbentry *VldbEntry,
+ struct nvlentry *VlEntry)
{
int i, serverindex;
}
-/* Update the vldb entry with the new fields as indicated by the value of the Mask entry in the updateentry structure. All necessary validation checks are performed. */
-static
-get_vldbupdateentry(trans, blockindex, updateentry, VlEntry)
- struct ubik_trans *trans;
- afs_int32 blockindex;
- struct VldbUpdateEntry *updateentry;
- struct nvlentry *VlEntry;
+/* Update the vldb entry with the new fields as indicated by the value of
+ * the Mask entry in the updateentry structure. All necessary validation
+ * checks are performed.
+ */
+static int
+get_vldbupdateentry(struct ubik_trans *trans,
+ afs_int32 blockindex,
+ struct VldbUpdateEntry *updateentry,
+ struct nvlentry *VlEntry)
{
int i, j, errorcode, serverindex;
if (updateentry->Mask & VLUPDATE_VOLUMENAME) {
if (InvalidVolname(updateentry->name))
return VL_BADNAME;
- if (errorcode = UnhashVolname(trans, blockindex, VlEntry))
+ if ((errorcode = UnhashVolname(trans, blockindex, VlEntry)))
return errorcode;
strncpy(VlEntry->name, updateentry->name, sizeof(VlEntry->name));
HashVolname(trans, blockindex, VlEntry);
}
if (updateentry->Mask & VLUPDATE_VOLNAMEHASH) {
- if (errorcode = UnhashVolname(trans, blockindex, VlEntry)) {
+ if ((errorcode = UnhashVolname(trans, blockindex, VlEntry))) {
if (errorcode != VL_NOENT)
return errorcode;
}
VlEntry->cloneId = updateentry->cloneId;
}
if (updateentry->Mask & VLUPDATE_RWID) {
- if (errorcode = UnhashVolid(trans, RWVOL, blockindex, VlEntry)) {
+ if ((errorcode = UnhashVolid(trans, RWVOL, blockindex, VlEntry))) {
if (errorcode != VL_NOENT)
return errorcode;
}
VlEntry->volumeId[RWVOL] = updateentry->spares3; /* rw id */
- if (errorcode = HashVolid(trans, RWVOL, blockindex, VlEntry))
+ if ((errorcode = HashVolid(trans, RWVOL, blockindex, VlEntry)))
return errorcode;
}
if (updateentry->Mask & VLUPDATE_READONLYID) {
- if (errorcode = UnhashVolid(trans, ROVOL, blockindex, VlEntry)) {
+ if ((errorcode = UnhashVolid(trans, ROVOL, blockindex, VlEntry))) {
if (errorcode != VL_NOENT)
return errorcode;
}
VlEntry->volumeId[ROVOL] = updateentry->ReadOnlyId;
- if (errorcode = HashVolid(trans, ROVOL, blockindex, VlEntry))
+ if ((errorcode = HashVolid(trans, ROVOL, blockindex, VlEntry)))
return errorcode;
}
if (updateentry->Mask & VLUPDATE_BACKUPID) {
- if (errorcode = UnhashVolid(trans, BACKVOL, blockindex, VlEntry)) {
+ if ((errorcode = UnhashVolid(trans, BACKVOL, blockindex, VlEntry))) {
if (errorcode != VL_NOENT)
return errorcode;
}
VlEntry->volumeId[BACKVOL] = updateentry->BackupId;
- if (errorcode = HashVolid(trans, BACKVOL, blockindex, VlEntry))
+ if ((errorcode = HashVolid(trans, BACKVOL, blockindex, VlEntry)))
return errorcode;
}
if (updateentry->Mask & VLUPDATE_REPSITES) {
}
-/* Check if the specified [server,partition] entry is found in the vldb entry's repsite table; it's offset in the table is returned, if it's present there. */
+/* Check if the specified [server,partition] entry is found in the vldb
+ * entry's repsite table; it's offset in the table is returned, if it's
+ * present there. */
static int
-repsite_exists(VlEntry, server, partition)
- struct nvlentry *VlEntry;
- int server, partition;
+repsite_exists(struct nvlentry *VlEntry, int server, int partition)
{
int i;
-/* Repsite table compression: used when deleting a repsite entry so that all active repsite entries are on the top of the table. */
-static
-repsite_compress(VlEntry, offset)
- struct nvlentry *VlEntry;
- int offset;
+/* Repsite table compression: used when deleting a repsite entry so that
+ * all active repsite entries are on the top of the table. */
+static void
+repsite_compress(struct nvlentry *VlEntry, int offset)
{
int repsite_offset = offset;
for (;
}
-/* Convert from the internal (compacted) vldb entry to the external representation used by the interface. */
-static
-vlentry_to_vldbentry(VlEntry, VldbEntry)
- struct nvlentry *VlEntry;
- struct vldbentry *VldbEntry;
+/* Convert from the internal (compacted) vldb entry to the external
+ * representation used by the interface. */
+static void
+vlentry_to_vldbentry(struct nvlentry *VlEntry, struct vldbentry *VldbEntry)
{
int i, j;
}
-/* Convert from the internal (compacted) vldb entry to the external representation used by the interface. */
-static
-vlentry_to_nvldbentry(VlEntry, VldbEntry)
- struct nvlentry *VlEntry;
- struct nvldbentry *VldbEntry;
+/* Convert from the internal (compacted) vldb entry to the external
+ * representation used by the interface. */
+static void
+vlentry_to_nvldbentry(struct nvlentry *VlEntry, struct nvldbentry *VldbEntry)
{
int i, j;
VldbEntry->flags = VlEntry->flags;
}
-static
-vlentry_to_uvldbentry(VlEntry, VldbEntry)
- struct nvlentry *VlEntry;
- struct uvldbentry *VldbEntry;
+static void
+vlentry_to_uvldbentry(struct nvlentry *VlEntry, struct uvldbentry *VldbEntry)
{
int i, j;
/* Verify that the volname is a valid volume name. */
static int
-InvalidVolname(volname)
- char *volname;
+InvalidVolname(char *volname)
{
char *map;
int slen;
/* Verify that the given volume type is valid. */
static int
-InvalidVoltype(voltype)
- afs_int32 voltype;
+InvalidVoltype(afs_int32 voltype)
{
if (voltype != RWVOL && voltype != ROVOL && voltype != BACKVOL)
return 1;
static int
-InvalidOperation(voloper)
- afs_int32 voloper;
+InvalidOperation(afs_int32 voloper)
{
if (voloper != VLOP_MOVE && voloper != VLOP_RELEASE
&& voloper != VLOP_BACKUP && voloper != VLOP_DELETE
}
static int
-InvalidReleasetype(releasetype)
- afs_int32 releasetype;
+InvalidReleasetype(afs_int32 releasetype)
{
if ((releasetype & LOCKREL_TIMESTAMP) || (releasetype & LOCKREL_OPCODE)
|| (releasetype & LOCKREL_AFSID))
}
static int
-IpAddrToRelAddr(ipaddr, atrans)
- struct ubik_trans *atrans;
- register afs_uint32 ipaddr;
+IpAddrToRelAddr(register afs_uint32 ipaddr, struct ubik_trans *atrans)
{
register int i, j;
register afs_int32 code, base, index;
}
static int
-ChangeIPAddr(ipaddr1, ipaddr2, atrans)
- struct ubik_trans *atrans;
- register afs_uint32 ipaddr1, ipaddr2;
+ChangeIPAddr(afs_uint32 ipaddr1, afs_uint32 ipaddr2, struct ubik_trans *atrans)
{
int i, j;
afs_int32 code;
- struct extentaddr *exp;
- int base, index, mhidx;
+ struct extentaddr *exp = NULL;
+ int base = 0;
+ int index, mhidx;
afsUUID tuuid;
afs_int32 blockindex, count;
int pollcount = 0;
for (blockindex = NextEntry(atrans, 0, &tentry, &count); blockindex;
blockindex = NextEntry(atrans, blockindex, &tentry, &count)) {
if (++pollcount > 50) {
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
pollcount = 0;
}
for (j = 0; j < NMAXNSERVERS; j++) {
/* see if the vlserver is back yet */
afs_int32
-SVL_ProbeServer(rxcall)
- struct rx_call *rxcall;
+SVL_ProbeServer(struct rx_call *rxcall)
{
return 0;
}