Whamcloud - gitweb
Change the function prototypes of ext2fs_set_bit, ext2fs_clear_bit, and
authorTheodore Ts'o <tytso@mit.edu>
Thu, 30 Jun 2005 23:40:18 +0000 (19:40 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 30 Jun 2005 23:40:18 +0000 (19:40 -0400)
ext2fs_test_bit to take an unsigned int for the bit number.  Negative
bit numbers were never allowed (and didn't make any sense), so this should
be a safe change.  This is needed to allow safe use of block numbers
greater than or equal to 2**31.

lib/ext2fs/ChangeLog
lib/ext2fs/bitops.c
lib/ext2fs/bitops.h

index f65cfcb..27c77b4 100644 (file)
@@ -1,3 +1,12 @@
+2005-06-30  Theodore Ts'o  <tytso@mit.edu>
+
+       * bitops.h, bitops.c (ext2fs_set_bit, ext2fs_clear_bit,
+               ext2fs_test_bit): Change these function prototypes to be
+               unsigned int's.  Negative bit numbers were never allowed
+               (and never made any sense), so this should be a safe
+               change.  This is needed to allow safe use of block numbers
+               greater than or equal to 2**31.
+
 2005-06-27  Stephen Tweedie  <sct@redhat.com>
 
        * ext2fs.h (ext2fs_resize_mem): Fix C99 strict type aliasing
index 207c44d..78632c6 100644 (file)
@@ -30,7 +30,7 @@
  * systems, as well as non-32 bit systems.
  */
 
-int ext2fs_set_bit(int nr,void * addr)
+int ext2fs_set_bit(unsigned int nr,void * addr)
 {
        int             mask, retval;
        unsigned char   *ADDR = (unsigned char *) addr;
@@ -42,7 +42,7 @@ int ext2fs_set_bit(int nr,void * addr)
        return retval;
 }
 
-int ext2fs_clear_bit(int nr, void * addr)
+int ext2fs_clear_bit(unsigned int nr, void * addr)
 {
        int             mask, retval;
        unsigned char   *ADDR = (unsigned char *) addr;
@@ -54,7 +54,7 @@ int ext2fs_clear_bit(int nr, void * addr)
        return retval;
 }
 
-int ext2fs_test_bit(int nr, const void * addr)
+int ext2fs_test_bit(unsigned int nr, const void * addr)
 {
        int                     mask;
        const unsigned char     *ADDR = (const unsigned char *) addr;
index b223809..dbd3027 100644 (file)
@@ -14,9 +14,9 @@
  */
 
 
-extern int ext2fs_set_bit(int nr,void * addr);
-extern int ext2fs_clear_bit(int nr, void * addr);
-extern int ext2fs_test_bit(int nr, const void * addr);
+extern int ext2fs_set_bit(unsigned int nr,void * addr);
+extern int ext2fs_clear_bit(unsigned int nr, void * addr);
+extern int ext2fs_test_bit(unsigned int nr, const void * addr);
 extern __u16 ext2fs_swab16(__u16 val);
 extern __u32 ext2fs_swab32(__u32 val);
 
@@ -152,7 +152,7 @@ struct __dummy_h { unsigned long a[100]; };
 #define EXT2FS_ADDR (*(struct __dummy_h *) addr)
 #define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)   
 
-_INLINE_ int ext2fs_set_bit(int nr, void * addr)
+_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
 {
        int oldbit;
 
@@ -162,7 +162,7 @@ _INLINE_ int ext2fs_set_bit(int nr, void * addr)
        return oldbit;
 }
 
-_INLINE_ int ext2fs_clear_bit(int nr, void * addr)
+_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
 {
        int oldbit;
 
@@ -172,7 +172,7 @@ _INLINE_ int ext2fs_clear_bit(int nr, void * addr)
        return oldbit;
 }
 
-_INLINE_ int ext2fs_test_bit(int nr, const void * addr)
+_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
 {
        int oldbit;
 
@@ -268,7 +268,7 @@ _INLINE_ __u16 ext2fs_swab16(__u16 val)
 
 #define _EXT2_HAVE_ASM_BITOPS_
 
-_INLINE_ int ext2fs_set_bit(int nr,void * addr)
+_INLINE_ int ext2fs_set_bit(unsigned int nr,void * addr)
 {
        char retval;
 
@@ -278,7 +278,7 @@ _INLINE_ int ext2fs_set_bit(int nr,void * addr)
        return retval;
 }
 
-_INLINE_ int ext2fs_clear_bit(int nr, void * addr)
+_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
 {
        char retval;
 
@@ -288,7 +288,7 @@ _INLINE_ int ext2fs_clear_bit(int nr, void * addr)
        return retval;
 }
 
-_INLINE_ int ext2fs_test_bit(int nr, const void * addr)
+_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
 {
        char retval;