mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
afs: Avoid using logical OR when setting f_fsid
Building with clang-10 produces the warning/error message
warning: converting the result of '<<' to a boolean always evaluates
to true [-Wtautological-constant-compare]
for the expression
abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
The message is because a logical OR '||' is used instead of a bitwise
OR '|'. The result of this expression will always set the f_fsid
member to a 1 and not the intended value of AFS_VFSMAGIC combined with
AFS_VFSFSID.
Update the expression to use a bitwise OR instead of the logical OR.
Note: This will change value stored in the f_fsid that is returned from
statfs.
Using a logical OR has existed since OpenAFS 1.0 for hpux/solaris and in
UKERNEL since OpenAFS 1.5 with the commit 'UKERNEL: add uafs_statvfs'
b822971a
.
Change-Id: I3e85ba48058ac68e3e3ac7f277623f660187926c
Reviewed-on: https://gerrit.openafs.org/14292
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
parent
446457a124
commit
c56873bf95
@ -166,7 +166,7 @@ afs_statfs(struct vfs *afsp, struct k_statvfs *abp)
|
||||
*/
|
||||
abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
|
||||
abp->f_ffree = abp->f_favail = AFS_VFS_FAKEFREE;
|
||||
abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
|
||||
abp->f_fsid = (AFS_VFSMAGIC << 16) | AFS_VFSFSID;
|
||||
|
||||
AFS_GUNLOCK();
|
||||
return 0;
|
||||
|
@ -229,7 +229,7 @@ afs_statvfs(struct vfs *afsp, struct statvfs64 *abp)
|
||||
abp->f_bsize = afsp->vfs_bsize;
|
||||
abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
|
||||
abp->f_favail = abp->f_ffree = AFS_VFS_FAKEFREE;
|
||||
abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
|
||||
abp->f_fsid = (AFS_VFSMAGIC << 16) | AFS_VFSFSID;
|
||||
|
||||
AFS_GUNLOCK();
|
||||
return 0;
|
||||
|
@ -129,7 +129,7 @@ afs_statvfs(struct vfs *afsp, struct statvfs *abp)
|
||||
abp->f_fsid.val[0] = AFS_VFSMAGIC;
|
||||
abp->f_fsid.val[1] = AFS_VFSFSID;
|
||||
#else
|
||||
abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
|
||||
abp->f_fsid = (AFS_VFSMAGIC << 16) | AFS_VFSFSID;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user