]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
This commit was generated by cvs2svn to compensate for changes in r186,
authorSam Hartman <hartmans@debian.org>
Wed, 7 Mar 2001 09:57:03 +0000 (09:57 +0000)
committerSam Hartman <hartmans@debian.org>
Wed, 7 Mar 2001 09:57:03 +0000 (09:57 +0000)
which included commits to RCS files with non-trunk default branches.

84 files changed:
src/afsd/afs.rc.solaris.2.7
src/afsd/afsd.c
src/audit/audit.h
src/auth/cellconfig.c
src/auth/cellconfig.p.h
src/auth/ktc.c
src/auth/writeconfig.c
src/bozo/bnode.c
src/bozo/bos.c
src/bozo/bosint.xg
src/bozo/bosoprocs.c
src/bozo/bosserver.c
src/bozo/fsbnodeops.c
src/bucoord/vol_sets.c
src/cmd/cmd.c
src/cmd/cmd.p.h
src/comerr/et_lex.lex.l
src/config/Makefile.s390_linux22
src/config/Makefile.version-NOCML
src/config/afs_sysnames.h
src/config/param.i386_linux22.h
src/config/param.i386_linux24.h
src/config/param.rs_aix42.h
src/config/param.sun4x_58.h
src/config/stds.h
src/config/venus.h
src/export/Makefile
src/fsint/afsint.xg
src/ftpd43+/getusershell.c
src/kauth/kaserver.c
src/kauth/krb_udp.c
src/kauth/user.c
src/libafs/MakefileProto.AIX
src/libafs/MakefileProto.DUX
src/libafs/MakefileProto.IRIX
src/libafsrpc/Makefile
src/libafsrpc/NTMakefile
src/libafsrpc/afsrpc.exp
src/libuafs/Makefile.common
src/libuafs/MakefileProto.AIX
src/lwp/Makefile
src/lwp/NTMakefile
src/lwp/lock.h
src/lwp/lwp_nt.c
src/lwp/process.s
src/ntp/ntp_proto.c
src/ntp/ntpsubs.c
src/pam/afs_auth.c
src/pam/afs_message.c
src/pam/afs_message.h
src/pam/afs_password.c
src/pam/afs_setcred.c
src/ptserver/ptserver.c
src/rx/Makefile
src/rx/NTMakefile
src/rx/rx_clock.c
src/rx/rx_clock_nt.c
src/rx/rx_kernel.h
src/rx/rx_lwp.c
src/rx/rx_rdwr.c
src/rx/xdr.h
src/rxgen/rpc_main.c
src/sys/afssyscalls.h
src/tviced/Makefile
src/tviced/NTMakefile
src/ubik/beacon.c
src/ubik/recovery.c
src/ubik/ubik.c
src/ubik/ubik.p.h
src/ubik/ubik_int.xg
src/ubik/udebug.c
src/ubik/vote.c
src/util/Makefile
src/util/errors.h
src/util/serverLog.c
src/util/volparse.c
src/viced/afsfileprocs.c
src/vlserver/vlserver.c
src/vol/Makefile
src/vol/devname.c
src/vol/listinodes.c
src/vol/volume.c
src/vol/xfs_size_check.c
src/volser/Makefile

index c68555a692483c5dac6a872813bdfa360c61edcc..c096da9bd777bd137feea2de4f76e4210a517fe6 100644 (file)
@@ -1,12 +1,12 @@
-\." Copyright 2000, International Business Machines Corporation and others.
-\." All Rights Reserved.
-\." 
-\." This software has been released under the terms of the IBM Public
-\." License.  For details, see the LICENSE file in the top-level source
-\." directory or online at http://www.openafs.org/dl/license10.html
-\."
 #!/bin/sh
 #
+# Copyright 2000, International Business Machines Corporation and others.
+# All Rights Reserved.
+# 
+# This software has been released under the terms of the IBM Public
+# License.  For details, see the LICENSE file in the top-level source
+# directory or online at http://www.openafs.org/dl/license10.html
+#
 # afs.rc: rc script for AFS on Solaris 2.x platforms
 #
 # Install this script as /etc/init.d/afs.rc
index 57eb222c92957ad5c3b8dbf81e4813b7ebc1d41b..0ca577e397c0587d93a0f36adf4782aa53c0f863 100644 (file)
@@ -1026,8 +1026,10 @@ mainproc(as, arock)
     sprintf(fullpn_VFile,       "%s/V",  cacheBaseDir);
     vFileNumber = fullpn_VFile + strlen(fullpn_VFile);
 
+#if 0
     fputs(AFS_GOVERNMENT_MESSAGE, stdout); 
     fflush(stdout);
+#endif
 
     /*
      * Set up all the kernel processes needed for AFS.
index 5ccc8ccbd33199e324645308437a31a4bb2ead19..2e6a1654cb7efeddeed4935bd322aceb36850a9f 100644 (file)
 #define AUD_DATE 6         /* date (unsigned long)           */
 #define AUD_FID  7         /* File ID                        */
 #define AUD_FIDS 8         /* array of Fids                  */
+/* next 3 lines on behalf of MR-AFS */
+#define AUD_RESID 20       /* resid         in variable list */
+#define AUD_RSSIZERANGE 21 /* rssizerange   in variable list */
+#define AUD_LOOKUPINFO 22  /* LookupInfo    in variable list */ 
 
 /*
  * Note: the master definitions of these error codes come from *.et
@@ -62,6 +66,9 @@
 #define VS_MonitorEvent    "AFS_VS_Monitor"
 #define VS_SetIdTyEvent    "AFS_VS_SetIdTy"
 #define VS_SetDateEvent    "AFS_VS_SetDate"
+/* Next 2 lines on behalf of MR-AFS */
+#define VS_SelectiveDumpEvent "AFS_VS_DmpSelct"
+#define VS_ListVolumeResidencyInfoEvent "AFS_VS_LstVInfo"
 
 #define PTS_StartEvent     "AFS_PTS_Start"
 #define PTS_FinishEvent    "AFS_PTS_Finish"
 #define FlushCPSEvent           "AFS_SRX_FlusCPS"
 #define PrivilegeEvent         "AFS_Priv"
 #define PrivSetID              "AFS_PrivSet"
+/* Next 5 lines on behalf of MR-AFS */
+#define GetResidenciesEvent     "AFS_SRX_GetR"
+#define ChangeResidenciesEvent  "AFS_SRX_ChgR"
+#define ImportResidenciesEvent  "AFS_SRX_Import"
+#define GetExtendedVolumeAttributesEvent "AFS_SRX_GetVA"
+#define SetExtendedVolumeAttributesEvent "AFS_SRX_SetVA"
 
 #define NoAuthEvent             "AFS_RunNoAuth"
 #define NoAuthDisableEvent      "AFS_NoAuthDsbl"
 #define VLReleaseLockEvent     "AFS_VL_RelLck"
 #define VLChangeAddrEvent      "AFS_VL_ChgAdd"
 
+/* Next 2 block of lines on behalf of MR-AFS */
+#define RSStartEvent            "AFS_RS_StartEnt"
+#define RSFinishEvent           "AFS_RS_FnshEnt"
+#define RSExitEvent             "AFS_RS_ExitEnt"
+#define RSChangeAddr            "AFS_RS_ChgAddr"
+#define RSChangeName            "AFS_RS_ChgName"
+#define RSNewEntry              "AFS_RS_NewEntry"
+#define RSAddResidencyToServer  "AFS_RS_AddRToS"
+#define RSRemoveResidencyFromServer "AFS_RS_RemRFS"
+#define RSNameToResId           "AFS_RS_NameToId"
+#define RSResIdToName           "AFS_RS_IdToName"
+#define RSDelete                "AFS_RS_Delete"
+#define RSListMax               "AFS_RS_ListMax"
+#define RSSetMax                "AFS_RS_SetMax"
+#define RSListEntry             "AFS_RS_ListEnt"
+#define RSSetFieldsEntry        "AFS_RS_SetEnt"
+#define RSListElements          "AFS_RS_ListElm"
+#define RSIsAHolderOf           "AFS_RS_IsAHold"
+#define RSChooseResidency       "AFS_RS_ChooseR"
+#define RSSwapAllocatedSpace    "AFS_RS_SwapSpc"
+#define RSQuickCheck            "AFS_RS_QuickChk"
+#define RSResidencyWipeableInfo "AFS_RS_WipeInfo"
+#define RSGetResidencySummary   "AFS_RS_GetRSum"
+#define RSGetWiperFreeSpaceFraction "AFS_RS_GetFSpc"
+#define RSRegisterAddrs         "AFS_RS_Regist"
+#define RSGetAddrsU             "AFS_RS_GetAddrU"
+#define RSSetWeights            "AFS_RS_SetWght"
+#define RSGetWeights            "AFS_RS_GetWght"
+#define RSSetThresholds         "AFS_RS_SetThrsh"
+#define RSGetThresholds         "AFS_RS_GetThrsh"
+#define RSListResidencies       "AFS_RS_ListRes"
+#define RSListServers           "AFS_RS_ListServ"
+#define RSGetRandom             "AFS_RS_GetRandm"
+
+#define REMIOExitEvent          "AFS_RE_ExitEnt"
+#define SREMIOGetConnection     "AFS_RE_GetConn"
+#define SREMIORemoteIncDec      "AFS_RE_IncDec"
+#define SREMIOBulkIncDec        "AFS_RE_BlkIDec"
+#define SREMIORemoteStat        "AFS_RE_Stat"
+#define SREMIORemoteCloseIfOpen "AFS_RE_Close"
+#define SREMIORemoteOpen        "AFS_RE_Open"
+#define SREMIORemoteSeek        "AFS_RE_Seek"
+#define SREMIORemoteRead        "AFS_RE_Read"
+#define SREMIORemoteWrite       "AFS_RE_Write"
+#define SREMIORemoteListFiles   "AFS_RE_LstFiles"
+#define SREMIORemoteTruncate    "AFS_RE_Truncate"
+#define SREMIORemoteFsyncFile   "AFS_RE_Fsync"
+#define SREMIORemoteImportFile  "AFS_RE_Import"
+#define SREMIORemoteGetHSMdata  "AFS_RE_HSMdata"
+#define SREMIOPrefetch          "AFS_RE_Prefetch"
+
 
 /* prototypes for audit functions */
 int osi_audit (char *audEvent, afs_int32 errCode, ...);
index c05cd53562b8a64bf80f87e7a42c06bda8f30c7d..81f78dd8f159133240e310fff7da1aa1325283a0 100644 (file)
@@ -55,6 +55,8 @@ static struct afsconf_servPair serviceTable [] = {
     "afsnanny",        7007,
     "afsupdate",7008,
     "afsrmtsys",7009,
+    "afsres",   7010,   /* residency database for MR-AFS */
+    "afsremio", 7011,   /* remote I/O interface for MR-AFS */
     0, 0               /* insert new services before this spot */
 };
 
@@ -216,7 +218,7 @@ register char *adir; {
     tdir->name = (char *) malloc(strlen(adir)+1);
     strcpy(tdir->name, adir);
 
-    code = afsconf_OpenInternal(tdir);
+    code = afsconf_OpenInternal(tdir, 0, 0);
     if (code) {
        char *afsconf_path, *getenv(), afs_confdir[128];
 
@@ -270,7 +272,7 @@ register char *adir; {
        }
        tdir->name = (char *) malloc(strlen(afsconf_path)+1);
        strcpy(tdir->name, afsconf_path);
-       code = afsconf_OpenInternal(tdir);
+       code = afsconf_OpenInternal(tdir, 0, 0);
        if (code) {
            free(tdir->name);
            free(tdir);
@@ -320,8 +322,11 @@ static int GetCellNT(struct afsconf_dir *adir)
 #endif /* AFS_NT40_ENV */
 
 
-static int afsconf_OpenInternal(adir)
-register struct afsconf_dir *adir; {
+static int afsconf_OpenInternal(adir, cell, clones)
+register struct afsconf_dir *adir; 
+char *cell;
+char clones[];
+{
     FILE *tf;
     register char *tp, *bp;
     register struct afsconf_entry *curEntry;
@@ -407,7 +412,10 @@ register struct afsconf_dir *adir; {
                return -1;
            }
            i = curEntry->cellInfo.numServers;
-           code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i]);
+           if (cell && !strcmp(cell, curEntry->cellInfo.name)) 
+                code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i], &clones[i]);
+           else
+                code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i], 0);
            if (code) {
                if (code == AFSCONF_SYNTAX) {
                    for (bp=tbuffer; *bp != '\n'; bp++) {       /* Take out the <cr> from the buffer */
@@ -440,17 +448,26 @@ register struct afsconf_dir *adir; {
 }
 
 /* parse a line of the form
- *"128.2.1.3   #hostname"
+ *"128.2.1.3   #hostname" or
+ *"[128.2.1.3]  #hostname" for clones
  * into the appropriate pieces.  
  */
-static ParseHostLine(aline, addr, aname)
-register struct sockaddr_in *addr;
-char *aline, *aname; {
+static ParseHostLine(aline, addr, aname, aclone)
+    char *aclone;
+    register struct sockaddr_in *addr;
+    char *aline, *aname; 
+{
     int c1, c2, c3, c4;
     register afs_int32 code;
     register char *tp;
 
-    code = sscanf(aline, "%d.%d.%d.%d #%s", &c1, &c2, &c3, &c4, aname);
+    if (*aline == '[') {
+        if (aclone) *aclone = 1;
+        code = sscanf(aline, "[%d.%d.%d.%d] #%s", &c1, &c2, &c3, &c4, aname);
+    } else {
+        if (aclone) *aclone = 0;
+        code = sscanf(aline, "%d.%d.%d.%d #%s", &c1, &c2, &c3, &c4, aname);
+    }
     if (code != 5) return AFSCONF_SYNTAX;
     addr->sin_family = AF_INET;
     addr->sin_port = 0;
@@ -499,6 +516,30 @@ char *arock; {
 }
 
 afs_int32 afsconf_SawCell = 0;
+
+afsconf_GetExtendedCellInfo(adir, acellName, aservice, acellInfo, clones)
+    struct afsconf_dir *adir;
+    char *aservice;
+    char *acellName;
+    struct afsconf_cell *acellInfo; 
+    char clones[];
+{
+    afs_int32 code;
+    char *cell;
+
+    code = afsconf_GetCellInfo(adir, acellName, aservice, acellInfo);
+    if (code) 
+       return code;
+
+    if (acellName) 
+       cell = acellName;
+    else
+       cell = (char *) &acellInfo->name;
+
+    code = afsconf_OpenInternal(adir, cell, clones);
+    return code;
+}
+
 afsconf_GetCellInfo(adir, acellName, aservice, acellInfo)
 struct afsconf_dir *adir;
 char *aservice;
@@ -518,8 +559,8 @@ struct afsconf_cell *acellInfo; {
        tcell = acellName;
        cnLen = strlen(tcell)+1;
        lcstring (tcell, tcell, cnLen);
-       afsconf_SawCell = 1;                       /* will ignore the AFSCELL switch on future */
-                                                  /* call to afsconf_GetLocalCell: like klog  */
+       afsconf_SawCell = 1;    /* will ignore the AFSCELL switch on future */
+                               /* call to afsconf_GetLocalCell: like klog  */
     } else {
        i = afsconf_GetLocalCell(adir, tbuffer, sizeof(tbuffer));
        if (i) {
@@ -641,7 +682,7 @@ register struct afsconf_dir *adir; {
     register afs_int32 code;
     code = afsconf_CloseInternal(adir);
     if (code) return code;
-    code = afsconf_OpenInternal(adir);
+    code = afsconf_OpenInternal(adir, 0, 0);
     return code;
 }
 
index 0a0bc2a9a9df426688e84060a6ed0f10a0810f0d..3632973b15ee113c8ee5c548822a0cb6294c19fc 100644 (file)
@@ -111,5 +111,9 @@ struct afsconf_servPair {
 #define        AFSCONF_UPDATEPORT              7008
 #define        AFSCONF_RMTSYSSERVICE           "afsrmtsys"
 #define        AFSCONF_RMTSYSPORT              7009
+#define AFSCONF_RSDBSERVICE             "afsres"
+#define AFSCONF_RESPORT                 7010
+#define AFSCONF_REMIODBSERVICE          "afsremio"
+#define AFSCONF_REMIOPORT               7011 
 
 #endif /* __CELLCONFIG_AFS_INCL_ */
index 34e6117d49cd2ccf461a596424db795b46ce8370..750a5ea524b428e2b9f8349ca128c37cd91e2619 100644 (file)
@@ -83,7 +83,7 @@ static char lcell[MAXCELLCHARS];
 #define                TKT_FIL_ACC     77      /* Couldn't access tkt file */
 #define                TKT_FIL_LCK     78      /* Couldn't lock ticket file */
 #define                TKT_FIL_FMT     79      /* Bad ticket file format */
-#define                TKT_FIL_INI     80      /* tf_init not called first */
+#define                TKT_FIL_INI     80      /* afs_tf_init not called first */
   
 /* Values returned by get_credentials */
 #define                RET_TKFIL      21       /* Can't read ticket file */
@@ -110,9 +110,12 @@ static struct flock fileUlock = { F_UNLCK, 0, 0, 0, 0 };
 #define EOF (-1)
 #endif
  
-static int tf_init(), tf_get_pname(), tf_get_pinst(), tf_get_cred(), tf_save_cred();
-static int tf_close();
-static int tf_create(), tf_dest_tkt(), ktc_LocalCell();
+/* the following routines aren't static anymore on behalf of the kerberos IV
+ * compatibility library built in subtree krb.
+ */
+int afs_tf_init(), afs_tf_get_pname(), afs_tf_get_pinst(), afs_tf_get_cred(); 
+int afs_tf_save_cred(), afs_tf_close(), afs_tf_create(); 
+int afs_tf_dest_tkt(), ktc_LocalCell();
 char *ktc_tkt_string();
 #endif  /* AFS_KERBEROS_ENV */
 
@@ -357,7 +360,21 @@ not_vice_id:
     iob.out = tbuffer;
     iob.out_size = sizeof(tbuffer);
 
+#if defined(NO_AFS_CLIENT)
+    { int fd;  /* DEBUG */
+      char *tkfile;
+      if ((tkfile=getenv("TKTFILE")) &&
+          ((fd=open(tkfile, O_WRONLY|O_APPEND|O_TRUNC|O_CREAT, 0644)) >= 0)) {
+        printf("Writing ticket to: %s\n", tkfile);
+        code = (write(fd, iob.in, iob.in_size) != iob.in_size);
+        close(fd);
+      }
+      else
+        code = KTC_PIOCTLFAIL;
+    }
+#else /* NO_AFS_CLIENT */
     code = PIOCTL(0, VIOCSETTOK, &iob, 0);
+#endif /* NO_AFS_CLIENT */
     if (code) return KTC_PIOCTLFAIL;
     return 0;
 }
@@ -383,23 +400,28 @@ ktc_SetToken (aserver, atoken, aclient, flags)
  
            if (!lrealm[0]) ucstring(lrealm, lcell, MAXKTCREALMLEN);
            if (strcmp(aserver->instance, lrealm) == 0) {
-               tf_create(aclient->name, aclient->instance);
+               afs_tf_create(aclient->name, aclient->instance);
            }
        }
  
-       ncode = tf_init(ktc_tkt_string(), W_TKT_FIL);
+       ncode = afs_tf_init(ktc_tkt_string(), W_TKT_FIL);
        if (ncode == NO_TKT_FIL) {
-           (void) tf_create(aclient->name, aclient->instance);
-           ncode = tf_init(ktc_tkt_string(), W_TKT_FIL);
+           (void) afs_tf_create(aclient->name, aclient->instance);
+           ncode = afs_tf_init(ktc_tkt_string(), W_TKT_FIL);
        }
  
        if (!ncode) {
-           tf_save_cred(aserver, atoken, aclient);
+           afs_tf_save_cred(aserver, atoken, aclient);
        }
-       tf_close();
+       afs_tf_close();
+#ifdef NO_AFS_CLIENT
+        UNLOCK_GLOBAL_MUTEX
+        return ncode;
+#endif /* NO_AFS_CLIENT */
      }
 #endif
 
+#ifndef NO_AFS_CLIENT
     ncode = NewSetToken (aserver, atoken, aclient, flags);
     if (ncode ||                       /* new style failed */
        (strcmp (aserver->name, "afs") == 0)) { /* for afs tokens do both */
@@ -414,6 +436,7 @@ ktc_SetToken (aserver, atoken, aclient, flags)
        if (ocode == EIO) return KTC_NOCM;
        return KTC_PIOCTLFAIL;
     }
+#endif /* NO_AFS_CLIENT */
     UNLOCK_GLOBAL_MUTEX
     return 0;
 }
@@ -435,14 +458,20 @@ struct ktc_token *atoken; {
     afs_int32 temp;
     int        maxLen; /* biggest ticket we can copy */
     int        tktLen; /* server ticket length */
+    char found = 0;
     
     LOCK_GLOBAL_MUTEX
+#ifndef NO_AFS_CLIENT
     TRY_KERNEL (KTC_GETTOKEN_OP, aserver, aclient, atoken, atokenLen);
+#endif /* NO_AFS_CLIENT */
 
 #ifdef AFS_KERBEROS_ENV
     if (!lcell[0]) ktc_LocalCell();
 #endif
-    if (strcmp(aserver->name, "afs") != 0) {
+#ifndef NO_AFS_CLIENT
+    if (strcmp(aserver->name, "afs") != 0) 
+#endif /* NO_AFS_CLIENT */
+      {
        int i;
        /* try the local tokens */
        for (i=0; i<MAXLOCALTOKENS; i++)
@@ -451,37 +480,51 @@ struct ktc_token *atoken; {
                (strcmp (local_tokens[i].server.instance, aserver->instance) == 0) &&
                (strcmp (local_tokens[i].server.cell, aserver->cell) == 0)) {
                bcopy (&local_tokens[i].token, atoken, min (atokenLen, sizeof(struct ktc_token)));
-               *aclient = local_tokens[i].client;
+               if (aclient)
+                   *aclient = local_tokens[i].client;
                UNLOCK_GLOBAL_MUTEX
                return 0;
            }
 #ifdef AFS_KERBEROS_ENV
-       if (!tf_init(ktc_tkt_string(), R_TKT_FIL) && !tf_get_pname(aclient->name) &&
-           !tf_get_pinst(aclient->instance)) {
+        if (!afs_tf_init(ktc_tkt_string(), R_TKT_FIL)) {
+            if  (aclient) {
+                if (!afs_tf_get_pname(aclient->name) &&
+                !afs_tf_get_pinst(aclient->instance))
+                    found = 1;
+            } else {
+                char tmpstring[MAXHOSTCHARS];
+                afs_tf_get_pname(&tmpstring);
+                afs_tf_get_pinst(&tmpstring);
+                found = 1;
+            }
+        }
+        if (found) {
            struct ktc_principal cprincipal;
            struct ktc_token ctoken;
  
-           while (!tf_get_cred(&cprincipal, &ctoken)) {
+           while (!afs_tf_get_cred(&cprincipal, &ctoken)) {
                if (strcmp(cprincipal.name, aserver->name) == 0 &&
                    strcmp(cprincipal.instance, aserver->instance) == 0 &&
                    strcmp(cprincipal.cell, aserver->cell) == 0) {
  
-                   strcpy(aclient->cell, lcell);
+                   if (aclient)
+                       strcpy(aclient->cell, lcell);
                    bcopy(&ctoken, atoken,
                          min (atokenLen, sizeof(struct ktc_token)));
                    
-                   tf_close();
+                   afs_tf_close();
                    UNLOCK_GLOBAL_MUTEX
                    return 0;
                }
            }
        }
-       tf_close();
+       afs_tf_close();
 #endif
        UNLOCK_GLOBAL_MUTEX
        return KTC_NOENT;
     }
 
+#ifndef NO_AFS_CLIENT
     for (index=0; index<200; index++) {        /* sanity check in case pioctl fails */
        iob.in = (char *) &index;
        iob.in_size = sizeof(afs_int32);
@@ -567,6 +610,7 @@ struct ktc_token *atoken; {
            }
        }
     }
+#endif /* NO_AFS_CLIENT */
 
     UNLOCK_GLOBAL_MUTEX
     if ((code < 0) && (errno == EINVAL)) return KTC_NOPIOCTL;
@@ -577,6 +621,7 @@ struct ktc_token *atoken; {
  * Forget tokens for this server and the calling user.
  * NOT IMPLEMENTED YET!
  */
+#ifndef NO_AFS_CLIENT
 ktc_ForgetToken(aserver)
 struct ktc_principal *aserver; {
     int rc;
@@ -588,6 +633,7 @@ struct ktc_principal *aserver; {
     UNLOCK_GLOBAL_MUTEX
     return rc;
 }
+#endif /* NO_AFS_CLIENT */
 
 /* ktc_ListTokens - list all tokens.  start aprevIndex at 0, it returns the
  * next rock in (*aindex).  (*aserver) is set to the relevant ticket on
@@ -603,42 +649,49 @@ struct ktc_principal *aserver; {
     afs_int32 temp, index;
 
     LOCK_GLOBAL_MUTEX
+#ifndef NO_AFS_CLIENT
     TRY_KERNEL (KTC_LISTTOKENS_OP, aserver, aprevIndex, aindex, 0);
+#endif /* NO_AFS_CLIENT */
 
     index = aprevIndex;
+#ifdef NO_AFS_CLIENT
+    if (index < 214) index = 214;
+#endif /* NO_AFS_CLIENT */
 #ifdef AFS_KERBEROS_ENV
      if (index >= 214) {
        int i;
        struct ktc_principal cprincipal;
        struct ktc_token ctoken;
  
-       if (tf_init(ktc_tkt_string(), R_TKT_FIL) ||
-           tf_get_pname(tbuffer) ||
-           tf_get_pinst(tbuffer)) {
-           tf_close();
+       if (afs_tf_init(ktc_tkt_string(), R_TKT_FIL) ||
+           afs_tf_get_pname(tbuffer) ||
+           afs_tf_get_pinst(tbuffer)) {
+           afs_tf_close();
            UNLOCK_GLOBAL_MUTEX
            return KTC_NOENT;
        }
  
        for (i=214; i<index; i++) {
-           if (tf_get_cred(&cprincipal, &ctoken)) {
-               tf_close();
+           if (afs_tf_get_cred(&cprincipal, &ctoken)) {
+               afs_tf_close();
                UNLOCK_GLOBAL_MUTEX
                return KTC_NOENT;
            }
        }
  
      again:
-       if (tf_get_cred(&cprincipal, &ctoken)) {
-           tf_close();
+       if (afs_tf_get_cred(&cprincipal, &ctoken)) {
+           afs_tf_close();
            UNLOCK_GLOBAL_MUTEX
            return KTC_NOENT;
        }           
        index++;
  
+#ifndef NO_AFS_CLIENT
        if (!strcmp(cprincipal.name, "afs") && cprincipal.instance[0]==0) {
            goto again;
        }
+#endif /* NO_AFS_CLIENT */
  
        for (i=0; i < MAXLOCALTOKENS; i++) {
            if (!strcmp(cprincipal.name, local_tokens[i].server.name) &&
@@ -650,12 +703,13 @@ struct ktc_principal *aserver; {
  
        *aserver = cprincipal;
        *aindex = index;
-       tf_close();
+       afs_tf_close();
        UNLOCK_GLOBAL_MUTEX
        return 0;
      }
 #endif
 
+#ifndef NO_AFS_CLIENT
     if (index >= 123) {                        /* special hack for returning TCS */
        while (index-123 < MAXLOCALTOKENS) {
            if (local_tokens[index-123].valid) {
@@ -724,6 +778,7 @@ struct ktc_principal *aserver; {
     strcpy(aserver->cell, tp);
     aserver->instance[0] = 0;
     strcpy(aserver->name, "afs");
+#endif /* NO_AFS_CLIENT */
     UNLOCK_GLOBAL_MUTEX
     return 0;
 }
@@ -732,7 +787,9 @@ struct ktc_principal *aserver; {
 
 static int NewForgetAll ()
 {
+#ifndef NO_AFS_CLIENT
     TRY_KERNEL (KTC_FORGETALLTOKENS_OP, 0,0,0,0);
+#endif /* NO_AFS_CLIENT */
     return EINVAL;
 }
 
@@ -748,8 +805,10 @@ static int OldForgetAll ()
     iob.in_size = 0;
     iob.out = 0;
     iob.out_size = 0;
+#ifndef NO_AFS_CLIENT
     code = PIOCTL(0, VIOCUNPAG, &iob, 0);
     if (code) return KTC_PIOCTLFAIL;
+#endif /* NO_AFS_CLIENT */
     return 0;
 }
 
@@ -759,7 +818,7 @@ int ktc_ForgetAllTokens()
 
     LOCK_GLOBAL_MUTEX
 #ifdef AFS_KERBEROS_ENV
-     (void) tf_dest_tkt();
+     (void) afs_tf_dest_tkt();
 #endif
 
     ncode = NewForgetAll ();
@@ -818,12 +877,12 @@ ktc_OldPioctl ()
 /*
  * fd must be initialized to something that won't ever occur as a real
  * file descriptor. Since open(2) returns only non-negative numbers as
- * valid file descriptors, and tf_init always stuffs the return value
+ * valid file descriptors, and afs_tf_init always stuffs the return value
  * from open in here even if it is an error flag, we must
  *     a. Initialize fd to a negative number, to indicate that it is
  *        not initially valid.
  *     b. When checking for a valid fd, assume that negative values
- *        are invalid (ie. when deciding whether tf_init has been
+ *        are invalid (ie. when deciding whether afs_tf_init has been
  *        called.)
  *     c. In tf_close, be sure it gets reinitialized to a negative
  *        number. 
@@ -862,27 +921,28 @@ static tf_gets(), tf_read();
  *
  * Short description of routines:
  *
- * tf_init() opens the ticket file and locks it.
+ * afs_tf_init() opens the ticket file and locks it.
  *
- * tf_get_pname() returns the principal's name.
+ * afs_tf_get_pname() returns the principal's name.
  *
- * tf_get_pinst() returns the principal's instance (may be null).
+ * afs_tf_get_pinst() returns the principal's instance (may be null).
  *
- * tf_get_cred() returns the next CREDENTIALS record.
+ * afs_tf_get_cred() returns the next CREDENTIALS record.
  *
- * tf_save_cred() appends a new CREDENTIAL record to the ticket file.
+ * afs_tf_save_cred() appends a new CREDENTIAL record to the ticket file.
  *
- * tf_close() closes the ticket file and releases the lock.
+ * afs_tf_close() closes the ticket file and releases the lock.
  *
  * tf_gets() returns the next null-terminated string.  It's an internal
- * routine used by tf_get_pname(), tf_get_pinst(), and tf_get_cred().
+ * routine used by afs_tf_get_pname(), afs_tf_get_pinst(), and 
+ * afs_tf_get_cred().
  *
  * tf_read() reads a given number of bytes.  It's an internal routine
- * used by tf_get_cred().
+ * used by afs_tf_get_cred().
  */
 
 /*
- * tf_init() should be called before the other ticket file routines.
+ * afs_tf_init() should be called before the other ticket file routines.
  * It takes the name of the ticket file to use, "tf_name", and a
  * read/write flag "rw" as arguments. 
  *
@@ -897,7 +957,7 @@ static tf_gets(), tf_read();
  * TKT_FIL_LCK  - couldn't lock the file, even after a retry
  */
  
-static tf_init(tf_name, rw)
+afs_tf_init(tf_name, rw)
     char   *tf_name;
 {
     int     wflag;
@@ -983,15 +1043,15 @@ static tf_init(tf_name, rw)
 }
 
 /*
- * tf_get_pname() reads the principal's name from the ticket file. It
- * should only be called after tf_init() has been called.  The
+ * afs_tf_get_pname() reads the principal's name from the ticket file. It
+ * should only be called after afs_tf_init() has been called.  The
  * principal's name is filled into the "p" parameter.  If all goes well,
- * 0 is returned.  If tf_init() wasn't called, TKT_FIL_INI is
+ * 0 is returned.  If afs_tf_init() wasn't called, TKT_FIL_INI is
  * returned.  If the name was null, or EOF was encountered, or the name
  * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned. 
  */
 
-static tf_get_pname(p)
+afs_tf_get_pname(p)
     char   *p;
 {
     if (fd < 0) {
@@ -1003,16 +1063,16 @@ static tf_get_pname(p)
 }
 
 /*
- * tf_get_pinst() reads the principal's instance from a ticket file.
- * It should only be called after tf_init() and tf_get_pname() have been
- * called.  The instance is filled into the "inst" parameter.  If all
- * goes well, 0 is returned.  If tf_init() wasn't called,
+ * afs_tf_get_pinst() reads the principal's instance from a ticket file.
+ * It should only be called after afs_tf_init() and afs_tf_get_pname() have
+ * been called.  The instance is filled into the "inst" parameter.  If all
+ * goes well, 0 is returned.  If afs_tf_init() wasn't called,
  * TKT_FIL_INI is returned.  If EOF was encountered, or the instance
  * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned.  Note that the
  * instance may be null. 
  */
 
-static tf_get_pinst(inst)
+afs_tf_get_pinst(inst)
     char   *inst;
 {
     if (fd < 0) {
@@ -1024,17 +1084,17 @@ static tf_get_pinst(inst)
 }
 
 /*
- * tf_get_cred() reads a CREDENTIALS record from a ticket file and fills
- * in the given structure "c".  It should only be called after tf_init(),
- * tf_get_pname(), and tf_get_pinst() have been called. If all goes well,
- * 0 is returned.  Possible error codes are: 
+ * afs_tf_get_cred() reads a CREDENTIALS record from a ticket file and fills
+ * in the given structure "c".  It should only be called after afs_tf_init(),
+ * afs_tf_get_pname(), and afs_tf_get_pinst() have been called. If all goes 
+ * well, 0 is returned.  Possible error codes are: 
  *
- * TKT_FIL_INI  - tf_init wasn't called first
+ * TKT_FIL_INI  - afs_tf_init wasn't called first
  * TKT_FIL_FMT  - bad format
  * EOF          - end of file encountered
  */
 
-static tf_get_cred(principal, token)
+afs_tf_get_cred(principal, token)
     struct ktc_principal *principal;
     struct ktc_token *token;
 {
@@ -1094,7 +1154,7 @@ static tf_get_cred(principal, token)
  * The return value is not defined.
  */
 
-static tf_close()
+afs_tf_close()
 {
     if (!(fd < 0)) {
 #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV)
@@ -1185,17 +1245,17 @@ tf_read(s, n)
 char   *tkt_string();
 
 /*
- * tf_save_cred() appends an incoming ticket to the end of the ticket
- * file.  You must call tf_init() before calling tf_save_cred().
+ * afs_tf_save_cred() appends an incoming ticket to the end of the ticket
+ * file.  You must call afs_tf_init() before calling afs_tf_save_cred().
  *
  * The "service", "instance", and "realm" arguments specify the
  * server's name; "aticket" contains the credential.
  *
- * Returns 0 if all goes well, TKT_FIL_INI if tf_init() wasn't
+ * Returns 0 if all goes well, TKT_FIL_INI if afs_tf_init() wasn't
  * called previously, and KFAILURE for anything else that went wrong.
  */
 
-static tf_save_cred(aserver, atoken, aclient)
+afs_tf_save_cred(aserver, atoken, aclient)
     struct ktc_principal *aserver;
     struct ktc_principal *aclient;
     struct ktc_token *atoken;  /* Token */
@@ -1209,7 +1269,7 @@ static tf_save_cred(aserver, atoken, aclient)
     int     lifetime, kvno;
     int     count;             /* count for write */
 
-    if (fd < 0) {              /* fd is ticket file as set by tf_init */
+    if (fd < 0) {              /* fd is ticket file as set by afs_tf_init */
          return TKT_FIL_INI;
     }
 
@@ -1220,12 +1280,12 @@ static tf_save_cred(aserver, atoken, aclient)
     (void) lseek(fd, (off_t) 0L, 0);
     curpos = sizeof(tfbfr);
 
-    if (tf_get_pname(junk) || strcmp(junk, aclient->name) ||
-       tf_get_pinst(junk) || strcmp(junk, aclient->instance)) goto bad;
+    if (afs_tf_get_pname(junk) || strcmp(junk, aclient->name) ||
+       afs_tf_get_pinst(junk) || strcmp(junk, aclient->instance)) goto bad;
 
     do {
        start = lseek(fd, (off_t) 0L, 1) - lastpos + curpos;
-       status = tf_get_cred(&principal, &token);
+       status = afs_tf_get_cred(&principal, &token);
     } while (status == 0 &&
             (strcmp(aserver->name, principal.name) != 0 ||
              strcmp(aserver->instance, principal.instance) != 0 ||
@@ -1362,7 +1422,7 @@ char *val;
  * success, or KFAILURE if something goes wrong.
  */
 
-static tf_create(pname,pinst)
+afs_tf_create(pname,pinst)
     char *pname;
     char *pinst;
 {
@@ -1441,7 +1501,7 @@ static tf_create(pname,pinst)
  * failure.
  */
 
-static tf_dest_tkt()
+afs_tf_dest_tkt()
 {
     char *file = ktc_tkt_string();
     int i,fd;
index 925cf999b149da060acde4d4f4951742f56bba37..9e0d81f38125893d21c22ffea8e10417c55f5c46 100644 (file)
@@ -74,7 +74,20 @@ register struct afsconf_cell *aci; {
 afsconf_SetCellInfo(adir, apath, acellInfo)
 struct afsconf_dir *adir;
 char *apath;
-struct afsconf_cell *acellInfo; {
+struct afsconf_cell *acellInfo; 
+{
+    afs_int32 code;
+
+    code = afsconf_SetExtendedCellInfo(adir, apath, acellInfo, (char *)0);
+    return code;
+}
+   
+afsconf_SetExtendedCellInfo(adir, apath, acellInfo, clones)
+    struct afsconf_dir *adir;
+    char *apath;
+    struct afsconf_cell *acellInfo; 
+    char clones[];
+{
     register afs_int32 code;
     register int fd;
     char tbuffer[1024];
@@ -121,7 +134,10 @@ struct afsconf_cell *acellInfo; {
        code = acellInfo->hostAddr[i].sin_addr.s_addr;  /* net order */
        if (code == 0) continue;    /* delete request */
        code = ntohl(code);     /* convert to host order */
-       fprintf(tf, "%d.%d.%d.%d    #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]);
+        if (clones && clones[i])
+            fprintf(tf, "[%d.%d.%d.%d]  #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]);
+        else
+           fprintf(tf, "%d.%d.%d.%d    #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]);
     }
     if (ferror(tf)) {
        fclose(tf);
index 8e168636315162b89c7e521f512d90d4a4b3ce4b..7f71b38f856516e0d0e01fc1d238e8cb614a3064 100644 (file)
@@ -19,6 +19,9 @@
 #include <sys/file.h>
 #include <sys/time.h>
 #endif
+#ifdef BOZO_SAVE_CORES
+#include <time.h>
+#endif
 #include <sys/stat.h>
 #include <afs/procmgmt.h>  /* signal(), kill(), wait(), etc. */
 #include <lwp.h>
@@ -85,11 +88,25 @@ register struct bnode *abnode; {
     char tbuffer[256];
     struct stat tstat;
     register afs_int32 code;
+#ifdef BOZO_SAVE_CORES
+    struct timeval  Start;
+    struct tm *TimeFields;
+    char FileName[256];
+#endif
 
     code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat);
     if (code) return;
     
     bnode_CoreName(abnode, aproc->coreName, tbuffer);
+#ifdef BOZO_SAVE_CORES
+    TM_GetTimeOfDay(&Start, 0);
+    TimeFields = localtime(&Start.tv_sec);
+    sprintf(FileName,"%s.%d%02d%02d%02d%02d%02d", tbuffer,
+            TimeFields->tm_year, TimeFields->tm_mon + 1,
+            TimeFields->tm_mday, TimeFields->tm_hour, TimeFields->tm_min,
+            TimeFields->tm_sec);
+    strcpy(tbuffer,FileName);
+#endif
     code = renamefile(AFSDIR_SERVER_CORELOG_FILEPATH, tbuffer);
 }
 
index 69c2bc40f1ea8dd6fd6f6239b47543ce0e89e00e..9659b1328b5416ff0624e1e1fb820d086eb22b80 100644 (file)
@@ -55,6 +55,30 @@ static DoStat();
 #include "bosint.h"
 #include "../permit_xprt.h"
 
+#define MRAFS_OFFSET  9
+#define ADDPARMOFFSET 26
+
+static struct SalvageParms {
+    afs_int32 Optdebug;
+    afs_int32 Optnowrite;
+    afs_int32 Optforce;
+    afs_int32 Optoktozap;
+    afs_int32 Optrootfiles;
+    afs_int32 Optsalvagedirs;
+    afs_int32 Optblockreads;
+    afs_int32 OptListResidencies;
+    afs_int32 OptSalvageRemote;
+    afs_int32 OptSalvageArchival;
+    afs_int32 OptIgnoreCheck;
+    afs_int32 OptForceOnLine;
+    afs_int32 OptUseRootDirACL;
+    afs_int32 OptTraceBadLinkCounts;
+    afs_int32 OptDontAskFS;
+    afs_int32 OptLogLevel;
+    afs_int32 OptRxDebug;
+    afs_uint32 OptResidencies;
+} mrafsParm;
+
 /* dummy routine for the audit work.  It should do nothing since audits */
 /* occur at the server level and bos is not a server. */
 osi_audit() {return 0;}
@@ -154,14 +178,15 @@ struct cmd_syndesc *as; {
     bcopy(th->h_addr, &addr, sizeof(afs_int32));
 
     /* get tokens for making authenticated connections */
-    localauth = (as->parms[14].items != 0);
+    localauth = (as->parms[ADDPARMOFFSET + 2].items != 0);
     confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH);
     tdir = afsconf_Open (confdir);
     if (tdir) {
        struct afsconf_cell info;
        char *tname;
 
-       if (as->parms[12].items) tname = as->parms[12].items->data;
+       if (as->parms[ADDPARMOFFSET].items) 
+           tname = as->parms[ADDPARMOFFSET].items->data;
        else tname = (char *) 0;
        /* next call expands cell name abbrevs for us and handles looking up
          * local cell */
@@ -184,8 +209,8 @@ struct cmd_syndesc *as; {
     sc[2] = 0;
     scIndex = 0;
 
-    if (!as->parms[13].items) {        /* not -noauth */
-       if (as->parms[14].items) { /* -localauth */
+    if (!as->parms[ADDPARMOFFSET + 1].items) { /* not -noauth */
+       if (as->parms[ADDPARMOFFSET + 2].items) { /* -localauth */
            code = afsconf_GetLatestKey (tdir, 0,0);
            if (code) com_err ("bos", code, "(getting key from local KeyFile)");
            else {
@@ -496,6 +521,36 @@ struct cmd_syndesc *as; {
     return 0;
 }
 
+static BlockScannerCmd(as, arock)
+struct cmd_syndesc *as;
+char *arock; {
+    register afs_int32 code;
+    struct rx_connection *tconn;
+    char BlockCommand[] = "/usr/afs/bin/scanner -block";
+
+    tconn = GetConn(as, 0);
+    code = BOZO_Exec(tconn, BlockCommand);
+    if (code)
+        printf("bos: failed to block scanner from making migration requests (%s)\n",
+               em(code));
+    return 0;
+}
+
+static UnBlockScannerCmd(as, arock)
+struct cmd_syndesc *as;
+char *arock; {
+    register afs_int32 code;
+    struct rx_connection *tconn;
+    char UnBlockCommand[] = "/usr/afs/bin/scanner -unblock";
+
+    tconn = GetConn(as, 0);
+    code = BOZO_Exec(tconn, UnBlockCommand);
+    if (code)
+        printf("bos: failed to allow scanner daemon to make migration requests again (%s)\n",
+               em(code));
+    return 0;
+}                      
+
 static GetRestartCmd(as, arock)
 struct cmd_syndesc *as;
 char *arock; {
@@ -652,10 +707,21 @@ register struct cmd_syndesc *as; {
     register struct rx_connection *tconn;
     register afs_int32 code;
     register struct cmd_item *ti;
+    char name[MAXHOSTCHARS];
     
     tconn = GetConn(as, 0);
     for(ti = as->parms[1].items; ti; ti=ti->next) {
-       code = BOZO_AddCellHost(tconn, ti->data);
+        if (as->parms[2].items) {
+           if (strlen(ti->data) > MAXHOSTCHARS - 3) {
+               fprintf(stderr, "bos: host name too long\n");
+               return E2BIG;
+           }
+            name[0] = '[';
+            strcpy(&name[1],ti->data);
+            strcat((char *)&name, "]");
+            code = BOZO_AddCellHost(tconn, name);
+        } else 
+           code = BOZO_AddCellHost(tconn, ti->data);
        if (code)
            printf("bos: failed to add host %s (%s)\n", ti->data, em(code));
     }
@@ -751,8 +817,8 @@ register struct cmd_syndesc *as; {
        strcpy((char *)&tkey, buf);
     }
     else {    /* kerberos key */
-       if (as->parms[12].items) {
-           strcpy(cellBuffer, as->parms[12].items->data);
+       if (as->parms[ADDPARMOFFSET].items) {
+           strcpy(cellBuffer, as->parms[ADDPARMOFFSET].items->data);
 
            /* string to key needs upper-case cell names */
 
@@ -1034,6 +1100,8 @@ register struct cmd_syndesc *as; {
     return code;
 }
 
+#define PARMBUFFERSSIZE 32
+
 static DoSalvage(aconn, aparm1, aparm2, aoutName, showlog,parallel,atmpDir,orphans)
 struct rx_connection *aconn;
 char *aoutName;
@@ -1054,6 +1122,7 @@ char *orphans;
     FILE *outFile;
     int closeIt;
     char partName[20]; /* canonical name for partition */
+    char pbuffer[PARMBUFFERSSIZE];
     afs_int32 partNumber;
     char *notifier = NONOTIFIER;
 
@@ -1141,6 +1210,47 @@ char *orphans;
        strcat(tbuffer, orphans);
     }
 
+    if (mrafsParm.Optdebug)
+        strcat(tbuffer," -debug");
+    if (mrafsParm.Optnowrite)
+        strcat(tbuffer," -nowrite");
+    if (mrafsParm.Optforce)
+        strcat(tbuffer," -force");
+    if (mrafsParm.Optoktozap)
+        strcat(tbuffer," -oktozap");
+    if (mrafsParm.Optrootfiles)
+        strcat(tbuffer," -rootfiles");
+    if (mrafsParm.Optsalvagedirs)
+        strcat(tbuffer," -salvagedirs");
+    if (mrafsParm.Optblockreads)
+        strcat(tbuffer," -blockreads");
+    if (mrafsParm.OptListResidencies)
+        strcat(tbuffer," -ListResidencies");
+    if (mrafsParm.OptSalvageRemote)
+        strcat(tbuffer," -SalvageRemote");
+    if (mrafsParm.OptSalvageArchival)
+        strcat(tbuffer," -SalvageArchival");
+    if (mrafsParm.OptIgnoreCheck)
+        strcat(tbuffer," -IgnoreCheck");
+    if (mrafsParm.OptForceOnLine)
+        strcat(tbuffer," -ForceOnLine");
+    if (mrafsParm.OptUseRootDirACL)
+        strcat(tbuffer," -UseRootDirACL");
+    if (mrafsParm.OptTraceBadLinkCounts)
+        strcat(tbuffer," -TraceBadLinkCounts");
+    if (mrafsParm.OptDontAskFS)
+        strcat(tbuffer," -DontAskFS");
+    if (mrafsParm.OptLogLevel) {
+        sprintf(pbuffer, " -LogLevel %ld", mrafsParm.OptLogLevel);
+        strcat(tbuffer, pbuffer);
+    }
+    if (mrafsParm.OptRxDebug)
+        strcat(tbuffer," -rxdebug");
+    if (mrafsParm.OptResidencies) {
+        sprintf(pbuffer, " -Residencies %lu", mrafsParm.OptResidencies);
+        strcat(tbuffer, pbuffer);
+    } 
+
     parms[0] = tbuffer;
     parms[1] = "now";      /* when to do it */
     code = BOZO_CreateBnode(aconn, "cron", "salvage-tmp", parms[0], parms[1],
@@ -1158,6 +1268,7 @@ char *orphans;
        printf("bos: salvage failed (%s)\n", em(code));
        goto done;
     }
+    code = 0;
 
     /* now print the log file to the output file */
     printf("bos: salvage completed\n");
@@ -1225,19 +1336,28 @@ register struct cmd_syndesc *as; {
 static SalvageCmd(as)
 struct cmd_syndesc *as; {
     register struct rx_connection *tconn;
-    register afs_int32 code, rc;
+    register afs_int32 code, rc, i;
     char *outName;
-    char tname[65];
+    char tname[BOZO_BSSIZE];
     afs_int32 newID;
     extern struct ubik_client *cstruct;
-    afs_int32 curGoal, showlog = 0;
+    afs_int32 curGoal, showlog = 0, mrafs = 0;
     char *parallel;
     char *tmpDir;
     char *orphans;
+    char *tp;
+
+    bzero(&mrafsParm, sizeof(mrafsParm));
     
     /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */
     tconn = GetConn(as, 0);
 
+    /* Find out whether fileserver is running MR-AFS (has a scanner instance) */
+    /* XXX this should really be done some other way, potentially by RPC */
+    tp = &tname;
+    if (code = BOZO_GetInstanceParm(tconn, "fs", 3, &tp) == 0)
+       mrafs = 1;
+
     /* we can do a volume, a partition or the whole thing, but not mixtures
      * thereof */
     if (!as->parms[1].items && as->parms[2].items) {
@@ -1274,8 +1394,75 @@ struct cmd_syndesc *as; {
 
     /* -orphans option */
     orphans = (char *)0;
-    if (as->parms[8].items)
-       orphans = as->parms[8].items->data;
+    if (as->parms[8].items) {
+       if (mrafs) {
+           printf("Can't specify -orphans for MR-AFS fileserver\n");
+           return EINVAL;
+       }
+        orphans = as->parms[8].items->data;
+    }
+    
+    if (mrafs) {
+        if (as->parms[MRAFS_OFFSET].items)
+            mrafsParm.Optdebug = 1;
+        if (as->parms[MRAFS_OFFSET + 1].items)
+            mrafsParm.Optnowrite = 1;
+        if (as->parms[MRAFS_OFFSET + 2].items)
+            mrafsParm.Optforce = 1;
+        if (as->parms[MRAFS_OFFSET + 3].items)
+            mrafsParm.Optoktozap = 1;
+        if (as->parms[MRAFS_OFFSET + 4].items)
+            mrafsParm.Optrootfiles = 1;
+        if (as->parms[MRAFS_OFFSET + 5].items)
+            mrafsParm.Optsalvagedirs = 1;
+        if (as->parms[MRAFS_OFFSET + 6].items)
+            mrafsParm.Optblockreads = 1;
+        if (as->parms[MRAFS_OFFSET + 7].items)
+            mrafsParm.OptListResidencies = 1;
+        if (as->parms[MRAFS_OFFSET + 8].items)
+            mrafsParm.OptSalvageRemote = 1;
+        if (as->parms[MRAFS_OFFSET + 9].items)
+            mrafsParm.OptSalvageArchival = 1;
+        if (as->parms[MRAFS_OFFSET + 10].items)
+            mrafsParm.OptIgnoreCheck = 1;
+        if (as->parms[MRAFS_OFFSET + 11].items)
+            mrafsParm.OptForceOnLine = 1;
+        if (as->parms[MRAFS_OFFSET + 12].items)
+            mrafsParm.OptUseRootDirACL = 1;
+        if (as->parms[MRAFS_OFFSET + 13].items)
+            mrafsParm.OptTraceBadLinkCounts = 1;
+        if (as->parms[MRAFS_OFFSET + 14].items)
+            mrafsParm.OptDontAskFS = 1;
+        if (as->parms[MRAFS_OFFSET + 15].items)
+            mrafsParm.OptLogLevel = atoi(as->parms[MRAFS_OFFSET + 15].items->data);
+        if (as->parms[MRAFS_OFFSET + 16].items)
+            mrafsParm.OptRxDebug = 1;
+        if (as->parms[MRAFS_OFFSET + 17].items) {                             
+           if (as->parms[MRAFS_OFFSET + 8].items || 
+               as->parms[MRAFS_OFFSET + 9].items) {
+                printf("Can't specify -Residencies with -SalvageRemote or -SalvageArchival\n");
+                return EINVAL;
+            }
+            code = GetUInt32(as->parms[MRAFS_OFFSET + 17].items->data, 
+                                       &mrafsParm.OptResidencies);
+            if (code) {
+                printf("bos: '%s' is not a valid residency mask.\n",
+                       as->parms[MRAFS_OFFSET + 13].items->data);
+                return code;
+            }
+        }
+    } else {
+       int stop = 0;
+
+       for (i = 9; i < ADDPARMOFFSET; i++) {
+           if (as->parms[i].items) {
+               printf(" %s only possible for MR-AFS fileserver.\n",
+                       as->parms[i].name);
+               stop = 1;
+           }
+       }
+       if (stop) exit(1);
+    }
 
     if (as->parms[4].items) {
        /* salvage whole enchilada */
@@ -1355,10 +1542,11 @@ struct cmd_syndesc *as; {
        const char *confdir;
        int localauth;
 
-       if (as->parms[12].items) tmpname = as->parms[12].items->data;
+       if (as->parms[ADDPARMOFFSET].items) 
+           tmpname = as->parms[ADDPARMOFFSET].items->data;
        else tmpname = (char *) 0;
 
-       localauth = (as->parms[14].items != 0);
+       localauth = (as->parms[ADDPARMOFFSET + 2].items != 0);
        confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH);
        code = vsu_ClientInit(/* noauth */ 1, confdir, tmpname,
                              /* server auth */ 0, &cstruct, (int (*)()) 0);
@@ -1518,15 +1706,42 @@ static DoStat (aname, aconn, aint32p, firstTime)
     return 0;
 }
 
+#ifdef BOS_RESTRICTED_MODE
+static GetRestrict(as)
+struct cmd_syndesc *as; {
+    register struct rx_connection *tconn;
+    afs_int32 code, val;
+    
+    tconn = GetConn(as, 0);
+    code = BOZO_GetRestrictedMode(tconn, &val);
+    if (code) printf("bos: failed to get restricted mode (%s)\n", em(code));
+    else printf("Restricted mode is %s\n", val ? "on" : "off");
+    
+    return 0;
+}
+
+static SetRestrict(as)
+struct cmd_syndesc *as; {
+    register struct rx_connection *tconn;
+    afs_int32 code, val;
+    
+    tconn = GetConn(as, 0);
+    util_GetInt32(as->parms[1].items->data, &val);
+    code = BOZO_SetRestrictedMode(tconn, val);
+    if (code) printf("bos: failed to set restricted mode (%s)\n", em(code));
+    return 0;
+}
+#endif
+
 static void add_std_args (ts)
   register struct cmd_syndesc *ts;
 {
-    cmd_Seek(ts, 12);
-    /* 12 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
-    /* 13 */cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL,
-                       "don't authenticate");
-    /* 14 */ cmd_AddParm (ts, "-localauth", CMD_FLAG, CMD_OPTIONAL,
-                         "create tickets from KeyFile");
+    cmd_Seek(ts, ADDPARMOFFSET);
+    /* + 0 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
+    /* + 1 */ cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL,
+                        "don't authenticate");
+    /* + 2 */ cmd_AddParm (ts, "-localauth", CMD_FLAG, CMD_OPTIONAL,
+                          "create tickets from KeyFile");
 }
   
 #include "AFS_component_version_number.c"
@@ -1681,6 +1896,7 @@ main(argc, argv)
     ts = cmd_CreateSyntax("addhost", AddHost, 0, "add host to cell dbase");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-host", CMD_LIST, 0, "host name");
+    cmd_AddParm(ts, "-clone", CMD_FLAG, CMD_OPTIONAL, "vote doesn't count");
     add_std_args (ts);
 
     ts = cmd_CreateSyntax("removehost", RemoveHost, 0,
@@ -1763,8 +1979,46 @@ main(argc, argv)
                "directory to place tmp files");
     cmd_AddParm(ts, "-orphans", CMD_SINGLE, CMD_OPTIONAL, 
                "ignore | remove | attach");
+    cmd_AddParm(ts, "-debug", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Run in Debugging mode");
+    cmd_AddParm(ts, "-nowrite", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Run readonly/test mode");
+    cmd_AddParm(ts, "-force", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force full salvaging");
+    cmd_AddParm(ts, "-oktozap", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Give permission to destroy bogus file residencies/volumes - debugging flag");
+    cmd_AddParm(ts, "-rootfiles", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Show files owned by root - debugging flag");
+    cmd_AddParm(ts, "-salvagedirs", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force rebuild/salvage of all directories");
+    cmd_AddParm(ts, "-blockreads", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Read smaller blocks to handle IO/bad blocks");
+    cmd_AddParm(ts, "-ListResidencies", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Just list affected file residencies - debugging flag");
+    cmd_AddParm(ts, "-SalvageRemote", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Salvage storage systems that are not directly attached");
+    cmd_AddParm(ts, "-SalvageArchival", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Salvage HSM storage systems");
+    cmd_AddParm(ts, "-IgnoreCheck", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Don't perform VLDB safety check when deleting unreferenced files.  Only a good idea in single server cell.");
+    cmd_AddParm(ts, "-ForceOnLine", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force the volume to come online, even if it hasn't salvaged cleanly.");
+    cmd_AddParm(ts, "-UseRootDirACL", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Use the root directory ACL for lost+found directory if it is created.");
+    cmd_AddParm(ts, "-TraceBadLinkCounts", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Print out lines about volume reference count changes.");
+    cmd_AddParm(ts, "-DontAskFS", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Don't ask fileserver to take volume offline.  THIS IS VERY DANGEROUS.");
+    cmd_AddParm(ts, "-LogLevel", CMD_SINGLE, CMD_OPTIONAL, "(MR-AFS) log level");
+    cmd_AddParm(ts, "-rxdebug", CMD_FLAG, CMD_OPTIONAL, "(MR-AFS) Write out rx debug information.");
+    cmd_AddParm(ts, "-Residencies", CMD_SINGLE, CMD_OPTIONAL, "(MR-AFS) Numeric mask of residencies to be included in the salvage.  Do not use with -SalvageRemote or -SalvageArchival");
     add_std_args (ts);
 
+    ts = cmd_CreateSyntax("blockscanner", BlockScannerCmd, 0,
+                          "block scanner daemon from making migration requests");
+    cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
+    add_std_args (ts);
+
+    ts = cmd_CreateSyntax("unblockscanner", UnBlockScannerCmd, 0,
+                          "allow scanner daemon to make migration requests again");
+    cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
+    add_std_args (ts); 
+
+#ifdef BOS_RESTRICTED_MODE
+    ts = cmd_CreateSyntax("getrestricted", GetRestrict, 0, "get restrict mode");
+    cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
+    add_std_args (ts);
+
+    ts = cmd_CreateSyntax("setrestricted", SetRestrict, 0, "set restrict mode");
+    cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
+    cmd_AddParm(ts, "-mode", CMD_SINGLE, 0, "mode to set");
+    add_std_args (ts);
+#endif
 #endif
 
     code = cmd_Dispatch(argc, argv);
index 21ae7432cc7e501ddfad08d270b99850d43101b1..98c5fc1ffcc91e951b71a330e9590abbfbd37f49 100644 (file)
@@ -222,3 +222,12 @@ GetInstanceStrings(
   OUT string spare2<BOZO_BSSIZE>,
   OUT string spare3<BOZO_BSSIZE>
 ) = 114;
+
+GetRestrictedMode(
+  OUT afs_int32 *restmode
+) = 115;
+
+SetRestrictedMode(
+  IN afs_int32 restmode
+) = 116;
+/* RPC #117 will be Salvage, if I get around to it */
index a2ff6d144269b671bfa5b17ba58f47135583b999..336d9269e9895567643025e1ce4c9c67c8f58bb3 100644 (file)
@@ -43,6 +43,9 @@ extern struct afsconf_dir *bozo_confdir;
 extern struct rx_securityClass *bozo_rxsc[2];
 extern int bozo_newKTs;
 extern int DoLogging;
+#ifdef BOS_RESTRICTED_MODE
+extern int bozo_isrestricted;
+#endif
 
 BOZO_GetRestartTime(acall, atype, aktime)
 struct rx_call *acall;
@@ -119,6 +122,12 @@ char *acmd; {
       code = BZACCESS;
       goto fail;
     }
+#ifdef BOS_RESTRICTED_MODE
+    if (bozo_isrestricted) {
+      code = BZACCESS;
+      goto fail;
+    }
+#endif
     if (DoLogging) bozo_Log("%s is executing the shell command '%s'\n", caller, acmd);
 
     /* should copy output to acall, but don't yet cause its hard */
@@ -180,6 +189,13 @@ register char *aname; {
        osi_auditU (acall, BOS_UnInstallEvent, code, AUD_STR, aname, AUD_END);
        return code;
     }
+#ifdef BOS_RESTRICTED_MODE
+    if (bozo_isrestricted) {
+       code = BZACCESS;
+       osi_auditU (acall, BOS_UnInstallEvent, code, AUD_STR, aname, AUD_END);
+       return code;
+    }
+#endif
 
     /* construct local path from canonical (wire-format) path */
     if (ConstructLocalBinPath(aname, &filepath)) {
@@ -267,6 +283,9 @@ afs_int32 mode; {
     char caller[MAXKTCNAMELEN];
 
     if (!afsconf_SuperUser(bozo_confdir, acall, caller)) return BZACCESS;
+#ifdef BOS_RESTRICTED_MODE
+    if (bozo_isrestricted) return BZACCESS;
+#endif
 
     /* construct local path from canonical (wire-format) path */
     if (ConstructLocalBinPath(aname, &fpp)) {
@@ -715,6 +734,17 @@ char *notifier; {
       code = BZACCESS;
       goto fail;
     }
+#ifdef BOS_RESTRICTED_MODE
+    if (bozo_isrestricted) {
+         if (strcmp(atype, "cron") || strcmp(ainstance, "salvage-tmp") ||
+             strcmp(ap2, "now") ||
+             strncmp(ap1, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, 
+                     strlen(AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH))) {
+              code = BZACCESS;
+              goto fail;
+         }
+    }
+#endif
 
     code = bnode_Create(atype, ainstance, &tb, ap1, ap2, ap3, ap4, ap5, notifier,BSTAT_NORMAL);
     if (!code)
@@ -754,6 +784,12 @@ char *ainstance; {
       code = BZACCESS;
       goto fail;
     }
+#ifdef BOS_RESTRICTED_MODE
+    if (bozo_isrestricted) {
+      code = BZACCESS;
+      goto fail;
+    }
+#endif
     if (DoLogging) bozo_Log("%s is executing DeleteBnode '%s'\n", caller, ainstance);
 
     code = bnode_DeleteName(ainstance);
@@ -1061,6 +1097,12 @@ afs_int32 aflags; {
       code = BZACCESS;
       goto fail; 
     }
+#ifdef BOS_RESTRICTED_MODE
+    if (bozo_isrestricted) {
+         code = BZACCESS;
+         goto fail; 
+    }
+#endif
     if (DoLogging) bozo_Log("%s is executing Prune (flags=%d)\n", caller, aflags);
 
     /* first scan AFS binary directory */
@@ -1299,6 +1341,13 @@ char *aname; {
       code = BZACCESS; 
       goto fail; 
     }
+#ifdef BOS_RESTRICTED_MODE
+    if (bozo_isrestricted && strchr(aname, '/') && 
+        strcmp(aname, AFSDIR_CANONICAL_SERVER_SLVGLOG_FILEPATH)) { 
+      code = BZACCESS; 
+      goto fail; 
+    }
+#endif
 
     /* construct local path from canonical (wire-format) path */
     if (ConstructLocalLogPath(aname, &logpath)) {
@@ -1369,6 +1418,51 @@ char **as1, **as2, **as3, **as4; {
     return BZNOENT;
 }
 
+#ifdef BOS_RESTRICTED_MODE
+BOZO_GetRestrictedMode(acall, arestmode) 
+struct rx_call *acall;
+afs_int32 *arestmode; 
+{
+     *arestmode=bozo_isrestricted;
+     return 0;
+}
+
+BOZO_SetRestrictedMode(acall, arestmode) 
+struct rx_call *acall;
+afs_int32 arestmode; 
+{
+     afs_int32 code;
+     char caller[MAXKTCNAMELEN];
+     
+     if (!afsconf_SuperUser(bozo_confdir, acall, caller)) { 
+          return BZACCESS; 
+     }     
+     if (bozo_isrestricted) {
+          return BZACCESS; 
+     }     
+     if (arestmode !=0 && arestmode !=1) {
+          return BZDOM;
+     }
+     bozo_isrestricted=arestmode;
+     code = WriteBozoFile(0);
+ fail:
+     return code;
+}
+#else
+BOZO_GetRestrictedMode(acall, arestmode) 
+struct rx_call *acall;
+afs_int32 *arestmode; 
+{
+     return RXGEN_OPCODE;
+}
+
+BOZO_SetRestrictedMode(acall, arestmode) 
+struct rx_call *acall;
+afs_int32 arestmode; 
+{
+     return RXGEN_OPCODE;
+}
+#endif
 
 void bozo_ShutdownAndExit(int asignal)
 {
index 409d72a0085847ec92041be3a97ff1a89ee5895e..0fce29aebdd02fa3a82b15b33cde1344241b2769 100644 (file)
@@ -60,6 +60,17 @@ static afs_int32 nextDay;
 
 struct ktime bozo_nextRestartKT, bozo_nextDayKT;
 int bozo_newKTs;
+#ifdef BOS_RESTRICTED_MODE
+int bozo_isrestricted=0;
+int bozo_restdisable=0;
+
+void bozo_insecureme(int sig) 
+{
+     signal(SIGFPE, bozo_insecureme);
+     bozo_isrestricted=0;
+     bozo_restdisable=1;
+}
+#endif
 
 struct bztemp {
     FILE *file;
@@ -209,6 +220,9 @@ char *aname; {
     afs_int32 i, goal;
     struct bnode *tb;
     char *parms[MAXPARMS];
+#ifdef BOS_RESTRICTED_MODE
+    int rmode;
+#endif
 
     /* rename BozoInit to BosServer for the user */
     if (!aname) {
@@ -219,6 +233,14 @@ char *aname; {
            if (code < 0)
                perror("bosconfig rename");
        }
+#ifdef BOS_NEW_CONFIG
+       if (access(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, 0) == 0) {
+            code = renamefile(AFSDIR_SERVER_BOZCONFNEW_FILEPATH,
+                              AFSDIR_SERVER_BOZCONF_FILEPATH);
+            if (code < 0)
+                 perror("bosconfig rename");
+       }
+#endif       
     }
 
     /* setup default times we want to do restarts */
@@ -280,6 +302,23 @@ char *aname; {
            continue;
        }
 
+#ifdef BOS_RESTRICTED_MODE
+       if (strncmp(tbuffer, "restrictmode", 12) == 0) {
+           code = sscanf(tbuffer, "restrictmode %d",
+                         &rmode);
+           if (code != 1) {
+               code = -1;
+               goto fail;
+           }
+           if (rmode !=0 && rmode != 1) {
+                code = -1;
+                goto fail;
+           } 
+           bozo_isrestricted=rmode;
+            continue;
+       }
+#endif
+       
        if (strncmp("bnode", tbuffer, 5) != 0) {
            code = -1;
            goto fail;
@@ -351,6 +390,9 @@ char *aname; {
     tfile = fopen(tbuffer, "w");
     if (!tfile) return -1;
     btemp.file = tfile;
+#ifdef BOS_RESTRICTED_MODE
+    fprintf(tfile, "restrictmode %d\n", bozo_isrestricted);
+#endif
     fprintf(tfile, "restarttime %d %d %d %d %d\n", bozo_nextRestartKT.mask,
            bozo_nextRestartKT.day, bozo_nextRestartKT.hour, bozo_nextRestartKT.min,
            bozo_nextRestartKT.sec);
@@ -406,6 +448,12 @@ static BozoDaemon() {
        IOMGR_Sleep(60);
        now = FT_ApproxTime();
 
+#ifdef BOS_RESTRICTED_MODE
+       if (bozo_restdisable) {
+            bozo_Log("Restricted mode disabled by signal\n");
+            bozo_restdisable=0;
+       }
+#endif
        if (bozo_newKTs) {      /* need to recompute restart times */
            bozo_newKTs = 0;    /* done for a while */
            nextRestart = ktime_next(&bozo_nextRestartKT, BOZO_MINSKIP);
@@ -619,6 +667,9 @@ char **envp;
     sigaction(SIGSEGV, &nsa, NULL);
     sigaction(SIGABRT, &nsa, NULL);
 #endif
+#ifdef BOS_RESTRICTED_MODE
+    signal(SIGFPE, bozo_insecureme);
+#endif
 
 #ifdef AFS_NT40_ENV
     /* Initialize winsock */
@@ -669,6 +720,11 @@ char **envp;
        else if (strcmp(argv[code], "-enable_process_stats")==0) {
            rx_enableProcessRPCStats();
        }
+#ifdef BOS_RESTRICTED_MODE
+       else if (strcmp(argv[code], "-restricted")==0) {
+           bozo_isrestricted=1;
+       }
+#endif
        else {
 
            /* hack to support help flag */
@@ -705,8 +761,10 @@ char **envp;
     /* chdir to AFS log directory */
     chdir(AFSDIR_SERVER_LOGS_DIRPATH);
 
+#if 0
     fputs(AFS_GOVERNMENT_MESSAGE, stdout);
     fflush(stdout);
+#endif
 
     /* go into the background and remove our controlling tty */
 
@@ -740,8 +798,10 @@ char **envp;
        }
        else break;
     }
-    if (i>=10)
+    if (i>=10) {
+       bozo_Log("Bos giving up, can't initialize rx\n");
        exit(code);
+    }
 
     code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
                             /* parm */0, "bozo-the-clown", &bozo_pid);
index ec4d62dea3e1d58cdb49c8773d752f00d537b303..ff8d204e4f03db29d894db494d0ecbd7764cbb77 100644 (file)
@@ -30,6 +30,7 @@ static int fs_timeout(), fs_getstat(), fs_setstat(), fs_delete();
 static int fs_procexit(), fs_getstring(), fs_getparm(), fs_restartp();
 static int fs_hascore();
 struct bnode *fs_create();
+struct bnode *fsmr_create();
 
 static SetNeedsClock();
 static NudgeProcs();
@@ -80,20 +81,26 @@ struct fsbnode {
     char *filecmd;                 /* command to start primary file server */
     char *volcmd;                  /* command to start secondary vol server */
     char *salcmd;                  /* command to start salvager */
+    char *scancmd;                  /* command to start scanner (MR-AFS) */
     struct bnode_proc *fileProc;    /* process for file server */
     struct bnode_proc *volProc;            /* process for vol server */
     struct bnode_proc *salProc;            /* process for salvager */
-    afs_int32 lastFileStart;               /* last start for file */
-    afs_int32 lastVolStart;                /* last start for vol */
+    struct bnode_proc *scanProc;    /* process for scanner (MR-AFS) */
+    afs_int32 lastFileStart;        /* last start for file */
+    afs_int32 lastVolStart;         /* last start for vol */
+    afs_int32 lastScanStart;        /* last start for scanner (MR-AFS) */
     char fileRunning;              /* file process is running */
     char volRunning;               /* volser is running */
     char salRunning;               /* salvager is running */
+    char scanRunning;               /* scanner is running (MR_AFS) */
     char fileSDW;                  /* file shutdown wait */
     char volSDW;                   /* vol shutdown wait */
     char salSDW;                   /* waiting for the salvager to shutdown */
+    char scanSDW;                   /* scanner shutdown wait (MR_AFS) */
     char fileKillSent;             /* kill signal has been sent */
     char volKillSent;
     char salKillSent;
+    char scanKillSent;              /* kill signal has been sent (MR_AFS) */
     char needsSalvage;             /* salvage before running */
     char needsClock;               /* do we need clock ticks */
 };
@@ -120,6 +127,10 @@ register struct ezbnode *abnode; {
     bnode_CoreName(abnode, "salv", tbuffer);
     if (access(tbuffer, 0) == 0) return 1;
 
+    /* see if scanner left a core file (MR-AFS) */
+    bnode_CoreName(abnode, "scan", tbuffer);
+    if (access(tbuffer, 0) == 0) return 1;
+
     /* no one left a core file */
     return 0;
 }
@@ -155,6 +166,22 @@ register struct fsbnode *abnode; {
     if (tstat.st_ctime > abnode->lastVolStart) code = 1;
     else code = 0;
     bnode_FreeTokens(tt);
+    if (code) return code;
+
+    if (abnode->scancmd) {                     /* Only in MR-AFS */
+        /* now do same for scancmd (MR-AFS) */
+        code = bnode_ParseLine(abnode->scancmd, &tt);
+        if (code) return 0;
+        if (!tt) return 0;
+        code = stat(tt->key, &tstat);
+        if (code) {
+            bnode_FreeTokens(tt);
+            return 0;
+       }
+        if (tstat.st_ctime > abnode->lastScanStart) code = 1;
+        else code = 0;
+        bnode_FreeTokens(tt); 
+    }
 
     return code;
 }
@@ -210,6 +237,7 @@ struct fsbnode *abnode; {
     free(abnode->filecmd);
     free(abnode->volcmd);
     free(abnode->salcmd);
+    if (abnode->scancmd) free(abnode->scancmd);
     free(abnode);
     return 0;
 }
@@ -229,15 +257,16 @@ static void AppendExecutableExtension(char *cmd)
 #endif /* AFS_NT40_ENV */
 
 
-struct bnode *fs_create(ainstance, afilecmd, avolcmd, asalcmd)
+struct bnode *fs_create(ainstance, afilecmd, avolcmd, asalcmd, ascancmd)
 char *ainstance;
 char *afilecmd;
 char *avolcmd;
-char *asalcmd; {
+char *asalcmd; 
+char *ascancmd; {
     struct stat tstat;
     register struct fsbnode *te;
     char cmdname[AFSDIR_PATH_MAX];
-    char *fileCmdpath, *volCmdpath, *salCmdpath;
+    char *fileCmdpath, *volCmdpath, *salCmdpath, *scanCmdpath;
     int bailout = 0;
 
     fileCmdpath = volCmdpath = salCmdpath = NULL;
@@ -256,6 +285,13 @@ char *asalcmd; {
        bailout = 1;
     }
 
+    if (ascancmd && strlen(ascancmd)) {
+       if (ConstructLocalBinPath(ascancmd, &scanCmdpath)) {
+            bozo_Log("BNODE: command path invalid '%s'\n", ascancmd);
+            bailout = 1;
+       }
+    }
+
     if (!bailout) {
        sscanf(fileCmdpath, "%s", cmdname);
 #ifdef AFS_NT40_ENV
@@ -283,6 +319,17 @@ char *asalcmd; {
            bozo_Log("BNODE: salvager binary '%s' not found\n", cmdname);
            bailout = 1;
        }
+
+        if (ascancmd && strlen(ascancmd)) {
+           sscanf(scanCmdpath, "%s", cmdname);
+#ifdef AFS_NT40_ENV
+           AppendExecutableExtension(cmdname);
+#endif
+           if (stat(cmdname, &tstat)) {
+               bozo_Log("BNODE: scanner binary '%s' not found\n", cmdname);
+               bailout = 1;
+           }
+       }
     }
 
     if (bailout) {
@@ -295,6 +342,10 @@ char *asalcmd; {
     te->filecmd = fileCmdpath;
     te->volcmd = volCmdpath;
     te->salcmd = salCmdpath;
+    if (ascancmd && strlen(ascancmd))
+       te->scancmd = scanCmdpath;
+    else 
+       te->scancmd = (char *)0;
     bnode_InitBnode(te, &fsbnode_ops, ainstance);
     bnode_SetTimeout(te, POLLTIME);    /* ask for timeout activations every 10 seconds */
     RestoreSalFlag(te);                /* restore needsSalvage flag based on file's existence */
@@ -333,6 +384,14 @@ struct fsbnode *abnode; {
                     FSSDTIME);
        }
     }
+    if (abnode->scanSDW) {
+        if (!abnode->scanKillSent && now - abnode->timeSDStarted > SDTIME) {
+            bnode_StopProc(abnode->scanProc, SIGKILL);
+            abnode->scanKillSent = 1;
+            bozo_Log("bos shutdown: scanner failed to shutdown within %d seconds\n",
+                     SDTIME);
+        }
+    }
     SetNeedsClock(abnode);
 }
 
@@ -340,11 +399,13 @@ static int fs_getstat(abnode, astatus)
 struct fsbnode *abnode;
 afs_int32 *astatus; {
     register afs_int32 temp;
-    if (abnode->volSDW || abnode->fileSDW || abnode->salSDW) temp = BSTAT_SHUTTINGDOWN;
+    if (abnode->volSDW || abnode->fileSDW || abnode->salSDW || abnode->scanSDW)
+       temp = BSTAT_SHUTTINGDOWN;
     else if (abnode->salRunning) temp = BSTAT_NORMAL;
-    else if (abnode->volRunning && abnode->fileRunning) temp = BSTAT_NORMAL;
-    else if (!abnode->salRunning && !abnode->volRunning && !abnode->fileRunning)
-       temp = BSTAT_SHUTDOWN;
+    else if (abnode->volRunning && abnode->fileRunning && (!abnode->scancmd || 
+       abnode->scanRunning)) temp = BSTAT_NORMAL;
+    else if (!abnode->salRunning && !abnode->volRunning && !abnode->fileRunning
+        && !abnode->scanRunning) temp = BSTAT_SHUTDOWN;
     else temp = BSTAT_STARTINGUP;
     *astatus = temp;
     return 0;
@@ -390,6 +451,12 @@ struct bnode_proc *aproc; {
        abnode->salSDW = 0;
        abnode->salKillSent = 0;
     }
+    else if (aproc == abnode->scanProc) {
+        abnode->scanProc = 0;
+        abnode->scanRunning = 0;
+        abnode->scanSDW = 0;
+        abnode->scanKillSent = 0;
+    }
 
     /* now restart anyone who needs to restart */
     return NudgeProcs(abnode);
@@ -397,10 +464,13 @@ struct bnode_proc *aproc; {
 
 /* make sure we're periodically checking the state if we need to */
 static SetNeedsClock(ab)
-register struct fsbnode *ab; {
-    if (ab->b.goal == 1 && ab->fileRunning && ab->volRunning)
+    register struct fsbnode *ab; 
+{
+    if (ab->b.goal == 1 && ab->fileRunning && ab->volRunning
+       && (!ab->scancmd || ab->scanRunning))
        ab->needsClock = 0; /* running normally */
-    else if (ab->b.goal == 0 && !ab->fileRunning && !ab->volRunning && !ab->salRunning)
+    else if (ab->b.goal == 0 && !ab->fileRunning && !ab->volRunning 
+            && !ab->salRunning && !ab->scanRunning)
        ab->needsClock = 0; /* halted normally */
     else ab->needsClock        = 1;    /* other */
     if (ab->needsClock && !bnode_PendingTimeout(ab))
@@ -437,6 +507,16 @@ register struct fsbnode *abnode; {
                    abnode->volRunning = 1;
                }
            }
+           if (abnode->scancmd) {
+               if (!abnode->scanRunning) {
+                   abnode->lastScanStart = FT_ApproxTime();
+                   code = bnode_NewProc(abnode, abnode->scancmd, "scanner", &tp);
+                   if (code == 0) {
+                       abnode->scanProc = tp;
+                       abnode->scanRunning = 1;
+                   }
+               }
+           }    
        }
        else {  /* file is not running */
            /* see how to start */
@@ -459,6 +539,15 @@ register struct fsbnode *abnode; {
                        abnode->volRunning = 1;
                    }
                }
+               if (abnode->scancmd && !abnode->scanRunning) {
+                    abnode->lastScanStart = FT_ApproxTime();
+                    code = bnode_NewProc(abnode, abnode->scancmd, "scanner",
+                                         &tp);
+                    if (code == 0) {
+                        abnode->scanProc = tp;
+                        abnode->scanRunning = 1;
+                    }
+                }
            }
            else {  /* needs to be salvaged */
                /* make sure file server and volser are gone */
@@ -472,7 +561,13 @@ register struct fsbnode *abnode; {
                    if (!abnode->fileSDW) abnode->timeSDStarted = now;
                    abnode->fileSDW = 1;
                }
-               if (abnode->volRunning || abnode->fileRunning) return 0;
+                if (abnode->scanRunning) {
+                    bnode_StopProc(abnode->scanProc, SIGTERM);
+                    if (!abnode->scanSDW) abnode->timeSDStarted = now;
+                    abnode->scanSDW = 1;
+                }
+               if (abnode->volRunning || abnode->fileRunning 
+                   || abnode->scanRunning) return 0;
                /* otherwise, it is safe to start salvager */
                if (!abnode->salRunning) {
                    code = bnode_NewProc(abnode, abnode->salcmd, "salv", &tp);
@@ -501,6 +596,11 @@ register struct fsbnode *abnode; {
            abnode->volSDW = 1;
            abnode->timeSDStarted = now;
        }
+        if (abnode->scanRunning && !abnode->scanSDW) {
+            bnode_StopProc(abnode->scanProc, SIGTERM);
+            abnode->scanSDW = 1;
+            abnode->timeSDStarted = now;
+        }
     }
     SetNeedsClock(abnode);
     return 0;
@@ -514,7 +614,18 @@ afs_int32 alen;{
     if (abnode->b.goal == 1) {
        if (abnode->fileRunning) {
            if (abnode->fileSDW) strcpy(abuffer, "file server shutting down");
-           else if (!abnode->volRunning) strcpy(abuffer, "file server up; volser down");
+           else if (abnode->scancmd) {
+                if (!abnode->volRunning && !abnode->scanRunning)
+                    strcpy(abuffer, "file server up; volser and scanner down");
+               else if (abnode->volRunning && !abnode->scanRunning)
+                    strcpy(abuffer, "file server up; volser up; scanner down");
+               else if (!abnode->volRunning && abnode->scanRunning)
+                    strcpy(abuffer, "file server up; volser down; scanner up");
+
+               else strcpy(abuffer, "file server running");
+           } 
+           else if (!abnode->volRunning) 
+               strcpy(abuffer, "file server up; volser down");
            else strcpy(abuffer, "file server running");
        }
        else if (abnode->salRunning) {
@@ -524,7 +635,7 @@ afs_int32 alen;{
     }
     else {
        /* shutting down */
-       if (abnode->fileRunning || abnode->volRunning) {
+       if (abnode->fileRunning || abnode->volRunning || abnode->scanRunning) {
            strcpy(abuffer, "file server shutting down");
        }
        else if (abnode->salRunning)
@@ -545,6 +656,8 @@ afs_int32  alen; {
        strcpy(abuffer, abnode->volcmd);
     else if (aindex == 2)
        strcpy(abuffer, abnode->salcmd);
+    else if (aindex == 3 && abnode->scancmd)
+       strcpy(abuffer, abnode->scancmd);
     else
        return BZDOM;
     return 0;
index b83ad7ea59687787af5a013f4ea3ea36d7e66bda..0d4fadd62125227a35fc1e4b326a7a5ce0999a0a 100644 (file)
@@ -66,6 +66,12 @@ bc_AddVolEntryCmd(as, arock)
     partitionName = as->parms[2].items->data;
     volRegExp     = as->parms[3].items->data;
 
+    code = bc_UpdateVolumeSet();
+    if (code) {
+       com_err(whoami, code, "; Can't retrieve volume sets");
+       return(code);
+    }
+
     ctPtr = &bc_globalConfig->configText[TB_VOLUMESET];
 
     tset = bc_FindVolumeSet(bc_globalConfig, volSetName);
index f8d6d0bbe702d9b841fa6530fc0b7efc4748e904..253586972bd5240ba31cebfc4de490abb256579b 100644 (file)
@@ -398,6 +398,13 @@ char *aname; {
     return 0;  /* all done */
 }
 
+int cmd_IsAdministratorCommand(as)
+register struct cmd_syndesc *as;
+{
+    as->flags |= CMD_ADMIN;
+    return 0;
+} 
+
 int cmd_Seek(as, apos)
 register struct cmd_syndesc *as;
 int apos; {
@@ -594,6 +601,7 @@ char **argv;
            ts = cmd_CreateSyntax("help", HelpProc, (char*)0,
                                  "get help on commands");
            cmd_AddParm(ts, "-topic", CMD_LIST, CMD_OPTIONAL, "help string");
+           cmd_AddParm(ts, "-admin", CMD_FLAG, CMD_OPTIONAL, (char *)0);
 
            ts = cmd_CreateSyntax("apropos", AproposProc, (char*)0,
                                  "search by help text");
index ec69bb820f0a9a4bf9f9ba0b4f6c50c3ca89af25..a4a77bff248201127d26d65b9bb9fce9c7cbc585 100644 (file)
@@ -18,6 +18,7 @@
 
 /* syndesc flags */
 #define        CMD_ALIAS       1       /* this is an alias */
+#define CMD_ADMIN       2       /* admin. command, show only with -admin */
 #define CMD_HIDDEN      4       /* A hidden command - similar to CMD_HIDE */
 
 #define CMD_HELPPARM   (CMD_MAXPARMS-1)/* last one is used by -help switch */
index 533b8284af0e8294faceba770927c25a32fd6749..7671731a89cdb842ce3716df42050d02e9433bcf 100644 (file)
@@ -8,7 +8,7 @@ error_code      return ERROR_CODE_ENTRY;
 ec             return ERROR_CODE_ENTRY;
 end            return END;
 
-[\t\n ]                ;
+[\t\n\r ]              ;
 
 \"{PC}*\"      { register char *p; yylval.dynstr = ds((char *)yytext+1);
                  if (p=strrchr(yylval.dynstr, '"')) *p='\0';
index a8ee3b65db2cd8df2f70eedd3eca9fd7d31d8f43..2c213bc7d831467040240c08a7d993cb7473b442 100644 (file)
@@ -15,10 +15,11 @@ LINUX_VERS = 2.2.16
 #
 # compilation and link editor flags
 DBG=-g
-OPTMZ=-O2
-PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
+OPTMZ=-O
+#PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
+PAM_CFLAGS= -O -Dlinux -DLINUX_PAM -fPIC
 # Put -O2 here to _ensure_ all Makefiles pick it up.
-XCFLAGS= -O2
+XCFLAGS= -O -g
 MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
 XLDFLAGS=
 SHARE_LDFLAGS = -shared -Xlinker -x
index d310e0ecdf7b3529c56bf35c9cc38053ffde86ae..a1b958595b81ae4ab61c1a8ddd09ec4dd3baf562 100644 (file)
@@ -8,8 +8,8 @@
 AFS_component_version_number.o: AFS_component_version_number.c
 
 AFS_component_version_number.c: 
-       echo 'char cml_version_number[]="@(#) OpenAFS stable 1.0.2 built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c;
-       echo 'char* AFSVersion = "openafs devel"; ' >>AFS_component_version_number.c;
+       echo 'char cml_version_number[]="@(#) OpenAFS stable 1.0.3 built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c;
+       echo 'char* AFSVersion = "openafs stable 1.0.3; ' >>AFS_component_version_number.c;
 
 noversion: install
 
index 7f5ed76f96460af834e31835d06983d9801c3474..ada6df6f3939a825e98ca922629739631576b5ad 100644 (file)
 #define SYS_NAME_ID_alpha_osf32                1203
 #define SYS_NAME_ID_alpha_osf32c       1204
 #define SYS_NAME_ID_alpha_dux40                1205
+#define SYS_NAME_ID_alpha_dux50                1206
 
 #define SYS_NAME_ID_ncrx86_20          1300
 #define SYS_NAME_ID_ncrx86_30          1301
index 3d0c1976d1fd875519c1daf331e5e75956dc20ae..7f3277e9fc9d0a3c9b4de41a4012c4bb0b05d979 100644 (file)
@@ -25,6 +25,7 @@
 
 #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
 #define AFS_SYSCALL 137
+#define AFS_64BIT_ENV
 #define AFS_64BIT_IOPS_ENV  1
 #define AFS_NAMEI_ENV     1   /* User space interface to file system */
 #include <afs/afs_sysnames.h>
 #define AFS_GLOBAL_SUNLOCK
 #endif
 
+#if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+#define MODVERSIONS
+#include <linux/modversions.h>
+#endif
+
 #endif /* __KERNEL__  && !DUMP_KERNEL*/
 
 #ifdef KERNEL
index 1dd862bcb37d17d2eea15c45ea224881b08b75fe..0e8e95401dd4d77889a61ef360fb4ae0ebe5f8a7 100644 (file)
 #define AFS_GLOBAL_SUNLOCK
 #endif
 
+#if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+#define MODVERSIONS
+#include <linux/modversions.h>
+#endif
+
 #endif /* __KERNEL__  && !DUMP_KERNEL*/
 
 #ifdef KERNEL
index e3d564c69f74479ed737d55e9f5f9364a3b6add2..e300213e3ab7dce922cd70e7aa0d65b70aed017a 100644 (file)
@@ -23,6 +23,7 @@
 
 /* File system entry (used if vmount.h doesn't define MNT_AFS */
 #define AFS_MOUNT_AFS  4
+#define AFS_SYSCALL    31
 
 /* Machine / Operating system information */
 #define SYS_NAME       "rs_aix42"
index b818510117198c29a40e53c224960a967f3d7cba..fbee6f77a14236ad4e8938cba3c8f2f298827ef4 100644 (file)
 
 #define AFS_64BIT_ENV          1       /* Defines afs_int32 as int, not long. */
 
+#ifdef AFS_NAMEI_ENV
+#define AFS_64BIT_IOPS_ENV     1       /* needed for NAMEI... */
+#else /* AFS_NAMEI_ENV */
+#define AFS_3DISPARES           1       /* Utilize the 3 available disk inode 'spares' */
+#endif /* AFS_NAMEI_ENV */
+
 #include <afs/afs_sysnames.h>
 
 #define AFS_GLOBAL_SUNLOCK     1       /* For global locking */
 #define RXK_LISTENER_ENV   1
 #define AFS_GCPAGS             1       /* if nonzero, garbage collect PAGs */
 
-#define        AFS_3DISPARES           1       /* Utilize the 3 available disk inode 'spares' */
 #define        AFS_SYSCALL             65
 
 /* File system entry (used if mount.h doesn't define MOUNT_AFS */
index de40ca9df519b210681a92ae31b3e252521c3883..21b22e3b6afdb229d26a7884877803be8e6800af 100644 (file)
@@ -55,11 +55,50 @@ typedef unsigned short   afs_uint16;
 #ifdef  AFS_64BIT_ENV
 typedef int              afs_int32;
 typedef unsigned int     afs_uint32;
+typedef long long       afs_int64;
+typedef  unsigned long long afs_uint64;
+#define ZeroInt64(a)       (a) = 0
+#define AssignInt64(a, b)   *(a) = (b)
+#define AddInt64(a,b,c) *(c) = (a) + (b)
+#define SubtractInt64(a,b,c) *(c) = (a) - (b)
+#define CompareInt64(a,b) (a) - (b)
+#define NonZeroInt64(a)                (a)
+#define Int64ToInt32(a)    (a) & 0xFFFFFFFFL
+#define FillInt64(t,h,l) (t) = (h); (t) <<= 32; (t) |= (l);
+#define SplitInt64(t,h,l) (h) = (t) >> 32; (l) = (t) & 0xFFFFFFFF;
 #else   /* AFS_64BIT_ENV */
 typedef long             afs_int32;
 typedef unsigned long    afs_uint32;
+
+struct Int64 {
+    afs_int32 high;
+    afs_uint32 low;
+};
+typedef struct Int64 afs_int64;
+
+struct u_Int64 {
+    afs_uint32 high;
+    afs_uint32 low;
+};
+typedef struct u_Int64 afs_uint64;
+#define ZeroInt64(a) (a).high = (a).low = 0
+#define AssignInt64(a, b) (b)->high = (a).high; (b)->low = (a).low
+#define NonZeroInt64(a)   (a).low || (a).high
+#define Int64ToInt32(a)    (a).low
+#define FillInt64(t,h,l) (t).high = (h); (t).low = (l);
+#define SplitInt64(t,h,l) (h) = (t).high; (l) = (t).low;
 #endif  /* AFS_64BIT_ENV */
 
+/* AFS_64BIT_CLIENT should presently be set only for AFS_64BIT_ENV systems */
+
+#ifdef AFS_64BIT_CLIENT
+typedef afs_int64 afs_size_t;
+typedef afs_uint64 afs_offs_t;
+#else /* AFS_64BIT_CLIENT */
+typedef afs_int32 afs_size_t;
+typedef afs_uint32 afs_offs_t;
+#endif /* AFS_64BIT_CLIENT */
+
 /* you still have to include <netinet/in.h> to make these work */
 
 #define hton32 htonl
index 1b019a157ec03066c64f67a74060e22ebcdd27dd..ec1263a5e47a3b132462c67f9753300ebc1396f4 100644 (file)
@@ -176,5 +176,6 @@ struct cm_initparams {
 #define VIOC_RXSTAT_PEER       _VICEIOCTL(54)  /* Control peer RX stats */
 #define VIOC_GETRXKCRYPT        _VICEIOCTL(55)  /* Set rxkad enc flag */
 #define VIOC_SETRXKCRYPT        _VICEIOCTL(56)  /* Set rxkad enc flag */
-
+#define VIOC_PREFETCHTAPE       _VICEIOCTL(66)  /* MR-AFS prefetch from tape */
+#define VIOC_RESIDENCY_CMD      _VICEIOCTL(67)  /* generic MR-AFS cmds */
 #endif /* AFS_VENUS_H */
index 7ad109107c7673b6a62b751f7ac90bea80ffd77c..d95326227af0e41e44de5b3a4ca9a2db19366b48 100644 (file)
@@ -53,14 +53,14 @@ export.ext.nonfs: export.nonfs.o symtab.o
        ${LD} -o export.ext.nonfs -eexport ${IMPORTS} export.nonfs.o symtab.o ${EXPORTS} -lcsys
 
 export.nonfs.o:
-       cc -DAFS_NONFSTRANS -c export.c
+       ${CC} -DAFS_NONFSTRANS -c export.c
        -mv export.o export.nonfs.o
 
 cfgexport: cfgexport.o
-       cc -O -o cfgexport cfgexport.o
+       ${CC} -O -o cfgexport cfgexport.o
 
 cfgafs: cfgafs.o
-       cc -O -o cfgafs cfgafs.o
+       ${CC} -O -o cfgafs cfgafs.o
 
 cfgexport.o: cfgexport.c AFS_component_version_number.c
 cfgafs.o: cfgafs.c AFS_component_version_number.c
index c55fe084e321be26cc68b660452cd8adbcd586fa..bb3e5166e9cc19dbe63aabb7f29c1647ff8ae869 100644 (file)
@@ -298,6 +298,26 @@ const FLUSHMAX = 10;
 typedef afs_int32 ViceIds<FLUSHMAX>;
 typedef        afs_int32 IPAddrs<FLUSHMAX>;
 
+%#define MAXCMDINT64S                           3
+%#define MAXCMDINT32S                           200
+%#define MAXCMDCHARS                            256
+
+struct ResidencyCmdInputs {
+    afs_int32  command;
+    struct AFSFid fid;
+    afs_int64  int64s[MAXCMDINT64S];
+    afs_uint32 int32s[MAXCMDINT32S];
+    char       chars[MAXCMDCHARS];
+};
+
+struct ResidencyCmdOutputs {
+    afs_int32  code;
+    struct AFSFetchStatus status;
+    afs_int64  int64s[MAXCMDINT64S];
+    afs_uint32 int32s[MAXCMDINT32S];
+    char       chars[MAXCMDCHARS];
+}; 
+
 package RXAFS_
 prefix S
 statindex 7
@@ -544,3 +564,9 @@ DFSSymlink(
   AFSCallBack *CallBack,
   AFSVolSync *Sync
 ) = 163;
+
+ResidencyCmd(
+  IN AFSFid *Fid,
+  IN struct ResidencyCmdInputs *Inputs,
+  OUT struct ResidencyCmdOutputs *Outputs
+) = 220; 
index 6409dbf9daa2aae63772b2f31e5f859957160726..e83ff2e8a6838230e154b5cf5ee126349f2015ce 100644 (file)
@@ -19,6 +19,7 @@
 static char sccsid[] = "@(#)getusershell.c     5.5 (Berkeley) 7/21/88";
 #endif /* LIBC_SCCS and not lint */
 
+#include <afs/param.h>
 #include <sys/param.h>
 #include <sys/file.h>
 #include <sys/stat.h>
@@ -53,6 +54,9 @@ getusershell()
        return (ret);
 }
 
+#ifdef AFS_AIX42_ENV
+void
+#endif
 endusershell()
 {
        
@@ -113,6 +117,9 @@ initshells()
        return (shells);
 }
 
+#ifdef AFS_AIX42_ENV
+void
+#endif
 setusershell()
 {
 
index e3374eef6c6488002a989f92299aa9ac030aa203..3bb2cf37bb89885e095e637d656c42c5fa692785 100644 (file)
@@ -156,6 +156,8 @@ main (argc, argv)
     int          servers;
     int          initFlags;
     int   level;                       /* security level for Ubik */
+    afs_int32 i;
+    char  clones[MAXHOSTSPERCELL];
 
     struct rx_service *tservice;
     struct rx_securityClass *sca[1];
@@ -282,15 +284,21 @@ main (argc, argv)
     OpenLog(AFSDIR_SERVER_KALOG_FILEPATH); 
     SetupLogSignals();
 #endif
+    code = afsconf_GetExtendedCellInfo (KA_conf, cell, AFSCONF_KAUTHSERVICE,
+                                    &cellinfo, &clones);
     if (servers) {
        if (code = ubik_ParseServerList(argc, argv, &myHost, serverList)) {
            com_err(whoami, code, "Couldn't parse server list");
            exit(1);
        }
+        cellinfo.hostAddr[0].sin_addr.s_addr = myHost;
+        for (i=1; i<MAXSERVERS; i++) {
+            if (!serverList[i]) break;
+            cellinfo.hostAddr[i].sin_addr.s_addr = serverList[i];
+        }
+        cellinfo.numServers = i;
     }
     else {
-       code = afsconf_GetCellInfo (KA_conf, cell, AFSCONF_KAUTHSERVICE,
-                                   &cellinfo);
        code = convert_cell_to_ubik (&cellinfo, &myHost, serverList);
        if (code) goto abort;
        ViceLog (0, ("Using server list from %s cell database.\n", cell));
@@ -313,8 +321,13 @@ main (argc, argv)
     ubik_CheckRXSecurityRock = (char *)KA_conf;
 
     ubik_nBuffers = 80;
-    code = ubik_ServerInit (myHost, htons(AFSCONF_KAUTHPORT), serverList,
-                           dbpath, &KA_dbase);
+    if (servers)
+        code = ubik_ServerInit (myHost, htons(AFSCONF_KAUTHPORT), serverList,
+                            dbpath, &KA_dbase);
+    else
+        code = ubik_ServerInitByInfo (myHost, htons(AFSCONF_KAUTHPORT), 
+                           &cellinfo, &clones, dbpath, &KA_dbase);
+
     if (code) {
        com_err(whoami, code, "Ubik init failed");
        exit(2);
index 0d470a8c330c64a001d00b8d7ee119ce21f52743..d8f8db245f4c6bd5ff1ad358b23ee4933fc74fdb 100644 (file)
@@ -559,8 +559,7 @@ static err_packet (ksoc, pkt, code, reason)
     char  buf[256];
 
     if (reason == 0) reason = "";
-    else if (strlen(reason) + 20 > sizeof(buf)) reason = "reason too long";
-    sprintf (buf, "code = %d: %s", code, reason);
+    snprintf (buf, 255, "code = %d: %s", code, reason);
 
     if (krb_udp_debug) {
        printf ("Sending error packet to '%s'.'%s'@'%s' containing %s\n",
index d834dc270a0f8ce5427f2e49471a8c1863356f63..b2a822a103281c3575d644cd696ee6f85c8c03ad 100644 (file)
@@ -51,7 +51,7 @@
 #endif /* defined(UKERNEL) */
 
 
-static afs_int32 GetTickets (
+afs_int32 GetTickets (
   char *name,
   char *instance,
   char *realm,
index d518d95bf95939353a102076add2e48d1c2700cd..1b25891349141dc4b33a186842de9779360ec2ba 100644 (file)
@@ -129,6 +129,8 @@ libafs: $(DEST_LIBAFS) $(DEST_LIBAFSIAUTH)
 # Common objects
 xdr.o: $(RX)/xdr.c
        $(CRULE1);
+xdr_int64.o: $(RX)/xdr_int64.c
+       $(CRULE1);
 
 xdr_array.o: $(RX)/xdr_array.c
        $(CRULE1);
index 6aa6589d4c103f26fbba4c25d0f1e395e8466c64..2d4ed95d68247b7119e174b0dc3424526c058eb0 100644 (file)
@@ -77,6 +77,8 @@ DEST_LIBAFSNONFS = ${DESTDIR}/root.client/bin/${LIBAFSNONFS}
 
 
 # libafs:      $(DEST_LIBAFS) $(DEST_LIBAFSNONFS)
+
+.PHONY: libafs
 libafs:        $(DEST_LIBAFSNONFS)
 
 
index 430f871a52e6f108e632e8bea93ec133c70b0c6d..9049f8496b8ea25bb17ad334818a44bef15c0b7b 100644 (file)
@@ -218,7 +218,7 @@ setup:
        -ln -s /usr/include/sys h
        -ln -s /usr/include/net /usr/include/netinet .
        -ln -s /usr/include/rpc /usr/include/sys .
-       -ln -s ../../obj/sgiefs sgiefs
+       -ln -s /usr/include/sys/fs .
        -mkdir ${DESTDIR}root.client/bin
        -mkdir ${DESTDIR}root.client/usr/vice/etc/sgiload
 <all -sgi_65>
@@ -342,14 +342,13 @@ ${COMPDIRS}:
                export CPU_KDEFS ;\
                export LDFLAGS ;\
                cd $$dir ; \
-               $(MAKE) IPNO=$$p DESTDIR=../${DESTDIR} $$t.libafs || exit $$?; \
+               $(MAKE) IPNO=$$p DESTDIR=${DESTDIR} $$t.libafs || exit $$?; \
                cd ../ ; \
          done; \
        done
 <all>
 
 
-LIBAFSA = libafs.a
 LIBAFSNONFSA = libafs.nonfs.a
 COPYFILES = copyfiles
 LINKFILES = linkfiles
@@ -358,47 +357,31 @@ STATICCLIENTDIR = ${DESTDIR}root.client/bin
 MODLOADCLIENTDIR = ${DESTDIR}root.client/usr/vice/etc/sgiload
 
 # Make the NFS and no-NFS clients for this directory.
-# STATIC.libafs: ${LIBAFSA} ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES}
+# STATIC.libafs: ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES}
 STATIC.libafs: ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES}
 <all -sgi_65>
-       ${CP} ${LIBAFSA} \
-               ${STATICCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.a
        ${CP} ${LIBAFSNONFSA} \
                ${STATICCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.nonfs.a
 <sgi_65>
-       ${CP} ${LIBAFSA} \
-               ${STATICCLIENTDIR}/libafs.${IPNO}.a
        ${CP} ${LIBAFSNONFSA} \
                ${STATICCLIENTDIR}/libafs.${IPNO}.nonfs.a
 <all>
 
-${LIBAFSA}: $(AFSAOBJS) $(AFSNFSOBJS)
-       $(AR) cru  $@ $?
-
 ${LIBAFSNONFSA}: $(AFSAOBJS) $(AFSNONFSOBJS)
        $(AR) cru  $@ $?
 
-LIBAFSO = libafs.o
 LIBAFSNONFSO = libaf.nonfs.o
 
-# MODLOAD.libafs: ${LIBAFSO} ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES}
+# MODLOAD.libafs: ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES}
 MODLOAD.libafs: ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES}
 <all -sgi_65>
-       ${CP} ${LIBAFSO} \
-               ${MODLOADCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.o
        ${CP} ${LIBAFSNONFSO} \
                ${MODLOADCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.nonfs.o
 <sgi_65>
-       ${CP} ${LIBAFSO} \
-               ${MODLOADCLIENTDIR}/libafs.${IPNO}.o
        ${CP} ${LIBAFSNONFSO} \
                ${MODLOADCLIENTDIR}/libafs.${IPNO}.nonfs.o
 <all>
 
-${LIBAFSO}: $(AFSAOBJS) $(AFSNFSOBJS)
-       $(LD) ${LDFLAGS} -elf -r -d -G 0 -o ${LIBAFSO} $(AFSAOBJS) $(AFSNFSOBJS)
-       
-
 ${LIBAFSNONFSO}: $(AFSAOBJS) $(AFSNONFSOBJS)
        $(LD) ${LDFLAGS} -elf -r -d -G 0 -o ${LIBAFSNONFSO} \
                $(AFSAOBJS) $(AFSNONFSOBJS)
index 057adaa964d6ad258eb96b0cf0436b3969aac3d6..fbc53ab83535190a6c929d3519e6303be2a8b20a 100644 (file)
@@ -41,6 +41,7 @@ COMERROBJS =\
 XDROBJS =\
        xdr_arrayn.o \
        xdr_rx.o \
+       xdr_int64.o \
        xdr_afsuuid.o \
        AFS_component_version_number.o
 
@@ -192,6 +193,9 @@ AFS_component_version_number.o: ${RX}/AFS_component_version_number.c
 xdr.o: ${RX}/xdr.c
        ${CCRULE};
 
+xdr_int64.o: ${RX}/xdr_int64.c
+       ${CCRULE};
+
 xdr_array.o: ${RX}/xdr_array.c
        ${CCRULE};
 
@@ -238,7 +242,7 @@ xdr_afsuuid.o: ${RX}/xdr_afsuuid.c
 #
 #   $ what /opt/langtools/bin/pxdb32
 #   /opt/langtools/bin/pxdb32:
-#           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.1.1.3 $
+#           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.1.1.4 $
 #
 # The problem occurs when -g and -O are both used when compiling des.c.
 # The simplest way to work around the problem is to leave out either -g or -O.
index 4a6469c7787b301530ca5266d3daa8e25274d396..80b9d2a40563f254e33a9fa89bb09935b61cd69e 100644 (file)
@@ -27,7 +27,7 @@ MULTIOBJS = rx_multi.obj
 
 XDROBJS = xdr.obj xdr_array.obj xdr_arrayn.obj xdr_float.obj xdr_mem.obj \
        xdr_rec.obj  xdr_refernce.obj xdr_rx.obj xdr_update.obj \
-       xdr_afsuuid.obj
+       xdr_afsuuid.obj xdr_int64.obj
 
 RXOBJS = rx_event.obj rx_user.obj rx_pthread.obj rx.obj \
        rx_null.obj rx_globals.obj rx_getaddr.obj rx_misc.obj rx_packet.obj \
@@ -88,6 +88,9 @@ xdr_update.obj: $(RX)\xdr_update.c
 xdr_afsuuid.obj: $(RX)\xdr_afsuuid.c
        $(C2OBJ) $(RX)\xdr_afsuuid.c
 
+xdr_int64.obj: $(RX)\xdr_int64.c
+       $(C2OBJ) $(RX)\xdr_int64.c
+
 rx_event.obj: $(RX)\rx_event.c
        $(C2OBJ) $(RX)\rx_event.c
 
index 9f44d52495e2a11db205d89da91e61e9e4dbb760..4269ce73dc66bf94904ef12f865b109b9b2b1265 100644 (file)
@@ -77,6 +77,7 @@ xdrrec_eof
 xdrrec_skiprecord
 xdrrx_create
 xdr_afsuuid
+xdr_int64
 hton_syserr_conv
 rxkad_stats
 _et_list
index 2b13b6e6ad0ccf08058c880b7da286363890a543..3957c7faac4f9110a77f54cd6a1d22a70f64ba89 100644 (file)
@@ -155,7 +155,8 @@ UAFSOBJ = \
        $(UOBJ)/hostparse.o \
        $(UOBJ)/Krxstat.ss.o \
        $(UOBJ)/Krxstat.xdr.o \
-       $(UOBJ)/rxstat.o
+       $(UOBJ)/rxstat.o \
+       $(UOBJ)/xdr_int64.o
 
 AFSWEBOBJ = \
        $(WEBOBJ)/afs_atomlist.o \
@@ -521,6 +522,8 @@ $(UOBJ)/rx_conncache.o: $(RX)/rx_conncache.c
        $(CRULE1);
 $(UOBJ)/xdr_rx.o: $(RX)/xdr_rx.c
        $(CRULE1);
+$(UOBJ)/xdr_int64.o: $(RX)/xdr_int64.c
+       $(CRULE1);
 $(UOBJ)/afs_usrops.o: $(AFS)/afs_usrops.c
        $(CRULE1);
 $(UOBJ)/afs_uuid.o: $(AFS)/afs_uuid.c
index 83fe167622a02102119c06cc2569cdb1a883bba2..df8d0a1095da3549659401c22538f02e346080d6 100644 (file)
@@ -18,7 +18,7 @@ CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
 AR = /usr/bin/ar
 ARFLAGS = -r
 RANLIB = /bin/ranlib
-CC = /usr/bin/xlc_r
+CC = xlc_r
 DEF_LIBPATH=/usr/lib/threads:/usr/lib:/lib
 EXPFILE=../nsafslib.exp 
 LD_FLAGS=-bM:SRE -bE:$(EXPFILE) -berok -bnoentry -blibpath:$(DEF_LIBPATH)
index cfacbe4fea232e2e556e230fb33f0e2663bec7cd..4111dc46894a1c2d0c3b654f28ec957a648100b4 100644 (file)
@@ -21,8 +21,8 @@ CFLAGS=${OPTIMIZE} -I${SRCDIR}include ${XCFLAGS}
 include ../config/Makefile.version
 
 LIBOBJS=lwp.o process.o lock.o iomgr.o timer.o fasttime.o preempt.o \
-       waitkey.o AFS_component_version_number.o
-LIBTOBJS=tlwp.o process.o lock.o tiomgr.o timer.o fasttime.o preempt.o AFS_component_version_number.o pthread.o
+       waitkey.o threadname.o AFS_component_version_number.o
+LIBTOBJS=tlwp.o process.o lock.o tiomgr.o timer.o fasttime.o preempt.o AFS_component_version_number.o pthread.o threadname.o
 
 noversion: install
 
@@ -66,6 +66,10 @@ process.o    : process.s process.c
                                        $(CC) -c -I${SRCDIR}include -KPIC -G0  process.s;; \
                                sgi_61 | sgi_62 | sgi_63 ) \
                                        $(CC) -c ${XCFLAGS} -I${SRCDIR}include -KPIC -G0  process.s;; \
+                               s390*) \
+                                       /lib/cpp -P -I${SRCDIR}include process.s >process.ss; \
+                                       ${AS} -ahlns process.ss -o process.o >process.lst; \
+                                       rm process.ss ;; \
                                hp* | *_linux* | sgi_64 | sgi_65) \
                                        ${CC} ${CFLAGS} -c process.c;; \
                                ncrx86_*) \
@@ -97,6 +101,7 @@ lwp.o                : lwp.c lwp.h
 lock.o         : lock.c lock.h lwp.h
 timer.o                : timer.c
 fasttime.o     : fasttime.c
+threadname.o    : threadname.c
 
 exc_handling.o : exc_handling.c
 
index 2ddc0469cdda3d22391399c853aa4c508941c8c1..5fcb9e5e262d95b3a03d0b9f2ee1f8c91fb546af 100644 (file)
@@ -16,6 +16,7 @@ LIBOBJS = lock.obj \
          timer.obj\
          fasttime.obj \
          waitkey.obj \
+         threadname.obj \
          AFS_component_version_number.obj
 
 LIBFILE = $(DESTDIR)\lib\afslwp.lib
index ab1911105fd66cc7aed65197bc52247c5310a83f..7aff635c7390bbeb4f2f3f25f702bc07fc5ed236 100644 (file)
@@ -87,6 +87,18 @@ void Lock_Destroy(struct Lock *lock);
            LOCK_UNLOCK(lock) \
        ENDMAC
     
+#define ObtainReadLockNoBlock(lock, code)\
+        BEGINMAC \
+            LOCK_LOCK(lock) \
+            if (!((lock)->excl_locked & WRITE_LOCK) && !(lock)->wait_states) {\
+                (lock) -> readers_reading++;\
+                code = 0;\
+            }\
+            else\
+                code = -1; \
+            LOCK_UNLOCK(lock) \
+        ENDMAC
+
 #define ObtainWriteLock(lock)\
        BEGINMAC \
            LOCK_LOCK(lock) \
@@ -97,6 +109,18 @@ void Lock_Destroy(struct Lock *lock);
            LOCK_UNLOCK(lock) \
        ENDMAC
     
+#define ObtainWriteLockNoBlock(lock, code)\
+        BEGINMAC \
+            LOCK_LOCK(lock) \
+            if (!(lock)->excl_locked && !(lock)->readers_reading) {\
+                (lock) -> excl_locked = WRITE_LOCK;\
+                code = 0;\
+            }\
+            else\
+                code = -1; \
+            LOCK_UNLOCK(lock) \
+        ENDMAC
+
 #define ObtainSharedLock(lock)\
        BEGINMAC \
            LOCK_LOCK(lock) \
@@ -107,6 +131,18 @@ void Lock_Destroy(struct Lock *lock);
            LOCK_UNLOCK(lock) \
        ENDMAC
 
+#define ObtainSharedLockNoBlock(lock, code)\
+        BEGINMAC \
+            LOCK_LOCK(lock) \
+            if (!(lock)->excl_locked && !(lock)->wait_states) {\
+                (lock) -> excl_locked = SHARED_LOCK;\
+                code = 0;\
+            }\
+            else\
+                code = -1; \
+            LOCK_UNLOCK(lock) \
+        ENDMAC
+
 #define BoostSharedLock(lock)\
        BEGINMAC \
            LOCK_LOCK(lock) \
index 02433b6f0e8291f838cf5129c2181cbee3a3e081..b9282ef1aafc53eba4e6d734b622341e4893de00 100644 (file)
@@ -275,6 +275,15 @@ int LWP_CurrentProcess(PROCESS *pid)
        return LWP_EINIT;
 }
 
+PROCESS LWP_ThreadId()
+{
+    Debug(0, ("Entered ThreadId"))
+    if (lwp_init)
+        return lwp_cpptr;
+    else
+        return (PROCESS) 0;
+}
+
 int LWP_DispatchProcess(void)          /* explicit voluntary preemption */
 {
     Debug(2, ("Entered Dispatch_Process"))
index 4327570d56f9aa5b3acf20591429292dd94bfa62..899e3842c6d8ad7f36e0b4667ab52a07d025eb28 100644 (file)
@@ -165,7 +165,93 @@ PRE_Block.S:
        .extern PRE_Block[ua]
 
 #endif /* RIOS */
+#if defined(AFS_S390_LINUX20_ENV)
+      /* Linux for S/390 (31 bit)
+       *
+       * Written by Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
+       *
+       *  additional munging by Adam Thornton <adam@sinenomine.net>
+       */
+              .file   "process.s"
+
+              .globl savecontext
+              .type  savecontext,%function
+      /*
+       * savecontext(f, area1, newsp)
+       *      int (*f)();    struct savearea *area1; char *newsp;
+       * f     - r2
+       * area1 - r3
+       * newsp - r4
+       */
+
+       /*
+        * struct savearea {
+        *      char    *topstack;
+        * }
+        */
+
+P_PRE:                   .long   PRE_Block
+P_ABORT:                     .long   abort
 
+savecontext:
+              stm     %r6,%r15,24(%r15)       /* Save our registers */
+              lr      %r1,%r15
+              ahi     %r15,-96                /* Move out of harm's way */
+              st      %r1,0(%r15)
+              bras    %r5,.L0                 /* Get A(A(PRE_Block)) */
+              .long   PRE_Block
+      .L0:
+              l       %r5,0(%r5)              /* Get A(PRE_Block) */
+              mvi     0(%r5),1                /* Set it */
+              lr      %r6,%r3                 /* Get base of savearea */
+              st      %r15,0(%r3)             /* Save stack pointer */
+              ltr     %r4,%r4                 /* If new sp is 0 */
+              jz      .L1                     /* ... don't change sp */
+              lr      %r15,%r4                /* Set new stack pointer */
+      .L1:
+              br      %r2                     /* Call the routine */
+              /* Can't get here....*/
+
+              bras    %r5,.L2
+              .long   abort
+      .L2:
+              l      %r5,0(%r5)
+              balr    %r14,%r5
+
+      .savecontext_end:
+              .size   savecontext,.savecontext_end-savecontext
+
+      /*
+       * returnto(area2)
+       *      struct savearea *area2;
+       *
+       * area2 - r2
+       */
+        .globl  returnto
+        .type   returnto,%function
+returnto:
+        l       %r15,0(%r2)             /* New frame, to get correct pointer*/
+        bras    %r5,.L3                         /* Get A(A(PRE_Block))
+      */
+                 .long          PRE_Block
+      .L3:
+              l       %r5,0(%r5)              /* Get A(PRE_Block) */
+              xc      0(4,%r5),0(%r5)         /* Clear it */
+              l       %r15,0(%r15)
+              lm      %r6,%r15,24(%r15)       /* Restore registers */
+              br      %r14                    /* Return */
+
+             /* Can't happen */
+              la      %r2,1234
+              bras    %r5,.L4
+                .long          abort
+      .L4:
+              l       %r5,0(%r5)
+              basr    %r14,%r5
+      .returnto_end:
+              .size   returnto,.returnto_end-returnto
+#endif /* AFS_S390_LINUX20_ENV */
+       
 #ifdef mc68000
 /*
 #
index 40cb35443e522894e9b8afe280fb80f7b8bfaa0b..5c3ada17d3bfc7fa4c9be96aa8b650f437a365e3 100644 (file)
@@ -184,7 +184,10 @@ extern struct servent *servp;
 extern char *malloc(), *ntoa();
 extern double drift_comp, compliance;  /* logical clock variables */
 extern double s_fixed_to_double(), ul_fixed_to_double();
-extern void make_new_peer(), double_to_s_fixed(), tstamp(), demobilize();
+extern void make_new_peer(), double_to_s_fixed(), demobilize();
+#ifndef AFS_SUN58_ENV
+extern void tstamp();
+#endif
        
 
 #ifdef REFCLOCK
index 28e017a2ed877603f45df348a4208fde1dc89b97..28bdbf31a5b941c0bc1cf03f69d0c8c1322ce467 100644 (file)
@@ -233,7 +233,8 @@ double_to_s_fixed(t, value)
        results in the value 2^31.  Neither 4.2bsd nor VMS have this
        problem.  Reported it to Bob O'Brien of SMI
 */
-#ifdef SUN_FLT_BUG
+#ifndef AFS_SUN58_ENV
+#ifdef SUN_FLT_BUG 
 tstamp(stampp, tvp)
        struct l_fixedpt *stampp;
        struct timeval *tvp;
@@ -255,6 +256,7 @@ tstamp(stampp, tvp)
        stampp->fraction = ntohl((afs_uint32) ((float) tvp->tv_usec * 4294.967295));
 }
 #endif
+#endif /* AFS_SUN58_ENV */
 
 /*
  * ntoa is similar to inet_ntoa, but cycles through a set of 8 buffers
index f26020636b1a5a2575a11e5234651dd623316556..aad7939b3b6c6fd35c86138362ad95f63619925c 100644 (file)
@@ -42,6 +42,8 @@ pam_sm_authenticate(
     int use_first_pass = 0;
     int try_first_pass = 0;
     int ignore_root = 0;
+    int trust_root = 0;
+    int catch_su = 0;
     int set_expires = 0;  /* This option is only used in pam_set_cred() */
     int got_authtok = 0;       /* got PAM_AUTHTOK upon entry */
     int nouser = 0;
@@ -80,6 +82,10 @@ pam_sm_authenticate(
            try_first_pass = 1;
        } else if (strcasecmp(argv[i], "ignore_root"   ) == 0) {
            ignore_root = 1;
+       } else if (strcasecmp(argv[i], "trust_root"   ) == 0) {
+           trust_root = 1;
+       } else if (strcasecmp(argv[i], "catch_su"   ) == 0) {
+           catch_su = 1;
        } else if (strcasecmp(argv[i], "setenv_password_expires") == 0) {
             set_expires = 1;
        } else {
@@ -107,6 +113,11 @@ pam_sm_authenticate(
        RET(PAM_USER_UNKNOWN);
     }
 
+    if ((!strncmp ("root", user, 4)) && trust_root) {
+       pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user);
+       RET(PAM_SUCCESS);
+    }
+
     pam_afs_syslog(LOG_DEBUG, PAMAFS_USERNAMEDEBUG, user);
 
     /*
@@ -132,9 +143,14 @@ pam_sm_authenticate(
 #else
     upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
 #endif
-    if (ignore_root && upwd != NULL && upwd->pw_uid == 0) {
-       pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
-       RET(PAM_AUTH_ERR);
+    if (upwd != NULL && upwd->pw_uid == 0) {
+       if (ignore_root) { 
+               pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
+               RET(PAM_AUTH_ERR);
+       } else if (trust_root && !catch_su) {
+               pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user);
+               RET(PAM_SUCCESS);
+       }
     }
 #endif
     errcode = pam_get_item(pamh, PAM_AUTHTOK, (void **) &password);
index 381054e663973dbbf5fafdf911c63a98124023a4..da3c7081770f5bb98a9bf9e3cdda754092a2fd78 100644 (file)
@@ -36,7 +36,7 @@ static char *fallback_messages[] = {
     "AFS not available",                       /* 10: AFS_UNAVAIL      */
     "AFS error code 0x%x",                     /* 11: AFS_ERROR        */
     "AFS Authentication succeeded.\n",         /* 12: LOGIN_OK         */
-    "AFS Authentication failed for user %s. %s\n",
+    "AFS Authentication failed for user %s %s\n",
                                                /* 13: LOGIN_FAILED     */
     "AFS PAM error, code=%d",                  /* 14: PAMERROR         */
     "AFS uid exceeds OS bounds.\n",            /* 15: UID_OVERFLOW     */
@@ -64,6 +64,17 @@ static char *fallback_messages[] = {
     "AFS ReInitializing creds for user %s\n",  /* 31: REINITCRED       */
     "AFS Failed to set PASSWORD_EXPIRES for user %s\n",
                                                /* 32: PASSEXPFAIL      */
+    "",
+                                               /* 33: */
+    "",
+                                               /* 34: */
+    "AFS blindly trusting user %s\n",          /* 35: TRUSTROOT        */
+    "New AFS Password: ",                       /* 36: NEW_PWD_PROMPT   */
+    "New AFS Password (again): ",               /* 37: VERIFY_PWD_PROMPT */
+    "Failed to change AFS password",            /* 38: KRBPASS_FAIL     */
+    "Missing PAM flag: %s",                     /* 39: FLAGS            */
+    "ka error, code=%d",                        /* 40: KAERROR          */
+    "Passwords are not equal"                   /* 41: NE_PASSWORD      */
 };
 
 static int num_fallbacks = sizeof(fallback_messages)/sizeof(char *);
index 46de2c502bd4cbb2e7f5594c49d59898ab903fe4..8b211b0454cf12b569a9eba3dbb31eb32a243a9a 100644 (file)
 #define PAMAFS_PASSEXPFAIL     32 /* "Failed to set PASSWORD_EXPIRES"  */
 #define PAMAFS_CHOWNKRB                33 /* "Failed to chown krb ticketfile"  */
 #define PAMAFS_KRBFAIL         34 /* "Failed to set KRBTKTFILE"        */
-
+#define PAMAFS_TRUSTROOT       35 /* "Ignoring superuser %s"           */
+#define PAMAFS_NEW_PWD_PROMPT   36 /* "New AFS Password:"               */
+#define PAMAFS_VERIFY_PWD_PROMPT  37 /* "New AFS Password (again):"     */
+#define PAMAFS_KAPASS_FAIL      38 /* "Failed to change AFS password"   */
+#define PAMAFS_FLAGS            39 /* "Missing PAM flag:"               */
+#define PAMAFS_KAERROR          40 /* "ka error, code=%d"               */
+#define PAMAFS_NE_PASSWORD      41 /* "Passwords are not equal"         */  
 
 char *pam_afs_message(int msgnum, int *freeit);
 void pam_afs_syslog(int priority, int msgid, ...);
index 3bd3dd8307da14bb6889ad9deb5801b3a4030529..c644e856828cb7ad51ebe73d9ab887d7680a56d2 100644 (file)
@@ -9,6 +9,22 @@
 
 #include <security/pam_appl.h>
 #include <security/pam_modules.h>
+#include <syslog.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pwd.h>
+#include <unistd.h>
+#include <afs/param.h>
+#include <sys/param.h>
+#include <afs/kautils.h>
+#include "afs_message.h"
+#include "afs_util.h"
+#include "afs_pam_msg.h"
+#include <signal.h>
+#include <sys/wait.h>
+#include <errno.h>
+
+#define RET(x) { retcode = (x); goto out; }
 
 extern int
 pam_sm_chauthtok(
@@ -17,5 +33,267 @@ pam_sm_chauthtok(
        int             argc,
        const char      **argv)
 {
-    return PAM_PERM_DENIED;
+    int retcode = PAM_SUCCESS;
+    int errcode = PAM_SUCCESS;
+    int code;
+    int origmask;
+    int logmask = LOG_UPTO(LOG_INFO);
+    int nowarn = 0;
+    int use_first_pass = 0;
+    int try_first_pass = 0;
+    int ignore_root = 0;
+    int got_authtok = 0;       /* got PAM_AUTHTOK upon entry */
+    int torch_password = 1;
+    int i;
+    char my_password_buf[256];
+    char instance[256];
+    char realm[256];
+    char cell[256];
+    char *localcell;
+    char *user = NULL, *password = NULL;
+    char *new_password = NULL, *verify_password = NULL;
+    char upwd_buf[2048];       /* size is a guess. */
+    char*      reason = NULL;
+    struct ktc_encryptionKey oldkey, newkey;
+    struct ktc_token token;
+    struct ubik_client *conn = 0;
+    struct pam_conv *pam_convp = NULL;
+    struct passwd unix_pwd, *upwd = NULL;
+
+#ifndef AFS_SUN56_ENV
+    openlog(pam_afs_ident, LOG_CONS, LOG_AUTH);
+#endif
+    origmask = setlogmask(logmask);
+
+    /*
+     * Parse the user options.  Log an error for any unknown options.
+     *
+     * Todo options: PAM_SILENT
+     */
+    for (i = 0; i < argc; i++) {
+       if (       strcasecmp(argv[i], "debug"         ) == 0) {
+           logmask |= LOG_MASK(LOG_DEBUG);
+           (void) setlogmask(logmask);
+       } else if (strcasecmp(argv[i], "nowarn"        ) == 0) {
+           nowarn = 1;
+       } else if (strcasecmp(argv[i], "use_first_pass") == 0) {
+           use_first_pass = 1;
+       } else if (strcasecmp(argv[i], "try_first_pass") == 0) {
+           try_first_pass = 1;
+       } else if (strcasecmp(argv[i], "ignore_root"   ) == 0) {
+           ignore_root = 1;
+       } else {
+           pam_afs_syslog(LOG_ERR, PAMAFS_UNKNOWNOPT, argv[i]);
+       }
+    }
+
+    if (use_first_pass) try_first_pass = 0;
+
+    pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass);
+    pam_afs_syslog(LOG_DEBUG, PAMAFS_PAMERROR, flags);
+
+    /* Try to get the user-interaction info, if available. */
+    errcode = pam_get_item(pamh, PAM_CONV, (const void **) &pam_convp);
+    if (errcode != PAM_SUCCESS) {
+       pam_afs_syslog(LOG_WARNING, PAMAFS_NO_USER_INT);
+       pam_convp = NULL;
+    }
+
+    /* Who are we trying to authenticate here? */
+    if ((errcode = pam_get_user(pamh, (const char **)&user, "AFS username: ")) != PAM_SUCCESS) {
+       pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode);
+       RET(PAM_USER_UNKNOWN);
+    }
+
+    pam_afs_syslog(LOG_DEBUG, PAMAFS_USERNAMEDEBUG, user);
+
+    /*
+     * If the user has a "local" (or via nss, possibly nss_dce) pwent,
+     * and its uid==0, and "ignore_root" was given in pam.conf,
+     * ignore the user.
+     */
+#if    defined(AFS_HPUX_ENV)
+#if     defined(AFS_HPUX110_ENV)
+    i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd);
+#else   /* AFS_HPUX110_ENV */
+    i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
+    if ( i == 0 )                      /* getpwnam_r success */
+       upwd = &unix_pwd; 
+#endif  /* else AFS_HPUX110_ENV */
+    if (ignore_root && i == 0  && upwd->pw_uid == 0) {
+       pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
+       RET(PAM_AUTH_ERR);
+    }
+#else
+#ifdef AFS_LINUX20_ENV
+    upwd = getpwnam(user);
+#else
+    upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
+#endif
+    if (ignore_root && upwd != NULL && upwd->pw_uid == 0) {
+       pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
+       RET(PAM_AUTH_ERR);
+    }
+#endif
+
+    errcode = pam_get_item(pamh, PAM_AUTHTOK, (const void **) &password);
+    if (errcode != PAM_SUCCESS || password == NULL) {
+       if (use_first_pass) {
+           pam_afs_syslog(LOG_ERR, PAMAFS_PASSWD_REQ, user);
+           RET(PAM_AUTH_ERR);
+       }
+       password = NULL;        /* In case it isn't already NULL */
+       pam_afs_syslog(LOG_DEBUG, PAMAFS_NOFIRSTPASS, user);
+    } else if (password[0] == '\0') {
+       /* Actually we *did* get one but it was empty. */
+       torch_password = 0;
+       pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user);
+       RET(PAM_NEW_AUTHTOK_REQD);
+    } else {
+       pam_afs_syslog(LOG_DEBUG, PAMAFS_GOTPASS, user);
+       torch_password = 0;
+       got_authtok = 1;
+    }
+    if (!(use_first_pass || try_first_pass)) {
+       password = NULL;
+    }
+
+    if (password == NULL) {
+       torch_password = 1;
+       if (use_first_pass)
+           RET(PAM_AUTH_ERR);  /* shouldn't happen */
+       if (try_first_pass)
+           try_first_pass = 0; 
+       if (pam_convp == NULL || pam_convp->conv == NULL) {
+           pam_afs_syslog(LOG_ERR, PAMAFS_CANNOT_PROMPT);
+           RET(PAM_AUTH_ERR);
+       }
+
+       errcode = pam_afs_prompt(pam_convp, &password, 0, PAMAFS_PWD_PROMPT);
+       if (errcode != PAM_SUCCESS || password == NULL) {
+           pam_afs_syslog(LOG_ERR, PAMAFS_GETPASS_FAILED);
+           RET(PAM_AUTH_ERR);
+       }
+       if (password[0] == '\0') {
+           pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user);
+           RET(PAM_NEW_AUTHTOK_REQD);
+       }
+
+       /*
+         * We aren't going to free the password later (we will wipe it,
+         * though), because the storage for it if we get it from other
+         * paths may belong to someone else.  Since we do need to free
+         * this storage, copy it to a buffer that won't need to be freed
+         * later, and free this storage now.
+         */
+        strncpy(my_password_buf, password, sizeof(my_password_buf));
+        my_password_buf[sizeof(my_password_buf)-1] = '\0';
+        memset(password, 0, strlen(password));
+        free(password);
+        password = my_password_buf;
+    }
+
+    if ( (code = ka_VerifyUserPassword(KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG,
+                                   user, /* kerberos name */
+                                   (char *)0, /* instance */
+                                   (char *)0, /* realm */
+                                   password, /* password */
+                                   0, /* spare 2 */
+                                   &reason /* error string */ )) !=0 ) {
+       pam_afs_syslog(LOG_ERR, PAMAFS_LOGIN_FAILED, user, reason);
+        RET(PAM_AUTH_ERR);
+    }
+    torch_password = 0;
+    pam_set_item(pamh, PAM_AUTHTOK, password);
+    pam_set_item(pamh, PAM_OLDAUTHTOK, password);
+    if (flags & PAM_PRELIM_CHECK) {
+       /* only auth check was requested, so return success here */
+       return(PAM_SUCCESS);
+    }
+    if (!(flags & PAM_UPDATE_AUTHTOK)) {
+       /* these lines are never executed ... */
+       /* UPDATE_AUTHTOK flag is required, return with error */
+       pam_afs_syslog(LOG_ERR, PAMAFS_FLAGS, "PAM_UPDATE_AUTHTOK");
+       RET(PAM_AUTH_ERR);
+    }
+
+    /* get the new passwd and verify it */
+    errcode = pam_afs_prompt(pam_convp, &new_password, 0, PAMAFS_NEW_PWD_PROMPT);
+    if (errcode != PAM_SUCCESS || new_password == NULL) {
+        pam_afs_syslog(LOG_ERR, PAMAFS_GETPASS_FAILED);
+        RET(PAM_AUTH_ERR);
+    }
+    if (new_password[0] == '\0') {
+        pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user);
+        RET(PAM_AUTH_ERR);
+    }
+    errcode = pam_afs_prompt(pam_convp, &verify_password, 0, PAMAFS_VERIFY_PWD_PROMPT);
+    if (errcode != PAM_SUCCESS || verify_password == NULL) {
+        pam_afs_syslog(LOG_ERR, PAMAFS_GETPASS_FAILED);
+       memset(new_password, 0, strlen(new_password));
+        RET(PAM_AUTH_ERR);
+    }
+    if (verify_password[0] == '\0') {
+        pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user);
+       memset(new_password, 0, strlen(new_password));
+        RET(PAM_AUTH_ERR);
+    }
+    if (strcmp(new_password, verify_password) != 0) {
+        pam_afs_syslog(LOG_INFO, PAMAFS_NE_PASSWORD);
+       memset(new_password, 0, strlen(new_password));
+       memset(verify_password, 0, strlen(verify_password));
+        RET(PAM_AUTH_ERR);
+    }
+    memset(verify_password, 0, strlen(verify_password));
+    /* checking password length and quality is up to other PAM modules */ 
+
+    /* set the new password */
+    if ((code = ka_Init(0)) != 0) {
+        pam_afs_syslog(LOG_ERR, PAMAFS_KAERROR, code);
+        RET(PAM_AUTH_ERR);
+    }
+    if ((code = rx_Init(0)) != 0) {
+        pam_afs_syslog(LOG_ERR, PAMAFS_KAERROR, code);
+        RET(PAM_AUTH_ERR);
+    }
+    strcpy(instance,"");
+    if ((localcell = ka_LocalCell()) == NULL) {
+        pam_afs_syslog(LOG_ERR, PAMAFS_NOCELLNAME);
+        RET(PAM_AUTH_ERR);
+    }
+    strcpy(realm,localcell);
+    strcpy(cell,realm);
+    /* oldkey is not used in ka_ChangePassword (only for ka_auth) */
+    ka_StringToKey(password, realm, &oldkey);
+    ka_StringToKey(new_password, realm, &newkey);
+    if ((code = ka_GetAdminToken(user, instance, realm, &oldkey, 20, &token, 0)) != 0) {
+        pam_afs_syslog(LOG_ERR, PAMAFS_KAERROR, code);
+        RET(PAM_AUTH_ERR);
+    }
+    if ((code = ka_AuthServerConn(realm, KA_MAINTENANCE_SERVICE, &token, &conn)) != 0) { 
+        pam_afs_syslog(LOG_ERR, PAMAFS_KAERROR, code);
+        RET(PAM_AUTH_ERR);
+    }
+    if ((code = ka_ChangePassword(user,     /* kerberos name */
+                                 instance, /* instance */
+                                 conn,     /* conn */
+                                 0,        /* old password unused */
+                                 &newkey   /* new password */ )) != 0) {
+       pam_afs_syslog(LOG_ERR, PAMAFS_KAPASS_FAIL);
+        memset(new_password, 0, strlen(new_password));
+        RET(PAM_AUTH_ERR);
+    } else {
+        pam_set_item(pamh, PAM_AUTHTOK, new_password);
+        RET(PAM_SUCCESS);
+    }
+       
+ out:
+    if (password && torch_password) {
+        memset(password, 0, strlen(password));
+    }
+    (void) setlogmask(origmask);
+#ifndef AFS_SUN56_ENV
+    closelog();
+#endif
+    return retcode;
 }
index e7115c3b54b4e777e5228508a131a350b304ba1e..daf17817661c366c67cf3344589ad457c16a1355 100644 (file)
@@ -44,6 +44,7 @@ pam_sm_setcred(
     int try_first_pass = 0;
     int got_authtok = 0;
     int ignore_root = 0;
+    int trust_root = 0;
     int set_expires = 0; /* the default is to not to set the env variable */
     int i;
     struct pam_conv *pam_convp = NULL;
@@ -79,6 +80,10 @@ pam_sm_setcred(
            try_first_pass = 1;
         } else if (strcasecmp(argv[i], "ignore_root"   ) == 0) {
             ignore_root = 1;
+        } else if (strcasecmp(argv[i], "trust_root"   ) == 0) {
+            trust_root = 1;
+        } else if (strcasecmp(argv[i], "catch_su"   ) == 0) {
+            use_first_pass = 0;
        } else if (strcasecmp(argv[i], "setenv_password_expires")==0) {
            set_expires = 1;
        } else {
@@ -124,9 +129,14 @@ pam_sm_setcred(
 #else
     upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
 #endif
-    if (ignore_root && upwd != NULL && upwd->pw_uid == 0) {
-        pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
-        RET(PAM_AUTH_ERR);
+    if (upwd != NULL && upwd->pw_uid == 0) {
+       if (ignore_root) { 
+               pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
+               RET(PAM_AUTH_ERR);
+       } else if (trust_root) {
+               pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user);
+               RET(PAM_SUCCESS);
+       }
     }
 #endif
 
index 291251f34876b52d712df01450ea02b2fc0db076..e29fe7cfd1e62beddf86d0e54b1f916eb3d2c187 100644 (file)
@@ -64,7 +64,6 @@ void main (argc, argv)
   char **argv;
 {
     register afs_int32 code;
-    afs_int32 serverList[MAXSERVERS];
     afs_int32 myHost;
     register struct hostent *th;
     char hostname[64];
@@ -81,6 +80,7 @@ void main (argc, argv)
     int kerberosKeys;                  /* set if found some keys */
     afs_int32 i,j;
     int lwps = 3;
+    char clones[MAXHOSTSPERCELL];
 
     const char *pr_dbaseName;
     char *whoami = "ptserver";
@@ -189,7 +189,8 @@ void main (argc, argv)
     bcopy(th->h_addr,&myHost,sizeof(afs_int32));
         
     /* get list of servers */
-    code = afsconf_GetCellInfo(prdir,(char *)0,"afsprot",&info);
+    code = afsconf_GetExtendedCellInfo(prdir,(char *)0,"afsprot",
+                       &info, &clones);
     if (code) {
        com_err (whoami, code, "Couldn't get server list");
        PT_EXIT(2);
@@ -197,11 +198,6 @@ void main (argc, argv)
     pr_realmName = info.name;
     pr_realmNameLen = strlen (pr_realmName);
 
-    for (i=0,j=0;i<info.numServers;i++)
-       if (info.hostAddr[i].sin_addr.s_addr != myHost) /* ubik already tacks myHost onto list */
-           serverList[j++] = info.hostAddr[i].sin_addr.s_addr;
-    serverList[j] = 0;
-
 #if 0
     /* get keys */
     code = afsconf_GetKey(prdir,999,&tkey);
@@ -234,8 +230,8 @@ void main (argc, argv)
      * and the header are in separate Ubik buffers then 120 buffers may be
      * required. */
     ubik_nBuffers = 120 + /*fudge*/40;
-    code = ubik_ServerInit(myHost, htons(AFSCONF_PROTPORT), serverList,
-                          pr_dbaseName, &dbase);
+    code = ubik_ServerInitByInfo(myHost, htons(AFSCONF_PROTPORT), &info,
+                           &clones, pr_dbaseName, &dbase);
     if (code) {
        com_err (whoami, code, "Ubik init failed");
        PT_EXIT(2);
index 44e2a0f494d27877217420532cb66e53cfa85df3..f4af3525261cdccc5bb52824d9a3c30bf75331b8 100644 (file)
@@ -24,7 +24,8 @@ CFLAGS = ${OPTMZ} -I${SRCDIR}include -DRXDEBUG ${XCFLAGS}
 XDROBJS = xdr_arrayn.o xdr_rx.o xdr_afsuuid.o
 
 RXOBJS = rx_clock.o rx_event.o rx_user.o rx_lwp.o rx.o rx_null.o rx_globals.o \
-       rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o  rx_trace.o rx_conncache.o
+       rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o  rx_trace.o rx_conncache.o \
+       xdr_int64.o
 
 MULTIOBJS = rx_multi.o
 
@@ -43,7 +44,7 @@ KSRCS = rx.c rx.h rx_clock.c rx_clock.h rx_event.c rx_event.h \
        rx_null.c rx_null.h rx_queue.h rx_getaddr.c rx_packet.c rx_packet.h \
        rx_multi.h rx_kcommon.h rx_kcommon.c \
        xdr.c xdr.h xdr_array.c xdr_arrayn.c xdr_rx.c rx_misc.c rx_rdwr.c \
-       xdr_afsuuid.c rx_trace.h
+       xdr_afsuuid.c rx_trace.h xdr_int64.c
 UKSRCS = $(KSRCS) rx_conncache.c
 
 include ../config/Makefile.version
@@ -119,8 +120,8 @@ includes: rx.h rx_user.h rx_event.h rx_queue.h rx_clock.h xdr.h rx_null.h rx_glo
 kinstall: includes
        set $(KERNELDIR)rx; $(MKDIR_IF_NEEDED)
        $(INSTALL) $(KSRCS) $(KERNELDIR)rx
-       @case ${SYS_NAME} in \
-       alpha_dux4* ) \
+       case ${SYS_NAME} in \
+       alpha_dux* ) \
                $(INSTALL) DUX/*.[ch] $(KERNELDIR)rx;; \
        hp_ux* ) \
                $(INSTALL) HPUX/*.[ch] $(KERNELDIR)rx;; \
@@ -139,7 +140,7 @@ kinstall: includes
 ukinstall webinstall: includes
        set $(UKERNELDIR)rx; $(MKDIR_IF_NEEDED)
        $(INSTALL) $(UKSRCS) $(UKERNELDIR)rx
-       $(INSTALL) UKERNEL/*.[ch] $(UKERNELDIR)rx
+       -$(INSTALL) UKERNEL/*.[ch] $(UKERNELDIR)rx
 
 clean:
        rm -f *.o *.a core *_component_version_number.c
index a5f3ad8f34e1d2ceb1c4f79d1a21f34b391397e6..004ad2946f386a8e3093af1d5379c5fa6f41470e 100644 (file)
@@ -20,7 +20,8 @@ LIBFILE = $(DESTDIR)\lib\afsrx.lib
 
 # Object files by category.
 XDROBJS = xdr.obj xdr_array.obj xdr_arrayn.obj xdr_float.obj xdr_mem.obj \
-       xdr_rec.obj  xdr_refernce.obj xdr_rx.obj xdr_update.obj xdr_afsuuid.obj
+       xdr_rec.obj  xdr_refernce.obj xdr_rx.obj xdr_update.obj \
+       xdr_afsuuid.obj xdr_int64.obj
 
 RXOBJS = rx_clock_nt.obj rx_event.obj rx_user.obj rx_lwp.obj rx.obj \
        rx_null.obj rx_globals.obj rx_getaddr.obj rx_misc.obj rx_packet.obj \
index 4938035a636796200bc2c2822715a92c7365033b..546ae0f662c21ea45e9433cc2428846a5be25488 100644 (file)
@@ -46,13 +46,13 @@ struct clock clock_now;             /* The last elapsed time ready by clock_GetTimer */
 int clock_haveCurrentTime;
 
 int clock_nUpdates;            /* The actual number of clock updates */
+static int clockInitialized = 0;
 
 /* Initialize the clock */
 void clock_Init(void) {
-    static initialized = 0;
     struct itimerval itimer, otimer;
 
-    if (!initialized) {
+    if (!clockInitialized) {
        itimer.it_value.tv_sec = STARTVALUE;
        itimer.it_value.tv_usec = 0;
        itimer.it_interval.tv_sec = 0;
@@ -64,12 +64,20 @@ void clock_Init(void) {
            fflush (stderr);
            exit(1);
        }
-       initialized = 1;
+       clockInitialized = 1;
     }
 
     clock_UpdateTime();
 }
 
+#ifndef KERNEL
+/* Make clock uninitialized. */
+clock_UnInit()
+{
+    clockInitialized = 0;
+} 
+#endif 
+
 /* Compute the current time.  The timer gets the current total elapsed time since startup, expressed in seconds and microseconds.  This call is almost 200 usec on an APC RT */
 void clock_UpdateTime()
 {
index 5b1bb934b97db0ec04f498c3e27ba00cb07c95df..d765720a3814ffdd63bac88c3774aeffe3ab5adc 100644 (file)
@@ -27,6 +27,7 @@ struct clock clock_now;       /* The last elapsed time ready by clock_GetTimer */
 int clock_haveCurrentTime;
 
 int clock_nUpdates;            /* The actual number of clock updates */
+static int clockInitialized = 0;
 
 /* Timing tests show that we can compute times at about 4uS per call. */
 LARGE_INTEGER rxi_clock0;
@@ -38,11 +39,20 @@ void clock_Init()
        exit(1);
     }
 
+    clockInitialized = 1;
     (void) QueryPerformanceCounter(&rxi_clock0);
 
     clock_UpdateTime();
 }
 
+#ifndef KERNEL
+/* Make clock uninitialized. */
+clock_UnInit()
+{
+    clockInitialized = 0;
+}
+#endif
+
 void clock_UpdateTime(void)
 {
     LARGE_INTEGER now, delta;
index 54f1eb1cc36b54ea4ec74335fd60939206dfeaf9..bb267c7fe302a30ae643a208c8cbc1b760dd97c7 100644 (file)
@@ -22,7 +22,7 @@ extern void rxi_StartListener();
 #define rxi_ReScheduleEvents    0 /* Not needed by kernel */
 
 /* This is a no-op, because the kernel server procs are pre-allocated */
-#define rxi_StartServerProcs(x)
+#define rxi_StartServerProcs(x) 0
 
 /* Socket stuff */
 typedef struct socket *osi_socket;
index 6517423b96adf2e4e68d992dd4c3447a16896f4a..f54df1a66e9999e522ac6e790421908db1aa3f63 100644 (file)
@@ -34,6 +34,7 @@
 # include "rx_globals.h"
 # include <lwp.h>
 
+#define MAXTHREADNAMELENGTH 64
 
 int debugSelectFailure;        /* # of times select failed */
 /*
@@ -64,6 +65,16 @@ void rxi_Delay(int sec)
     IOMGR_Sleep(sec);
 }
 
+static int quitListening = 0;
+
+/* This routine will kill the listener thread, if it exists. */
+void
+rxi_StopListener()
+{
+    quitListening = 1;
+    rxi_ReScheduleEvents();
+}
+
 /* This routine will get called by the event package whenever a new,
    earlier than others, event is posted.  If the Listener process
    is blocked in selects, this will unblock it.  It also can be called
@@ -128,10 +139,19 @@ void rxi_ListenerProc(rfds, tnop, newcallp)
     int lastPollWorked, doingPoll;     /* true iff last poll was useful */
     struct timeval tv, *tvp;
     int i, code;
+    PROCESS pid;
+    char name[MAXTHREADNAMELENGTH] = "srv_0";
 
     clock_NewTime();
     lastPollWorked = 0;
     nextPollTime = 0;
+    code = LWP_CurrentProcess(&pid);
+    if (code) {
+        fprintf(stderr, "rxi_Listener: Can't get my pid.\n");
+        exit(1);
+    }
+    rx_listenerPid = pid;
+    swapthreadname(pid, "listener", &name);
 
     for (;;) {
        /* Grab a new packet only if necessary (otherwise re-use the old one) */
@@ -175,6 +195,11 @@ void rxi_ListenerProc(rfds, tnop, newcallp)
        }
        lastPollWorked = 0;     /* default is that it didn't find anything */
 
+       if (quitListening) {
+           quitListening = 0;
+           LWP_DestroyProcess(pid);
+       }
+
        switch(code) {
            case 0: 
                 /* Timer interrupt:
index 2184f06492d6498b612cdee4425995cb60af6bac..b1bbadd13a6e1eb6a925b56ef1227e1b8b378284 100644 (file)
@@ -1059,6 +1059,38 @@ int rx_WritevAlloc(call, iov, nio, maxio, nbytes)
     return bytes;
 }
 
+int rx_WritevInit(call)
+    struct rx_call *call;
+{
+    int bytes;
+    SPLVAR;
+
+    /*
+     * Free any packets from the last call to ReadvProc/WritevProc.
+     * We do not need the lock because the receiver threads only
+     * touch the iovq when the RX_CALL_IOVEC_WAIT flag is set, and the
+     * RX_CALL_IOVEC_WAIT is always cleared before returning from
+     * ReadvProc/WritevProc.
+     */
+    if (!queue_IsEmpty(&call->iovq)) {
+        register struct rx_packet *rp;
+        register struct rx_packet *nxp;
+        for (queue_Scan(&call->iovq, rp, nxp, rx_packet)) {
+            queue_Remove(rp);
+            rxi_FreePacket(rp);
+        }
+    }
+
+    NETPRI;
+    AFS_RXGLOCK();
+    MUTEX_ENTER(&call->lock);
+    bytes = rxi_WriteProc(call, &bytes, 0);
+    MUTEX_EXIT(&call->lock);
+    AFS_RXGUNLOCK();
+    USERPRI;
+    return bytes;
+}
+
 /* rxi_WritevProc -- internal version.
  *
  * Send buffers allocated in rxi_WritevAlloc.
index 7fb77810e258ba830a4d28120dda80231a4327f1..095335089562f9626fdde682566e1ebb5b849358 100644 (file)
@@ -304,6 +304,8 @@ extern bool_t       xdr_double();
 extern bool_t  xdr_reference();
 extern bool_t  xdr_wrapstring();
 extern bool_t  xdr_vector();
+extern bool_t   xdr_int64();
+extern bool_t   xdr_uint64();
 
 /*
  * These are the public routines for the various implementations of
index 7b3a454d5e76c0a4064991889ede0dff0e26401c..15d771ff99114966d6983bfb831f4cb35604c38c 100644 (file)
@@ -251,6 +251,12 @@ write_int32_macros(fout)
        f_print(fout, "#ifndef xdr_afs_uint32\n");
        f_print(fout, "#define xdr_afs_uint32 xdr_u_int\n");
        f_print(fout, "#endif\n");
+        f_print(fout, "#ifndef xdr_afs_int64\n");
+        f_print(fout, "#define xdr_afs_int64 xdr_int64\n");
+        f_print(fout, "#endif\n");
+        f_print(fout, "#ifndef xdr_afs_uint64\n");
+        f_print(fout, "#define xdr_afs_uint64 xdr_uint64\n");
+        f_print(fout, "#endif\n");
 #else
 #error Need to do some work here...
 #endif
@@ -560,6 +566,8 @@ h_output(infile, define, extend, outfile, append)
        f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
        f_print(fout, "#include \"../rx/xdr.h\"\n");
        f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
+       f_print(fout, "extern bool_t xdr_int64();\n");
+       f_print(fout, "extern bool_t xdr_uint64();\n");
        f_print(fout, "#include \"../rpc/xdr.h\"\n");
        f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
        f_print(fout, "#endif /* XDR_GETLONG */\n");
index 97fe5f0df471c5c895c6bdc3cf7cc17b3cf8d215..7ad63324c616ef65bede2544578334b855924e6b 100644 (file)
@@ -22,7 +22,15 @@ typedef uint64_t Inode;
 #else
 #ifdef AFS_NAMEI_ENV
 #include <sys/types.h>
+#ifdef AFS_NEC_SX92_ENV
+typedef unsigned long Inode;
+#else /* AFS_NEC_SX92_ENV */
+#ifdef AFS_64BIT_ENV
+typedef afs_uint64 Inode;
+#else
 typedef u_int64_t Inode;
+#endif
+#endif /* AFS_NEC_SX92_ENV */
 #else
 error Need 64 bit Inode defined.
 #endif /* AFS_NAMEI_ENV */
index 9b4563fd03492c3e9d3fa0339dfa749105df7708..0d37a57367c304cfb68535ffa1f6a53aae1d7dec 100644 (file)
@@ -28,7 +28,7 @@ VICEDOBJS=viced.o afsfileprocs.o host.o physio.o callback.o
 
 VLSERVEROBJS=vldbint.cs.o vldbint.xdr.o
 
-LWPOBJS=lock.o fasttime.o
+LWPOBJS=lock.o fasttime.o threadname.o
 
 LIBACLOBJS=aclprocs.o netprocs.o
 
@@ -101,6 +101,9 @@ lock.o: ${LWP}/lock.c
 fasttime.o: ${LWP}/fasttime.c
        ${CRULE1};
 
+threadname.o: ${LWP}/threadname.c
+       ${CRULE1};
+
 aclprocs.o: ${LIBACL}/aclprocs.c
        ${CRULE1}
 
@@ -184,9 +187,6 @@ fileserver: callback_clean1 viced.o ${objects} ${LIBS}
        *linux*) \
            ${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} \
            ${MTLIBS} ${XLIBS} ;; \
-       sgi_6*) \
-           ${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} \
-           ${MTLIBS} ${XLIBS} ../sgiefs/libefs.a ;; \
        *) \
            ${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} \
            ${MTLIBS} ${XLIBS} ;; \
index b326a335b379ef593224b0fe127df8aad7b8bf5d..b989022f9fe55dcca23aca300366ada01c460ad5 100644 (file)
@@ -32,7 +32,7 @@ VICEDOBJS = viced.obj afsfileprocs.obj host.obj physio.obj callback.obj       \
 
 VLSERVEROBJS = vldbint.cs.obj vldbint.xdr.obj
 
-LWPOBJS = lock.obj fasttime.obj
+LWPOBJS = lock.obj fasttime.obj threadname.obj
 
 LIBACLOBJS = aclprocs.obj netprocs.obj
 
@@ -94,6 +94,9 @@ lock.obj: $(LWP)/lock.c
 fasttime.obj: $(LWP)/fasttime.c
        $(C2OBJ) $**
 
+threadname.obj: $(LWP)/threadname.c
+       $(C2OBJ) $**
+
 ############################################################################
 # LIBACL package
 aclprocs.obj: $(LIBACL)/aclprocs.c
index 63687facf08a4f517700a5ac1d830f0dd02b14bf..59fb4c8d63f9c5b0d1d1b6ef955905ea004f9f51 100644 (file)
@@ -24,6 +24,7 @@
 #include <rx/xdr.h>
 #include <rx/rx.h>
 #include <rx/rx_multi.h>
+#include <afs/cellconfig.h>
 #ifndef AFS_NT40_ENV
 #include <afs/afsutil.h>
 #include <afs/netutils.h>
@@ -38,6 +39,8 @@ static afs_int32 syncSiteUntil = 0;       /* valid only if amSyncSite */
 int ubik_amSyncSite = 0;           /* flag telling if I'm sync site */
 static nServers;                   /* total number of servers */
 static char amIMagic=0;                    /* is this host the magic host */
+char amIClone=0;                    /* is this a clone which doesn't vote */
+static char ubik_singleServer = 0;
 extern struct rx_securityClass *rxnull_NewClientSecurityObject();
 int (*ubik_CRXSecurityProc)();
 char *ubik_CRXSecurityRock;
@@ -91,11 +94,11 @@ ubeacon_AmSyncSite() {
     register afs_int32 rcode;
     
     /* special case for fast startup */
-    if (nServers == 1) {
+    if (nServers == 1 && !amIClone) {
        return 1;       /* one guy is always the sync site */
     }
 
-    if (ubik_amSyncSite == 0) rcode = 0;  /* if I don't think I'm the sync site, say so */
+    if (ubik_amSyncSite == 0 || amIClone) rcode = 0;  /* if I don't think I'm the sync site, say so */
     else {
        now = FT_ApproxTime();
        if (syncSiteUntil <= now) {         /* if my votes have expired, say so */
@@ -127,17 +130,43 @@ ubeacon_AmSyncSite() {
  * is sync site.  Without the magic host hack, if anyone crashed in a 2
  * site system, we'd be out of business.
  */
+ubeacon_InitServerListByInfo(ame, info, clones)
+    afs_int32 ame;
+    struct afsconf_cell *info;
+    char clones[];
+{
+    afs_int32 code;
+
+    code = ubeacon_InitServerListCommon(ame, info, clones, 0);
+    return code;
+}
+
 ubeacon_InitServerList(ame, aservers)
     afs_int32 ame;
-    register afs_int32 aservers[]; {
+    register afs_int32 aservers[];
+{
+    afs_int32 code;
+
+    code = ubeacon_InitServerListCommon(ame, (struct afsconf_cell *)0, 0,
+                                                       aservers);
+    return code;
+}
+
+ubeacon_InitServerListCommon(ame, info, clones, aservers)
+    afs_int32 ame;
+    struct afsconf_cell *info;
+    char clones[];
+    register afs_int32 aservers[];
+{
     register struct ubik_server *ts;
+    afs_int32 me = -1;
     register afs_int32 servAddr;
     register afs_int32 i, code;
     afs_int32 magicHost;
     struct ubik_server *magicServer;
 
     /* verify that the addresses passed in are correct */
-    if ( code = verifyInterfaceAddress(&ame, aservers ))
+    if (code = verifyInterfaceAddress(&ame, info, aservers))
        return code;
 
     /* get the security index to use, if we can */
@@ -150,28 +179,79 @@ ubeacon_InitServerList(ame, aservers)
        ubikSecIndex = 0;
        ubikSecClass = rxnull_NewClientSecurityObject();
     }
-    i = 0;
     magicHost =        ntohl(ame);     /* do comparisons in host order */
     magicServer = (struct ubik_server *) 0;
-    while (servAddr = *aservers++) {
-       if (i >= MAXSERVERS) return UNHOSTS;        /* too many hosts */
-       ts = (struct ubik_server *) malloc(sizeof(struct ubik_server));
-       bzero(ts, sizeof(struct ubik_server));
-       ts->next = ubik_servers;
-       ubik_servers = ts;
-       ts->addr[0] = servAddr; /* primary address in  net byte order */
-       ts->vote_rxcid = rx_NewConnection(servAddr, ubik_callPortal, VOTE_SERVICE_ID, ubikSecClass, ubikSecIndex);      /* for vote reqs */
-       ts->disk_rxcid = rx_NewConnection(servAddr, ubik_callPortal, DISK_SERVICE_ID, ubikSecClass, ubikSecIndex);      /* for disk reqs */
-       ts->up = 1;
-       if (ntohl((afs_uint32) servAddr) < (afs_uint32) magicHost) {
-           magicHost = ntohl(servAddr);
-           magicServer = ts;
+
+    if (info) {
+        for (i = 0; i < info->numServers; i++) {
+            if (ntohl((afs_uint32) info->hostAddr[i].sin_addr.s_addr) ==
+                                                ntohl((afs_uint32) ame)) {
+                me = i;
+                if (clones[i]) {
+                    amIClone = 1;
+                    magicHost = 0;
+                }
+            }
+        }
+        nServers = 0;
+        for (i = 0; i < info->numServers; i++) {
+            if (i == me) continue;
+           ts = (struct ubik_server *) malloc(sizeof(struct ubik_server));
+           bzero(ts, sizeof(struct ubik_server));
+           ts->next = ubik_servers;
+           ubik_servers = ts;
+            ts->addr[0] = info->hostAddr[i].sin_addr.s_addr;
+            if (clones[i]) {
+                ts->isClone = 1;
+            } else {
+                if (!magicHost || 
+               ntohl((afs_uint32) ts->addr[0]) < (afs_uint32) magicHost) {
+                    magicHost = ntohl(ts->addr[0]);
+                    magicServer = ts;
+                }
+                ++nServers;
+            }
+           ts->vote_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
+               VOTE_SERVICE_ID, 
+               ubikSecClass, ubikSecIndex);            /* for vote reqs */
+           ts->disk_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
+               DISK_SERVICE_ID, ubikSecClass, 
+               ubikSecIndex);                          /* for disk reqs */
+           ts->up = 1;
+       }
+    } else {
+        i = 0;
+        while (servAddr = *aservers++) {
+           if (i >= MAXSERVERS) return UNHOSTS;            /* too many hosts */
+           ts = (struct ubik_server *) malloc(sizeof(struct ubik_server));
+           bzero(ts, sizeof(struct ubik_server));
+           ts->next = ubik_servers;
+           ubik_servers = ts;
+           ts->addr[0] = servAddr;     /* primary address in  net byte order */
+           ts->vote_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
+               VOTE_SERVICE_ID, 
+               ubikSecClass, ubikSecIndex);            /* for vote reqs */
+           ts->disk_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
+               DISK_SERVICE_ID, ubikSecClass, 
+               ubikSecIndex);                          /* for disk reqs */
+           ts->isClone = 0;                    /* don't know about clones */
+           ts->up = 1;
+           if (ntohl((afs_uint32) servAddr) < (afs_uint32) magicHost) {
+               magicHost = ntohl(servAddr);
+               magicServer = ts;
+           }
+           i++;
        }
-       i++;
     }
     if (magicServer) magicServer->magic        = 1;    /* remember for when counting votes */
-    else amIMagic = 1;
-    nServers = i+1;    /* count this server as well as the remotes */
+
+    if (!amIClone && !magicServer) amIMagic = 1;
+    if (info) {
+        if (!amIClone) 
+            ++nServers;        /* count this server as well as the remotes */
+    } else
+        nServers = i+1;                /* count this server as well as the remotes */
+
     ubik_quorum        = (nServers>>1)+1;      /* compute the majority figure */
                                        /* send addrs to all other servers */
     code = updateUbikNetworkAddress(ubik_host);
@@ -182,7 +262,19 @@ ubeacon_InitServerList(ame, aservers)
     r_retryInterval = 2;       
     r_nRetries = (RPCTIMEOUT/r_retryInterval);
 */
-    if (nServers == 1) {    /* special case 1 server */
+    if (info) {
+       if (!ubik_servers)              /* special case 1 server */
+           ubik_singleServer = 1;
+       if (nServers == 1 && !amIClone) {
+           ubik_amSyncSite = 1;        /* let's start as sync site */
+           syncSiteUntil = 0x7fffffff; /* and be it quite a while */
+       }
+    } else {
+       if (nServers == 1)              /* special case 1 server */
+           ubik_singleServer = 1;
+    }
+
+    if (ubik_singleServer) {   
         if (!ubik_amSyncSite) ubik_dprint("Ubik: I am the sync site - 1 server\n");
        ubik_amSyncSite = 1;
        syncSiteUntil = 0x7fffffff; /* quite a while */
@@ -222,7 +314,7 @@ ubeacon_Interact() {
 
        lastWakeupTime = FT_ApproxTime();   /* started a new collection phase */
 
-       if (nServers == 1) continue;    /* special-case 1 server for speedy startup */
+        if (ubik_singleServer) continue;    /* special-case 1 server for speedy startup */
 
        if (!uvote_ShouldIRun()) continue;  /* if voter has heard from a better candidate than us, don't bother running */
 
@@ -233,7 +325,7 @@ ubeacon_Interact() {
            prepare to send them an r multi-call containing the beacon message */
        i = 0;      /* collect connections */
        for(ts = ubik_servers; ts; ts=ts->next) {
-           if (ts->up && ts->addr[0] != ubik_host[0]) {
+            if (ts->up && ts->addr[0] != ubik_host[0]) {
                servers[i] = ts;
                connections[i++] = ts->vote_rxcid;
            }
@@ -279,7 +371,8 @@ ubeacon_Interact() {
                    ts->lastVoteTime = code;
                    if (code < oldestYesVote) oldestYesVote = code;
                    ts->lastVote = 1;
-                   yesVotes += 2;
+                    if (!ts->isClone)
+                       yesVotes += 2;
                    if (ts->magic) yesVotes++;  /* the extra epsilon */
                    ts->up = 1; /* server is up (not really necessary: recovery does this for real) */
                    ts->beaconSinceDown = 1;
@@ -340,16 +433,20 @@ ubeacon_Interact() {
 *
 * Return Values : 0 on success, non-zero on failure
 */
-verifyInterfaceAddress(ame, aservers)
-afs_uint32 *ame;               /* one of my interface addr in net byte order */
-afs_uint32 aservers[];         /* list of all possible server addresses */
+static verifyInterfaceAddress(ame, info, aservers)
+    struct afsconf_cell *info;
+    afs_uint32 aservers[];     /* list of all possible server addresses */
+    afs_uint32 *ame;           /* one of my interface addr in net byte order */
 {
-    afs_uint32 myAddr[UBIK_MAX_INTERFACE_ADDR], *servList;
+    afs_uint32 myAddr[UBIK_MAX_INTERFACE_ADDR], *servList, tmpAddr;
     int        count, index, found, i, j, totalServers, start, end;
 
-    /* count the number of servers */
-    for ( totalServers=0, servList = aservers; *servList; servList++)
-       totalServers++;
+    if (info)
+        totalServers = info->numServers;
+    else {                             /* count the number of servers */
+        for ( totalServers=0, servList = aservers; *servList; servList++)
+           totalServers++;
+    }
 
 #ifdef AFS_NT40_ENV 
     /* for now use getaddr(). use getAllAddr when implemented */
@@ -407,34 +504,41 @@ afs_uint32 aservers[];    /* list of all possible server addresses */
     */
     for ( j=0, found = 0; j < count; j++)
     {
-       for ( i=0; i < totalServers; i++)
-           if ( myAddr[j] == aservers[i] )     
-           {
-               *ame = aservers[i];
-               aservers[i]  = 0 ; 
+       for ( i=0; i < totalServers; i++) {
+            if (info)
+               tmpAddr = ntohl((afs_uint32) info->hostAddr[i].sin_addr.s_addr);
+           else 
+               tmpAddr = aservers[i];
+            if ( myAddr[j] == tmpAddr) {
+                *ame = tmpAddr;
+               if (!info)
+                   aservers[i]  = 0 ; 
                found = 1;
            }
+       }
     }
     if ( found )
        ubik_print("Using %s as my primary address\n", afs_inet_ntoa(*ame) );
 
-    /* get rid of servers which were purged because all 
-    ** those interface addresses are myself 
-    */
-    for ( start=0, end=totalServers-1; (start<end) ; start++, end--)
-    {
-       /* find the first zero entry from the beginning */
-       for ( ; (start < end) && ( aservers[start] ); start++);
-
-       /* find the last non-zero entry from the end */
-       for ( ; (end >= 0) && ( !aservers[end] ); end-- );
-
-       /* if there is nothing more to purge, exit from loop */
-       if ( start >= end ) break;
+    if (!info) {
+        /* get rid of servers which were purged because all 
+        ** those interface addresses are myself 
+        */
+        for ( start=0, end=totalServers-1; (start<end) ; start++, end--)
+        {
+           /* find the first zero entry from the beginning */
+           for ( ; (start < end) && ( aservers[start] ); start++);
+    
+           /* find the last non-zero entry from the end */
+           for ( ; (end >= 0) && ( !aservers[end] ); end-- );
+    
+           /* if there is nothing more to purge, exit from loop */
+           if ( start >= end ) break;
 
-       /* move the entry */
-       aservers[start] = aservers[end];
-       aservers[end]   = 0;            /* this entry was moved */
+           /* move the entry */
+           aservers[start] = aservers[end];
+           aservers[end]   = 0;                /* this entry was moved */
+        }
     }
        
     /* update all my addresses in ubik_host in such a way 
index c3aa09cf61ef9a9564d5f3aed85e586bd1237d16..6de9dccecb19037bb90c53f389e6a0d047965d23 100644 (file)
@@ -425,6 +425,7 @@ urecovery_Interact() {
            bestDBVersion.counter = 0;
            for(ts=ubik_servers; ts; ts=ts->next) {
                if (!ts->up) continue;  /* don't bother with these guys */
+                if (ts->isClone) continue;
                code = DISK_GetVersion(ts->disk_rxcid, &ts->version);
                if (code == 0) {
                    /* perhaps this is the best version */
index 4b6618dadfe418dea7b74cf3cacb24a84be935b9..79116338213e0a446779b0e6af1d166ae2fcafc3 100644 (file)
@@ -20,6 +20,7 @@
 #include <lock.h>
 #include <rx/xdr.h>
 #include <rx/rx.h>
+#include <afs/cellconfig.h>
 
 #define UBIK_INTERNALS
 #include "ubik.h"
@@ -145,7 +146,8 @@ afs_int32 ContactQuorum(aproc, atrans, aflags, aparm0, aparm1, aparm2, aparm3, a
            ts->beaconSinceDown = 0;
            urecovery_LostServer(); /* tell recovery to try to resend dbase later */
        } else {            /* success */
-           okcalls++;      /* count up how many worked */
+            if (!ts->isClone)
+               okcalls++;          /* count up how many worked */
            if (aflags & CStampVersion) {
                ts->version = atrans->dbase->version;
            }
@@ -161,12 +163,43 @@ afs_int32 ContactQuorum(aproc, atrans, aflags, aparm0, aparm1, aparm2, aparm3, a
     Note that the host named by myHost should not also be listed in serverList.
 */
 
+int ubik_ServerInitByInfo(myHost, myPort, info, clones, pathName, dbase)
+    struct afsconf_cell *info;  /* in */
+    char clones[];
+    afs_int32 myHost;
+    short myPort;
+    char *pathName;    /* in */
+    struct ubik_dbase **dbase; /* out */ 
+{
+     afs_int32 code;
+    
+     code = ubik_ServerInitCommon(myHost, myPort, info, clones, 0, pathName, dbase);
+     return code;
+}
+
 int ubik_ServerInit(myHost, myPort, serverList, pathName, dbase)
+    afs_int32 serverList[];    /* in */
     afs_int32 myHost;
     short myPort;
+    char *pathName;    /* in */
+    struct ubik_dbase **dbase; /* out */ 
+{
+     afs_int32 code;
+    
+     code = ubik_ServerInitCommon(myHost, myPort, (struct afsconf_cell *)0, 0,
+                       serverList, pathName, dbase);
+     return code;
+}
+
+int ubik_ServerInitCommon(myHost, myPort, info, clones, serverList, pathName, dbase)
+    afs_int32 myHost;
+    short myPort;
+    struct afsconf_cell *info;  /* in */
+    char clones[];
     afs_int32 serverList[];    /* in */
     char *pathName;    /* in */
-    struct ubik_dbase **dbase; /* out */ {
+    struct ubik_dbase **dbase; /* out */ 
+{
     register struct ubik_dbase *tdb;
     register afs_int32 code;
     PROCESS junk;
@@ -245,7 +278,10 @@ int ubik_ServerInit(myHost, myPort, serverList, pathName, dbase)
     if (code) return code;
     code = urecovery_Initialize(tdb);
     if (code) return code;
-    code = ubeacon_InitServerList(myHost, serverList);
+    if (info)
+        code = ubeacon_InitServerListByInfo(myHost, info, clones);
+    else 
+        code = ubeacon_InitServerList(myHost, serverList);
     if (code) return code;
 
     /* now start up async processes */
index e0c681ab48e171f27ce46dab2cbbaba634e6b13b..bf75fbc8d3aba4536eba1df58dac43ed82d84417 100644 (file)
@@ -248,6 +248,7 @@ struct ubik_server {
     char beaconSinceDown;              /* did beacon get through since last crash? */
     char currentDB;                    /* is dbase up-to-date */
     char magic;                                /* the one whose vote counts twice */
+    char isClone;                       /* is only a clone, doesn't vote */
 };
 
 /* hold and release functions on a database */
@@ -258,6 +259,7 @@ struct ubik_server {
 
 /* list of all servers in the system */
 extern struct ubik_server *ubik_servers;
+extern char amIClone;
 
 /* network port info */
 extern short ubik_callPortal;
index 36bde6999bb6922d67351498681b7c17f77fa52a..df8e7f731d3106a41d67a0581d5bf2471fa22df0 100644 (file)
@@ -167,6 +167,8 @@ statindex 11
 #define        VOTE_GETSYNCSITE        10003
 #define VOTE_DEBUG             10004
 #define VOTE_SDEBUG            10005
+#define VOTE_XDEBUG             10006
+#define VOTE_XSDEBUG            10007
 
 /* Vote package interface calls */
 Beacon         (IN afs_int32 state,
@@ -186,6 +188,13 @@ Debug              (OUT ubik_debug *db) = VOTE_DEBUG;
 SDebug         (IN afs_int32 which, 
                OUT ubik_sdebug *db) = VOTE_SDEBUG;
 
+XDebug          (OUT ubik_debug *db,
+                 OUT afs_int32 *isClone) = VOTE_XDEBUG;
+
+XSDebug         (IN afs_int32 which,
+                 OUT ubik_sdebug *db,
+                 OUT afs_int32 *isClone) = VOTE_XSDEBUG;
+
 /* This package handles calls used to pass writes, begins and ends to other servers */
 package DISK_
 statindex 12
index 71602b12dcf21ea4ac46320707dbffdd1aa88db8..25862484596b68ea18bb94f3ed233dc4299c104d 100644 (file)
@@ -86,6 +86,7 @@ struct cmd_syndesc *as; {
     struct ubik_debug udebug;
     struct ubik_sdebug usdebug;
     int                oldServer =0;   /* are we talking to a pre 3.5 server? */
+    afs_int32 isClone = 0;
 
     int32p = (as->parms[2].items ? 1 : 0);
 
@@ -128,7 +129,8 @@ struct cmd_syndesc *as; {
     tconn = rx_NewConnection(hostAddr, port, VOTE_SERVICE_ID, sc, 0);
     
     /* now do the main call */
-    code = VOTE_Debug(tconn, &udebug);
+    code = VOTE_XDebug(tconn, &udebug, &isClone);
+    if (code) code = VOTE_Debug(tconn, &udebug);
     if ( code == RXGEN_OPCODE )        
     {
        oldServer = 1;                  /* talking to a pre 3.5 server */
@@ -205,7 +207,10 @@ struct cmd_syndesc *as; {
                   udebug.epochTime, udebug.tidCounter);
        }
     } else {
-       printf("I am not sync site\n");
+        if (isClone) 
+           printf("I am a clone and never can become sync site\n");
+        else
+           printf("I am not sync site\n");
        inhostAddr.s_addr = htonl(udebug.lowestHost);
        diff = udebug.now - udebug.lowestTime;
        printf("Lowest host %s was set %d secs ago\n", inet_ntoa(inhostAddr), diff);
@@ -239,13 +244,16 @@ struct cmd_syndesc *as; {
     if (int32p || udebug.amSyncSite) {
        /* now do the subcalls */
        for(i=0;;i++) {
-           if ( oldServer )
-           {                           /* pre 3.5 server */
-               memset(&usdebug, 0, sizeof(usdebug)); 
-               code = VOTE_SDebugOld(tconn, i, &usdebug);
+            isClone = 0;
+            code = VOTE_XSDebug(tconn, i, &usdebug, &isClone);
+            if (code < 0) {
+               if ( oldServer ) {                      /* pre 3.5 server */
+                   memset(&usdebug, 0, sizeof(usdebug)); 
+                   code = VOTE_SDebugOld(tconn, i, &usdebug);
+               }
+               else
+                   code = VOTE_SDebug(tconn, i, &usdebug);
            }
-           else
-               code = VOTE_SDebug(tconn, i, &usdebug);
            if (code > 0) break;        /* done */
            if (code < 0) {
                printf("error code %d from VOTE_SDebug\n", code);
@@ -253,12 +261,15 @@ struct cmd_syndesc *as; {
            }
            inhostAddr.s_addr = htonl(usdebug.addr);
            /* otherwise print the structure */
-           printf("\nServer%s", afs_inet_ntoa(htonl(usdebug.addr))); 
+           printf("\nServer (%s", afs_inet_ntoa(htonl(usdebug.addr))); 
            for ( j=0;((usdebug.altAddr[j]) && 
                                (j<UBIK_MAX_INTERFACE_ADDR-1)); j++)
                printf(" %s", afs_inet_ntoa(htonl(usdebug.altAddr[j])));
-           printf(" ): (db %d.%d)\n",
+           printf("): (db %d.%d)",
                   usdebug.remoteVersion.epoch, usdebug.remoteVersion.counter);
+            if (isClone)
+                printf("    is only a clone!");
+           printf("\n");
 
            if (usdebug.lastVoteTime == 0) {
               printf("    last vote never rcvd \n");
index 8897cfba5d6b3e6411919f088370f5576227be6b..ebf831a4f518ddf93ec9f4de98a0243930a39be3 100644 (file)
@@ -172,6 +172,8 @@ SVOTE_Beacon(rxcall, astate, astart, avers, atid)
     afs_int32 vote;
     struct rx_connection *aconn;
     struct rx_peer *rxp;
+    struct ubik_server *ts;
+    int isClone = 0;
 
     now = FT_ApproxTime();                     /* close to current time */
     if (rxcall)        {                               /* caller's host */
@@ -188,8 +190,15 @@ SVOTE_Beacon(rxcall, astate, astart, avers, atid)
                                        afs_inet_ntoa(rx_HostOf(rxp)));
                 return 0; /* I don't know about you: vote no */
         }
-    } else
+        for (ts = ubik_servers; ts; ts = ts->next) {
+            if (ts->addr[0] == otherHost) break;
+        }
+        if (!ts) ubik_dprint("Unknown host %x has sent a beacon\n", otherHost);
+        if (ts && ts->isClone) isClone = 1;
+    } else {
        otherHost = ubik_host[0];                       /* this host */
+        isClone = amIClone;
+    }
 
     ubik_dprint("Received beacon type %d from host %s\n", astate, 
                                afs_inet_ntoa(otherHost));
@@ -211,8 +220,11 @@ SVOTE_Beacon(rxcall, astate, astart, avers, atid)
        seconds, we ignore its presence in lowestHost: it may have crashed.
        Note that we don't ever let anyone appear in our lowestHost if we're
        lower than them, 'cause we know we're up. */
-    if (ntohl((afs_uint32) otherHost) <= ntohl((afs_uint32) lowestHost)
-       || lowestTime + BIGTIME < now) {
+    /* But do not consider clones for lowesHost since they never may become
+       sync site */
+    if (!isClone &&
+        (ntohl((afs_uint32) otherHost) <= ntohl((afs_uint32) lowestHost)
+        || lowestTime + BIGTIME < now)) {
        lowestTime = now;
        lowestHost = otherHost;
     }
@@ -223,8 +235,9 @@ SVOTE_Beacon(rxcall, astate, astart, avers, atid)
        lowest.  Need to prove: if one guy in the system is lowest and knows
        he's lowest, these loops don't occur.  because if someone knows he's
        lowest, he will send out beacons telling others to vote for him. */
-    if (ntohl((afs_uint32) ubik_host[0]) <= ntohl((afs_uint32) lowestHost)
-       || lowestTime + BIGTIME < now) {
+    if (!amIClone &&
+        (ntohl((afs_uint32) ubik_host) <= ntohl((afs_uint32) lowestHost)
+        || lowestTime + BIGTIME < now)) {
        lowestTime = now;
        lowestHost = ubik_host[0];
     }
@@ -261,7 +274,18 @@ SVOTE_Beacon(rxcall, astate, astart, avers, atid)
        /* someone else *is* a sync site, just say no */
        if (syncHost && syncHost != otherHost)
            return 0;
+    } else  /* fast startup if this is the only non-clone */
+    if (lastYesHost == 0xffffffff && otherHost == ubik_host[0]) {
+       int i = 0;
+        for (ts = ubik_servers; ts; ts = ts->next) {
+            if (ts->addr[0] == otherHost) continue;
+           if (!ts->isClone) i++;
+       }
+       if (!i) lastYesHost = otherHost;
     }
+       
+
+    if (isClone) return 0; /* clone never can become sync site */
 
     /* Don't promise sync site support to more than one host every BIGTIME
        seconds.  This is the heart of our invariants in this system. */
@@ -293,7 +317,19 @@ SVOTE_Beacon(rxcall, astate, astart, avers, atid)
 SVOTE_SDebug(rxcall, awhich, aparm)
     struct rx_call *rxcall;
     afs_int32 awhich;
-    register struct ubik_sdebug *aparm; {
+    register struct ubik_sdebug *aparm;
+{
+    afs_int32 code, isClone;
+    code = SVOTE_XSDebug(rxcall, awhich, aparm, &isClone);
+    return code;
+}
+
+SVOTE_XSDebug(rxcall, awhich, aparm, isclone)
+    afs_int32 *isclone;
+    struct rx_call *rxcall;
+    afs_int32 awhich;
+    register struct ubik_sdebug *aparm; 
+{
     register struct ubik_server *ts;
     register int i;
     for(ts=ubik_servers; ts; ts=ts->next) {
@@ -309,12 +345,24 @@ SVOTE_SDebug(rxcall, awhich, aparm)
            aparm->up = ts->up;
            aparm->beaconSinceDown = ts->beaconSinceDown;
            aparm->currentDB = ts->currentDB;
+            *isclone = ts->isClone;
            return 0;
        }
     }
     return 2;
 }
 
+SVOTE_XDebug(rxcall, aparm, isclone)
+    struct rx_call *rxcall;
+    register struct ubik_debug *aparm;
+    afs_int32 *isclone;
+{
+    afs_int32 code;
+
+    code = SVOTE_Debug(rxcall, aparm);
+    *isclone = amIClone;
+    return code;
+}
 
 /* handle basic network debug command.  This is the global state dumper */
 SVOTE_Debug(rxcall, aparm)
index 9b1377012ec8e52cc71a5dfb8dd8a9eecf167116..86eadede21c84de47071b846084e3ee28c9dac3d 100644 (file)
@@ -16,7 +16,7 @@ INSTALL = ${SRCDIR}bin/install
 objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
         hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
         dirpath.o fileutil.o netutils.o flipbase64.o \
-        afs_atomlist.o afs_lhash.o
+        afs_atomlist.o afs_lhash.o snprintf.o
 
 headers = assert.h potpourri.h itc.h errors.h afsutil.h pthread_glock.h \
          dirpath.h afs_atomlist.h afs_lhash.h
@@ -76,6 +76,9 @@ util.a: ${objects} AFS_component_version_number.o
 volparse.o: volparse.c
        ${CC} ${CFLAGS} -c volparse.c
 
+snprintf.o: snprintf.c
+       ${CC} ${CFLAGS} -c snprintf.c
+
 base64.o: base64.c
        ${CC} ${CFLAGS} -c base64.c
 
index 3dfb9281fac46f929bb6b3b67835b365b3c85fb3..ca75596f38dcd25f25f3b32fdaed546a4a370ced 100644 (file)
                                   propagated to the application level */
 #define VMOVED         111     /* Volume has moved to another server; do a VGetVolumeInfo
                                   to THIS server to find out where */
-#define VIO            112     /* Vnode temporarily unaccessible, but not known to
+#define VIO            112     /* Vnode temporarily unaccessible, but not known 
                                   to be permanently bad. */
+#define VRESTRICTED     120     /* Volume is restricted from using one or more
+                                   of the given residencies; do a
+                                   vos examine to find out the current
+                                   restrictions. */
 #define VRESTARTING    -100    /* server is restarting, otherwise similar to 
                                   VBUSY above.  This is negative so that old
                                   cache managers treat it as "server is down"*/
index 8abfde974b4c612baded9c215ab1397e86b6aa97..3d3ed3e7418e61ec7c9289baf10759ab85580680 100644 (file)
@@ -60,10 +60,25 @@ static pthread_mutex_t serverLogMutex;
 #define F_OK 0
 #endif
 
+char *threadname();
+
 static int serverLogFD = -1;
 
 #include <stdarg.h>
 int LogLevel;
+int mrafsStyleLogs = 0;
+int printLocks = 0;
+static char ourName[MAXPATHLEN];
+
+void WriteLogBuffer(buf,len)
+    char *buf;
+    afs_uint32 len;
+{
+    LOCK_SERVERLOG();
+    if (serverLogFD > 0)
+        write(serverLogFD, buf, len);
+    UNLOCK_SERVERLOG();
+}
 
 /* VARARGS1 */
 void FSLog (const char *format, ...)
@@ -75,12 +90,20 @@ void FSLog (const char *format, ...)
     char tbuffer[1024];
     char *info;
     int len;
+    int i;
+    char *name;
 
     currenttime = time(0);
     timeStamp = afs_ctime(&currenttime, tbuffer, sizeof(tbuffer));
     timeStamp[24] = ' ';  /* ts[24] is the newline, 25 is the null */
     info = &timeStamp[25];
 
+    if (mrafsStyleLogs) {
+       name = threadname();
+       sprintf(info, "[%s] ", name);
+       info += strlen(info);
+    }
+
     va_start(args, format);
     (void) vsprintf(info, format, args);
     va_end(args);
@@ -118,6 +141,7 @@ void SetDebug_Signal(int signo)
     else {
         LogLevel = 1;
     }
+    printLocks = 2;
 #if defined(AFS_PTHREAD_ENV)
     DebugOn(LogLevel);
 #else /* AFS_PTHREAD_ENV */
@@ -132,6 +156,7 @@ void ResetDebug_Signal(int signo)
 {
     LogLevel = 0;
 
+    if (printLocks >0) --printLocks;
 #if defined(AFS_PTHREAD_ENV)
     DebugOn(LogLevel);
 #else /* AFS_PTHREAD_ENV */
@@ -140,6 +165,8 @@ void ResetDebug_Signal(int signo)
 
     signal(signo, ResetDebug_Signal);   /* on some platforms, this signal */
                                        /* handler needs to be set again */
+    if (mrafsStyleLogs)
+       OpenLog((char *)&ourName);
 } /*ResetDebug_Signal*/
 
 
@@ -158,13 +185,32 @@ int OpenLog(const char *fileName)
      */
     int tempfd;
     char oldName[MAXPATHLEN];
+    struct timeval Start;
+    struct tm *TimeFields;
+    char FileName[MAXPATHLEN]; 
+
+    if (mrafsStyleLogs) {
+        TM_GetTimeOfDay(&Start, 0);
+        TimeFields = localtime(&Start.tv_sec);
+        if (fileName) {
+            if (strncmp(fileName, (char *)&ourName, strlen(fileName)))
+            strcpy((char *)&ourName, (char *) fileName);
+       }
+        sprintf(FileName, "%s.%d%02d%02d%02d%02d%02d", ourName,
+               TimeFields->tm_year + 1900, TimeFields->tm_mon + 1, 
+               TimeFields->tm_mday, TimeFields->tm_hour, 
+               TimeFields->tm_min, TimeFields->tm_sec);
+        rename (fileName, FileName); /* don't check error code */
+        tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT, 0666); 
+    } else {
+        strcpy(oldName, fileName);
+        strcat(oldName, ".old");
 
-    strcpy(oldName, fileName);
-    strcat(oldName, ".old");
+        /* don't check error */
+        renamefile(fileName, oldName);
+        tempfd = open(fileName, O_WRONLY|O_TRUNC|O_CREAT, 0666);
+    }
 
-    /* don't check error */
-    renamefile(fileName, oldName);
-    tempfd = open(fileName, O_WRONLY|O_TRUNC|O_CREAT, 0666);
     if(tempfd < 0)
     {
        printf("Unable to open log file %s\n", fileName);
index 1efbcd14f27570af2a1423964c2bdebf5194f52a..33cbb69c5c4f93b882178dd90232065b7a553a96 100644 (file)
@@ -179,3 +179,43 @@ afs_int32 *aval;
     else *aval = total;
     return 0;
 }
+
+afs_uint32
+GetUInt32 (as, aval)
+register char *as;
+afs_uint32 *aval;
+{
+    register afs_uint32 total;
+    register int tc;
+    int base;
+
+    total = 0;  /* initialize things */
+
+    /* skip over leading spaces */
+    while (tc = *as) {
+        if (tc != ' ' && tc != '\t') break;
+    }
+
+    /* compute the base */
+    if (*as == '0') {
+        as++;
+        if (*as == 'x' || *as == 'X') {
+            base = 16;
+            as++;
+       }
+        else base = 8;
+    }
+    else base = 10;
+
+    /* compute the # itself */
+    while(tc = *as) {
+        if (!ismeta(tc, base)) return -1;
+        total *= base;
+        total += getmeta(tc);
+        as++;
+    }
+    
+    *aval = total;
+    return 0;
+}
+
index ac0a9a1325bd4865a49d3d7eeb7a658dffba3b37..d92e55b372d17d963f6f9d134d985b2841384aaa 100644 (file)
@@ -6896,3 +6896,11 @@ SRXAFS_DFSSymlink (tcon, DirFid, Name, LinkContents, InStatus, OutFid, OutFidSta
     return EINVAL;
 }
 
+SRXAFS_ResidencyCmd (tcon, Fid, Inputs, Outputs)
+    struct rx_connection *tcon;
+    struct AFSFid *Fid;
+    struct ResidencyCmdInputs *Inputs;
+    struct ResidencyCmdOutputs *Outputs;
+{
+    return EINVAL;
+}
index e57e41081a8c68b606a1271e9d733f0029dd9eaa..6f17df50d02b2be5e23ddb1a5bc5ac2bce7ac458 100644 (file)
@@ -106,7 +106,6 @@ int argc;
 char   **argv;
 {
     register afs_int32   code;
-    afs_int32      serverList[MAXSERVERS];
     afs_int32              myHost;
     struct rx_service      *tservice;
     struct rx_securityClass *sc[3];
@@ -121,7 +120,8 @@ char        **argv;
     int noAuth = 0, index, i;
     extern int rx_extraPackets;
     char commandLine[150];
-
+    char clones[MAXHOSTSPERCELL];
 #ifdef AFS_AIX32_ENV
     /*
      * The following signal action for AIX is necessary so that in case of a 
@@ -214,15 +214,12 @@ char      **argv;
     signal(SIGXCPU, CheckSignal_Signal);
 #endif
     /* get list of servers */
-    code = afsconf_GetCellInfo(tdir,(char *)0, AFSCONF_VLDBSERVICE,&info);
+    code = afsconf_GetExtendedCellInfo(tdir,(char *)0, AFSCONF_VLDBSERVICE,
+                                       &info, &clones);
     if (code) {
        printf("vlserver: Couldn't get cell server list for 'afsvldb'.\n");
        exit(2);
     }
-    for (index=0,i = 0;index<info.numServers;index++)
-       if (info.hostAddr[index].sin_addr.s_addr != myHost) /* ubik already tacks myHost onto list */
-           serverList[i++] = info.hostAddr[index].sin_addr.s_addr;
-     serverList[i] = 0;
 
     vldb_confdir = tdir;               /* Preserve our configuration dir */
     /* rxvab no longer supported */
@@ -237,7 +234,8 @@ char        **argv;
     ubik_SRXSecurityRock = (char *) tdir;
     ubik_CheckRXSecurityProc = afsconf_CheckAuth;
     ubik_CheckRXSecurityRock = (char *) tdir;
-    code = ubik_ServerInit(myHost, htons(AFSCONF_VLDBPORT), serverList, vl_dbaseName, &VL_dbase);
+    code = ubik_ServerInitByInfo(myHost, htons(AFSCONF_VLDBPORT), &info,
+                                &clones, vl_dbaseName, &VL_dbase);
     if (code) {
        printf("vlserver: Ubik init failed with code %d\n",code);
        exit(2);
index 127e33840d8e165003d215dc841dd8a112c3c0a9..711de2b776d760d941c349c393deca23fd090b81 100644 (file)
@@ -81,9 +81,6 @@ salvager: vol-salvage.o physio.o vlib.a
                 *linux* ) \
                         ${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o \
                                ${LIBS}  ;; \
-                sgi_* ) \
-                        ${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o \
-                               ${LIBS} ../sgiefs/libefs.a ;; \
                 *) \
                         ${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o \
                                ${LIBS};; \
index 8b2c8e993c5fee24243aff954b0c13b01b5d6631..1dc43091128369b8eeeedcb1e698a5c4ebc471fc 100644 (file)
 #if defined(AFS_SGI_ENV)
 #include <fcntl.h>
 #include <mntent.h>
-#include "../sgiefs/efs.h"
+#ifdef AFS_SGI_EFS_IOPS_ENV
 #define ROOTINO EFS_ROOTINO
+#include "../sgiefs/efs.h"
+#endif
 #else
 #ifdef AFS_LINUX22_ENV
 #include <mntent.h>
index 4ac1e7c314c6c95cb2541aa7c03566c98998ae47..8e9bf01a61d7ed20a237933e7a918b378d17fcfd 100644 (file)
@@ -417,6 +417,7 @@ ginode(inum) {
 /* libefs.h includes <assert.h>, which we don't want */
 #define        __ASSERT_H__
 
+#ifdef AFS_SGI_EFS_IOPS_ENV
 #include "../sgiefs/libefs.h"
 extern int Log();
 
@@ -606,6 +607,7 @@ Log("Ino=%d, bytes=%d, linkCnt=%d, [%x,%x,%x,%x]\n", inum, p->di_size, p->di_nli
 
        return err;
 }
+#endif /* AFS_SGI_EFS_IOPS_ENV */
 
 #ifdef AFS_SGI_XFS_IOPS_ENV
 #include <dirent.h>
@@ -1022,7 +1024,9 @@ int *forcep, forceR;
        int ninodes = 0, err = 0;
        struct efs_dinode *dinodeBuf = NULL;
        int last_cgno;
+#ifdef AFS_SGI_EFS_IOPS_ENV
        EFS_MOUNT *mp;
+#endif
        ino_t   imax, inum;     /* total number of I-nodes in file system */
 
        *forcep = 0;
@@ -1044,15 +1048,18 @@ int *forcep, forceR;
        }
        else
 #endif
-       {
-           if (root_inode.st_ino != EFS_ROOTINO) {
-               Log("%s is not root of a filesystem\n", mountedOn);
-               return -1;
-           }
+#ifdef AFS_SGI_EFS_IOPS_ENV
+         if (root_inode.st_ino == EFS_ROOTINO) {
            return efs_ListViceInodes(devname, mountedOn, resultFile,
-                                    judgeInode, judgeParam,
+                                     judgeInode, judgeParam,
                                     forcep, forceR, wpath);
        }
+       else
+#endif
+         {
+             Log("%s is not root of a filesystem\n", mountedOn);
+             return -1;
+         }
 }
 
 #else /* AFS_SGI_ENV */
index 2345e231ddd647b88eae191bc0223e39c9cad593..87398c4b91f24b38e2c5284f7628c8d0a4caffee 100644 (file)
 #if defined(AFS_SGI_ENV)
 #include <fcntl.h>
 #include <mntent.h>
-#ifndef AFS_SGI_XFS_IOPS_ENV
+#ifdef AFS_SGI_EFS_IOPS_ENV
 #define ROOTINO EFS_ROOTINO
-#endif
-/*
 #include <sys/fs/efs.h>
-*/
-#include "../sgiefs/efs.h" /* until 5.1 release */
+#include "../sgiefs/efs.h" /* until 5.1 release */ 
+#endif
+
 
 #else
 #ifndef AFS_LINUX20_ENV
index db12aed7d0f9058cf1285f7b50ec277c115a7582..74aa0acd225018476130289558165aa2ba62e3eb 100644 (file)
@@ -19,7 +19,9 @@
 #include <fcntl.h>
 #include <mntent.h>
 #include "partition.h"
+#ifdef AFS_SGI_EFS_IOPS_ENV
 #include "../sgiefs/efs.h"
+#endif
 #include <afs/xfsattrs.h>
 
 char *prog = "xfs_size_check";
index 751c08e17a4c4d92e5459fcb1fa091a114058774..95b909c6aa1ea72877ab422ea140de0a229313c1 100644 (file)
@@ -107,10 +107,6 @@ volserver: $(SOBJS) $(LIBS) $(HACKS)
                 *linux*) \
                         ${CC} ${DBUG} -o volserver $(SOBJS) $(HACKS) \
                                ${LDFLAGS} $(LIBS) ${XLIBS} ;; \
-                sgi_*) \
-                        ${CC} ${DBUG} -o volserver $(SOBJS) $(HACKS) \
-                               ${LDFLAGS} $(LIBS) ${XLIBS} \
-                               ../sgiefs/libefs.a ;; \
                 *) \
                         ${CC} ${DBUG} -g -o volserver $(SOBJS) $(HACKS) \
                                ${LDFLAGS} $(LIBS) ${XLIBS} ;; \