]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vol: Don't assume enum is an int
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 15 Feb 2013 17:22:02 +0000 (17:22 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 30 Jan 2014 09:37:53 +0000 (01:37 -0800)
The type that an enum is promoted to for arithmetic is compiler
dependent. We can't assume that it's an int, or a short.

Explicitly cast the volume state enum where clang gets upset.

Reviewed-on: http://gerrit.openafs.org/9137
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 304fac42b8cd4a71d0df063cafe88b2888e4d175)

Change-Id: I8c5b3493549ec88727728a7f28e3430660c673b2
Reviewed-on: http://gerrit.openafs.org/10748
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/vol/vnode_inline.h
src/vol/volume.c
src/vol/volume_inline.h

index f31c5ca298a470f771b2096a0883adcf1babf8d8..a076a06c83260b6e27ef6e64fe59c789b0525c6d 100644 (file)
@@ -236,7 +236,7 @@ VnIsErrorState(VnState state)
 static_inline int
 VnIsValidState(VnState state)
 {
-    if ((state >= 0) &&
+    if (((int) state >= 0) &&
        (state < VN_STATE_COUNT)) {
        return 1;
     }
index f88c6fbbde0ff88d4bd880a4343425b7c8cbd192..7af7c65bcdbeb63e5fffefdb35ab5f72718ecad0 100644 (file)
@@ -1841,8 +1841,8 @@ VShutdownVolume_r(Volume * vp)
     VCreateReservation_r(vp);
 
     if (LogLevel >= 5) {
-       Log("VShutdownVolume_r:  vid=%u, device=%d, state=%hu\n",
-           vp->hashid, vp->partition->device, V_attachState(vp));
+       Log("VShutdownVolume_r:  vid=%u, device=%d, state=%u\n",
+           vp->hashid, vp->partition->device, (unsigned int)V_attachState(vp));
     }
 
     /* wait for other blocking ops to finish */
index 342288217111644184e412942d75e0132f15b863..2ca112c32d5b0b3df68c95a7d1ef443ae0cce227 100644 (file)
@@ -418,7 +418,7 @@ VIsOfflineState(VolState state)
 static_inline int
 VIsValidState(VolState state)
 {
-    if ((state >= 0) &&
+    if (((int) state >= 0) &&
        (state < VOL_STATE_COUNT)) {
        return 1;
     }