add AFS_DEMAND_ATTACH_UTIL
[openafs.git] / src / vol / volume.h
index e3d6c7b..a0ad8f5 100644 (file)
@@ -96,36 +96,6 @@ extern pthread_t vol_glock_holder;
 #define VOL_CV_WAIT(cv) CV_WAIT((cv), &vol_glock_mutex)
 #endif /* !VOL_LOCK_DEBUG */
 
-/**
- * @param[in] cv cond var
- * @param[in] ts deadline, or NULL to wait forever
- * @param[out] timedout  set to 1 if we returned due to the deadline, 0 if we
- *                       returned due to the cond var getting signalled. If
- *                       NULL, it is ignored.
- */
-static_inline void
-VOL_CV_TIMEDWAIT(pthread_cond_t *cv, const struct timespec *ts, int *timedout)
-{
-    int code;
-    if (timedout) {
-       *timedout = 0;
-    }
-    if (!ts) {
-       VOL_CV_WAIT(cv);
-       return;
-    }
-    VOL_LOCK_DBG_CV_WAIT_BEGIN;
-    code = CV_TIMEDWAIT(cv, &vol_glock_mutex, ts);
-    VOL_LOCK_DBG_CV_WAIT_END;
-    if (code == ETIMEDOUT) {
-       code = 0;
-       if (timedout) {
-           *timedout = 1;
-       }
-    }
-    osi_Assert(code == 0);
-}
-
 #define VSALVSYNC_LOCK MUTEX_ENTER(&vol_salvsync_mutex)
 #define VSALVSYNC_UNLOCK MUTEX_EXIT(&vol_salvsync_mutex)
 #define VTRANS_LOCK MUTEX_ENTER(&vol_trans_mutex)
@@ -829,8 +799,6 @@ struct volHeader {
 extern char *VSalvageMessage;  /* Canonical message when a volume is forced
                                 * offline */
 extern Volume *VGetVolume(Error * ec, Error * client_ec, VolId volumeId);
-extern Volume *VGetVolumeTimed(Error * ec, Error * client_ec, VolId volumeId,
-                               const struct timespec *ts);
 extern Volume *VGetVolumeWithCall(Error * ec, Error * client_ec, VolId volumeId,
                                   const struct timespec *ts, struct VCallByVol *cbv);
 extern Volume *VGetVolume_r(Error * ec, VolId volumeId);
@@ -854,10 +822,10 @@ 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, struct vnodeIndex *index,
+extern void VFreeBitMapEntry(Error * ec, Volume *vp, struct vnodeIndex *index,
                             unsigned bitNumber);
-extern void VFreeBitMapEntry_r(Error * ec, struct vnodeIndex *index,
-                              unsigned bitNumber);
+extern void VFreeBitMapEntry_r(Error * ec, Volume *vp, struct vnodeIndex *index,
+                              unsigned bitNumber, int flags);
 extern int VolumeNumber(char *name);
 extern char *VolumeExternalName(VolumeId volumeId);
 extern int VolumeExternalName_r(VolumeId volumeId, char *name, size_t len);
@@ -931,13 +899,15 @@ extern int VDeregisterVolOp_r(Volume * vp);
 extern void VCancelReservation_r(Volume * vp);
 extern int VChildProcReconnectFS_r(void);
 extern void VOfflineForVolOp_r(Error *ec, Volume *vp, char *message);
+#endif /* AFS_DEMAND_ATTACH_FS */
 
+#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
 struct VDiskLock;
 extern void VDiskLockInit(struct VDiskLock *dl, struct VLockFile *lf,
                           afs_uint32 offset);
 extern int VGetDiskLock(struct VDiskLock *dl, int locktype, int nonblock);
 extern void VReleaseDiskLock(struct VDiskLock *dl, int locktype);
-#endif /* AFS_DEMAND_ATTACH_FS */
+#endif /* AFS_DEMAND_ATTACH_FS || AFS_DEMAND_ATTACH_UTIL */
 extern int VVolOpLeaveOnline_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
 extern int VVolOpLeaveOnlineNoHeader_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
 extern int VVolOpSetVBusy_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
@@ -1055,6 +1025,9 @@ extern int VWalkVolumeHeaders(struct DiskPartition64 *dp, const char *partpath,
 /* VAllocBitmapEntry_r flags */
 #define VOL_ALLOC_BITMAP_WAIT    0x1  /* for demand attach, wait for other exclusive ops to end */
 
+/* VFreeBitMapEntry_r flags */
+#define VOL_FREE_BITMAP_WAIT     0x1  /* for demand attach, wait for other exclusive ops to end */
+
 /* VRequestSalvage_r flags */
 #define VOL_SALVAGE_INVALIDATE_HEADER 0x1 /* for demand attach fs, invalidate volume header cache */
 #define VOL_SALVAGE_NO_OFFLINE        0x2 /* we do not need to wait to offline the volume; it has