newuuid-20070612
[openafs.git] / src / venus / fs.c
index b309c23..439bc78 100644 (file)
@@ -25,6 +25,7 @@ RCSID
 #include <afs/stds.h>
 #include <afs/vice.h>
 #include <afs/venus.h>
+#include <afs/com_err.h>
 #ifdef AFS_AIX32_ENV
 #include <signal.h>
 #endif
@@ -41,7 +42,6 @@ RCSID
 #undef VICE
 #include "afs/prs_fs.h"
 #include <afs/afsint.h>
-#include <afs/auth.h>
 #include <afs/cellconfig.h>
 #include <ubik.h>
 #include <rx/rxkad.h>
@@ -69,7 +69,7 @@ static char tspace[1024];
 static struct ubik_client *uclient;
 
 static int GetClientAddrsCmd(), SetClientAddrsCmd(), FlushMountCmd();
-static int RxStatProcCmd(), RxStatPeerCmd();
+static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd(), NewUuidCmd();
 
 extern char *hostutil_GetNameByINet();
 extern struct hostent *hostutil_GetHostByName();
@@ -112,6 +112,13 @@ struct AclEntry {
     afs_int32 rights;
 };
 
+struct vcxstat2 {
+    afs_int32 callerAccess;
+    afs_int32 cbExpires;
+    afs_int32 anyAccess;
+    char mvstat;
+};
+
 static void
 ZapAcl(acl)
      struct Acl *acl;
@@ -724,7 +731,7 @@ AclToString(struct Acl *acl)
 }
 
 static int
-SetACLCmd(struct cmd_syndesc *as)
+SetACLCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -858,7 +865,7 @@ SetACLCmd(struct cmd_syndesc *as)
 
 
 static int
-CopyACLCmd(struct cmd_syndesc *as)
+CopyACLCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1038,7 +1045,7 @@ CleanAcl(struct Acl *aa, char *fname)
 
 /* clean up an acl to not have bogus entries */
 static int
-CleanACLCmd(struct cmd_syndesc *as)
+CleanACLCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct Acl *ta = 0;
@@ -1125,7 +1132,7 @@ CleanACLCmd(struct cmd_syndesc *as)
 }
 
 static int
-ListACLCmd(struct cmd_syndesc *as)
+ListACLCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct Acl *ta;
@@ -1189,7 +1196,34 @@ ListACLCmd(struct cmd_syndesc *as)
 }
 
 static int
-FlushVolumeCmd(struct cmd_syndesc *as)
+GetCallerAccess(struct cmd_syndesc *as, char *arock)
+{
+    struct cmd_item *ti;
+    int error = 0;
+
+    SetDotDefault(&as->parms[0].items);
+    for (ti = as->parms[0].items; ti; ti = ti->next) {
+        afs_int32 code;
+        struct ViceIoctl blob;
+        struct vcxstat2 stat;
+        blob.out_size = sizeof(struct vcxstat2);
+        blob.in_size = 0;
+        blob.out = (void *)&stat;
+        code = pioctl(ti->data, VIOC_GETVCXSTATUS2, &blob, 1);
+        if (code) {
+            Die(errno, ti->data);
+            error = 1;
+            continue;
+        }
+        printf("Callers access to %s is ", ti->data);
+        PRights(stat.callerAccess, 0);
+        printf("\n");
+    }
+    return error;
+}
+
+static int
+FlushVolumeCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1211,7 +1245,25 @@ FlushVolumeCmd(struct cmd_syndesc *as)
 }
 
 static int
-FlushCmd(struct cmd_syndesc *as)
+NewUuidCmd(struct cmd_syndesc *as, char *arock)
+{
+    afs_int32 code;
+    struct ViceIoctl blob;
+
+    blob.in_size = 0;
+    blob.out_size = 0;
+    code = pioctl(0, VIOC_NEWUUID, &blob, 1);
+    if (code) {
+       Die(errno, 0);
+       return 1;
+    }
+
+    printf("New uuid generated.\n");
+    return 0;
+}
+
+static int
+FlushCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1238,7 +1290,7 @@ FlushCmd(struct cmd_syndesc *as)
 
 /* all this command does is repackage its args and call SetVolCmd */
 static int
-SetQuotaCmd(struct cmd_syndesc *as)
+SetQuotaCmd(struct cmd_syndesc *as, char *arock)
 {
     struct cmd_syndesc ts;
 
@@ -1248,7 +1300,7 @@ SetQuotaCmd(struct cmd_syndesc *as)
 }
 
 static int
-SetVolCmd(struct cmd_syndesc *as)
+SetVolCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1312,7 +1364,7 @@ struct VenusFid {
 };
 
 static int
-ExamineCmd(struct cmd_syndesc *as)
+ExamineCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1353,7 +1405,7 @@ ExamineCmd(struct cmd_syndesc *as)
 }
 
 static int
-ListQuotaCmd(struct cmd_syndesc *as)
+ListQuotaCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1384,7 +1436,7 @@ ListQuotaCmd(struct cmd_syndesc *as)
 }
 
 static int
-WhereIsCmd(struct cmd_syndesc *as)
+WhereIsCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1423,7 +1475,7 @@ WhereIsCmd(struct cmd_syndesc *as)
 
 
 static int
-DiskFreeCmd(struct cmd_syndesc *as)
+DiskFreeCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1454,7 +1506,7 @@ DiskFreeCmd(struct cmd_syndesc *as)
 }
 
 static int
-QuotaCmd(struct cmd_syndesc *as)
+QuotaCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1487,7 +1539,7 @@ QuotaCmd(struct cmd_syndesc *as)
 }
 
 static int
-ListMountCmd(struct cmd_syndesc *as)
+ListMountCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1608,7 +1660,7 @@ ListMountCmd(struct cmd_syndesc *as)
 }
 
 static
-MakeMountCmd(struct cmd_syndesc *as)
+MakeMountCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     char *cellName, *volName, *tmpName;
@@ -1680,7 +1732,7 @@ defect #3069
        if (code == 0) {
            /* make the check.  Don't complain if there are problems with init */
            code =
-               ubik_Call(VL_GetEntryByNameO, uclient, 0, volName,
+               ubik_VL_GetEntryByNameO(uclient, 0, volName,
                          &vldbEntry);
            if (code == VL_NOENT) {
                fprintf(stderr,
@@ -1716,7 +1768,7 @@ defect #3069
  *      tp: Set to point to the actual name of the mount point to nuke.
  */
 static int
-RemoveMountCmd(struct cmd_syndesc *as)
+RemoveMountCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code = 0;
     struct ViceIoctl blob;
@@ -1768,7 +1820,7 @@ RemoveMountCmd(struct cmd_syndesc *as)
 */
 
 static int
-CheckServersCmd(struct cmd_syndesc *as)
+CheckServersCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1867,7 +1919,7 @@ CheckServersCmd(struct cmd_syndesc *as)
 }
 
 static int
-MessagesCmd(struct cmd_syndesc *as)
+MessagesCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code = 0;
     struct ViceIoctl blob;
@@ -1913,7 +1965,7 @@ MessagesCmd(struct cmd_syndesc *as)
 }
 
 static int
-CheckVolumesCmd(struct cmd_syndesc *as)
+CheckVolumesCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1931,7 +1983,7 @@ CheckVolumesCmd(struct cmd_syndesc *as)
 }
 
 static int
-SetCacheSizeCmd(struct cmd_syndesc *as)
+SetCacheSizeCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -1970,15 +2022,30 @@ SetCacheSizeCmd(struct cmd_syndesc *as)
 
 #define MAXGCSIZE      16
 static int
-GetCacheParmsCmd(struct cmd_syndesc *as)
+GetCacheParmsCmd(struct cmd_syndesc *as, char *arock)
 {
-    afs_int32 code;
+    afs_int32 code, filesUsed;
     struct ViceIoctl blob;
     afs_int32 parms[MAXGCSIZE];
+    double percentFiles, percentBlocks;
+    afs_int32 flags = 0;
+
+    if (as->parms[0].items){ /* -files */
+       flags = 1;
+    } else if (as->parms[1].items){ /* -excessive */
+       flags = 2;
+    } else {
+       flags = 0;
+    }
 
     memset(parms, '\0', sizeof parms); /* avoid Purify UMR error */
-    blob.in = NULL;
-    blob.in_size = 0;
+    if (flags){
+       blob.in = (char *)&flags;
+       blob.in_size = sizeof(afs_int32);
+    } else {   /* be backward compatible */
+       blob.in = NULL;
+       blob.in_size = 0;
+    }
     blob.out_size = sizeof(parms);
     blob.out = (char *)parms;
     code = pioctl(0, VIOCGETCACHEPARMS, &blob, 1);
@@ -1986,16 +2053,53 @@ GetCacheParmsCmd(struct cmd_syndesc *as)
        Die(errno, NULL);
        return 1;
     }
-    printf("AFS using %d of the cache's available %d 1K byte blocks.\n",
-          parms[1], parms[0]);
-    if (parms[1] > parms[0])
-       printf
-           ("[Cache guideline temporarily deliberately exceeded; it will be adjusted down but you may wish to increase the cache size.]\n");
+
+    if (!flags){
+       printf("AFS using %d of the cache's available %d 1K byte blocks.\n",
+               parms[1], parms[0]);
+       if (parms[1] > parms[0])
+               printf("[Cache guideline temporarily deliberately exceeded; it will be adjusted down but you may wish to increase the cache size.]\n");
+       return 0;
+    }
+
+    percentBlocks = ((double)parms[1]/parms[0]) * 100;
+    printf("AFS using %5.0f%% of cache blocks (%d of %d 1k blocks)\n",
+          percentBlocks, parms[1], parms[0]);
+
+    if (parms[2] == 0)
+       return 0;
+
+    filesUsed = parms[2] - parms[3];
+    percentFiles = ((double)filesUsed/parms[2]) * 100;
+    printf("          %5.0f%% of the cache files (%d of %d files)\n",
+           percentFiles, filesUsed, parms[2]);
+    if (flags == 2){
+       printf("        afs_cacheFiles: %10d\n", parms[2]);
+       printf("        IFFree:         %10d\n", parms[3]); 
+       printf("        IFEverUsed:     %10d\n", parms[4]); 
+       printf("        IFDataMod:      %10d\n", parms[5]); 
+       printf("        IFDirtyPages:   %10d\n", parms[6]);
+       printf("        IFAnyPages:     %10d\n", parms[7]); 
+       printf("        IFDiscarded:    %10d\n", parms[8]);
+       printf("        DCentries:  %10d\n", parms[9]);
+       printf("          0k-   4K: %10d\n", parms[10]); 
+       printf("          4k-  16k: %10d\n", parms[11]); 
+       printf("         16k-  64k: %10d\n", parms[12]); 
+       printf("         64k- 256k: %10d\n", parms[13]); 
+       printf("        256k-   1M: %10d\n", parms[14]); 
+       printf("              >=1M: %10d\n", parms[15]); 
+    }
+
+    if (percentBlocks > 90)
+       printf("[cache size usage over 90%, consider increasing cache size]\n");
+    if (percentFiles > 90)
+       printf("[cache file usage over 90%, consider increasing '-files' argument to afsd]\n");
+        
     return 0;
 }
 
 static int
-ListCellsCmd(struct cmd_syndesc *as)
+ListCellsCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     afs_int32 i, j;
@@ -2046,7 +2150,7 @@ ListCellsCmd(struct cmd_syndesc *as)
 }
 
 static int
-ListAliasesCmd(struct cmd_syndesc *as)
+ListAliasesCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code, i;
     char *tp, *aliasName, *realName;
@@ -2076,7 +2180,77 @@ ListAliasesCmd(struct cmd_syndesc *as)
 }
 
 static int
-NewCellCmd(struct cmd_syndesc *as)
+CallBackRxConnCmd(struct cmd_syndesc *as, char *arock)
+{
+    afs_int32 code;
+    struct ViceIoctl blob;
+    struct cmd_item *ti;
+    afs_int32 hostAddr;
+    struct hostent *thp;
+    char *tp;
+    int setp;
+    
+    ti = as->parms[0].items;
+    setp = 1;
+    if (ti) {
+        thp = hostutil_GetHostByName(ti->data);
+       if (!thp) {
+           fprintf(stderr, "host %s not found in host table.\n", ti->data);
+           return 1;
+       }
+       else memcpy(&hostAddr, thp->h_addr, sizeof(afs_int32));
+    } else {
+        hostAddr = 0;   /* means don't set host */
+       setp = 0;       /* aren't setting host */
+    }
+    
+    /* now do operation */
+    blob.in_size = sizeof(afs_int32);
+    blob.out_size = sizeof(afs_int32);
+    blob.in = (char *) &hostAddr;
+    blob.out = (char *) &hostAddr;
+    
+    code = pioctl(0, VIOC_CBADDR, &blob, 1);
+    if (code < 0) {
+       Die(errno, 0);
+       return 1;
+    }
+    return 0;
+}
+
+static int
+NukeNFSCredsCmd(struct cmd_syndesc *as, char *arock)
+{
+    afs_int32 code;
+    struct ViceIoctl blob;
+    struct cmd_item *ti;
+    afs_int32 hostAddr;
+    struct hostent *thp;
+    
+    ti = as->parms[0].items;
+    thp = hostutil_GetHostByName(ti->data);
+    if (!thp) {
+       fprintf(stderr, "host %s not found in host table.\n", ti->data);
+       return 1;
+    }
+    else memcpy(&hostAddr, thp->h_addr, sizeof(afs_int32));
+    
+    /* now do operation */
+    blob.in_size = sizeof(afs_int32);
+    blob.out_size = sizeof(afs_int32);
+    blob.in = (char *) &hostAddr;
+    blob.out = (char *) &hostAddr;
+    
+    code = pioctl(0, VIOC_NFS_NUKE_CREDS, &blob, 1);
+    if (code < 0) {
+       Die(errno, 0);
+       return 1;
+    }
+    return 0;
+}
+
+static int
+NewCellCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code, linkedstate = 0, size = 0, *lp;
     struct ViceIoctl blob;
@@ -2188,7 +2362,7 @@ NewCellCmd(struct cmd_syndesc *as)
 }
 
 static int
-NewAliasCmd(struct cmd_syndesc *as)
+NewAliasCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -2223,7 +2397,7 @@ NewAliasCmd(struct cmd_syndesc *as)
 }
 
 static int
-WhichCellCmd(struct cmd_syndesc *as)
+WhichCellCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct cmd_item *ti;
@@ -2248,7 +2422,7 @@ WhichCellCmd(struct cmd_syndesc *as)
 }
 
 static int
-WSCellCmd(struct cmd_syndesc *as)
+WSCellCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -2278,7 +2452,7 @@ static PrimaryCellCmd(as)
 */
 
 static int
-MonitorCmd(struct cmd_syndesc *as)
+MonitorCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -2339,7 +2513,7 @@ MonitorCmd(struct cmd_syndesc *as)
 }
 
 static int
-SysNameCmd(struct cmd_syndesc *as)
+SysNameCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -2393,13 +2567,13 @@ SysNameCmd(struct cmd_syndesc *as)
 
 static char *exported_types[] = { "null", "nfs", "" };
 static int
-ExportAfsCmd(struct cmd_syndesc *as)
+ExportAfsCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
     struct cmd_item *ti;
     int export = 0, type = 0, mode = 0, exp = 0, exportcall, pwsync =
-       0, smounts = 0;
+       0, smounts = 0, clipags = 0, pagcb = 0;
 
     ti = as->parms[0].items;
     if (strcmp(ti->data, "nfs") == 0)
@@ -2452,8 +2626,29 @@ ExportAfsCmd(struct cmd_syndesc *as)
            return 1;
        }
     }
+    if (ti = as->parms[5].items) {     /* -clipags */
+       if (strcmp(ti->data, "on") == 0)
+           clipags = 3;
+       else if (strcmp(ti->data, "off") == 0)
+           clipags = 2;
+       else {
+           fprintf(stderr, "Illegal argument %s\n", ti->data);
+           return 1;
+       }
+    }
+    if (ti = as->parms[6].items) {     /* -pagcb */
+       if (strcmp(ti->data, "on") == 0)
+           pagcb = 3;
+       else if (strcmp(ti->data, "off") == 0)
+           pagcb = 2;
+       else {
+           fprintf(stderr, "Illegal argument %s\n", ti->data);
+           return 1;
+       }
+    }
     exportcall =
-       (type << 24) | (mode << 6) | (pwsync << 4) | (smounts << 2) | export;
+       (type << 24) | (pagcb << 10) | (clipags << 8) |
+       (mode << 6) | (pwsync << 4) | (smounts << 2) | export;
     type &= ~0x70;
     /* make the call */
     blob.in = (char *)&exportcall;
@@ -2484,6 +2679,13 @@ ExportAfsCmd(struct cmd_syndesc *as)
        printf("\t%s\n",
               (exportcall & 8 ? "Allow mounts of /afs/.. subdirs" :
                "Only mounts to /afs allowed"));
+       printf("\t%s\n",
+              (exportcall & 16 ? "Client-assigned PAG's are used" :
+               "Client-assigned PAG's are not used"));
+       printf("\t%s\n",
+              (exportcall & 32 ?
+               "Callbacks are made to get creds from new clients" :
+               "Callbacks are not made to get creds from new clients"));
     } else {
        printf("'%s' translator is disabled\n", exported_types[type]);
     }
@@ -2492,7 +2694,7 @@ ExportAfsCmd(struct cmd_syndesc *as)
 
 
 static int
-GetCellCmd(struct cmd_syndesc *as)
+GetCellCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -2543,7 +2745,7 @@ GetCellCmd(struct cmd_syndesc *as)
 }
 
 static int
-SetCellCmd(struct cmd_syndesc *as)
+SetCellCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -2620,75 +2822,14 @@ static int
 VLDBInit(int noAuthFlag, struct afsconf_cell *info)
 {
     afs_int32 code;
-    struct ktc_principal sname;
-    struct ktc_token ttoken;
-    afs_int32 scIndex;
-    struct rx_securityClass *sc;
-    struct rx_connection *serverconns[VLDB_MAXSERVERS];
-    afs_int32 i;
-
-    code = rx_Init(0);
-    if (code) {
-       fprintf(stderr, "%s: could not initialize rx.\n", pn);
-       return code;
-    }
-    rxInitDone = 1;
-    rx_SetRxDeadTime(50);
-    if (!noAuthFlag) {         /* we don't need tickets for null */
-       strcpy(sname.cell, info->name);
-       sname.instance[0] = 0;
-       strcpy(sname.name, "afs");
-       code = ktc_GetToken(&sname, &ttoken, sizeof(ttoken), NULL);
-       if (code) {
-           fprintf(stderr,
-                   "%s: Could not get afs tokens, running unauthenticated.\n",
-                   pn);
-           scIndex = 0;
-       } else {
-           /* got a ticket */
-           if (ttoken.kvno >= 0 && ttoken.kvno <= 255)
-               scIndex = 2;    /* kerberos */
-           else {
-               fprintf(stderr, "%s: funny kvno (%d) in ticket, proceeding\n",
-                       pn, ttoken.kvno);
-               scIndex = 2;
-           }
-       }
-    } else
-       scIndex = 0;            /* don't authenticate */
-    switch (scIndex) {
-    case 0:
-       sc = rxnull_NewClientSecurityObject();
-       break;
-
-    case 1:
-       break;
-    case 2:
-       sc = (struct rx_securityClass *)
-           rxkad_NewClientSecurityObject(rxkad_clear, &ttoken.sessionKey,
-                                         ttoken.kvno, ttoken.ticketLen,
-                                         ttoken.ticket);
-       break;
-    }
-    if (info->numServers > VLDB_MAXSERVERS) {
-       fprintf(stderr, "%s: info.numServers=%d (> VLDB_MAXSERVERS=%d)\n", pn,
-               info->numServers, VLDB_MAXSERVERS);
-       exit(1);
-    }
-    memset(serverconns, 0, sizeof(serverconns));
-    for (i = 0; i < info->numServers; i++)
-       serverconns[i] =
-           rx_NewConnection(info->hostAddr[i].sin_addr.s_addr,
-                            info->hostAddr[i].sin_port, USER_SERVICE_ID, sc,
-                            scIndex);
 
-    code = ubik_ClientInit(serverconns, &uclient);
-
-    if (code) {
-       fprintf(stderr, "%s: ubik client init failed.\n", pn);
-       return code;
-    }
-    return 0;
+    code = ugen_ClientInit(noAuthFlag, AFSDIR_CLIENT_ETC_DIRPATH, 
+                          info->name, 0, &uclient, 
+                           NULL, pn, rxkad_clear,
+                           VLDB_MAXSERVERS, AFSCONF_VLDBSERVICE, 50,
+                           0, 0, USER_SERVICE_ID);
+    rxInitDone = 1;
+    return code;
 }
 
 static struct ViceIoctl gblob;
@@ -2788,7 +2929,7 @@ addServer(char *name, afs_int32 rank)
 
 
 static int
-SetPrefCmd(struct cmd_syndesc *as)
+SetPrefCmd(struct cmd_syndesc *as, char *arock)
 {
     FILE *infd;
     afs_int32 code;
@@ -2894,7 +3035,7 @@ SetPrefCmd(struct cmd_syndesc *as)
 
 
 static int
-GetPrefCmd(struct cmd_syndesc *as)
+GetPrefCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct cmd_item *ti;
@@ -2964,7 +3105,7 @@ GetPrefCmd(struct cmd_syndesc *as)
 }
 
 static int
-StoreBehindCmd(struct cmd_syndesc *as)
+StoreBehindCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code = 0;
     struct ViceIoctl blob;
@@ -3065,7 +3206,7 @@ StoreBehindCmd(struct cmd_syndesc *as)
 
 
 static afs_int32
-SetCryptCmd(struct cmd_syndesc *as)
+SetCryptCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code = 0, flag;
     struct ViceIoctl blob;
@@ -3092,7 +3233,7 @@ SetCryptCmd(struct cmd_syndesc *as)
 
 
 static afs_int32
-GetCryptCmd(struct cmd_syndesc *as)
+GetCryptCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code = 0, flag;
     struct ViceIoctl blob;
@@ -3119,6 +3260,61 @@ GetCryptCmd(struct cmd_syndesc *as)
     return 0;
 }
 
+#ifdef AFS_DISCON_ENV
+static char *modenames[] = {
+    "discon",
+    "fetchonly",
+    "partial",
+    "nat",
+    "full",
+    NULL
+};
+
+static afs_int32
+DisconCmd(struct cmd_syndesc *as, char *arock)
+{
+    struct cmd_item *ti;
+    char *modename;
+    int modelen;
+    afs_int32 mode, code;
+    struct ViceIoctl blob;
+
+    blob.in = NULL;
+    blob.in_size = 0;
+
+    ti = as->parms[0].items;
+    if (ti) {
+       modename = ti->data;
+       modelen = strlen(modename);
+       for (mode = 0; modenames[mode] != NULL; mode++)
+           if (!strncasecmp(modename, modenames[mode], modelen))
+               break;
+       if (modenames[mode] == NULL)
+           printf("Unknown discon mode \"%s\"\n", modename);
+       else {
+           memcpy(space, &mode, sizeof mode);
+           blob.in = space;
+           blob.in_size = sizeof mode;
+       }
+    }
+
+    blob.out_size = sizeof(mode);
+    blob.out = space;
+    code = pioctl(0, VIOC_DISCON, &blob, 1);
+    if (code)
+       Die(errno, NULL);
+    else {
+       memcpy(&mode, space, sizeof mode);
+       if (mode < sizeof modenames / sizeof (char *))
+           printf("Discon mode is now \"%s\"\n", modenames[mode]);
+       else
+           printf("Unknown discon mode %d\n", mode);
+    }
+
+    return 0;
+}
+#endif
+
 #include "AFS_component_version_number.c"
 
 int
@@ -3194,6 +3390,11 @@ main(int argc, char **argv)
     cmd_AddParm(ts, "-if", CMD_FLAG, CMD_OPTIONAL, "initial file acl");
     cmd_CreateAlias(ts, "la");
 
+    ts = cmd_CreateSyntax("getcalleraccess", GetCallerAccess, 0,
+            "list callers access");
+    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
+    cmd_CreateAlias(ts, "gca");
+
     ts = cmd_CreateSyntax("cleanacl", CleanACLCmd, 0,
                          "clean up access control list");
     cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
@@ -3300,6 +3501,8 @@ defect 3069
 
     ts = cmd_CreateSyntax("getcacheparms", GetCacheParmsCmd, 0,
                          "get cache usage info");
+    cmd_AddParm(ts, "-files", CMD_FLAG, CMD_OPTIONAL, "Show cach files used as well");
+    cmd_AddParm(ts, "-excessive", CMD_FLAG, CMD_OPTIONAL, "excessively verbose cache stats");
 
     ts = cmd_CreateSyntax("listcells", ListCellsCmd, 0,
                          "list configured cells");
@@ -3386,6 +3589,10 @@ defect 3069
                "run on strict 'uid check' mode (on | off)");
     cmd_AddParm(ts, "-submounts", CMD_SINGLE, CMD_OPTIONAL,
                "allow nfs mounts to subdirs of /afs/.. (on  | off)");
+    cmd_AddParm(ts, "-clipags", CMD_SINGLE, CMD_OPTIONAL,
+               "enable use of client-assigned PAG's (on  | off)");
+    cmd_AddParm(ts, "-pagcb", CMD_SINGLE, CMD_OPTIONAL,
+               "enable callbacks to get creds from new clients (on  | off)");
 
 
     ts = cmd_CreateSyntax("storebehind", StoreBehindCmd, 0,
@@ -3403,7 +3610,7 @@ defect 3069
     cmd_AddParm(ts, "-crypt", CMD_SINGLE, 0, "on or off");
 
     ts = cmd_CreateSyntax("getcrypt", GetCryptCmd, 0,
-                         "set cache manager encryption flag");
+                         "get cache manager encryption flag");
 
     ts = cmd_CreateSyntax("rxstatproc", RxStatProcCmd, 0,
                          "Manage per process RX statistics");
@@ -3417,6 +3624,26 @@ defect 3069
     cmd_AddParm(ts, "-disable", CMD_FLAG, CMD_OPTIONAL, "Disable RX stats");
     cmd_AddParm(ts, "-clear", CMD_FLAG, CMD_OPTIONAL, "Clear RX stats");
 
+    ts = cmd_CreateSyntax("setcbaddr", CallBackRxConnCmd, 0, "configure callback connection address");
+    cmd_AddParm(ts, "-addr", CMD_SINGLE, CMD_OPTIONAL, "host name or address");
+
+    /* try to find volume location information */
+    ts = cmd_CreateSyntax("getfid", GetFidCmd, 0,
+                         "get fid for file(s)");
+    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
+
+#ifdef AFS_DISCON_ENV
+    ts = cmd_CreateSyntax("discon", DisconCmd, 0,
+                         "disconnection mode");
+    cmd_AddParm(ts, "-mode", CMD_SINGLE, CMD_OPTIONAL, "nat | full");
+#endif
+
+    ts = cmd_CreateSyntax("nukenfscreds", NukeNFSCredsCmd, 0, "nuke credentials for NFS client");
+    cmd_AddParm(ts, "-addr", CMD_SINGLE, 0, "host name or address");
+
+    ts = cmd_CreateSyntax("newuuid", NewUuidCmd, 0,
+                         "force a new uuid");
+
     code = cmd_Dispatch(argc, argv);
     if (rxInitDone)
        rx_Finalize();
@@ -3462,14 +3689,14 @@ Die(int errnum, char *filename)
            fprintf(stderr, "%s:'%s'", pn, filename);
        else
            fprintf(stderr, "%s", pn);
-       fprintf(stderr, ": %s\n", error_message(errnum));
+       fprintf(stderr, ": %s\n", afs_error_message(errnum));
        break;
     }
 }
 
 /* get clients interface addresses */
 static int
-GetClientAddrsCmd(struct cmd_syndesc *as)
+GetClientAddrsCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct cmd_item *ti;
@@ -3515,7 +3742,7 @@ GetClientAddrsCmd(struct cmd_syndesc *as)
 }
 
 static int
-SetClientAddrsCmd(struct cmd_syndesc *as)
+SetClientAddrsCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code, addr;
     struct cmd_item *ti;
@@ -3589,7 +3816,7 @@ SetClientAddrsCmd(struct cmd_syndesc *as)
 }
 
 static int
-FlushMountCmd(struct cmd_syndesc *as)
+FlushMountCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     struct ViceIoctl blob;
@@ -3705,7 +3932,7 @@ FlushMountCmd(struct cmd_syndesc *as)
 }
 
 static int
-RxStatProcCmd(struct cmd_syndesc *as)
+RxStatProcCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     afs_int32 flags = 0;
@@ -3740,7 +3967,7 @@ RxStatProcCmd(struct cmd_syndesc *as)
 }
 
 static int
-RxStatPeerCmd(struct cmd_syndesc *as)
+RxStatPeerCmd(struct cmd_syndesc *as, char *arock)
 {
     afs_int32 code;
     afs_int32 flags = 0;
@@ -3773,3 +4000,26 @@ RxStatPeerCmd(struct cmd_syndesc *as)
 
     return 0;
 }
+
+static int
+GetFidCmd(struct cmd_syndesc *as, char *arock)
+{
+    struct ViceIoctl blob;
+    struct cmd_item *ti;
+    for (ti = as->parms[0].items; ti; ti = ti->next) {
+      struct VenusFid vfid;
+      
+      blob.out_size = sizeof(struct VenusFid);
+      blob.out = (char *) &vfid;
+      blob.in_size = 0;
+      
+      if (0 == pioctl(ti->data, VIOCGETFID, &blob, 1)) {
+       printf("File %s (%u.%u.%u) contained in volume %u\n",
+              ti->data, vfid.Fid.Volume, vfid.Fid.Vnode, vfid.Fid.Unique,
+              vfid.Fid.Volume);
+      }
+    }
+
+    return 0;
+}
+