vos: Properly print volume transaction flags 26/14126/3
authorAndrew Deason <adeason@sinenomine.net>
Wed, 1 Apr 2020 02:19:18 +0000 (21:19 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 3 Apr 2020 15:11:54 +0000 (11:11 -0400)
commitf841c189a53f3a6bcf5c25336e4e0ad5362036e2
tree74e09d58406a1ce26ef398d48fd67ee933e43df9
parent4c4fb6e36634e5663c8be25acd4a1ac872e4738c
vos: Properly print volume transaction flags

Currently, the code in 'vos status' treats the 'iflags' and 'vflags'
of a transaction like an enumerated type; that is, we only check if
'iflags' is equal to ITOffline or ITBusy, etc. But both of these flags
fields are bitfields; any combination of the relevant flags could
theoretically be set.

Practically speaking, we only ever set at most one of the flags in
'iflags', but if anything ever did set more than one flag, our output
would look broken (we'd print "attachFlags:" without any flags).

For 'vflags', multiple flags are often set at once: the most common
combination is VTDeleteOnSalvage|VTOutOfService. So currently, we
usually print "attachFlags:" without any actual flags, since the
'vflags' field isn't exactly equal to VTDeleteOnSalvage (instead it's
set to VTDeleteOnSalvage|VTOutOfService). And if we ever did see just
VTDeleteOnSalvage set by itself, the way the switch() cases fall
through to each other, we'd print out that _all_ flags are set.

To fix all of this, just test for the individual flag bits instead.

Change-Id: Ib4d207bc713f0ef8eb51b9dbeaf2af50395536ee
Reviewed-on: https://gerrit.openafs.org/14126
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/volser/vos.c