diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-02-06 00:36:53 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-02-06 00:36:53 +0000 |
commit | dc485c9da66192a705e4d4a1ea0f8301d72906d6 (patch) | |
tree | 54b5747a29a75676ec4ef5bccc37f7df4c6b7aae /util-linux/fsck_minix.c | |
parent | f885c543da79845113d23e9eb78798988cc0a6b6 (diff) | |
download | busybox-w32-dc485c9da66192a705e4d4a1ea0f8301d72906d6.tar.gz busybox-w32-dc485c9da66192a705e4d4a1ea0f8301d72906d6.tar.bz2 busybox-w32-dc485c9da66192a705e4d4a1ea0f8301d72906d6.zip |
minix utils: make a message easier to understand; small tweaks
Diffstat (limited to 'util-linux/fsck_minix.c')
-rw-r--r-- | util-linux/fsck_minix.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 049bda4cc..4c486d08e 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -174,13 +174,16 @@ static char *zone_map; | |||
174 | static unsigned char *inode_count; | 174 | static unsigned char *inode_count; |
175 | static unsigned char *zone_count; | 175 | static unsigned char *zone_count; |
176 | 176 | ||
177 | static int bit(char *a, unsigned i) | 177 | static int bit(const char *a, unsigned i) |
178 | { | 178 | { |
179 | return (a[i >> 3] & (1<<(i & 7))) != 0; | 179 | return (a[i >> 3] & (1<<(i & 7))); |
180 | } | 180 | } |
181 | 181 | ||
182 | #define inode_in_use(x) (bit(inode_map,(x))) | 182 | /* setbit/clrbit are supplied by sys/param.h */ |
183 | |||
184 | /* Note: do not assume 0/1, it is 0/nonzero */ | ||
183 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) | 185 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) |
186 | #define inode_in_use(x) (bit(inode_map,(x))) | ||
184 | 187 | ||
185 | #define mark_inode(x) (setbit(inode_map,(x)),changed=1) | 188 | #define mark_inode(x) (setbit(inode_map,(x)),changed=1) |
186 | #define unmark_inode(x) (clrbit(inode_map,(x)),changed=1) | 189 | #define unmark_inode(x) (clrbit(inode_map,(x)),changed=1) |
@@ -1109,7 +1112,8 @@ static void check_counts(void) | |||
1109 | } | 1112 | } |
1110 | if (Inode1[i].i_nlinks != inode_count[i]) { | 1113 | if (Inode1[i].i_nlinks != inode_count[i]) { |
1111 | printf("Inode %d (mode=%07o), i_nlinks=%d, counted=%d. ", | 1114 | printf("Inode %d (mode=%07o), i_nlinks=%d, counted=%d. ", |
1112 | i, Inode1[i].i_mode, Inode1[i].i_nlinks, inode_count[i]); | 1115 | i, Inode1[i].i_mode, Inode1[i].i_nlinks, |
1116 | inode_count[i]); | ||
1113 | if (ask("Set i_nlinks to count", 1)) { | 1117 | if (ask("Set i_nlinks to count", 1)) { |
1114 | Inode1[i].i_nlinks = inode_count[i]; | 1118 | Inode1[i].i_nlinks = inode_count[i]; |
1115 | changed = 1; | 1119 | changed = 1; |
@@ -1117,7 +1121,7 @@ static void check_counts(void) | |||
1117 | } | 1121 | } |
1118 | } | 1122 | } |
1119 | for (i = FIRSTZONE; i < ZONES; i++) { | 1123 | for (i = FIRSTZONE; i < ZONES; i++) { |
1120 | if (zone_in_use(i) == zone_count[i]) | 1124 | if ((zone_in_use(i) != 0) == zone_count[i]) |
1121 | continue; | 1125 | continue; |
1122 | if (!zone_count[i]) { | 1126 | if (!zone_count[i]) { |
1123 | if (bad_zone(i)) | 1127 | if (bad_zone(i)) |
@@ -1160,8 +1164,8 @@ static void check_counts2(void) | |||
1160 | } | 1164 | } |
1161 | if (Inode2[i].i_nlinks != inode_count[i]) { | 1165 | if (Inode2[i].i_nlinks != inode_count[i]) { |
1162 | printf("Inode %d (mode=%07o), i_nlinks=%d, counted=%d. ", | 1166 | printf("Inode %d (mode=%07o), i_nlinks=%d, counted=%d. ", |
1163 | i, Inode2[i].i_mode, Inode2[i].i_nlinks, | 1167 | i, Inode2[i].i_mode, Inode2[i].i_nlinks, |
1164 | inode_count[i]); | 1168 | inode_count[i]); |
1165 | if (ask("Set i_nlinks to count", 1)) { | 1169 | if (ask("Set i_nlinks to count", 1)) { |
1166 | Inode2[i].i_nlinks = inode_count[i]; | 1170 | Inode2[i].i_nlinks = inode_count[i]; |
1167 | changed = 1; | 1171 | changed = 1; |
@@ -1169,7 +1173,7 @@ static void check_counts2(void) | |||
1169 | } | 1173 | } |
1170 | } | 1174 | } |
1171 | for (i = FIRSTZONE; i < ZONES; i++) { | 1175 | for (i = FIRSTZONE; i < ZONES; i++) { |
1172 | if (zone_in_use(i) == zone_count[i]) | 1176 | if ((zone_in_use(i) != 0) == zone_count[i]) |
1173 | continue; | 1177 | continue; |
1174 | if (!zone_count[i]) { | 1178 | if (!zone_count[i]) { |
1175 | if (bad_zone(i)) | 1179 | if (bad_zone(i)) |