]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vnode alloc bitnumber returns bitnumber
authorDerrick Brashear <shadow@dementia.org>
Tue, 11 May 2010 15:40:09 +0000 (11:40 -0400)
committerDerrick Brashear <shadow@dementia.org>
Tue, 11 May 2010 16:52:27 +0000 (09:52 -0700)
fix function return types to match a bitnumber (int)
and comment the function appropriately

Change-Id: I9542c02b1aa7aacdd0596675992bb1e8a1708572
Reviewed-on: http://gerrit.openafs.org/1941
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/vol/volume.c
src/vol/volume.h

index 41f9ccee367e9f7ebecf871f3c55cce713affe33..177c230f44cbb2ba836e761ce0ac35e4eb180987 100644 (file)
@@ -5405,19 +5405,33 @@ VChildProcReconnectFS(void)
 /* volume bitmap routines                          */
 /***************************************************/
 
+/**
+ * allocate a vnode bitmap number for the vnode
+ *
+ * @param[out] ec  error code
+ * @param[in] vp   volume object pointer
+ * @param[in] index vnode index number for the vnode
+ * @param[in] flags flag values described in note
+ *
+ * @note for DAFS, flags parameter controls locking behavior.
+ * If (flags & VOL_ALLOC_BITMAP_WAIT) is set, then this function
+ * will create a reservation and block on any other exclusive
+ * operations.  Otherwise, this function assumes the caller
+ * already has exclusive access to vp, and we just change the
+ * volume state.
+ *
+ * @pre VOL_LOCK held
+ *
+ * @return bit number allocated
+ */
 /*
- * For demand attach fs, flags parameter controls
- * locking behavior.  If (flags & VOL_ALLOC_BITMAP_WAIT)
- * is set, then this function will create a reservation
- * and block on any other exclusive operations.  Otherwise,
- * this function assumes the caller already has exclusive
- * access to vp, and we just change the volume state.
+
  */
-VnodeId
+int
 VAllocBitmapEntry_r(Error * ec, Volume * vp, 
                    struct vnodeIndex *index, int flags)
 {
-    VnodeId ret;
+    int ret = 0;
     register byte *bp, *ep;
 #ifdef AFS_DEMAND_ATTACH_FS
     VolState state_save;
@@ -5428,7 +5442,7 @@ VAllocBitmapEntry_r(Error * ec, Volume * vp,
     /* This test is probably redundant */
     if (!VolumeWriteable(vp)) {
        *ec = (bit32) VREADONLY;
-       return 0;
+       return ret;
     }
 
 #ifdef AFS_DEMAND_ATTACH_FS
@@ -5479,7 +5493,6 @@ VAllocBitmapEntry_r(Error * ec, Volume * vp,
                    vp->shuttingDown = 1;       /* Let who has it free it. */
                    vp->specialStatus = 0;
 #endif /* AFS_DEMAND_ATTACH_FS */
-                   ret = NULL;
                    goto done;
                }
            }
@@ -5504,7 +5517,7 @@ VAllocBitmapEntry_r(Error * ec, Volume * vp,
                bp++;
            o = ffs(~*bp) - 1;  /* ffs is documented in BSTRING(3) */
            *bp |= (1 << o);
-           ret = (VnodeId) ((bp - index->bitmap) * 8 + o);
+           ret = ((bp - index->bitmap) * 8 + o);
 #ifdef AFS_DEMAND_ATTACH_FS
            VOL_LOCK;
 #endif /* AFS_DEMAND_ATTACH_FS */
@@ -5537,10 +5550,10 @@ VAllocBitmapEntry_r(Error * ec, Volume * vp,
     return ret;
 }
 
-VnodeId
+int
 VAllocBitmapEntry(Error * ec, Volume * vp, register struct vnodeIndex * index)
 {
-    VnodeId retVal;
+    int retVal;
     VOL_LOCK;
     retVal = VAllocBitmapEntry_r(ec, vp, index, VOL_ALLOC_BITMAP_WAIT);
     VOL_UNLOCK;
index 8a45135878d65feb5a40c35ab1899358a83f99eb..afc88bd5ca4b318eaff9cbe5d47188093373a762 100644 (file)
@@ -774,10 +774,10 @@ extern Volume *VCreateVolume(Error * ec, char *partname, VolId volumeId,
                             VolId parentId);
 extern Volume *VCreateVolume_r(Error * ec, char *partname, VolId volumeId,
                               VolId parentId);
-extern VnodeId VAllocBitmapEntry(Error * ec, Volume * vp,
-                                struct vnodeIndex *index);
-extern VnodeId VAllocBitmapEntry_r(Error * ec, Volume * vp,
-                                  struct vnodeIndex *index, int flags);
+extern int VAllocBitmapEntry(Error * ec, Volume * vp,
+                            struct vnodeIndex *index);
+extern int VAllocBitmapEntry_r(Error * ec, Volume * vp,
+                              struct vnodeIndex *index, int flags);
 extern void VFreeBitMapEntry(Error * ec, register struct vnodeIndex *index,
                             unsigned bitNumber);
 extern void VFreeBitMapEntry_r(Error * ec, register struct vnodeIndex *index,