diff options
author | Karel Zak | 2009-10-15 14:14:32 +0200 |
---|---|---|
committer | Karel Zak | 2009-10-15 14:14:32 +0200 |
commit | e98754d6bbd277902f4e5e8190b29ece5d4376ec (patch) | |
tree | ea79a5fc2c0ba655c78fda16b76fc4f0c8130c26 /include/bitops.h | |
parent | blockdev: fix topology ioctls (diff) | |
download | kernel-qcow2-util-linux-e98754d6bbd277902f4e5e8190b29ece5d4376ec.tar.gz kernel-qcow2-util-linux-e98754d6bbd277902f4e5e8190b29ece5d4376ec.tar.xz kernel-qcow2-util-linux-e98754d6bbd277902f4e5e8190b29ece5d4376ec.zip |
fsck.minix: fix broken zone checking
This bug has been introduced by commit
95356e8b744439336925eeb36f01399f1ee8a5e9.
The fsck.minix code assumes that isset() macro returns boolean,
unfortunately the generic implementation from libc returns integer.
This patch also add a fallback for the bitmap macros to include/bitops.h.
Reported-by: "Andries E. Brouwer" <Andries.Brouwer@cwi.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/bitops.h')
-rw-r--r-- | include/bitops.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/bitops.h b/include/bitops.h index e6eaff18c..e283b8355 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -4,6 +4,22 @@ #include <stdint.h> #include <endian.h> +/* + * Bit map related macros. Usually provided by libc. + */ +#include <sys/param.h> + +#ifndef NBBY +# define NBBY CHAR_BIT +#endif + +#ifndef setbit +# define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +# define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +# define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +# define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) +#endif + #if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN) #error missing __BYTE_ORDER #endif |