From 95356e8b744439336925eeb36f01399f1ee8a5e9 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 5 Feb 2009 15:44:17 +0000 Subject: [PATCH] mkfs.minix: remove local implementation of {set,clr}bit We needn't to duplicate stuff from . Signed-off-by: Karel Zak --- disk-utils/Makefile.am | 4 +-- disk-utils/fsck.minix.c | 8 +++--- disk-utils/minix_bitops.h | 54 --------------------------------------- disk-utils/mkfs.minix.c | 11 +++----- 4 files changed, 8 insertions(+), 69 deletions(-) delete mode 100644 disk-utils/minix_bitops.h diff --git a/disk-utils/Makefile.am b/disk-utils/Makefile.am index c2cc2f9f..9e9db95b 100644 --- a/disk-utils/Makefile.am +++ b/disk-utils/Makefile.am @@ -9,8 +9,8 @@ dist_man_MANS = isosize.8 mkfs.8 mkswap.8 \ fsck.minix.8 mkfs.minix.8 mkfs.bfs.8 sbin_PROGRAMS = mkfs mkswap fsck.minix mkfs.minix mkfs.bfs -fsck_minix_SOURCES = fsck.minix.c minix_bitops.h minix.h -mkfs_minix_SOURCES = mkfs.minix.c minix_bitops.h minix.h $(utils_common) +fsck_minix_SOURCES = fsck.minix.c minix.h +mkfs_minix_SOURCES = mkfs.minix.c minix.h $(utils_common) mkfs_bfs_SOURCES = mkfs.bfs.c $(utils_common) mkswap_SOURCES = mkswap.c $(utils_common) diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c index f6930d2a..af54c987 100644 --- a/disk-utils/fsck.minix.c +++ b/disk-utils/fsck.minix.c @@ -100,6 +100,7 @@ #include #include #include +#include #include #include "minix.h" @@ -169,10 +170,8 @@ static unsigned char * zone_count = NULL; static void recursive_check(unsigned int ino); static void recursive_check2(unsigned int ino); -#include "minix_bitops.h" - -#define inode_in_use(x) (bit(inode_map,(x))) -#define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) +#define inode_in_use(x) (isset(inode_map,(x))) +#define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1)) #define mark_inode(x) (setbit(inode_map,(x)),changed=1) #define unmark_inode(x) (clrbit(inode_map,(x)),changed=1) @@ -180,7 +179,6 @@ static void recursive_check2(unsigned int ino); #define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1),changed=1) #define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1),changed=1) - static void reset(void) { if (termios_set) diff --git a/disk-utils/minix_bitops.h b/disk-utils/minix_bitops.h deleted file mode 100644 index 270dc2d8..00000000 --- a/disk-utils/minix_bitops.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifdef __i386__ - -#define bitop(name,op) \ -static inline int name(char * addr,unsigned int nr) \ -{ \ -int __res; \ -__asm__ __volatile__("bt" op " %1,%2; adcl $0,%0" \ -:"=g" (__res) \ -:"r" (nr),"m" (*(addr)),"0" (0)); \ -return __res; \ -} - -bitop(bit,"") -bitop(setbit,"s") -bitop(clrbit,"r") - -#elif defined(__mc68000__) - -#define bitop(name,op) \ -static inline int name (char *addr, unsigned int nr) \ -{ \ - char __res; \ - __asm__ __volatile__("bf" op " %2@{%1:#1}; sne %0" \ - : "=d" (__res) \ - : "d" (nr ^ 15), "a" (addr)); \ - return __res != 0; \ -} - -bitop (bit, "tst") -bitop (setbit, "set") -bitop (clrbit, "clr") - -#else -static inline int bit(char * addr,unsigned int nr) -{ - return (addr[nr >> 3] & (1<<(nr & 7))) != 0; -} - -static inline int setbit(char * addr,unsigned int nr) -{ - int __res = bit(addr, nr); - addr[nr >> 3] |= (1<<(nr & 7)); - return __res != 0; \ -} - -static inline int clrbit(char * addr,unsigned int nr) -{ - int __res = bit(addr, nr); - addr[nr >> 3] &= ~(1<<(nr & 7)); - return __res != 0; -} - -#endif - diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index 4744db8c..e669ec6b 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -69,6 +69,7 @@ #include #include #include +#include #include #include @@ -77,10 +78,6 @@ #include "nls.h" #include "pathnames.h" -#ifndef __GNUC__ -#error "needs gcc for the bitop-__asm__'s" -#endif - #define MINIX_ROOT_INO 1 #define MINIX_BAD_INO 2 @@ -135,10 +132,8 @@ static unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; static int used_good_blocks = 0; static unsigned long req_nr_inodes = 0; -#include "minix_bitops.h" - -#define inode_in_use(x) (bit(inode_map,(x))) -#define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) +#define inode_in_use(x) (isset(inode_map,(x))) +#define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1)) #define mark_inode(x) (setbit(inode_map,(x))) #define unmark_inode(x) (clrbit(inode_map,(x))) -- 2.39.5