Commit de331827 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] 2.5.8-pre3 set_bit cleanup II

This changes over some bogus casts, and converts the ext2, hfs and
minix set-bit macros.  Also changes pte and open_fds to hand the
actual bitfield rather than whole structure.

No object code changes
parent 22e962f9
...@@ -686,7 +686,7 @@ int get_unused_fd(void) ...@@ -686,7 +686,7 @@ int get_unused_fd(void)
write_lock(&files->file_lock); write_lock(&files->file_lock);
repeat: repeat:
fd = find_next_zero_bit(files->open_fds, fd = find_next_zero_bit(files->open_fds->fds_bits,
files->max_fdset, files->max_fdset,
files->next_fd); files->next_fd);
......
...@@ -469,18 +469,23 @@ static __inline__ int ffs(int x) ...@@ -469,18 +469,23 @@ static __inline__ int ffs(int x)
#ifdef __KERNEL__ #ifdef __KERNEL__
#define ext2_set_bit __test_and_set_bit #define ext2_set_bit(nr,addr) \
#define ext2_clear_bit __test_and_clear_bit __test_and_set_bit((nr),(unsigned long*)addr)
#define ext2_test_bit test_bit #define ext2_clear_bit(nr, addr) \
#define ext2_find_first_zero_bit find_first_zero_bit __test_and_clear_bit((nr),(unsigned long*)addr)
#define ext2_find_next_zero_bit find_next_zero_bit #define ext2_test_bit(nr, addr) test_bit((nr),(unsigned long*)addr)
#define ext2_find_first_zero_bit(addr, size) \
find_first_zero_bit((unsigned long*)addr, size)
#define ext2_find_next_zero_bit(addr, size, off) \
find_next_zero_bit((unsigned long*)addr, size, off)
/* Bitmap functions for the minix filesystem. */ /* Bitmap functions for the minix filesystem. */
#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr) #define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr)
#define minix_set_bit(nr,addr) __set_bit(nr,addr) #define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr)
#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr) #define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr)
#define minix_test_bit(nr,addr) test_bit(nr,addr) #define minix_test_bit(nr,addr) test_bit(nr,(void*)addr)
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) #define minix_find_first_zero_bit(addr,size) \
find_first_zero_bit((void*)addr,size)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -223,10 +223,10 @@ static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; retur ...@@ -223,10 +223,10 @@ static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; retur
static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
static inline int ptep_test_and_clear_dirty(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep); } static inline int ptep_test_and_clear_dirty(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); }
static inline int ptep_test_and_clear_young(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); } static inline int ptep_test_and_clear_young(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); }
static inline void ptep_set_wrprotect(pte_t *ptep) { clear_bit(_PAGE_BIT_RW, ptep); } static inline void ptep_set_wrprotect(pte_t *ptep) { clear_bit(_PAGE_BIT_RW, &ptep->pte_low); }
static inline void ptep_mkdirty(pte_t *ptep) { set_bit(_PAGE_BIT_DIRTY, ptep); } static inline void ptep_mkdirty(pte_t *ptep) { set_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); }
/* /*
* Conversion functions: convert a page and protection to a page entry, * Conversion functions: convert a page and protection to a page entry,
......
...@@ -394,8 +394,8 @@ static __inline__ unsigned long find_next_zero_bit(void * addr, ...@@ -394,8 +394,8 @@ static __inline__ unsigned long find_next_zero_bit(void * addr,
#ifdef __KERNEL__ #ifdef __KERNEL__
#define ext2_set_bit(nr, addr) __test_and_set_bit((nr) ^ 0x18, addr) #define ext2_set_bit(nr, addr) __test_and_set_bit((nr) ^ 0x18, (unsigned long *)(addr))
#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 0x18, addr) #define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 0x18, (unsigned long *)(addr))
static __inline__ int ext2_test_bit(int nr, __const__ void * addr) static __inline__ int ext2_test_bit(int nr, __const__ void * addr)
{ {
......
...@@ -200,16 +200,16 @@ static inline void *hfs_buffer_data(const hfs_buffer buffer) { ...@@ -200,16 +200,16 @@ static inline void *hfs_buffer_data(const hfs_buffer buffer) {
#endif #endif
static inline int hfs_clear_bit(int bitnr, hfs_u32 *lword) { static inline int hfs_clear_bit(int bitnr, hfs_u32 *lword) {
return test_and_clear_bit(BITNR(bitnr), lword); return test_and_clear_bit(BITNR(bitnr), (unsigned long *)lword);
} }
static inline int hfs_set_bit(int bitnr, hfs_u32 *lword) { static inline int hfs_set_bit(int bitnr, hfs_u32 *lword) {
return test_and_set_bit(BITNR(bitnr), lword); return test_and_set_bit(BITNR(bitnr), (unsigned long *)lword);
} }
static inline int hfs_test_bit(int bitnr, const hfs_u32 *lword) { static inline int hfs_test_bit(int bitnr, const hfs_u32 *lword) {
/* the kernel should declare the second arg of test_bit as const */ /* the kernel should declare the second arg of test_bit as const */
return test_bit(BITNR(bitnr), (void *)lword); return test_bit(BITNR(bitnr), (unsigned long *)lword);
} }
#undef BITNR #undef BITNR
......
...@@ -959,7 +959,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags) ...@@ -959,7 +959,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags)
p->lowest_bit = 0; p->lowest_bit = 0;
p->highest_bit = 0; p->highest_bit = 0;
for (i = 1 ; i < 8*PAGE_SIZE ; i++) { for (i = 1 ; i < 8*PAGE_SIZE ; i++) {
if (test_bit(i,(char *) swap_header)) { if (test_bit(i,(unsigned long *) swap_header)) {
if (!p->lowest_bit) if (!p->lowest_bit)
p->lowest_bit = i; p->lowest_bit = i;
p->highest_bit = i; p->highest_bit = i;
...@@ -974,7 +974,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags) ...@@ -974,7 +974,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags)
goto bad_swap; goto bad_swap;
} }
for (i = 1 ; i < maxpages ; i++) { for (i = 1 ; i < maxpages ; i++) {
if (test_bit(i,(char *) swap_header)) if (test_bit(i,(unsigned long *) swap_header))
p->swap_map[i] = 0; p->swap_map[i] = 0;
else else
p->swap_map[i] = SWAP_MAP_BAD; p->swap_map[i] = SWAP_MAP_BAD;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment