mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
Convert from using nvldbentry to uvldbentry
The support routines relied upon by vos use the older nvldbentry data structures which do not include the UUID for the server. This patchset updates the code to use the uvldbentry structure so that a future patchset can make use of UUID values when available. Any functions from vsprocs.c which are referenced by vos.c are considered public. This includes all of the VL_xxxx, UV_xxxx and Lp_xxxx functions, the EnumerateEntry, SubEnumerateEntry, and host mapping functions. For any which references an nvldbentry as a parameter a new 'U' version is created that accepts a uvldbentry. These new 'U' functions are then used throughout vos.c and the internal routines. Change-Id: Ib95e4c38574c97284e6b8eee06d92555365a179e Reviewed-on: http://gerrit.openafs.org/2089 Reviewed-by: Jeffrey Altman <jaltman@openafs.org> Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
parent
e2b4fde0b5
commit
4f1efdc8b7
@ -44,8 +44,8 @@
|
||||
* If server is zero, will match first index of ANY server and partition
|
||||
* Zero is a valid partition field.
|
||||
*/
|
||||
int
|
||||
FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type)
|
||||
static int
|
||||
FindIndex(struct uvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type)
|
||||
{
|
||||
int e;
|
||||
afs_int32 error = 0;
|
||||
@ -54,7 +54,7 @@ FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32
|
||||
if (!type || (entry->serverFlags[e] & type)) {
|
||||
if ((!server || (entry->serverPartition[e] == part))
|
||||
&& (!server
|
||||
|| VLDB_IsSameAddrs(entry->serverNumber[e], server,
|
||||
|| VLDB_IsSameAddrs(entry->serverUnique[e], server,
|
||||
&error)))
|
||||
break;
|
||||
if (type == ITSRWVOL)
|
||||
@ -65,7 +65,7 @@ FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32
|
||||
if (error) {
|
||||
fprintf(STDERR,
|
||||
"Failed to get info about server's %d address(es) from vlserver (err=%d)\n",
|
||||
entry->serverNumber[e], error);
|
||||
entry->serverUnique[e], error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -76,8 +76,8 @@ FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32
|
||||
}
|
||||
|
||||
/* Changes the rw site only */
|
||||
void
|
||||
SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
static void
|
||||
SetAValue(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
afs_uint32 nserver, afs_int32 npart, afs_int32 type)
|
||||
{
|
||||
int e;
|
||||
@ -86,13 +86,13 @@ SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
if (e == -1)
|
||||
return; /* If didn't find it, just return */
|
||||
|
||||
entry->serverNumber[e] = nserver;
|
||||
entry->serverUnique[e] = nserver;
|
||||
entry->serverPartition[e] = npart;
|
||||
|
||||
/* Now move rest of entries up */
|
||||
if ((nserver == 0L) && (npart == 0L)) {
|
||||
for (e++; e < entry->nServers; e++) {
|
||||
entry->serverNumber[e - 1] = entry->serverNumber[e];
|
||||
entry->serverUnique[e - 1] = entry->serverUnique[e];
|
||||
entry->serverPartition[e - 1] = entry->serverPartition[e];
|
||||
entry->serverFlags[e - 1] = entry->serverFlags[e];
|
||||
}
|
||||
@ -101,7 +101,18 @@ SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
|
||||
/* Changes the RW site only */
|
||||
void
|
||||
Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
Lp_SetRWValue(struct nvldbentry *entryp, afs_uint32 oserver, afs_int32 opart,
|
||||
afs_uint32 nserver, afs_int32 npart)
|
||||
{
|
||||
struct uvldbentry uentry;
|
||||
|
||||
nvlentry_to_uvlentry(entryp, &uentry);
|
||||
SetAValue(&uentry, oserver, opart, nserver, npart, ITSRWVOL);
|
||||
uvlentry_to_nvlentry(&uentry, entryp);
|
||||
}
|
||||
|
||||
void
|
||||
Lp_SetRWValueU(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
afs_uint32 nserver, afs_int32 npart)
|
||||
{
|
||||
SetAValue(entry, oserver, opart, nserver, npart, ITSRWVOL);
|
||||
@ -109,7 +120,18 @@ Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
|
||||
/* Changes the RO site only */
|
||||
void
|
||||
Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
|
||||
Lp_SetROValue(struct nvldbentry *entryp, afs_uint32 oserver,
|
||||
afs_int32 opart, afs_uint32 nserver, afs_int32 npart)
|
||||
{
|
||||
struct uvldbentry uentry;
|
||||
|
||||
nvlentry_to_uvlentry(entryp, &uentry);
|
||||
SetAValue(&uentry, oserver, opart, nserver, npart, ITSROVOL);
|
||||
uvlentry_to_nvlentry(&uentry, entryp);
|
||||
}
|
||||
|
||||
void
|
||||
Lp_SetROValueU(struct uvldbentry *entry, afs_uint32 oserver,
|
||||
afs_int32 opart, afs_uint32 nserver, afs_int32 npart)
|
||||
{
|
||||
SetAValue(entry, oserver, opart, nserver, npart, ITSROVOL);
|
||||
@ -118,7 +140,20 @@ Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
|
||||
/* Returns success if this server and partition matches the RW entry */
|
||||
int
|
||||
Lp_Match(afs_uint32 server, afs_int32 part,
|
||||
struct nvldbentry *entry)
|
||||
struct nvldbentry *entryp)
|
||||
{
|
||||
struct uvldbentry uentry;
|
||||
|
||||
nvlentry_to_uvlentry(entryp, &uentry);
|
||||
if (FindIndex(&uentry, server, part, ITSRWVOL) == -1)
|
||||
return 0;
|
||||
uvlentry_to_nvlentry(&uentry, entryp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
Lp_MatchU(afs_uint32 server, afs_int32 part,
|
||||
struct uvldbentry *entry)
|
||||
{
|
||||
if (FindIndex(entry, server, part, ITSRWVOL) == -1)
|
||||
return 0;
|
||||
@ -127,14 +162,40 @@ Lp_Match(afs_uint32 server, afs_int32 part,
|
||||
|
||||
/* Return the index of the RO entry (plus 1) if it exists, else return 0 */
|
||||
int
|
||||
Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entry)
|
||||
Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entryp)
|
||||
{
|
||||
struct uvldbentry uentry;
|
||||
int idx;
|
||||
|
||||
nvlentry_to_uvlentry(entryp, &uentry);
|
||||
idx = (FindIndex(&uentry, server, part, ITSROVOL) + 1);
|
||||
if (idx)
|
||||
uvlentry_to_nvlentry(&uentry, entryp);
|
||||
return idx;
|
||||
}
|
||||
|
||||
int
|
||||
Lp_ROMatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry)
|
||||
{
|
||||
return (FindIndex(entry, server, part, ITSROVOL) + 1);
|
||||
}
|
||||
|
||||
/* Return the index of the RW entry if it exists, else return -1 */
|
||||
int
|
||||
Lp_GetRwIndex(struct nvldbentry *entry)
|
||||
Lp_GetRwIndex(struct nvldbentry *entryp)
|
||||
{
|
||||
struct uvldbentry uentry;
|
||||
int idx;
|
||||
|
||||
nvlentry_to_uvlentry(entryp, &uentry);
|
||||
idx = (FindIndex(&uentry, 0, 0, ITSRWVOL));
|
||||
if (idx > -1)
|
||||
uvlentry_to_nvlentry(&uentry, entryp);
|
||||
return idx;
|
||||
}
|
||||
|
||||
int
|
||||
Lp_GetRwIndexU(struct uvldbentry *entry)
|
||||
{
|
||||
return (FindIndex(entry, 0, 0, ITSRWVOL));
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef _LOCKPROCS_PROTOTYPES_H
|
||||
#define _LOCKPROCS_PROTOTYPES_H
|
||||
extern int FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type);
|
||||
extern void SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
afs_uint32 nserver, afs_int32 npart, afs_int32 type);
|
||||
/* older nvldbentry versions */
|
||||
extern void Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
afs_uint32 nserver, afs_int32 npart);
|
||||
extern void Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
|
||||
@ -10,6 +8,16 @@ extern void Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
|
||||
extern int Lp_Match(afs_uint32 server, afs_int32 part, struct nvldbentry *entry);
|
||||
extern int Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entry);
|
||||
extern int Lp_GetRwIndex(struct nvldbentry *entry);
|
||||
|
||||
/* newer uvldbentry versions */
|
||||
extern void Lp_SetRWValueU(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
|
||||
afs_uint32 nserver, afs_int32 npart);
|
||||
extern void Lp_SetROValueU(struct uvldbentry *entry, afs_uint32 oserver,
|
||||
afs_int32 opart, afs_uint32 nserver, afs_int32 npart);
|
||||
extern int Lp_MatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry);
|
||||
extern int Lp_ROMatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry);
|
||||
extern int Lp_GetRwIndexU(struct uvldbentry *entry);
|
||||
|
||||
extern void Lp_QInit(struct qHead *ahead);
|
||||
extern void Lp_QAdd(struct qHead *ahead, struct aqueue *elem);
|
||||
extern int Lp_QScan(struct qHead *ahead, afs_int32 id, int *success, struct aqueue **elem);
|
||||
|
@ -212,7 +212,7 @@ struct pIDs {
|
||||
struct diskPartition {
|
||||
char name[32]; /* Mounted partition name */
|
||||
char devName[32];
|
||||
int lock_fd;
|
||||
int lock_fd; /* assigned from DiskPartition FD_t (64-bit on Windows) */
|
||||
int totalUsable;
|
||||
int free;
|
||||
int minFree;
|
||||
@ -222,7 +222,7 @@ struct diskPartition {
|
||||
struct diskPartition64 {
|
||||
char name[256]; /* Mounted partition name */
|
||||
char devName[256];
|
||||
int lock_fd;
|
||||
int lock_fd; /* assigned from DiskPartition64 FD_t (64-bit on Windows) */
|
||||
afs_int64 totalUsable;
|
||||
afs_int64 free;
|
||||
afs_int64 minFree;
|
||||
|
@ -32,10 +32,12 @@ extern int VPFullUnlock(void);
|
||||
extern afs_int32 GCTrans(void);
|
||||
|
||||
/* vsprocs.c */
|
||||
struct uvldbentry;
|
||||
struct nvldbentry;
|
||||
extern int yesprompt(char *str);
|
||||
extern int PrintError(char *msg, afs_int32 errcode);
|
||||
extern void init_volintInfo(struct volintInfo *vinfo);
|
||||
extern void SubEnumerateEntryU(struct uvldbentry *entry);
|
||||
extern void EnumerateEntryU(struct uvldbentry *entry);
|
||||
extern void SubEnumerateEntry(struct nvldbentry *entry);
|
||||
extern void EnumerateEntry(struct nvldbentry *entry);
|
||||
extern int UV_NukeVolume(afs_uint32 server, afs_int32 partid, afs_uint32 volid);
|
||||
@ -62,7 +64,6 @@ extern int UV_BackupVolume(afs_uint32 aserver, afs_int32 apart,
|
||||
afs_uint32 avolid);
|
||||
extern int UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
|
||||
afs_int32 afrompart, int forceflag);
|
||||
extern void dump_sig_handler(int x);
|
||||
extern int UV_DumpVolume(afs_uint32 afromvol, afs_uint32 afromserver,
|
||||
afs_int32 afrompart, afs_int32 fromdate,
|
||||
afs_int32(*DumpFunction) (struct rx_call *, void *),
|
||||
@ -96,22 +97,16 @@ extern int UV_XListVolumes(afs_uint32 a_serverID, afs_int32 a_partID,
|
||||
extern int UV_XListOneVolume(afs_uint32 a_serverID, afs_int32 a_partID,
|
||||
afs_uint32 a_volID,
|
||||
struct volintXInfo **a_resultPP);
|
||||
extern int sortVolumes(const void *a, const void *b);
|
||||
extern int UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname,
|
||||
int flags);
|
||||
extern int UV_SyncVldb(afs_uint32 aserver, afs_int32 apart, int flags,
|
||||
int force);
|
||||
extern afs_int32 VolumeExists(afs_uint32 server, afs_int32 partition,
|
||||
afs_uint32 volumeid);
|
||||
extern afs_int32 CheckVldbRWBK(struct nvldbentry *entry,
|
||||
afs_int32 * modified);
|
||||
extern int CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified);
|
||||
extern afs_int32 CheckVldb(struct nvldbentry *entry, afs_int32 * modified,
|
||||
afs_int32 *deleted);
|
||||
extern int UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags,
|
||||
int force);
|
||||
extern int UV_RenameVolume(struct nvldbentry *entry, char oldname[],
|
||||
char newname[]);
|
||||
extern int UV_RenameVolumeU(struct uvldbentry *entry, char oldname[],
|
||||
char newname[]);
|
||||
extern int UV_VolserStatus(afs_uint32 server, transDebugInfo ** rpntr,
|
||||
afs_int32 * rcount);
|
||||
extern int UV_VolumeZap(afs_uint32 server, afs_int32 part, afs_uint32 volid);
|
||||
@ -120,6 +115,7 @@ extern int UV_SetVolume(afs_uint32 server, afs_int32 partition,
|
||||
afs_int32 setflag, int sleeptime);
|
||||
extern int UV_SetVolumeInfo(afs_uint32 server, afs_int32 partition,
|
||||
afs_uint32 volid, volintInfo * infop);
|
||||
extern void MapNetworkToHostU(struct uvldbentry *old, struct uvldbentry *new);
|
||||
extern void MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new);
|
||||
extern int UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver,
|
||||
afs_int32 afrompart, char *atovolname,
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define AFS_SRC_VOLSER_PROTOTYPES_H
|
||||
|
||||
struct nvldbentry;
|
||||
struct uvldbentry;
|
||||
struct volintInfo;
|
||||
|
||||
/* vsprocs.c */
|
||||
@ -18,6 +19,8 @@ extern void MapPartIdIntoName(afs_int32 partId, char *partName);
|
||||
|
||||
extern void MapHostToNetwork(struct nvldbentry *entry);
|
||||
|
||||
extern void MapHostToNetworkU(struct uvldbentry *entry);
|
||||
|
||||
extern struct rx_connection *UV_Bind(afs_uint32 aserver, afs_int32 port);
|
||||
|
||||
extern int UV_CreateVolume(afs_uint32 aserver, afs_int32 apart, char *aname,
|
||||
|
235
src/volser/vos.c
235
src/volser/vos.c
@ -77,7 +77,7 @@
|
||||
/* Local Prototypes */
|
||||
int PrintDiagnostics(char *astring, afs_int32 acode);
|
||||
int GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part,
|
||||
afs_int32 *voltype, struct nvldbentry *rentry);
|
||||
afs_int32 *voltype, struct uvldbentry *rentry);
|
||||
|
||||
struct tqElem {
|
||||
afs_uint32 volid;
|
||||
@ -167,8 +167,7 @@ FileExists(char *filename)
|
||||
static int
|
||||
VolNameOK(char *name)
|
||||
{
|
||||
int total;
|
||||
|
||||
size_t total;
|
||||
|
||||
total = strlen(name);
|
||||
if (!strcmp(&name[total - 9], ".readonly")) {
|
||||
@ -184,7 +183,8 @@ VolNameOK(char *name)
|
||||
static int
|
||||
IsNumeric(char *name)
|
||||
{
|
||||
int result, len, i;
|
||||
int result, i;
|
||||
size_t len;
|
||||
char *ptr;
|
||||
|
||||
result = 1;
|
||||
@ -1379,7 +1379,7 @@ XDisplayVolumes2(afs_uint32 a_servID, afs_int32 a_partID, volintXInfo *a_xInfoP,
|
||||
/* set <server> and <part> to the correct values depending on
|
||||
* <voltype> and <entry> */
|
||||
static void
|
||||
GetServerAndPart(struct nvldbentry *entry, int voltype, afs_uint32 *server,
|
||||
GetServerAndPart(struct uvldbentry *entry, int voltype, afs_uint32 *server,
|
||||
afs_int32 *part, int *previdx)
|
||||
{
|
||||
int i, istart, vtype;
|
||||
@ -1397,9 +1397,10 @@ GetServerAndPart(struct nvldbentry *entry, int voltype, afs_uint32 *server,
|
||||
istart = ((*previdx < 0) ? 0 : *previdx + 1);
|
||||
}
|
||||
|
||||
for (i = istart; i < entry->nServers; i++) {
|
||||
for (i = istart; i < entry->nServers && i < NMAXNSERVERS; i++) {
|
||||
if (entry->serverFlags[i] & vtype) {
|
||||
*server = entry->serverNumber[i];
|
||||
/* *uuid = entry->serverNumber[i]; */
|
||||
*server = entry->serverUnique[i];
|
||||
*part = entry->serverPartition[i];
|
||||
*previdx = i;
|
||||
return;
|
||||
@ -1438,9 +1439,9 @@ PrintLocked(afs_int32 aflags)
|
||||
}
|
||||
|
||||
static void
|
||||
PostVolumeStats(struct nvldbentry *entry)
|
||||
PostVolumeStats(struct uvldbentry *entry)
|
||||
{
|
||||
SubEnumerateEntry(entry);
|
||||
SubEnumerateEntryU(entry);
|
||||
/* Check for VLOP_ALLOPERS */
|
||||
PrintLocked(entry->flags);
|
||||
return;
|
||||
@ -1470,7 +1471,7 @@ PostVolumeStats(struct nvldbentry *entry)
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
XVolumeStats(volintXInfo *a_xInfoP, struct nvldbentry *a_entryP,
|
||||
XVolumeStats(volintXInfo *a_xInfoP, struct uvldbentry *a_entryP,
|
||||
afs_int32 a_srvID, afs_int32 a_partID, int a_volType)
|
||||
{ /*XVolumeStats */
|
||||
|
||||
@ -1490,7 +1491,7 @@ XVolumeStats(volintXInfo *a_xInfoP, struct nvldbentry *a_entryP,
|
||||
} /*XVolumeStats */
|
||||
|
||||
static void
|
||||
VolumeStats_int(volintInfo *pntr, struct nvldbentry *entry, afs_uint32 server,
|
||||
VolumeStats_int(volintInfo *pntr, struct uvldbentry *entry, afs_uint32 server,
|
||||
afs_int32 part, int voltype)
|
||||
{
|
||||
int totalOK, totalNotOK, totalBusy;
|
||||
@ -1570,7 +1571,7 @@ NukeVolume(struct cmd_syndesc *as)
|
||||
static int
|
||||
ExamineVolume(struct cmd_syndesc *as, void *arock)
|
||||
{
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
afs_int32 vcode = 0;
|
||||
volintInfo *pntr = (volintInfo *) 0;
|
||||
volintXInfo *xInfoP = (volintXInfo *) 0;
|
||||
@ -1599,7 +1600,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock)
|
||||
(unsigned long)volid);
|
||||
fflush(STDOUT);
|
||||
}
|
||||
vcode = VLDB_GetEntryByID(volid, -1, &entry);
|
||||
vcode = VLDB_GetEntryByIDU(volid, -1, &entry);
|
||||
if (vcode) {
|
||||
fprintf(STDERR,
|
||||
"Could not fetch the entry for volume number %lu from VLDB \n",
|
||||
@ -1608,7 +1609,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock)
|
||||
}
|
||||
if (verbose)
|
||||
fprintf(STDOUT, "done\n");
|
||||
MapHostToNetwork(&entry);
|
||||
MapHostToNetworkU(&entry);
|
||||
|
||||
if (entry.volumeId[RWVOL] == volid)
|
||||
voltype = RWVOL;
|
||||
@ -1670,7 +1671,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock)
|
||||
XVolumeStats(xInfoP, &entry, aserver, apart, voltype);
|
||||
else if (as->parms[2].items) {
|
||||
DisplayFormat2(aserver, apart, pntr);
|
||||
EnumerateEntry(&entry);
|
||||
EnumerateEntryU(&entry);
|
||||
isSubEnum = 1;
|
||||
} else
|
||||
VolumeStats_int(pntr, &entry, aserver, apart, voltype);
|
||||
@ -1723,7 +1724,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock)
|
||||
static int
|
||||
SetFields(struct cmd_syndesc *as, void *arock)
|
||||
{
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
volintInfo info;
|
||||
afs_uint32 volid;
|
||||
afs_int32 code, err;
|
||||
@ -1741,14 +1742,14 @@ SetFields(struct cmd_syndesc *as, void *arock)
|
||||
return -1;
|
||||
}
|
||||
|
||||
code = VLDB_GetEntryByID(volid, RWVOL, &entry);
|
||||
code = VLDB_GetEntryByIDU(volid, RWVOL, &entry);
|
||||
if (code) {
|
||||
fprintf(STDERR,
|
||||
"Could not fetch the entry for volume number %lu from VLDB \n",
|
||||
(unsigned long)volid);
|
||||
return (code);
|
||||
}
|
||||
MapHostToNetwork(&entry);
|
||||
MapHostToNetworkU(&entry);
|
||||
|
||||
GetServerAndPart(&entry, RWVOL, &aserver, &apart, &previdx);
|
||||
if (previdx == -1) {
|
||||
@ -1925,7 +1926,7 @@ CreateVolume(struct cmd_syndesc *as, void *arock)
|
||||
afs_uint32 volid = 0, rovolid = 0, bkvolid = 0;
|
||||
afs_uint32 *arovolid;
|
||||
afs_int32 code;
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
afs_int32 vcode;
|
||||
afs_int32 quota;
|
||||
|
||||
@ -1970,7 +1971,7 @@ CreateVolume(struct cmd_syndesc *as, void *arock)
|
||||
as->parms[2].items->data);
|
||||
return EINVAL;
|
||||
}
|
||||
vcode = VLDB_GetEntryByName(as->parms[2].items->data, &entry);
|
||||
vcode = VLDB_GetEntryByNameU(as->parms[2].items->data, &entry);
|
||||
if (!vcode) {
|
||||
fprintf(STDERR, "Volume %s already exists\n",
|
||||
as->parms[2].items->data);
|
||||
@ -2034,16 +2035,16 @@ CreateVolume(struct cmd_syndesc *as, void *arock)
|
||||
|
||||
#if 0
|
||||
static afs_int32
|
||||
DeleteAll(struct nvldbentry *entry)
|
||||
DeleteAll(struct uvldbentry *entry)
|
||||
{
|
||||
int i;
|
||||
afs_int32 error, code, curserver, curpart;
|
||||
afs_uint32 volid;
|
||||
|
||||
MapHostToNetwork(entry);
|
||||
MapHostToNetworkU(entry);
|
||||
error = 0;
|
||||
for (i = 0; i < entry->nServers; i++) {
|
||||
curserver = entry->serverNumber[i];
|
||||
curserver = entry->serverUnique[i];
|
||||
curpart = entry->serverPartition[i];
|
||||
if (entry->serverFlags[i] & ITSROVOL) {
|
||||
volid = entry->volumeId[ROVOL];
|
||||
@ -2111,9 +2112,9 @@ DeleteVolume(struct cmd_syndesc *as, void *arock)
|
||||
* them in from the VLDB entry.
|
||||
*/
|
||||
if ((partition == -1) || !server) {
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
|
||||
code = VLDB_GetEntryByID(volid, -1, &entry);
|
||||
code = VLDB_GetEntryByIDU(volid, -1, &entry);
|
||||
if (code) {
|
||||
fprintf(STDERR,
|
||||
"Could not fetch the entry for volume %lu from VLDB\n",
|
||||
@ -2125,8 +2126,8 @@ DeleteVolume(struct cmd_syndesc *as, void *arock)
|
||||
if (((volid == entry.volumeId[RWVOL]) && (entry.flags & RW_EXISTS))
|
||||
|| ((volid == entry.volumeId[BACKVOL])
|
||||
&& (entry.flags & BACK_EXISTS))) {
|
||||
idx = Lp_GetRwIndex(&entry);
|
||||
if ((idx == -1) || (server && (server != entry.serverNumber[idx]))
|
||||
idx = Lp_GetRwIndexU(&entry);
|
||||
if ((idx == -1) || (server && (server != entry.serverUnique[idx]))
|
||||
|| ((partition != -1)
|
||||
&& (partition != entry.serverPartition[idx]))) {
|
||||
fprintf(STDERR, "VLDB: Volume '%s' no match\n",
|
||||
@ -2139,7 +2140,7 @@ DeleteVolume(struct cmd_syndesc *as, void *arock)
|
||||
if (entry.serverFlags[j] != ITSROVOL)
|
||||
continue;
|
||||
|
||||
if (((server == 0) || (server == entry.serverNumber[j]))
|
||||
if (((server == 0) || (server == entry.serverUnique[j]))
|
||||
&& ((partition == -1)
|
||||
|| (partition == entry.serverPartition[j]))) {
|
||||
if (idx != -1) {
|
||||
@ -2162,7 +2163,7 @@ DeleteVolume(struct cmd_syndesc *as, void *arock)
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
server = htonl(entry.serverNumber[idx]);
|
||||
server = htonl(entry.serverUnique[idx]);
|
||||
partition = entry.serverPartition[idx];
|
||||
}
|
||||
|
||||
@ -2316,7 +2317,7 @@ CopyVolume(struct cmd_syndesc *as, void *arock)
|
||||
afs_uint32 fromserver, toserver;
|
||||
afs_int32 frompart, topart, code, err, flags;
|
||||
char fromPartName[10], toPartName[10], *tovolume;
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
struct diskPartition64 partition; /* for space check */
|
||||
volintInfo *p;
|
||||
|
||||
@ -2361,7 +2362,7 @@ CopyVolume(struct cmd_syndesc *as, void *arock)
|
||||
tovolume);
|
||||
return EINVAL;
|
||||
}
|
||||
code = VLDB_GetEntryByName(tovolume, &entry);
|
||||
code = VLDB_GetEntryByNameU(tovolume, &entry);
|
||||
if (!code) {
|
||||
fprintf(STDERR, "Volume %s already exists\n", tovolume);
|
||||
PrintDiagnostics("copy", code);
|
||||
@ -2662,7 +2663,7 @@ CloneVolume(struct cmd_syndesc *as, void *arock)
|
||||
afs_int32 part, voltype;
|
||||
char partName[10], *volname;
|
||||
afs_int32 code, err, flags;
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
|
||||
volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
|
||||
if (volid == 0) {
|
||||
@ -2775,12 +2776,12 @@ BackupVolume(struct cmd_syndesc *as, void *arock)
|
||||
afs_uint32 avolid;
|
||||
afs_uint32 aserver;
|
||||
afs_int32 apart, vtype, code, err;
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
|
||||
afs_uint32 buvolid;
|
||||
afs_uint32 buserver;
|
||||
afs_int32 bupart, butype;
|
||||
struct nvldbentry buentry;
|
||||
struct uvldbentry buentry;
|
||||
|
||||
avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
|
||||
if (avolid == 0) {
|
||||
@ -2845,7 +2846,7 @@ static int
|
||||
ReleaseVolume(struct cmd_syndesc *as, void *arock)
|
||||
{
|
||||
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
afs_uint32 avolid;
|
||||
afs_uint32 aserver;
|
||||
afs_int32 apart, vtype, code, err;
|
||||
@ -2895,7 +2896,7 @@ DumpVolumeCmd(struct cmd_syndesc *as, void *arock)
|
||||
afs_uint32 aserver;
|
||||
afs_int32 apart, voltype, fromdate = 0, code, err, i, flags;
|
||||
char filename[MAXPATHLEN];
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
|
||||
rx_SetRxDeadTime(60 * 10);
|
||||
for (i = 0; i < MAXSERVERS; i++) {
|
||||
@ -3002,7 +3003,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock)
|
||||
int readonly = 0, offline = 0, voltype = RWVOL;
|
||||
char afilename[MAXPATHLEN], avolname[VOLSER_MAXVOLNAME + 1], apartName[10];
|
||||
char volname[VOLSER_MAXVOLNAME + 1];
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
|
||||
aparentid = 0;
|
||||
if (as->parms[4].items) {
|
||||
@ -3124,7 +3125,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock)
|
||||
/* Check if volume exists or not */
|
||||
|
||||
vsu_ExtractName(volname, avolname);
|
||||
vcode = VLDB_GetEntryByName(volname, &entry);
|
||||
vcode = VLDB_GetEntryByNameU(volname, &entry);
|
||||
if (vcode) { /* no volume - do a full restore */
|
||||
restoreflags = RV_FULLRST;
|
||||
if ((aoverwrite == INC) || (aoverwrite == ABORT))
|
||||
@ -3132,8 +3133,8 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock)
|
||||
"Volume does not exist; Will perform a full restore\n");
|
||||
}
|
||||
|
||||
else if ((!readonly && Lp_GetRwIndex(&entry) == -1) /* RW volume does not exist - do a full */
|
||||
||(readonly && !Lp_ROMatch(0, 0, &entry))) { /* RO volume does not exist - do a full */
|
||||
else if ((!readonly && Lp_GetRwIndexU(&entry) == -1) /* RW volume does not exist - do a full */
|
||||
||(readonly && !Lp_ROMatchU(0, 0, &entry))) { /* RO volume does not exist - do a full */
|
||||
restoreflags = RV_FULLRST;
|
||||
if ((aoverwrite == INC) || (aoverwrite == ABORT))
|
||||
fprintf(STDERR,
|
||||
@ -3152,7 +3153,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock)
|
||||
else { /* volume exists - do we do a full incremental or abort */
|
||||
afs_uint32 Oserver;
|
||||
afs_int32 Opart, Otype, vol_elsewhere = 0;
|
||||
struct nvldbentry Oentry;
|
||||
struct uvldbentry Oentry;
|
||||
int c, dc;
|
||||
|
||||
if (avolid == 0) {
|
||||
@ -3929,19 +3930,19 @@ SyncServer(struct cmd_syndesc *as, void *arock)
|
||||
static int
|
||||
VolumeInfoCmd(char *name)
|
||||
{
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
afs_int32 vcode;
|
||||
|
||||
/* The vlserver will handle names with the .readonly
|
||||
* and .backup extension as well as volume ids.
|
||||
*/
|
||||
vcode = VLDB_GetEntryByName(name, &entry);
|
||||
vcode = VLDB_GetEntryByNameU(name, &entry);
|
||||
if (vcode) {
|
||||
PrintError("", vcode);
|
||||
exit(1);
|
||||
}
|
||||
MapHostToNetwork(&entry);
|
||||
EnumerateEntry(&entry);
|
||||
MapHostToNetworkU(&entry);
|
||||
EnumerateEntryU(&entry);
|
||||
|
||||
/* Defect #3027: grubby check to handle locked volume.
|
||||
* If VLOP_ALLOPERS is set, the entry is locked.
|
||||
@ -3955,7 +3956,7 @@ VolumeInfoCmd(char *name)
|
||||
static int
|
||||
VolumeZap(struct cmd_syndesc *as, void *arock)
|
||||
{
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
afs_uint32 volid, zapbackupid = 0, backupid = 0;
|
||||
afs_int32 code, server, part, err;
|
||||
|
||||
@ -3998,7 +3999,7 @@ VolumeZap(struct cmd_syndesc *as, void *arock)
|
||||
as->parms[1].items->data);
|
||||
exit(1);
|
||||
}
|
||||
code = VLDB_GetEntryByID(volid, -1, &entry);
|
||||
code = VLDB_GetEntryByIDU(volid, -1, &entry);
|
||||
if (!code) {
|
||||
if (volid == entry.volumeId[RWVOL])
|
||||
backupid = entry.volumeId[BACKVOL];
|
||||
@ -4140,15 +4141,15 @@ static int
|
||||
RenameVolume(struct cmd_syndesc *as, void *arock)
|
||||
{
|
||||
afs_int32 code1, code2, code;
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
|
||||
code1 = VLDB_GetEntryByName(as->parms[0].items->data, &entry);
|
||||
code1 = VLDB_GetEntryByNameU(as->parms[0].items->data, &entry);
|
||||
if (code1) {
|
||||
fprintf(STDERR, "vos: Could not find entry for volume %s\n",
|
||||
as->parms[0].items->data);
|
||||
exit(1);
|
||||
}
|
||||
code2 = VLDB_GetEntryByName(as->parms[1].items->data, &entry);
|
||||
code2 = VLDB_GetEntryByNameU(as->parms[1].items->data, &entry);
|
||||
if ((!code1) && (!code2)) { /*the newname already exists */
|
||||
fprintf(STDERR, "vos: volume %s already exists\n",
|
||||
as->parms[1].items->data);
|
||||
@ -4183,10 +4184,10 @@ RenameVolume(struct cmd_syndesc *as, void *arock)
|
||||
as->parms[1].items->data);
|
||||
exit(1);
|
||||
}
|
||||
MapHostToNetwork(&entry);
|
||||
MapHostToNetworkU(&entry);
|
||||
code =
|
||||
UV_RenameVolume(&entry, as->parms[0].items->data,
|
||||
as->parms[1].items->data);
|
||||
UV_RenameVolumeU(&entry, as->parms[0].items->data,
|
||||
as->parms[1].items->data);
|
||||
if (code) {
|
||||
PrintDiagnostics("rename", code);
|
||||
exit(1);
|
||||
@ -4198,12 +4199,12 @@ RenameVolume(struct cmd_syndesc *as, void *arock)
|
||||
|
||||
int
|
||||
GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *voltype,
|
||||
struct nvldbentry *rentry)
|
||||
struct uvldbentry *rentry)
|
||||
{
|
||||
afs_int32 vcode;
|
||||
int i, index = -1;
|
||||
|
||||
vcode = VLDB_GetEntryByID(volid, -1, rentry);
|
||||
vcode = VLDB_GetEntryByIDU(volid, -1, rentry);
|
||||
if (vcode) {
|
||||
fprintf(STDERR,
|
||||
"Could not fetch the entry for volume %lu from VLDB \n",
|
||||
@ -4211,7 +4212,7 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *
|
||||
PrintError("", vcode);
|
||||
return (vcode);
|
||||
}
|
||||
MapHostToNetwork(rentry);
|
||||
MapHostToNetworkU(rentry);
|
||||
if (volid == rentry->volumeId[ROVOL]) {
|
||||
*voltype = ROVOL;
|
||||
for (i = 0; i < rentry->nServers; i++) {
|
||||
@ -4226,12 +4227,12 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *
|
||||
return -1;
|
||||
}
|
||||
|
||||
*server = rentry->serverNumber[index];
|
||||
*server = rentry->serverUnique[index];
|
||||
*part = rentry->serverPartition[index];
|
||||
return 0;
|
||||
}
|
||||
|
||||
index = Lp_GetRwIndex(rentry);
|
||||
index = Lp_GetRwIndexU(rentry);
|
||||
if (index == -1) {
|
||||
fprintf(STDERR,
|
||||
"RW Volume is not found in VLDB entry for volume %lu\n",
|
||||
@ -4240,13 +4241,13 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *
|
||||
}
|
||||
if (volid == rentry->volumeId[RWVOL]) {
|
||||
*voltype = RWVOL;
|
||||
*server = rentry->serverNumber[index];
|
||||
*server = rentry->serverUnique[index];
|
||||
*part = rentry->serverPartition[index];
|
||||
return 0;
|
||||
}
|
||||
if (volid == rentry->volumeId[BACKVOL]) {
|
||||
*voltype = BACKVOL;
|
||||
*server = rentry->serverNumber[index];
|
||||
*server = rentry->serverUnique[index];
|
||||
*part = rentry->serverPartition[index];
|
||||
return 0;
|
||||
}
|
||||
@ -4263,8 +4264,8 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
|
||||
afs_uint32 avolid;
|
||||
afs_int32 vcode;
|
||||
struct VldbListByAttributes attributes;
|
||||
nbulkentries arrayEntries;
|
||||
struct nvldbentry *vllist;
|
||||
ubulkentries arrayEntries;
|
||||
struct uvldbentry *vllist;
|
||||
struct cmd_item *itp;
|
||||
afs_int32 nentries;
|
||||
int j;
|
||||
@ -4375,7 +4376,7 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
|
||||
|
||||
/* Get all the VLDB entries on a server and/or partition */
|
||||
memset(&arrayEntries, 0, sizeof(arrayEntries));
|
||||
vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
|
||||
vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries);
|
||||
if (vcode) {
|
||||
fprintf(STDERR, "Could not access the VLDB for attributes\n");
|
||||
PrintError("", vcode);
|
||||
@ -4384,7 +4385,7 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
|
||||
|
||||
/* Process each entry */
|
||||
for (j = 0; j < nentries; j++) {
|
||||
vllist = &arrayEntries.nbulkentries_val[j];
|
||||
vllist = &arrayEntries.ubulkentries_val[j];
|
||||
if (seenprefix) {
|
||||
/* It only deletes the RW volumes */
|
||||
if (strncmp(vllist->name, prefix, strlen(prefix))) {
|
||||
@ -4426,8 +4427,8 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
|
||||
fprintf(STDOUT,
|
||||
"Total VLDB entries deleted: %lu; failed to delete: %lu\n",
|
||||
(unsigned long)totalBack, (unsigned long)totalFail);
|
||||
if (arrayEntries.nbulkentries_val)
|
||||
free(arrayEntries.nbulkentries_val);
|
||||
if (arrayEntries.ubulkentries_val)
|
||||
free(arrayEntries.ubulkentries_val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4435,24 +4436,24 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
|
||||
static int
|
||||
CompareVldbEntryByName(const void *p1, const void *p2)
|
||||
{
|
||||
struct nvldbentry *arg1, *arg2;
|
||||
struct uvldbentry *arg1, *arg2;
|
||||
|
||||
arg1 = (struct nvldbentry *)p1;
|
||||
arg2 = (struct nvldbentry *)p2;
|
||||
arg1 = (struct uvldbentry *)p1;
|
||||
arg2 = (struct uvldbentry *)p2;
|
||||
return (strcmp(arg1->name, arg2->name));
|
||||
}
|
||||
|
||||
/*
|
||||
static int CompareVldbEntry(char *p1, char *p2)
|
||||
{
|
||||
struct nvldbentry *arg1,*arg2;
|
||||
struct uvldbentry *arg1,*arg2;
|
||||
int i;
|
||||
int pos1, pos2;
|
||||
char comp1[100],comp2[100];
|
||||
char temp1[20],temp2[20];
|
||||
|
||||
arg1 = (struct nvldbentry *)p1;
|
||||
arg2 = (struct nvldbentry *)p2;
|
||||
arg1 = (struct uvldbentry *)p1;
|
||||
arg2 = (struct uvldbentry *)p2;
|
||||
pos1 = -1;
|
||||
pos2 = -1;
|
||||
|
||||
@ -4464,8 +4465,8 @@ static int CompareVldbEntry(char *p1, char *p2)
|
||||
pos1 = 0;
|
||||
pos2 = 0;
|
||||
}
|
||||
sprintf(comp1,"%10u",arg1->serverNumber[pos1]);
|
||||
sprintf(comp2,"%10u",arg2->serverNumber[pos2]);
|
||||
sprintf(comp1,"%10u",arg1->serverUnique[pos1]);
|
||||
sprintf(comp2,"%10u",arg2->serverUnique[pos2]);
|
||||
sprintf(temp1,"%10u",arg1->serverPartition[pos1]);
|
||||
sprintf(temp2,"%10u",arg2->serverPartition[pos2]);
|
||||
strcat(comp1,temp1);
|
||||
@ -4485,8 +4486,8 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
|
||||
afs_int32 code;
|
||||
afs_int32 vcode;
|
||||
struct VldbListByAttributes attributes;
|
||||
nbulkentries arrayEntries;
|
||||
struct nvldbentry *vllist, *tarray = 0, *ttarray;
|
||||
ubulkentries arrayEntries;
|
||||
struct uvldbentry *vllist, *tarray = 0, *ttarray;
|
||||
afs_int32 centries, nentries = 0;
|
||||
afs_int32 tarraysize = 0;
|
||||
afs_int32 parraysize;
|
||||
@ -4566,12 +4567,12 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
|
||||
nextindex = -1;
|
||||
|
||||
vcode =
|
||||
VLDB_ListAttributesN2(&attributes, 0, thisindex, ¢ries,
|
||||
VLDB_ListAttributesN2U(&attributes, 0, thisindex, ¢ries,
|
||||
&arrayEntries, &nextindex);
|
||||
if (vcode == RXGEN_OPCODE) {
|
||||
/* Vlserver not running with ListAttributesN2. Fall back */
|
||||
vcode =
|
||||
VLDB_ListAttributes(&attributes, ¢ries, &arrayEntries);
|
||||
VLDB_ListAttributesU(&attributes, ¢ries, &arrayEntries);
|
||||
nextindex = -1;
|
||||
}
|
||||
if (vcode) {
|
||||
@ -4584,9 +4585,9 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
|
||||
/* We don't sort, so just print the entries now */
|
||||
if (!sort) {
|
||||
for (j = 0; j < centries; j++) { /* process each entry */
|
||||
vllist = &arrayEntries.nbulkentries_val[j];
|
||||
MapHostToNetwork(vllist);
|
||||
EnumerateEntry(vllist);
|
||||
vllist = &arrayEntries.ubulkentries_val[j];
|
||||
MapHostToNetworkU(vllist);
|
||||
EnumerateEntryU(vllist);
|
||||
|
||||
PrintLocked(vllist->flags);
|
||||
}
|
||||
@ -4598,14 +4599,14 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
|
||||
else if (centries > 0) {
|
||||
if (!tarray) {
|
||||
/* steal away the first bulk entries array */
|
||||
tarray = (struct nvldbentry *)arrayEntries.nbulkentries_val;
|
||||
tarraysize = centries * sizeof(struct nvldbentry);
|
||||
arrayEntries.nbulkentries_val = 0;
|
||||
tarray = (struct uvldbentry *)arrayEntries.ubulkentries_val;
|
||||
tarraysize = centries * sizeof(struct uvldbentry);
|
||||
arrayEntries.ubulkentries_val = 0;
|
||||
} else {
|
||||
/* Grow the tarray to keep the extra entries */
|
||||
parraysize = (centries * sizeof(struct nvldbentry));
|
||||
parraysize = (centries * sizeof(struct uvldbentry));
|
||||
ttarray =
|
||||
(struct nvldbentry *)realloc(tarray,
|
||||
(struct uvldbentry *)realloc(tarray,
|
||||
tarraysize + parraysize);
|
||||
if (!ttarray) {
|
||||
fprintf(STDERR,
|
||||
@ -4616,25 +4617,25 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
|
||||
|
||||
/* Copy them in */
|
||||
memcpy(((char *)tarray) + tarraysize,
|
||||
(char *)arrayEntries.nbulkentries_val, parraysize);
|
||||
(char *)arrayEntries.ubulkentries_val, parraysize);
|
||||
tarraysize += parraysize;
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the bulk array */
|
||||
if (arrayEntries.nbulkentries_val) {
|
||||
free(arrayEntries.nbulkentries_val);
|
||||
arrayEntries.nbulkentries_val = 0;
|
||||
if (arrayEntries.ubulkentries_val) {
|
||||
free(arrayEntries.ubulkentries_val);
|
||||
arrayEntries.ubulkentries_val = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Here is where we now sort all the entries and print them */
|
||||
if (sort && (nentries > 0)) {
|
||||
qsort((char *)tarray, nentries, sizeof(struct nvldbentry),
|
||||
qsort((char *)tarray, nentries, sizeof(struct uvldbentry),
|
||||
CompareVldbEntryByName);
|
||||
for (vllist = tarray, j = 0; j < nentries; j++, vllist++) {
|
||||
MapHostToNetwork(vllist);
|
||||
EnumerateEntry(vllist);
|
||||
MapHostToNetworkU(vllist);
|
||||
EnumerateEntryU(vllist);
|
||||
|
||||
PrintLocked(vllist->flags);
|
||||
}
|
||||
@ -4657,8 +4658,8 @@ BackSys(struct cmd_syndesc *as, void *arock)
|
||||
afs_int32 code, apart1;
|
||||
afs_int32 vcode;
|
||||
struct VldbListByAttributes attributes;
|
||||
nbulkentries arrayEntries;
|
||||
struct nvldbentry *vllist;
|
||||
ubulkentries arrayEntries;
|
||||
struct uvldbentry *vllist;
|
||||
afs_int32 nentries;
|
||||
int j;
|
||||
char pname[10];
|
||||
@ -4763,7 +4764,7 @@ BackSys(struct cmd_syndesc *as, void *arock)
|
||||
}
|
||||
|
||||
memset(&arrayEntries, 0, sizeof(arrayEntries)); /* initialize to hint the stub to alloc space */
|
||||
vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
|
||||
vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries);
|
||||
if (vcode) {
|
||||
fprintf(STDERR, "Could not access the VLDB for attributes\n");
|
||||
PrintError("", vcode);
|
||||
@ -4817,7 +4818,7 @@ BackSys(struct cmd_syndesc *as, void *arock)
|
||||
}
|
||||
|
||||
for (j = 0; j < nentries; j++) { /* process each vldb entry */
|
||||
vllist = &arrayEntries.nbulkentries_val[j];
|
||||
vllist = &arrayEntries.ubulkentries_val[j];
|
||||
|
||||
if (seenprefix) {
|
||||
for (ti = as->parms[0].items; ti; ti = ti->next) {
|
||||
@ -4929,7 +4930,7 @@ BackSys(struct cmd_syndesc *as, void *arock)
|
||||
}
|
||||
|
||||
avolid = vllist->volumeId[RWVOL];
|
||||
MapHostToNetwork(vllist);
|
||||
MapHostToNetworkU(vllist);
|
||||
GetServerAndPart(vllist, RWVOL, &aserver1, &apart1, &previdx);
|
||||
if (aserver1 == -1 || apart1 == -1) {
|
||||
fprintf(STDOUT, "could not backup %s, invalid VLDB entry\n",
|
||||
@ -4977,8 +4978,8 @@ BackSys(struct cmd_syndesc *as, void *arock)
|
||||
fprintf(STDOUT, "Total volumes backed up: %lu; failed to backup: %lu\n",
|
||||
(unsigned long)totalBack, (unsigned long)totalFail);
|
||||
fflush(STDOUT);
|
||||
if (arrayEntries.nbulkentries_val)
|
||||
free(arrayEntries.nbulkentries_val);
|
||||
if (arrayEntries.ubulkentries_val)
|
||||
free(arrayEntries.ubulkentries_val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4990,8 +4991,8 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock)
|
||||
afs_int32 code;
|
||||
afs_int32 vcode;
|
||||
struct VldbListByAttributes attributes;
|
||||
nbulkentries arrayEntries;
|
||||
struct nvldbentry *vllist;
|
||||
ubulkentries arrayEntries;
|
||||
struct uvldbentry *vllist;
|
||||
afs_int32 nentries;
|
||||
int j;
|
||||
afs_uint32 volid;
|
||||
@ -5034,14 +5035,14 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock)
|
||||
attributes.flag = VLOP_ALLOPERS;
|
||||
attributes.Mask |= VLLIST_FLAG;
|
||||
memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */
|
||||
vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
|
||||
vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries);
|
||||
if (vcode) {
|
||||
fprintf(STDERR, "Could not access the VLDB for attributes\n");
|
||||
PrintError("", vcode);
|
||||
exit(1);
|
||||
}
|
||||
for (j = 0; j < nentries; j++) { /* process each entry */
|
||||
vllist = &arrayEntries.nbulkentries_val[j];
|
||||
vllist = &arrayEntries.ubulkentries_val[j];
|
||||
volid = vllist->volumeId[RWVOL];
|
||||
vcode =
|
||||
ubik_VL_ReleaseLock(cstruct, 0, volid, -1,
|
||||
@ -5079,8 +5080,8 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock)
|
||||
}
|
||||
}
|
||||
|
||||
if (arrayEntries.nbulkentries_val)
|
||||
free(arrayEntries.nbulkentries_val);
|
||||
if (arrayEntries.ubulkentries_val)
|
||||
free(arrayEntries.ubulkentries_val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5557,7 +5558,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
|
||||
afs_uint32 volid;
|
||||
afs_uint32 server;
|
||||
afs_int32 code, i, same;
|
||||
struct nvldbentry entry, storeEntry;
|
||||
struct uvldbentry entry, storeEntry;
|
||||
afs_int32 vcode;
|
||||
afs_int32 rwindex = 0;
|
||||
afs_uint32 rwserver = 0;
|
||||
@ -5602,7 +5603,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
|
||||
if (as->parms[3].items)
|
||||
force = 1;
|
||||
|
||||
vcode = VLDB_GetEntryByID(volid, -1, &entry);
|
||||
vcode = VLDB_GetEntryByIDU(volid, -1, &entry);
|
||||
if (vcode) {
|
||||
fprintf(STDERR,
|
||||
"Could not fetch the entry for volume %lu from VLDB\n",
|
||||
@ -5616,15 +5617,15 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
|
||||
if (volid != entry.volumeId[ROVOL])
|
||||
volid = entry.volumeId[ROVOL];
|
||||
|
||||
MapHostToNetwork(&entry);
|
||||
MapHostToNetworkU(&entry);
|
||||
for (i = 0; i < entry.nServers; i++) {
|
||||
if (entry.serverFlags[i] & ITSRWVOL) {
|
||||
rwindex = i;
|
||||
rwserver = entry.serverNumber[i];
|
||||
rwserver = entry.serverUnique[i];
|
||||
rwpartition = entry.serverPartition[i];
|
||||
}
|
||||
if (entry.serverFlags[i] & ITSROVOL) {
|
||||
same = VLDB_IsSameAddrs(server, entry.serverNumber[i], &code);
|
||||
same = VLDB_IsSameAddrs(server, entry.serverUnique[i], &code);
|
||||
if (code) {
|
||||
fprintf(STDERR,
|
||||
"Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n",
|
||||
@ -5633,7 +5634,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
|
||||
}
|
||||
if (same) {
|
||||
roindex = i;
|
||||
roserver = entry.serverNumber[i];
|
||||
roserver = entry.serverUnique[i];
|
||||
ropartition = entry.serverPartition[i];
|
||||
break;
|
||||
}
|
||||
@ -5683,11 +5684,11 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
|
||||
if (rwserver) {
|
||||
(entry.nServers)--;
|
||||
if (rwindex != entry.nServers) {
|
||||
entry.serverNumber[rwindex] = entry.serverNumber[entry.nServers];
|
||||
entry.serverUnique[rwindex] = entry.serverUnique[entry.nServers];
|
||||
entry.serverPartition[rwindex] =
|
||||
entry.serverPartition[entry.nServers];
|
||||
entry.serverFlags[rwindex] = entry.serverFlags[entry.nServers];
|
||||
entry.serverNumber[entry.nServers] = 0;
|
||||
entry.serverUnique[entry.nServers] = 0;
|
||||
entry.serverPartition[entry.nServers] = 0;
|
||||
entry.serverFlags[entry.nServers] = 0;
|
||||
}
|
||||
@ -5699,9 +5700,9 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
|
||||
entry.flags |= RO_EXISTS;
|
||||
}
|
||||
}
|
||||
MapNetworkToHost(&entry, &storeEntry);
|
||||
MapNetworkToHostU(&entry, &storeEntry);
|
||||
code =
|
||||
VLDB_ReplaceEntry(entry.volumeId[RWVOL], RWVOL, &storeEntry,
|
||||
VLDB_ReplaceEntryU(entry.volumeId[RWVOL], RWVOL, &storeEntry,
|
||||
(LOCKREL_OPCODE | LOCKREL_AFSID |
|
||||
LOCKREL_TIMESTAMP));
|
||||
if (code) {
|
||||
@ -5722,7 +5723,7 @@ Sizes(struct cmd_syndesc *as, void *arock)
|
||||
afs_uint32 avolid;
|
||||
afs_uint32 aserver;
|
||||
afs_int32 apart, voltype, fromdate = 0, code, err, i;
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
volintSize vol_size;
|
||||
|
||||
rx_SetRxDeadTime(60 * 10);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -60,7 +60,16 @@ ovlentry_to_nvlentry(struct vldbentry *oentryp,
|
||||
memset(nentryp, 0, sizeof(struct nvldbentry));
|
||||
strncpy(nentryp->name, oentryp->name, sizeof(nentryp->name));
|
||||
for (i = 0; i < oentryp->nServers; i++) {
|
||||
nentryp->serverNumber[i] = oentryp->serverNumber[i];
|
||||
bulkaddrs m_addrs;
|
||||
ListAddrByAttributes m_attrs;
|
||||
afs_int32 m_nentries;
|
||||
|
||||
m_attrs.Mask = VLADDR_IPADDR;
|
||||
m_attrs.ipaddr = oentryp->serverNumber[i];
|
||||
m_nentries = 0;
|
||||
m_addrs.bulkaddrs_val = 0;
|
||||
m_addrs.bulkaddrs_len = 0;
|
||||
nentryp->serverNumber[i] = oentryp->serverNumber[i];
|
||||
nentryp->serverPartition[i] = oentryp->serverPartition[i];
|
||||
nentryp->serverFlags[i] = oentryp->serverFlags[i];
|
||||
}
|
||||
@ -71,6 +80,8 @@ ovlentry_to_nvlentry(struct vldbentry *oentryp,
|
||||
nentryp->flags = oentryp->flags;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* It is here for when we need it. Not currently used. */
|
||||
static int
|
||||
nvlentry_to_ovlentry(struct nvldbentry *nentryp,
|
||||
struct vldbentry *oentryp)
|
||||
@ -98,31 +109,181 @@ nvlentry_to_ovlentry(struct nvldbentry *nentryp,
|
||||
oentryp->flags = nentryp->flags;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int newvlserver = 0;
|
||||
static void
|
||||
ovlentry_to_uvlentry(struct vldbentry *oentryp,
|
||||
struct uvldbentry *uentryp)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(uentryp, 0, sizeof(struct uvldbentry));
|
||||
strncpy(uentryp->name, oentryp->name, sizeof(uentryp->name));
|
||||
for (i = 0; i < oentryp->nServers; i++) {
|
||||
afs_int32 vcode, m_uniq=0;
|
||||
bulkaddrs m_addrs;
|
||||
ListAddrByAttributes m_attrs;
|
||||
afs_int32 m_nentries;
|
||||
|
||||
m_attrs.Mask = VLADDR_IPADDR;
|
||||
m_attrs.ipaddr = oentryp->serverNumber[i];
|
||||
m_nentries = 0;
|
||||
m_addrs.bulkaddrs_val = 0;
|
||||
m_addrs.bulkaddrs_len = 0;
|
||||
vcode =
|
||||
ubik_VL_GetAddrsU(cstruct, 0, &m_attrs,
|
||||
&uentryp->serverNumber[i],
|
||||
&m_uniq, &m_nentries,
|
||||
&m_addrs);
|
||||
uentryp->serverUnique[i] = oentryp->serverNumber[i];
|
||||
uentryp->serverPartition[i] = oentryp->serverPartition[i];
|
||||
uentryp->serverFlags[i] = oentryp->serverFlags[i];
|
||||
}
|
||||
uentryp->nServers = oentryp->nServers;
|
||||
for (i = 0; i < MAXTYPES; i++)
|
||||
uentryp->volumeId[i] = oentryp->volumeId[i];
|
||||
uentryp->cloneId = oentryp->cloneId;
|
||||
uentryp->flags = oentryp->flags;
|
||||
}
|
||||
|
||||
static int
|
||||
uvlentry_to_ovlentry(struct uvldbentry *uentryp,
|
||||
struct vldbentry *oentryp)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(oentryp, 0, sizeof(struct vldbentry));
|
||||
strncpy(oentryp->name, uentryp->name, sizeof(oentryp->name));
|
||||
if (uentryp->nServers > OMAXNSERVERS) {
|
||||
/*
|
||||
* The alternative is to store OMAXSERVERS but it's always better
|
||||
* to know what's going on...
|
||||
*/
|
||||
return VL_BADSERVER;
|
||||
}
|
||||
for (i = 0; i < uentryp->nServers; i++) {
|
||||
oentryp->serverNumber[i] = uentryp->serverUnique[i];
|
||||
oentryp->serverPartition[i] = uentryp->serverPartition[i];
|
||||
oentryp->serverFlags[i] = uentryp->serverFlags[i];
|
||||
}
|
||||
oentryp->nServers = i;
|
||||
for (i = 0; i < MAXTYPES; i++)
|
||||
oentryp->volumeId[i] = uentryp->volumeId[i];
|
||||
oentryp->cloneId = uentryp->cloneId;
|
||||
oentryp->flags = uentryp->flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nvlentry_to_uvlentry(struct nvldbentry *nentryp,
|
||||
struct uvldbentry *uentryp)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(uentryp, 0, sizeof(struct uvldbentry));
|
||||
strncpy(uentryp->name, nentryp->name, sizeof(uentryp->name));
|
||||
for (i = 0; i < nentryp->nServers; i++) {
|
||||
afs_int32 vcode, m_uniq=0;
|
||||
bulkaddrs m_addrs;
|
||||
ListAddrByAttributes m_attrs;
|
||||
afs_int32 m_nentries;
|
||||
|
||||
m_attrs.Mask = VLADDR_IPADDR;
|
||||
m_attrs.ipaddr = nentryp->serverNumber[i];
|
||||
m_nentries = 0;
|
||||
m_addrs.bulkaddrs_val = 0;
|
||||
m_addrs.bulkaddrs_len = 0;
|
||||
vcode =
|
||||
ubik_VL_GetAddrsU(cstruct, 0, &m_attrs,
|
||||
&uentryp->serverNumber[i],
|
||||
&m_uniq, &m_nentries,
|
||||
&m_addrs);
|
||||
uentryp->serverUnique[i] = nentryp->serverNumber[i];
|
||||
uentryp->serverPartition[i] = nentryp->serverPartition[i];
|
||||
uentryp->serverFlags[i] = nentryp->serverFlags[i];
|
||||
}
|
||||
uentryp->nServers = nentryp->nServers;
|
||||
for (i = 0; i < MAXTYPES; i++)
|
||||
uentryp->volumeId[i] = nentryp->volumeId[i];
|
||||
uentryp->cloneId = nentryp->cloneId;
|
||||
uentryp->flags = nentryp->flags;
|
||||
uentryp->matchindex = nentryp->matchindex;
|
||||
}
|
||||
|
||||
int
|
||||
uvlentry_to_nvlentry(struct uvldbentry *uentryp,
|
||||
struct nvldbentry *nentryp)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(nentryp, 0, sizeof(struct vldbentry));
|
||||
strncpy(nentryp->name, uentryp->name, sizeof(nentryp->name));
|
||||
if (uentryp->nServers > NMAXNSERVERS) {
|
||||
/*
|
||||
* The alternative is to store NMAXSERVERS but it's always better
|
||||
* to know what's going on...
|
||||
*/
|
||||
return VL_BADSERVER;
|
||||
}
|
||||
for (i = 0; i < uentryp->nServers; i++) {
|
||||
nentryp->serverNumber[i] = uentryp->serverUnique[i];
|
||||
nentryp->serverPartition[i] = uentryp->serverPartition[i];
|
||||
nentryp->serverFlags[i] = uentryp->serverFlags[i];
|
||||
}
|
||||
nentryp->nServers = i;
|
||||
for (i = 0; i < MAXTYPES; i++)
|
||||
nentryp->volumeId[i] = uentryp->volumeId[i];
|
||||
nentryp->cloneId = uentryp->cloneId;
|
||||
nentryp->flags = uentryp->flags;
|
||||
nentryp->matchindex = uentryp->matchindex;
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum _vlserver_type {
|
||||
vltype_unknown = 0,
|
||||
vltype_old = 1,
|
||||
vltype_new = 2,
|
||||
vltype_uuid = 3
|
||||
};
|
||||
|
||||
static enum _vlserver_type newvlserver = vltype_unknown;
|
||||
|
||||
int
|
||||
VLDB_CreateEntry(struct nvldbentry *entryp)
|
||||
{
|
||||
struct vldbentry oentry;
|
||||
int code;
|
||||
struct uvldbentry uentry;
|
||||
|
||||
nvlentry_to_uvlentry(entryp, &uentry);
|
||||
code = VLDB_CreateEntryU(&uentry);
|
||||
if (!code)
|
||||
code = uvlentry_to_nvlentry(&uentry, entryp);
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_CreateEntryU(struct uvldbentry *entryp)
|
||||
{
|
||||
struct nvldbentry nentry;
|
||||
int code;
|
||||
|
||||
if (newvlserver == 1) {
|
||||
if (newvlserver == vltype_old) {
|
||||
struct vldbentry oentry;
|
||||
tryold:
|
||||
code = nvlentry_to_ovlentry(entryp, &oentry);
|
||||
code = uvlentry_to_ovlentry(entryp, &oentry);
|
||||
if (code)
|
||||
return code;
|
||||
code = ubik_VL_CreateEntry(cstruct, 0, &oentry);
|
||||
return code;
|
||||
}
|
||||
code = ubik_VL_CreateEntryN(cstruct, 0, entryp);
|
||||
if (!newvlserver) {
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = 1; /* Doesn't support new interface */
|
||||
goto tryold;
|
||||
} else if (!code) {
|
||||
newvlserver = 2;
|
||||
}
|
||||
|
||||
code = uvlentry_to_nvlentry(entryp, &nentry);
|
||||
if (code)
|
||||
return code;
|
||||
code = ubik_VL_CreateEntryN(cstruct, 0, &nentry);
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = vltype_old;
|
||||
goto tryold;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -130,80 +291,128 @@ VLDB_CreateEntry(struct nvldbentry *entryp)
|
||||
int
|
||||
VLDB_GetEntryByID(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *entryp)
|
||||
{
|
||||
struct vldbentry oentry;
|
||||
int code;
|
||||
struct uvldbentry uentry;
|
||||
|
||||
nvlentry_to_uvlentry(entryp, &uentry);
|
||||
code = VLDB_GetEntryByIDU(volid, voltype, &uentry);
|
||||
if (!code)
|
||||
code = uvlentry_to_nvlentry(&uentry, entryp);
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_GetEntryByIDU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp)
|
||||
{
|
||||
struct nvldbentry nentry;
|
||||
int code;
|
||||
|
||||
if (newvlserver == 1) {
|
||||
if (newvlserver == vltype_old) {
|
||||
struct vldbentry oentry;
|
||||
tryold:
|
||||
code =
|
||||
ubik_VL_GetEntryByID(cstruct, 0, volid, voltype, &oentry);
|
||||
if (!code)
|
||||
ovlentry_to_nvlentry(&oentry, entryp);
|
||||
ovlentry_to_uvlentry(&oentry, entryp);
|
||||
return code;
|
||||
}
|
||||
code = ubik_VL_GetEntryByIDN(cstruct, 0, volid, voltype, entryp);
|
||||
if (!newvlserver) {
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = 1; /* Doesn't support new interface */
|
||||
goto tryold;
|
||||
} else if (!code) {
|
||||
newvlserver = 2;
|
||||
}
|
||||
|
||||
code = ubik_VL_GetEntryByIDN(cstruct, 0, volid, voltype, &nentry);
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = vltype_old;
|
||||
goto tryold;
|
||||
}
|
||||
if (!code)
|
||||
nvlentry_to_uvlentry(&nentry, entryp);
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_GetEntryByName(char *namep, struct nvldbentry *entryp)
|
||||
{
|
||||
struct vldbentry oentry;
|
||||
int code;
|
||||
struct uvldbentry uentry;
|
||||
|
||||
nvlentry_to_uvlentry(entryp, &uentry);
|
||||
code = VLDB_GetEntryByNameU(namep, &uentry);
|
||||
if (!code)
|
||||
code = uvlentry_to_nvlentry(&uentry, entryp);
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_GetEntryByNameU(char *namep, struct uvldbentry *entryp)
|
||||
{
|
||||
int code;
|
||||
|
||||
if (newvlserver == 1) {
|
||||
if (newvlserver == vltype_old) {
|
||||
struct vldbentry oentry;
|
||||
tryold:
|
||||
code = ubik_VL_GetEntryByNameO(cstruct, 0, namep, &oentry);
|
||||
if (!code)
|
||||
ovlentry_to_nvlentry(&oentry, entryp);
|
||||
ovlentry_to_uvlentry(&oentry, entryp);
|
||||
return code;
|
||||
}
|
||||
code = ubik_VL_GetEntryByNameN(cstruct, 0, namep, entryp);
|
||||
if (!newvlserver) {
|
||||
if (newvlserver == vltype_new) {
|
||||
struct nvldbentry nentry;
|
||||
trynew:
|
||||
code = ubik_VL_GetEntryByNameN(cstruct, 0, namep, &nentry);
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = vltype_old;
|
||||
goto tryold;
|
||||
}
|
||||
if (!code)
|
||||
nvlentry_to_uvlentry(&nentry, entryp);
|
||||
}
|
||||
code = ubik_VL_GetEntryByNameU(cstruct, 0, namep, entryp);
|
||||
if (newvlserver == vltype_unknown) {
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = 1; /* Doesn't support new interface */
|
||||
goto tryold;
|
||||
newvlserver = vltype_new;
|
||||
goto trynew;
|
||||
} else if (!code) {
|
||||
newvlserver = 2;
|
||||
newvlserver = vltype_uuid;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *entryp, afs_int32 releasetype)
|
||||
VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *nentryp, afs_int32 releasetype)
|
||||
{
|
||||
struct vldbentry oentry;
|
||||
struct uvldbentry uentry;
|
||||
int code;
|
||||
|
||||
if (newvlserver == 1) {
|
||||
nvlentry_to_uvlentry(nentryp, &uentry);
|
||||
code = VLDB_ReplaceEntryU(volid, voltype, &uentry, releasetype);
|
||||
if (!code)
|
||||
code = uvlentry_to_nvlentry(&uentry, nentryp);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_ReplaceEntryU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp, afs_int32 releasetype)
|
||||
{
|
||||
int code;
|
||||
struct nvldbentry nentry;
|
||||
|
||||
if (newvlserver == vltype_old) {
|
||||
struct vldbentry oentry;
|
||||
tryold:
|
||||
code = nvlentry_to_ovlentry(entryp, &oentry);
|
||||
code = uvlentry_to_ovlentry(entryp, &oentry);
|
||||
if (code)
|
||||
return code;
|
||||
code =
|
||||
ubik_VL_ReplaceEntry(cstruct, 0, volid, voltype, &oentry,
|
||||
releasetype);
|
||||
ubik_VL_ReplaceEntry(cstruct, 0, volid, voltype, &oentry, releasetype);
|
||||
return code;
|
||||
}
|
||||
code =
|
||||
ubik_VL_ReplaceEntryN(cstruct, 0, volid, voltype, entryp,
|
||||
releasetype);
|
||||
if (!newvlserver) {
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = 1; /* Doesn't support new interface */
|
||||
goto tryold;
|
||||
} else if (!code) {
|
||||
newvlserver = 2;
|
||||
}
|
||||
code = uvlentry_to_nvlentry(entryp, &nentry);
|
||||
if (code)
|
||||
return code;
|
||||
code = ubik_VL_ReplaceEntryN(cstruct, 0, volid, voltype, &nentry, releasetype);
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = vltype_old;
|
||||
goto tryold;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -214,10 +423,11 @@ VLDB_ListAttributes(VldbListByAttributes *attrp,
|
||||
afs_int32 *entriesp,
|
||||
nbulkentries *blkentriesp)
|
||||
{
|
||||
bulkentries arrayEntries;
|
||||
int code, i;
|
||||
int code;
|
||||
|
||||
if (newvlserver == 1) {
|
||||
if (newvlserver == vltype_old) {
|
||||
int i;
|
||||
bulkentries arrayEntries;
|
||||
tryold:
|
||||
memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */
|
||||
code =
|
||||
@ -225,30 +435,74 @@ VLDB_ListAttributes(VldbListByAttributes *attrp,
|
||||
&arrayEntries);
|
||||
if (!code) {
|
||||
blkentriesp->nbulkentries_val =
|
||||
(nvldbentry *) malloc(*entriesp * sizeof(struct nvldbentry));
|
||||
(nvldbentry *) xdr_alloc(*entriesp * sizeof(struct nvldbentry));
|
||||
for (i = 0; i < *entriesp; i++) { /* process each entry */
|
||||
ovlentry_to_nvlentry(&arrayEntries.bulkentries_val[i],
|
||||
&blkentriesp->nbulkentries_val[i]);
|
||||
}
|
||||
}
|
||||
if (arrayEntries.bulkentries_val)
|
||||
free(arrayEntries.bulkentries_val);
|
||||
xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries);
|
||||
return code;
|
||||
}
|
||||
|
||||
code =
|
||||
ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp,
|
||||
blkentriesp);
|
||||
if (!newvlserver) {
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = 1; /* Doesn't support new interface */
|
||||
goto tryold;
|
||||
} else if (!code) {
|
||||
newvlserver = 2;
|
||||
}
|
||||
ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp, blkentriesp);
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = vltype_old; /* Doesn't support new interface */
|
||||
goto tryold;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_ListAttributesU(VldbListByAttributes *attrp,
|
||||
afs_int32 *entriesp,
|
||||
ubulkentries *blkentriesp)
|
||||
{
|
||||
nbulkentries narrayEntries;
|
||||
int code, i;
|
||||
|
||||
if (newvlserver == vltype_old) {
|
||||
bulkentries arrayEntries;
|
||||
tryold:
|
||||
memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */
|
||||
code =
|
||||
ubik_VL_ListAttributes(cstruct, 0, attrp, entriesp,
|
||||
&arrayEntries);
|
||||
if (!code) {
|
||||
blkentriesp->ubulkentries_val =
|
||||
(uvldbentry *) xdr_alloc(*entriesp * sizeof(struct uvldbentry));
|
||||
for (i = 0; i < *entriesp; i++) { /* process each entry */
|
||||
ovlentry_to_uvlentry(&arrayEntries.bulkentries_val[i],
|
||||
&blkentriesp->ubulkentries_val[i]);
|
||||
}
|
||||
}
|
||||
if (arrayEntries.bulkentries_val)
|
||||
xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries);
|
||||
return code;
|
||||
}
|
||||
|
||||
memset(&narrayEntries, 0, sizeof(narrayEntries)); /*initialize to hint the stub to alloc space */
|
||||
code =
|
||||
ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp, &narrayEntries);
|
||||
if (code == RXGEN_OPCODE) {
|
||||
newvlserver = vltype_old; /* Doesn't support new interface */
|
||||
goto tryold;
|
||||
}
|
||||
if (!code) {
|
||||
blkentriesp->ubulkentries_val =
|
||||
(uvldbentry *) xdr_alloc(*entriesp * sizeof(struct uvldbentry));
|
||||
for (i = 0; i < *entriesp; i++) { /* process each entry */
|
||||
nvlentry_to_uvlentry(&narrayEntries.nbulkentries_val[i],
|
||||
&blkentriesp->ubulkentries_val[i]);
|
||||
}
|
||||
}
|
||||
if (narrayEntries.nbulkentries_val)
|
||||
xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries);
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_ListAttributesN2(VldbListByAttributes *attrp,
|
||||
char *name,
|
||||
@ -257,16 +511,50 @@ VLDB_ListAttributesN2(VldbListByAttributes *attrp,
|
||||
nbulkentries *blkentriesp,
|
||||
afs_int32 *nextindexp)
|
||||
{
|
||||
afs_int32 code;
|
||||
afs_int32 code = RXGEN_OPCODE;
|
||||
|
||||
code =
|
||||
ubik_VL_ListAttributesN2(cstruct, 0, attrp, (name ? name : ""),
|
||||
thisindex, nentriesp, blkentriesp, nextindexp);
|
||||
if (newvlserver != vltype_old) {
|
||||
code =
|
||||
ubik_VL_ListAttributesN2(cstruct, 0, attrp, (name ? name : ""),
|
||||
thisindex, nentriesp, blkentriesp, nextindexp);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int
|
||||
VLDB_ListAttributesN2U(VldbListByAttributes *attrp,
|
||||
char *name,
|
||||
afs_int32 thisindex,
|
||||
afs_int32 *nentriesp,
|
||||
ubulkentries *blkentriesp,
|
||||
afs_int32 *nextindexp)
|
||||
{
|
||||
afs_int32 code = RXGEN_OPCODE;
|
||||
int i;
|
||||
|
||||
if (newvlserver != vltype_old) {
|
||||
nbulkentries narrayEntries;
|
||||
|
||||
memset(&narrayEntries, 0, sizeof(narrayEntries)); /*initialize to hint the stub to alloc space */
|
||||
code =
|
||||
ubik_VL_ListAttributesN2(cstruct, 0, attrp, (name ? name : ""),
|
||||
thisindex, nentriesp, &narrayEntries, nextindexp);
|
||||
if (!code) {
|
||||
blkentriesp->ubulkentries_val =
|
||||
(uvldbentry *) xdr_alloc(*nentriesp * sizeof(struct uvldbentry));
|
||||
for (i = 0; i < *nentriesp; i++) { /* process each entry */
|
||||
nvlentry_to_uvlentry(&narrayEntries.nbulkentries_val[i],
|
||||
&blkentriesp->ubulkentries_val[i]);
|
||||
}
|
||||
}
|
||||
if (narrayEntries.nbulkentries_val)
|
||||
xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries);
|
||||
return code;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
static int vlserverv4 = -1;
|
||||
struct cacheips {
|
||||
afs_uint32 server;
|
||||
afs_int32 count;
|
||||
@ -287,8 +575,8 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp)
|
||||
int code;
|
||||
ListAddrByAttributes attrs;
|
||||
bulkaddrs addrs;
|
||||
afs_uint32 *addrp, i, j, f1, f2;
|
||||
afs_int32 unique, nentries;
|
||||
afs_uint32 *addrp, f1, f2;
|
||||
afs_int32 i, j, unique, nentries;
|
||||
afsUUID uuid;
|
||||
static int initcache = 0;
|
||||
|
||||
@ -296,7 +584,8 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp)
|
||||
|
||||
if (serv1 == serv2)
|
||||
return 1;
|
||||
if (vlserverv4 == 1) {
|
||||
if (newvlserver == vltype_old ||
|
||||
newvlserver == vltype_new) {
|
||||
return 0;
|
||||
}
|
||||
if (!initcache) {
|
||||
@ -332,12 +621,12 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp)
|
||||
code =
|
||||
ubik_VL_GetAddrsU(cstruct, 0, &attrs, &uuid, &unique, &nentries,
|
||||
&addrs);
|
||||
if (vlserverv4 == -1) {
|
||||
if (newvlserver == vltype_unknown) {
|
||||
if (code == RXGEN_OPCODE) {
|
||||
vlserverv4 = 1; /* Doesn't support new interface */
|
||||
newvlserver = vltype_new;
|
||||
return 0;
|
||||
} else if (!code) {
|
||||
vlserverv4 = 2;
|
||||
newvlserver = vltype_uuid;
|
||||
}
|
||||
}
|
||||
if (code == VL_NOENT)
|
||||
@ -404,7 +693,7 @@ int
|
||||
vsu_ExtractName(char rname[], char name[])
|
||||
{
|
||||
char sname[VOLSER_OLDMAXVOLNAME + 1];
|
||||
int total;
|
||||
size_t total;
|
||||
|
||||
strncpy(sname, name, sizeof(sname));
|
||||
sname[sizeof(sname) - 1] = '\0';
|
||||
@ -431,9 +720,9 @@ afs_uint32
|
||||
vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp)
|
||||
{
|
||||
char volname[VOLSER_OLDMAXVOLNAME + 1];
|
||||
struct nvldbentry entry;
|
||||
struct uvldbentry entry;
|
||||
afs_int32 vcode = 0;
|
||||
int total;
|
||||
size_t total;
|
||||
|
||||
*errp = 0;
|
||||
|
||||
@ -448,7 +737,7 @@ vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp)
|
||||
/* It was not a volume number but something else */
|
||||
total = strlen(astring);
|
||||
vsu_ExtractName(volname, astring);
|
||||
vcode = VLDB_GetEntryByName(volname, &entry);
|
||||
vcode = VLDB_GetEntryByNameU(volname, &entry);
|
||||
if (!vcode) {
|
||||
if ((total >= 9) && (!strcmp(&astring[total - 9], ".readonly")))
|
||||
return entry.volumeId[ROVOL];
|
||||
|
@ -9,10 +9,26 @@ extern int VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldben
|
||||
extern int VLDB_ListAttributes(VldbListByAttributes *attrp, afs_int32 *entriesp, nbulkentries *blkentriesp);
|
||||
extern int VLDB_ListAttributesN2(VldbListByAttributes *attrp, char *name, afs_int32 thisindex,
|
||||
afs_int32 *nentriesp, nbulkentries *blkentriesp, afs_int32 *nextindexp);
|
||||
|
||||
extern int VLDB_CreateEntryU(struct uvldbentry *entryp);
|
||||
extern int VLDB_GetEntryByIDU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp);
|
||||
extern int VLDB_GetEntryByNameU(char *namep, struct uvldbentry *entryp);
|
||||
extern int VLDB_ReplaceEntryU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp, afs_int32 releasetype);
|
||||
extern int VLDB_ListAttributesU(VldbListByAttributes *attrp, afs_int32 *entriesp, ubulkentries *blkentriesp);
|
||||
extern int VLDB_ListAttributesN2U(VldbListByAttributes *attrp, char *name, afs_int32 thisindex,
|
||||
afs_int32 *nentriesp, ubulkentries *blkentriesp, afs_int32 *nextindexp);
|
||||
|
||||
extern int VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp);
|
||||
|
||||
extern void vsu_SetCrypt(int cryptflag);
|
||||
extern afs_int32 vsu_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 sauth,
|
||||
struct ubik_client **uclientp, int (*secproc)(struct rx_securityClass *, afs_int32));
|
||||
extern int vsu_ExtractName(char rname[], char name[]);
|
||||
extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp);
|
||||
|
||||
/* private */
|
||||
extern void nvlentry_to_uvlentry(struct nvldbentry *nentryp,
|
||||
struct uvldbentry *uentryp);
|
||||
extern int uvlentry_to_nvlentry(struct uvldbentry *uentryp,
|
||||
struct nvldbentry *nentryp);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user