freelance-cellid-20040726
authorJeffrey Altman <jaltman@mit.edu>
Mon, 26 Jul 2004 20:08:42 +0000 (20:08 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 26 Jul 2004 20:08:42 +0000 (20:08 +0000)
Replace Freelance cellid constant 0x1 with a #define and set its
value to 0xFFFFFFFF to avoid collisions with the root.cell volumes
on remote cells.

src/WINNT/afsd/cm_callback.c
src/WINNT/afsd/cm_freelance.c
src/WINNT/afsd/cm_freelance.h
src/WINNT/afsd/cm_scache.c
src/WINNT/afsd/cm_vnodeops.c

index bade3f2..48be6ff 100644 (file)
@@ -600,7 +600,9 @@ int cm_HaveCallback(cm_scache_t *scp)
     // good shape and we simply return true, provided no change is detected.
   int fdc, fgc;
 
-    if (cm_freelanceEnabled && scp->fid.cell==0x1 && scp->fid.volume==AFS_FAKE_ROOT_VOL_ID) {  // if it's something on /afs
+    if (cm_freelanceEnabled && 
+        scp->fid.cell==AFS_FAKE_ROOT_CELL_ID &&
+        scp->fid.volume==AFS_FAKE_ROOT_VOL_ID) {       // if it's something on /afs
        if (!(scp->fid.vnode==0x1 && scp->fid.unique==0x1))     // if it's not root.afs
            return 1;
        else {
@@ -757,7 +759,7 @@ long cm_GetCallback(cm_scache_t *scp, struct cm_user *userp,
        // specially. We need to fetch the status by calling
        // cm_MergeStatus and mark that cm_fakeDirCallback is 2
        if (cm_freelanceEnabled &&
-        scp->fid.cell==0x1 &&
+        scp->fid.cell==AFS_FAKE_ROOT_CELL_ID &&
                scp->fid.volume==AFS_FAKE_ROOT_VOL_ID &&
                scp->fid.unique==0x1 &&
                scp->fid.vnode==0x1) {
index 2b0281d..0c6152e 100644 (file)
@@ -225,7 +225,7 @@ void cm_InitFakeRootDir() {
 
 int cm_FakeRootFid(cm_fid_t *fidp)
 {
-      fidp->cell = 0x1;            /* root cell */
+      fidp->cell = AFS_FAKE_ROOT_CELL_ID;            /* root cell */
       fidp->volume = AFS_FAKE_ROOT_VOL_ID;   /* root.afs ? */
       fidp->vnode = 0x1;
       fidp->unique = 0x1;
@@ -264,7 +264,7 @@ int cm_reInitLocalMountPoints() {
 
        osi_Log0(afsd_logp,"Invalidating local mount point scp...  ");
 
-       aFid.cell = 0x1;
+       aFid.cell = AFS_FAKE_ROOT_CELL_ID;
        aFid.volume=AFS_FAKE_ROOT_VOL_ID;
        aFid.unique=0x1;
        aFid.vnode=0x2;
index 1b6c8bf..2554d40 100644 (file)
@@ -18,5 +18,6 @@ extern long cm_FreelanceRemoveMount(char *toremove);
 extern long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, cm_fid_t *fidp);
 
 #define AFS_FREELANCE_INI "afs_freelance.ini"
-#define AFS_FAKE_ROOT_VOL_ID  0x00000001
+#define AFS_FAKE_ROOT_CELL_ID 0xFFFFFFFF
+#define AFS_FAKE_ROOT_VOL_ID  0xFFFFFFFF
 #endif // _CM_FREELANCE_H
index 28536a9..9228c6b 100644 (file)
@@ -272,10 +272,12 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
        // because we have to fill in the status stuff 'coz we
        // don't want trybulkstat to fill it in for us
 #ifdef AFS_FREELANCE_CLIENT
-       special = (fidp->cell==0x1 && fidp->volume==AFS_FAKE_ROOT_VOL_ID && 
+       special = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && 
+               fidp->volume==AFS_FAKE_ROOT_VOL_ID &&
                           !(fidp->vnode==0x1 && fidp->unique==0x1));
-       isRoot = (fidp->cell==0x1 && fidp->volume==AFS_FAKE_ROOT_VOL_ID && 
-                          fidp->vnode==0x1 && fidp->unique==0x1);
+       isRoot = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && 
+              fidp->volume==AFS_FAKE_ROOT_VOL_ID &&
+                         fidp->vnode==0x1 && fidp->unique==0x1);
        if (cm_freelanceEnabled && isRoot) {
                osi_Log0(afsd_logp,"cm_getSCache Freelance and isRoot");
           /* freelance: if we are trying to get the root scp for the first
@@ -295,7 +297,7 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
                scp->volp = cm_rootSCachep->volp;
                if (scp->dotdotFidp == (cm_fid_t *) NULL)
                        scp->dotdotFidp = (cm_fid_t *) malloc (sizeof(cm_fid_t));
-               scp->dotdotFidp->cell=0x1;
+               scp->dotdotFidp->cell=AFS_FAKE_ROOT_CELL_ID;
                scp->dotdotFidp->volume=AFS_FAKE_ROOT_VOL_ID;
                scp->dotdotFidp->unique=1;
                scp->dotdotFidp->vnode=1;
@@ -592,7 +594,7 @@ long cm_SyncOp(cm_scache_t *scp, cm_buf_t *bufp, cm_user_t *up, cm_req_t *reqp,
 #ifdef AFS_FREELANCE_CLIENT
                        && (!cm_freelanceEnabled || !(!(scp->fid.vnode==0x1 &&
                                                         scp->fid.unique==0x1) &&
-                                                        scp->fid.cell==0x1 &&
+                                                        scp->fid.cell==AFS_FAKE_ROOT_CELL_ID &&
                                                         scp->fid.volume==AFS_FAKE_ROOT_VOL_ID))
 #endif /* AFS_FREELANCE_CLIENT */
                    ) {
index 6ee0494..5fde067 100644 (file)
@@ -1275,6 +1275,9 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags,
                tp = pathp;
                phase = 2;
        }
+       if (tp == NULL) {
+               tp = "";
+       }
        haveComponent = 0;
         psp = NULL;
         tscp = rootSCachep;
@@ -1548,9 +1551,10 @@ long cm_TryBulkProc(cm_scache_t *scp, cm_dirEntry_t *dep, void *rockp,
        // yj: if this is a mountpoint under root.afs then we don't want it
        // to be bulkstat-ed, instead, we call getSCache directly and under
        // getSCache, it is handled specially.
-       if      (cm_freelanceEnabled &&
-           tfid.cell==0x1 && tfid.volume==AFS_FAKE_ROOT_VOL_ID &&
-                          !(tfid.vnode==0x1 && tfid.unique==0x1) )
+       if      ( cm_freelanceEnabled &&
+          tfid.cell==AFS_FAKE_ROOT_CELL_ID && 
+          tfid.volume==AFS_FAKE_ROOT_VOL_ID &&
+          !(tfid.vnode==0x1 && tfid.unique==0x1) )
        {
         osi_Log0(afsd_logp, "cm_TryBulkProc Freelance calls cm_SCache on root.afs mountpoint");
                return cm_GetSCache(&tfid, &tscp, NULL, NULL);