]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vol: Move VOL_CV_TIMEDWAIT to volume_inline.h
authorAndrew Deason <adeason@sinenomine.net>
Tue, 23 Nov 2010 03:23:02 +0000 (22:23 -0500)
committerDerrick Brashear <shadow@dementix.org>
Fri, 16 Dec 2011 04:32:33 +0000 (20:32 -0800)
Some platforms will give errors for the vol package glock not being
defined in VOL_CV_TIMEDWAIT, since some utilities include volume.h
(with pthreaded ubik enabled) but do not have the vol glock. This
isn't a problem for the other CV_WAIT (et al) macros, since, being
macros, they are not expanded if never referenced. Since
VOL_CV_TIMEDWAIT is a static inline function, however, and at least
some platforms try to compile/link it even if it's not referenced.

So, move it to volume_inline.h, which is only used by the volume
package itself, where we will have the vol glock.

Reviewed-on: http://gerrit.openafs.org/3363
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit e4059c1b812410bd96481cc60c86c67f8733b66f)

Change-Id: Ic1d6286bb148f202b8da010edf48fff93a5a48fb
Reviewed-on: http://gerrit.openafs.org/6268
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/vol/volume.h
src/vol/volume_inline.h

index 713e8ef2d90fdcedccd180d9a016c13be4b2c510..c5517644314c004781fbbe2b94d5e5bc63dbbd9e 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)
index 4bbfad8bf098d1d347cf0c7a19e9cb3be5df59c9..571f3084b2d4aa369eed757e8320b32f12c2674e 100644 (file)
 # include "lock.h"
 #endif
 
+#ifdef AFS_PTHREAD_ENV
+/**
+ * @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);
+}
+#endif /* AFS_PTHREAD_ENV */
+
 /**
  * tell caller whether the given program type represents a salvaging
  * program.