aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-03-08 07:03:27 +0000
committerMike Frysinger <vapier@gentoo.org>2006-03-08 07:03:27 +0000
commit874af85d5eb08b65476f406f6a1e7edc127ac210 (patch)
tree1cb4ee52f1592350dd9c4471b2a334957cc42b5e
parent0f2dd9f4eb9007bf44aa3f0cf30a35c36fbbd5b2 (diff)
downloadbusybox-w32-874af85d5eb08b65476f406f6a1e7edc127ac210.tar.gz
busybox-w32-874af85d5eb08b65476f406f6a1e7edc127ac210.tar.bz2
busybox-w32-874af85d5eb08b65476f406f6a1e7edc127ac210.zip
import most of e2fsprogs 1.38 updates
-rw-r--r--e2fsprogs/blkid/blkid.h6
-rw-r--r--e2fsprogs/blkid/blkidP.h61
-rw-r--r--e2fsprogs/blkid/cache.c2
-rw-r--r--e2fsprogs/blkid/dev.c99
-rw-r--r--e2fsprogs/blkid/devno.c4
-rw-r--r--e2fsprogs/blkid/probe.c29
-rw-r--r--e2fsprogs/blkid/probe.h31
-rw-r--r--e2fsprogs/blkid/read.c33
-rw-r--r--e2fsprogs/blkid/tag.c101
-rw-r--r--e2fsprogs/e2fsbb.h6
-rw-r--r--e2fsprogs/e2fsck.c173
-rw-r--r--e2fsprogs/e2p/ls.c1
-rw-r--r--e2fsprogs/e2p/ostype.c1
-rw-r--r--e2fsprogs/ext2fs/bitops.c6
-rw-r--r--e2fsprogs/ext2fs/bitops.h6
-rw-r--r--e2fsprogs/ext2fs/ext2fs.h1
-rw-r--r--e2fsprogs/ext2fs/ext2fs_inline.c8
-rw-r--r--e2fsprogs/ext2fs/getsectsize.c2
-rw-r--r--e2fsprogs/ext2fs/ismounted.c6
-rw-r--r--e2fsprogs/mke2fs.c28
-rw-r--r--e2fsprogs/util.c28
-rw-r--r--include/usage.h2
22 files changed, 435 insertions, 199 deletions
diff --git a/e2fsprogs/blkid/blkid.h b/e2fsprogs/blkid/blkid.h
index 3bb0e78d8..c051b2b85 100644
--- a/e2fsprogs/blkid/blkid.h
+++ b/e2fsprogs/blkid/blkid.h
@@ -55,6 +55,8 @@ extern int blkid_get_cache(blkid_cache *cache, const char *filename);
55extern const char *blkid_dev_devname(blkid_dev dev); 55extern const char *blkid_dev_devname(blkid_dev dev);
56 56
57extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache); 57extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
58extern int blkid_dev_set_search(blkid_dev_iterate iter,
59 char *search_type, char *search_value);
58extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev); 60extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
59extern void blkid_dev_iterate_end(blkid_dev_iterate iterate); 61extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
60 62
@@ -63,6 +65,7 @@ extern char *blkid_devno_to_devname(dev_t devno);
63 65
64/* devname.c */ 66/* devname.c */
65extern int blkid_probe_all(blkid_cache cache); 67extern int blkid_probe_all(blkid_cache cache);
68extern int blkid_probe_all_new(blkid_cache cache);
66extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, 69extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname,
67 int flags); 70 int flags);
68 71
@@ -86,7 +89,8 @@ extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
86extern int blkid_tag_next(blkid_tag_iterate iterate, 89extern int blkid_tag_next(blkid_tag_iterate iterate,
87 const char **type, const char **value); 90 const char **type, const char **value);
88extern void blkid_tag_iterate_end(blkid_tag_iterate iterate); 91extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
89 92extern int blkid_dev_has_tag(blkid_dev dev, const char *type,
93 const char *value);
90extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache, 94extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
91 const char *type, 95 const char *type,
92 const char *value); 96 const char *value);
diff --git a/e2fsprogs/blkid/blkidP.h b/e2fsprogs/blkid/blkidP.h
index 759dfcd87..4ae9763d2 100644
--- a/e2fsprogs/blkid/blkidP.h
+++ b/e2fsprogs/blkid/blkidP.h
@@ -147,65 +147,8 @@ extern int blkid_debug_mask;
147#endif 147#endif
148 148
149#ifdef CONFIG_BLKID_DEBUG 149#ifdef CONFIG_BLKID_DEBUG
150static inline void DEB_DUMP_TAG(int mask, blkid_tag tag) 150extern void blkid_debug_dump_dev(blkid_dev dev);
151{ 151extern void blkid_debug_dump_tag(blkid_tag tag);
152 if (!(mask & blkid_debug_mask))
153 return;
154
155 if (!tag) {
156 printf(" tag: NULL\n");
157 return;
158 }
159
160 printf(" tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
161}
162
163static inline void DEB_DUMP_DEV(int mask, blkid_dev dev)
164{
165 struct list_head *p;
166
167 if (!(mask & blkid_debug_mask))
168 return;
169
170 if (!dev) {
171 printf(" dev: NULL\n");
172 return;
173 }
174
175 printf(" dev: name = %s\n", dev->bid_name);
176 printf(" dev: DEVNO=\"0x%0Lx\"\n", dev->bid_devno);
177 printf(" dev: TIME=\"%lu\"\n", dev->bid_time);
178 printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
179 printf(" dev: flags = 0x%08X\n", dev->bid_flags);
180
181 list_for_each(p, &dev->bid_tags) {
182 blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
183 DEB_DUMP_TAG(mask, tag);
184 }
185 printf("\n");
186}
187
188static inline void DEB_DUMP_CACHE(int mask, blkid_cache cache)
189{
190 struct list_head *p;
191
192 if (!cache || !(mask & blkid_debug_mask)) {
193 printf("cache: NULL\n");
194 return;
195 }
196
197 printf("cache: time = %lu\n", cache->bic_time);
198 printf("cache: flags = 0x%08X\n", cache->bic_flags);
199
200 list_for_each(p, &cache->bic_devs) {
201 blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
202 DEB_DUMP_DEV(mask, dev);
203 }
204}
205#else
206#define DEB_DUMP_TAG(mask, tag) do {} while (0)
207#define DEB_DUMP_DEV(mask, dev) do {} while (0)
208#define DEB_DUMP_CACHE(mask, cache) do {} while (0)
209#endif 152#endif
210 153
211/* lseek.c */ 154/* lseek.c */
diff --git a/e2fsprogs/blkid/cache.c b/e2fsprogs/blkid/cache.c
index daccb30b3..9c9b8c7e4 100644
--- a/e2fsprogs/blkid/cache.c
+++ b/e2fsprogs/blkid/cache.c
@@ -63,7 +63,7 @@ void blkid_put_cache(blkid_cache cache)
63 63
64 DBG(DEBUG_CACHE, printf("freeing cache struct\n")); 64 DBG(DEBUG_CACHE, printf("freeing cache struct\n"));
65 65
66 /* DEB_DUMP_CACHE(cache); */ 66 /* DBG(DEBUG_CACHE, blkid_debug_dump_cache(cache)); */
67 67
68 while (!list_empty(&cache->bic_devs)) { 68 while (!list_empty(&cache->bic_devs)) {
69 blkid_dev dev = list_entry(cache->bic_devs.next, 69 blkid_dev dev = list_entry(cache->bic_devs.next,
diff --git a/e2fsprogs/blkid/dev.c b/e2fsprogs/blkid/dev.c
index 04cf8b5fa..5d56c5096 100644
--- a/e2fsprogs/blkid/dev.c
+++ b/e2fsprogs/blkid/dev.c
@@ -35,7 +35,7 @@ void blkid_free_dev(blkid_dev dev)
35 35
36 DBG(DEBUG_DEV, 36 DBG(DEBUG_DEV,
37 printf(" freeing dev %s (%s)\n", dev->bid_name, dev->bid_type)); 37 printf(" freeing dev %s (%s)\n", dev->bid_name, dev->bid_type));
38 DEB_DUMP_DEV(DEBUG_DEV, dev); 38 DBG(DEBUG_DEV, blkid_debug_dump_dev(dev));
39 39
40 list_del(&dev->bid_devs); 40 list_del(&dev->bid_devs);
41 while (!list_empty(&dev->bid_tags)) { 41 while (!list_empty(&dev->bid_tags)) {
@@ -57,6 +57,34 @@ const char *blkid_dev_devname(blkid_dev dev)
57 return dev->bid_name; 57 return dev->bid_name;
58} 58}
59 59
60#ifdef CONFIG_BLKID_DEBUG
61void blkid_debug_dump_dev(blkid_dev dev)
62{
63 struct list_head *p;
64
65 if (!dev) {
66 printf(" dev: NULL\n");
67 return;
68 }
69
70 printf(" dev: name = %s\n", dev->bid_name);
71 printf(" dev: DEVNO=\"0x%0llx\"\n", dev->bid_devno);
72 printf(" dev: TIME=\"%lu\"\n", dev->bid_time);
73 printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
74 printf(" dev: flags = 0x%08X\n", dev->bid_flags);
75
76 list_for_each(p, &dev->bid_tags) {
77 blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
78 if (tag)
79 printf(" tag: %s=\"%s\"\n", tag->bit_name,
80 tag->bit_val);
81 else
82 printf(" tag: NULL\n");
83 }
84 printf("\n");
85}
86#endif
87
60/* 88/*
61 * dev iteration routines for the public libblkid interface. 89 * dev iteration routines for the public libblkid interface.
62 * 90 *
@@ -114,3 +142,72 @@ void blkid_dev_iterate_end(blkid_dev_iterate iter)
114 free(iter); 142 free(iter);
115} 143}
116 144
145#ifdef TEST_PROGRAM
146#ifdef HAVE_GETOPT_H
147#include <getopt.h>
148#else
149extern char *optarg;
150extern int optind;
151#endif
152
153void usage(char *prog)
154{
155 fprintf(stderr, "Usage: %s [-f blkid_file] [-m debug_mask]\n", prog);
156 fprintf(stderr, "\tList all devices and exit\n", prog);
157 exit(1);
158}
159
160int main(int argc, char **argv)
161{
162 blkid_dev_iterate iter;
163 blkid_cache cache = NULL;
164 blkid_dev dev;
165 int c, ret;
166 char *tmp;
167 char *file = NULL;
168 char *search_type = NULL;
169 char *search_value = NULL;
170
171 while ((c = getopt (argc, argv, "m:f:")) != EOF)
172 switch (c) {
173 case 'f':
174 file = optarg;
175 break;
176 case 'm':
177 blkid_debug_mask = strtoul (optarg, &tmp, 0);
178 if (*tmp) {
179 fprintf(stderr, "Invalid debug mask: %d\n",
180 optarg);
181 exit(1);
182 }
183 break;
184 case '?':
185 usage(argv[0]);
186 }
187 if (argc >= optind+2) {
188 search_type = argv[optind];
189 search_value = argv[optind+1];
190 optind += 2;
191 }
192 if (argc != optind)
193 usage(argv[0]);
194
195 if ((ret = blkid_get_cache(&cache, file)) != 0) {
196 fprintf(stderr, "%s: error creating cache (%d)\n",
197 argv[0], ret);
198 exit(1);
199 }
200
201 iter = blkid_dev_iterate_begin(cache);
202 if (search_type)
203 blkid_dev_set_search(iter, search_type, search_value);
204 while (blkid_dev_next(iter, &dev) == 0) {
205 printf("Device: %s\n", blkid_dev_devname(dev));
206 }
207 blkid_dev_iterate_end(iter);
208
209
210 blkid_put_cache(cache);
211 return (0);
212}
213#endif
diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c
index 2979280f7..89119945c 100644
--- a/e2fsprogs/blkid/devno.c
+++ b/e2fsprogs/blkid/devno.c
@@ -117,7 +117,7 @@ static void scan_dir(char *dir_name, dev_t devno, struct dir_list **list,
117 else if (S_ISBLK(st.st_mode) && st.st_rdev == devno) { 117 else if (S_ISBLK(st.st_mode) && st.st_rdev == devno) {
118 *devname = blkid_strdup(path); 118 *devname = blkid_strdup(path);
119 DBG(DEBUG_DEVNO, 119 DBG(DEBUG_DEVNO,
120 printf("found 0x%Lx at %s (%p)\n", devno, 120 printf("found 0x%llx at %s (%p)\n", devno,
121 path, *devname)); 121 path, *devname));
122 break; 122 break;
123 } 123 }
@@ -175,7 +175,7 @@ char *blkid_devno_to_devname(dev_t devno)
175 (unsigned long) devno)); 175 (unsigned long) devno));
176 } else { 176 } else {
177 DBG(DEBUG_DEVNO, 177 DBG(DEBUG_DEVNO,
178 printf("found devno 0x%04Lx as %s\n", devno, devname)); 178 printf("found devno 0x%04llx as %s\n", devno, devname));
179 } 179 }
180 180
181 181
diff --git a/e2fsprogs/blkid/probe.c b/e2fsprogs/blkid/probe.c
index 36f7177b8..5ee8a200e 100644
--- a/e2fsprogs/blkid/probe.c
+++ b/e2fsprogs/blkid/probe.c
@@ -98,7 +98,8 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf)
98static int probe_ext3(int fd __BLKID_ATTR((unused)), 98static int probe_ext3(int fd __BLKID_ATTR((unused)),
99 blkid_cache cache __BLKID_ATTR((unused)), 99 blkid_cache cache __BLKID_ATTR((unused)),
100 blkid_dev dev, 100 blkid_dev dev,
101 const struct blkid_magic *id, unsigned char *buf) 101 struct blkid_magic *id __BLKID_ATTR((unused)),
102 unsigned char *buf)
102{ 103{
103 struct ext2_super_block *es; 104 struct ext2_super_block *es;
104 105
@@ -124,10 +125,10 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)),
124static int probe_ext2(int fd __BLKID_ATTR((unused)), 125static int probe_ext2(int fd __BLKID_ATTR((unused)),
125 blkid_cache cache __BLKID_ATTR((unused)), 126 blkid_cache cache __BLKID_ATTR((unused)),
126 blkid_dev dev, 127 blkid_dev dev,
127 const struct blkid_magic *id, unsigned char *buf) 128 struct blkid_magic *id __BLKID_ATTR((unused)),
129 unsigned char *buf)
128{ 130{
129 struct ext2_super_block *es; 131 struct ext2_super_block *es;
130// const char *sec_type = 0, *label = 0;
131 132
132 es = (struct ext2_super_block *)buf; 133 es = (struct ext2_super_block *)buf;
133 134
@@ -303,6 +304,23 @@ static int probe_romfs(int fd __BLKID_ATTR((unused)),
303 return 0; 304 return 0;
304} 305}
305 306
307static int probe_cramfs(int fd __BLKID_ATTR((unused)),
308 blkid_cache cache __BLKID_ATTR((unused)),
309 blkid_dev dev,
310 struct blkid_magic *id __BLKID_ATTR((unused)),
311 unsigned char *buf)
312{
313 struct cramfs_super_block *csb;
314 const char *label = 0;
315
316 csb = (struct cramfs_super_block *)buf;
317
318 if (strlen((char *) csb->name))
319 label = (char *) csb->name;
320 blkid_set_tag(dev, "LABEL", label, 0);
321 return 0;
322}
323
306static int probe_swap0(int fd __BLKID_ATTR((unused)), 324static int probe_swap0(int fd __BLKID_ATTR((unused)),
307 blkid_cache cache __BLKID_ATTR((unused)), 325 blkid_cache cache __BLKID_ATTR((unused)),
308 blkid_dev dev, 326 blkid_dev dev,
@@ -321,7 +339,6 @@ static int probe_swap1(int fd,
321 unsigned char *buf __BLKID_ATTR((unused))) 339 unsigned char *buf __BLKID_ATTR((unused)))
322{ 340{
323 struct swap_id_block *sws; 341 struct swap_id_block *sws;
324// const char *label = 0;
325 342
326 probe_swap0(fd, cache, dev, id, buf); 343 probe_swap0(fd, cache, dev, id, buf);
327 /* 344 /*
@@ -489,7 +506,7 @@ static const struct blkid_magic type_array[] = {
489 { "xfs", 0, 0, 4, "XFSB", probe_xfs }, 506 { "xfs", 0, 0, 4, "XFSB", probe_xfs },
490 { "romfs", 0, 0, 8, "-rom1fs-", probe_romfs }, 507 { "romfs", 0, 0, 8, "-rom1fs-", probe_romfs },
491 { "bfs", 0, 0, 4, "\316\372\173\033", 0 }, 508 { "bfs", 0, 0, 4, "\316\372\173\033", 0 },
492 { "cramfs", 0, 0, 4, "E=\315\034", 0 }, 509 { "cramfs", 0, 0, 4, "E=\315\050", probe_cramfs },
493 { "qnx4", 0, 4, 6, "QNX4FS", 0 }, 510 { "qnx4", 0, 4, 6, "QNX4FS", 0 },
494 { "udf", 32, 1, 5, "BEA01", probe_udf }, 511 { "udf", 32, 1, 5, "BEA01", probe_udf },
495 { "udf", 32, 1, 5, "BOOT2", probe_udf }, 512 { "udf", 32, 1, 5, "BOOT2", probe_udf },
@@ -647,7 +664,7 @@ found_type:
647 664
648 blkid_set_tag(dev, "TYPE", type, 0); 665 blkid_set_tag(dev, "TYPE", type, 0);
649 666
650 DBG(DEBUG_PROBE, printf("%s: devno 0x%04Lx, type %s\n", 667 DBG(DEBUG_PROBE, printf("%s: devno 0x%04llx, type %s\n",
651 dev->bid_name, st.st_rdev, type)); 668 dev->bid_name, st.st_rdev, type));
652 } 669 }
653 670
diff --git a/e2fsprogs/blkid/probe.h b/e2fsprogs/blkid/probe.h
index 530b8efe2..134913f59 100644
--- a/e2fsprogs/blkid/probe.h
+++ b/e2fsprogs/blkid/probe.h
@@ -108,13 +108,28 @@ struct romfs_super_block {
108 unsigned char ros_volume[16]; 108 unsigned char ros_volume[16];
109}; 109};
110 110
111struct cramfs_super_block {
112 __u8 magic[4];
113 __u32 size;
114 __u32 flags;
115 __u32 future;
116 __u8 signature[16];
117 struct cramfs_info {
118 __u32 crc;
119 __u32 edition;
120 __u32 blocks;
121 __u32 files;
122 } info;
123 __u8 name[16];
124};
125
111struct swap_id_block { 126struct swap_id_block {
112/* unsigned char sws_boot[1024]; */ 127/* unsigned char sws_boot[1024]; */
113 __u32 sws_version; 128 __u32 sws_version;
114 __u32 sws_lastpage; 129 __u32 sws_lastpage;
115 __u32 sws_nrbad; 130 __u32 sws_nrbad;
116 unsigned char sws_uuid[16]; 131 unsigned char sws_uuid[16];
117 unsigned char sws_volume[16]; 132 char sws_volume[16];
118 unsigned char sws_pad[117]; 133 unsigned char sws_pad[117];
119 __u32 sws_badpg; 134 __u32 sws_badpg;
120}; 135};
@@ -216,22 +231,22 @@ struct ocfs_volume_header {
216 unsigned char minor_version[4]; 231 unsigned char minor_version[4];
217 unsigned char major_version[4]; 232 unsigned char major_version[4];
218 unsigned char signature[128]; 233 unsigned char signature[128];
219 unsigned char mount[128]; 234 char mount[128];
220 unsigned char mount_len[2]; 235 unsigned char mount_len[2];
221}; 236};
222 237
223struct ocfs_volume_label { 238struct ocfs_volume_label {
224 unsigned char disk_lock[48]; 239 unsigned char disk_lock[48];
225 unsigned char label[64]; 240 char label[64];
226 unsigned char label_len[2]; 241 unsigned char label_len[2];
227 unsigned char vol_id[16]; 242 unsigned char vol_id[16];
228 unsigned char vol_id_len[2]; 243 unsigned char vol_id_len[2];
229}; 244};
230 245
231#define ocfsmajor(o) ((__u32)o.major_version[0] \ 246#define ocfsmajor(o) ((__u32)o.major_version[0] \
232 + (((__u32) o.major_version[1]) << 8) \ 247 + (((__u32) o.major_version[1]) << 8) \
233 + (((__u32) o.major_version[2]) << 16) \ 248 + (((__u32) o.major_version[2]) << 16) \
234 + (((__u32) o.major_version[3]) << 24)) 249 + (((__u32) o.major_version[3]) << 24))
235#define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8)) 250#define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8))
236#define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8)) 251#define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8))
237 252
@@ -241,7 +256,7 @@ struct ocfs2_super_block {
241 unsigned char signature[8]; 256 unsigned char signature[8];
242 unsigned char s_dummy1[184]; 257 unsigned char s_dummy1[184];
243 unsigned char s_dummy2[80]; 258 unsigned char s_dummy2[80];
244 unsigned char s_label[64]; 259 char s_label[64];
245 unsigned char s_uuid[16]; 260 unsigned char s_uuid[16];
246}; 261};
247 262
diff --git a/e2fsprogs/blkid/read.c b/e2fsprogs/blkid/read.c
index 08a3162f3..5f7422b0c 100644
--- a/e2fsprogs/blkid/read.c
+++ b/e2fsprogs/blkid/read.c
@@ -33,6 +33,11 @@
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36#ifdef TEST_PROGRAM
37#define blkid_debug_dump_dev(dev) (debug_dump_dev(dev))
38static void debug_dump_dev(blkid_dev dev);
39#endif
40
36/* 41/*
37 * File format: 42 * File format:
38 * 43 *
@@ -355,7 +360,7 @@ static int blkid_parse_line(blkid_cache cache, blkid_dev *dev_p, char *cp)
355 blkid_free_dev(dev); 360 blkid_free_dev(dev);
356 } 361 }
357 362
358 DEB_DUMP_DEV(DEBUG_READ, dev); 363 DBG(DEBUG_READ, blkid_debug_dump_dev(dev));
359 364
360 return ret; 365 return ret;
361} 366}
@@ -433,6 +438,32 @@ errout:
433} 438}
434 439
435#ifdef TEST_PROGRAM 440#ifdef TEST_PROGRAM
441static void debug_dump_dev(blkid_dev dev)
442{
443 struct list_head *p;
444
445 if (!dev) {
446 printf(" dev: NULL\n");
447 return;
448 }
449
450 printf(" dev: name = %s\n", dev->bid_name);
451 printf(" dev: DEVNO=\"0x%0llx\"\n", dev->bid_devno);
452 printf(" dev: TIME=\"%lu\"\n", dev->bid_time);
453 printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
454 printf(" dev: flags = 0x%08X\n", dev->bid_flags);
455
456 list_for_each(p, &dev->bid_tags) {
457 blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
458 if (tag)
459 printf(" tag: %s=\"%s\"\n", tag->bit_name,
460 tag->bit_val);
461 else
462 printf(" tag: NULL\n");
463 }
464 printf("\n");
465}
466
436int main(int argc, char**argv) 467int main(int argc, char**argv)
437{ 468{
438 blkid_cache cache = NULL; 469 blkid_cache cache = NULL;
diff --git a/e2fsprogs/blkid/tag.c b/e2fsprogs/blkid/tag.c
index 51615d4a5..61642464d 100644
--- a/e2fsprogs/blkid/tag.c
+++ b/e2fsprogs/blkid/tag.c
@@ -29,6 +29,18 @@ static blkid_tag blkid_new_tag(void)
29 return tag; 29 return tag;
30} 30}
31 31
32#ifdef CONFIG_BLKID_DEBUG
33void blkid_debug_dump_tag(blkid_tag tag)
34{
35 if (!tag) {
36 printf(" tag: NULL\n");
37 return;
38 }
39
40 printf(" tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
41}
42#endif
43
32void blkid_free_tag(blkid_tag tag) 44void blkid_free_tag(blkid_tag tag)
33{ 45{
34 if (!tag) 46 if (!tag)
@@ -36,7 +48,7 @@ void blkid_free_tag(blkid_tag tag)
36 48
37 DBG(DEBUG_TAG, printf(" freeing tag %s=%s\n", tag->bit_name, 49 DBG(DEBUG_TAG, printf(" freeing tag %s=%s\n", tag->bit_name,
38 tag->bit_val ? tag->bit_val : "(NULL)")); 50 tag->bit_val ? tag->bit_val : "(NULL)"));
39 DEB_DUMP_TAG(DEBUG_TAG, tag); 51 DBG(DEBUG_TAG, blkid_debug_dump_tag(tag));
40 52
41 list_del(&tag->bit_tags); /* list of tags for this device */ 53 list_del(&tag->bit_tags); /* list of tags for this device */
42 list_del(&tag->bit_names); /* list of tags with this type */ 54 list_del(&tag->bit_names); /* list of tags with this type */
@@ -330,3 +342,90 @@ try_again:
330 } 342 }
331 return dev; 343 return dev;
332} 344}
345
346#ifdef TEST_PROGRAM
347#ifdef HAVE_GETOPT_H
348#include <getopt.h>
349#else
350extern char *optarg;
351extern int optind;
352#endif
353
354void usage(char *prog)
355{
356 fprintf(stderr, "Usage: %s [-f blkid_file] [-m debug_mask] device "
357 "[type value]\n",
358 prog);
359 fprintf(stderr, "\tList all tags for a device and exit\n", prog);
360 exit(1);
361}
362
363int main(int argc, char **argv)
364{
365 blkid_tag_iterate iter;
366 blkid_cache cache = NULL;
367 blkid_dev dev;
368 int c, ret, found;
369 int flags = BLKID_DEV_FIND;
370 char *tmp;
371 char *file = NULL;
372 char *devname = NULL;
373 char *search_type = NULL;
374 char *search_value = NULL;
375 const char *type, *value;
376
377 while ((c = getopt (argc, argv, "m:f:")) != EOF)
378 switch (c) {
379 case 'f':
380 file = optarg;
381 break;
382 case 'm':
383 blkid_debug_mask = strtoul (optarg, &tmp, 0);
384 if (*tmp) {
385 fprintf(stderr, "Invalid debug mask: %d\n",
386 optarg);
387 exit(1);
388 }
389 break;
390 case '?':
391 usage(argv[0]);
392 }
393 if (argc > optind)
394 devname = argv[optind++];
395 if (argc > optind)
396 search_type = argv[optind++];
397 if (argc > optind)
398 search_value = argv[optind++];
399 if (!devname || (argc != optind))
400 usage(argv[0]);
401
402 if ((ret = blkid_get_cache(&cache, file)) != 0) {
403 fprintf(stderr, "%s: error creating cache (%d)\n",
404 argv[0], ret);
405 exit(1);
406 }
407
408 dev = blkid_get_dev(cache, devname, flags);
409 if (!dev) {
410 fprintf(stderr, "%s: Can not find device in blkid cache\n");
411 exit(1);
412 }
413 if (search_type) {
414 found = blkid_dev_has_tag(dev, search_type, search_value);
415 printf("Device %s: (%s, %s) %s\n", blkid_dev_devname(dev),
416 search_type, search_value ? search_value : "NULL",
417 found ? "FOUND" : "NOT FOUND");
418 return(!found);
419 }
420 printf("Device %s...\n", blkid_dev_devname(dev));
421
422 iter = blkid_tag_iterate_begin(dev);
423 while (blkid_tag_next(iter, &type, &value) == 0) {
424 printf("\tTag %s has value %s\n", type, value);
425 }
426 blkid_tag_iterate_end(iter);
427
428 blkid_put_cache(cache);
429 return (0);
430}
431#endif
diff --git a/e2fsprogs/e2fsbb.h b/e2fsprogs/e2fsbb.h
index 74c4e5b62..ddd196644 100644
--- a/e2fsprogs/e2fsbb.h
+++ b/e2fsprogs/e2fsbb.h
@@ -11,8 +11,8 @@
11#include "libbb.h" 11#include "libbb.h"
12 12
13/* version we've last synced against */ 13/* version we've last synced against */
14#define E2FSPROGS_VERSION "1.37" 14#define E2FSPROGS_VERSION "1.38"
15#define E2FSPROGS_DATE "21-Mar-2005" 15#define E2FSPROGS_DATE "30-Jun-2005"
16 16
17/* make sure com_err.h isnt included before us */ 17/* make sure com_err.h isnt included before us */
18#ifdef __COM_ERR_H__ 18#ifdef __COM_ERR_H__
@@ -51,7 +51,7 @@ typedef long errcode_t;
51#define HAVE_UNISTD_H 1 51#define HAVE_UNISTD_H 1
52 52
53/* Endianness */ 53/* Endianness */
54#if __BYTE_ORDER== __BIG_ENDIAN 54#if __BYTE_ORDER == __BIG_ENDIAN
55#define ENABLE_SWAPFS 1 55#define ENABLE_SWAPFS 1
56#define WORDS_BIGENDIAN 1 56#define WORDS_BIGENDIAN 1
57#endif 57#endif
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c
index 18dfd00b6..fb1e772a4 100644
--- a/e2fsprogs/e2fsck.c
+++ b/e2fsprogs/e2fsck.c
@@ -3712,6 +3712,8 @@ err_out:
3712 * @j journal 3712 * @j journal
3713 * @l lost+found 3713 * @l lost+found
3714 * @L is a link 3714 * @L is a link
3715 * @m multiply-claimed
3716 * @n invalid
3715 * @o orphaned 3717 * @o orphaned
3716 * @p problem in 3718 * @p problem in
3717 * @r root inode 3719 * @r root inode
@@ -3749,6 +3751,8 @@ static const char * const abbrevs[] = {
3749 N_("hHTREE @d @i"), 3751 N_("hHTREE @d @i"),
3750 N_("llost+found"), 3752 N_("llost+found"),
3751 N_("Lis a link"), 3753 N_("Lis a link"),
3754 N_("mmultiply-claimed"),
3755 N_("ninvalid"),
3752 N_("oorphaned"), 3756 N_("oorphaned"),
3753 N_("pproblem in"), 3757 N_("pproblem in"),
3754 N_("rroot @i"), 3758 N_("rroot @i"),
@@ -4698,7 +4702,8 @@ static void e2fsck_pass1(e2fsck_t ctx)
4698 if (ctx->progress) 4702 if (ctx->progress)
4699 if ((ctx->progress)(ctx, 1, 0, ctx->fs->group_desc_count)) 4703 if ((ctx->progress)(ctx, 1, 0, ctx->fs->group_desc_count))
4700 return; 4704 return;
4701 if (fs->super->s_wtime < fs->super->s_inodes_count) 4705 if ((fs->super->s_wtime < fs->super->s_inodes_count) ||
4706 (fs->super->s_mtime < fs->super->s_inodes_count))
4702 busted_fs_time = 1; 4707 busted_fs_time = 1;
4703 4708
4704 while (1) { 4709 while (1) {
@@ -5052,6 +5057,11 @@ static void e2fsck_pass1(e2fsck_t ctx)
5052 ctx->flags |= E2F_FLAG_ABORT; 5057 ctx->flags |= E2F_FLAG_ABORT;
5053 return; 5058 return;
5054 } 5059 }
5060 e2fsck_read_inode(ctx, EXT2_RESIZE_INO, inode,
5061 "recreate inode");
5062 inode->i_mtime = time(0);
5063 e2fsck_write_inode(ctx, EXT2_RESIZE_INO, inode,
5064 "recreate inode");
5055 fs->block_map = save_bmap; 5065 fs->block_map = save_bmap;
5056 ctx->flags &= ~E2F_FLAG_RESIZE_INODE; 5066 ctx->flags &= ~E2F_FLAG_RESIZE_INODE;
5057 } 5067 }
@@ -6702,7 +6712,7 @@ static void pass1d(e2fsck_t ctx, char *block_buf)
6702 shared_len = 0; 6712 shared_len = 0;
6703 file_ok = 1; 6713 file_ok = 1;
6704 ino = (ext2_ino_t)VOIDPTR_TO_INT(dnode_getkey(n)); 6714 ino = (ext2_ino_t)VOIDPTR_TO_INT(dnode_getkey(n));
6705 if (ino == EXT2_BAD_INO) 6715 if (ino == EXT2_BAD_INO || ino == EXT2_RESIZE_INO)
6706 continue; 6716 continue;
6707 6717
6708 /* 6718 /*
@@ -10052,7 +10062,7 @@ static const char * const prompt[] = {
10052 N_("Abort"), /* 11 */ 10062 N_("Abort"), /* 11 */
10053 N_("Split"), /* 12 */ 10063 N_("Split"), /* 12 */
10054 N_("Continue"), /* 13 */ 10064 N_("Continue"), /* 13 */
10055 N_("Clone duplicate/bad blocks"), /* 14 */ 10065 N_("Clone multiply-claimed blocks"), /* 14 */
10056 N_("Delete file"), /* 15 */ 10066 N_("Delete file"), /* 15 */
10057 N_("Suppress messages"),/* 16 */ 10067 N_("Suppress messages"),/* 16 */
10058 N_("Unlink"), /* 17 */ 10068 N_("Unlink"), /* 17 */
@@ -10080,7 +10090,7 @@ static const char * const preen_msg[] = {
10080 N_("ABORTED"), /* 11 */ 10090 N_("ABORTED"), /* 11 */
10081 N_("SPLIT"), /* 12 */ 10091 N_("SPLIT"), /* 12 */
10082 N_("CONTINUING"), /* 13 */ 10092 N_("CONTINUING"), /* 13 */
10083 N_("DUPLICATE/BAD BLOCKS CLONED"), /* 14 */ 10093 N_("MULTIPLY-CLAIMED BLOCKS CLONED"), /* 14 */
10084 N_("FILE DELETED"), /* 15 */ 10094 N_("FILE DELETED"), /* 15 */
10085 N_("SUPPRESSED"), /* 16 */ 10095 N_("SUPPRESSED"), /* 16 */
10086 N_("UNLINKED"), /* 17 */ 10096 N_("UNLINKED"), /* 17 */
@@ -10147,12 +10157,11 @@ static const struct e2fsck_problem problem_table[] = {
10147 10157
10148 /* Relocate hint */ 10158 /* Relocate hint */
10149 { PR_0_RELOCATE_HINT, 10159 { PR_0_RELOCATE_HINT,
10150 N_("Note: if there is several inode or block bitmap blocks\n" 10160 N_("Note: if several inode or block bitmap blocks or part\n"
10151 "which require relocation, or one part of the inode table\n" 10161 "of the inode table require relocation, you may wish to try\n"
10152 "which must be moved, you may wish to try running e2fsck\n" 10162 "running e2fsck with the '-b %S' option first. The problem\n"
10153 "with the '-b %S' option first. The problem may lie only\n" 10163 "may lie only with the primary block group descriptors, and\n"
10154 "with the primary block group descriptor, and the backup\n" 10164 "the backup block group descriptors may be OK.\n\n"),
10155 "block group descriptor may be OK.\n\n"),
10156 PROMPT_NONE, PR_PREEN_OK | PR_NOCOLLATE }, 10165 PROMPT_NONE, PR_PREEN_OK | PR_NOCOLLATE },
10157 10166
10158 /* Miscellaneous superblock corruption */ 10167 /* Miscellaneous superblock corruption */
@@ -10167,7 +10176,7 @@ static const struct e2fsck_problem problem_table[] = {
10167 10176
10168 /* Inode count in superblock is incorrect */ 10177 /* Inode count in superblock is incorrect */
10169 { PR_0_INODE_COUNT_WRONG, 10178 { PR_0_INODE_COUNT_WRONG,
10170 N_("@i count in @S is %i, should be %j.\n"), 10179 N_("@i count in @S is %i, @s %j.\n"),
10171 PROMPT_FIX, 0 }, 10180 PROMPT_FIX, 0 },
10172 10181
10173 { PR_0_HURD_CLEAR_FILETYPE, 10182 { PR_0_HURD_CLEAR_FILETYPE,
@@ -10176,7 +10185,7 @@ static const struct e2fsck_problem problem_table[] = {
10176 10185
10177 /* Journal inode is invalid */ 10186 /* Journal inode is invalid */
10178 { PR_0_JOURNAL_BAD_INODE, 10187 { PR_0_JOURNAL_BAD_INODE,
10179 N_("@S has a bad ext3 @j (@i %i).\n"), 10188 N_("@S has an @n ext3 @j (@i %i).\n"),
10180 PROMPT_CLEAR, PR_PREEN_OK }, 10189 PROMPT_CLEAR, PR_PREEN_OK },
10181 10190
10182 /* The external journal has (unsupported) multiple filesystems */ 10191 /* The external journal has (unsupported) multiple filesystems */
@@ -10224,7 +10233,7 @@ static const struct e2fsck_problem problem_table[] = {
10224 10233
10225 /* Journal has data, but recovery flag is clear */ 10234 /* Journal has data, but recovery flag is clear */
10226 { PR_0_JOURNAL_RECOVERY_CLEAR, 10235 { PR_0_JOURNAL_RECOVERY_CLEAR,
10227 N_("ext3 recovery flag clear, but @j has data.\n"), 10236 N_("ext3 recovery flag is clear, but @j has data.\n"),
10228 PROMPT_NONE, 0 }, 10237 PROMPT_NONE, 0 },
10229 10238
10230 /* Ask if we should clear the journal */ 10239 /* Ask if we should clear the journal */
@@ -10269,7 +10278,7 @@ static const struct e2fsck_problem problem_table[] = {
10269 10278
10270 /* Filesystem revision is 0, but feature flags are set */ 10279 /* Filesystem revision is 0, but feature flags are set */
10271 { PR_0_FS_REV_LEVEL, 10280 { PR_0_FS_REV_LEVEL,
10272 "@f has feature flag(s) set, but is a revision 0 @f. ", 10281 N_("@f has feature flag(s) set, but is a revision 0 @f. "),
10273 PROMPT_FIX, PR_PREEN_OK | PR_NO_OK }, 10282 PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
10274 10283
10275 /* Journal superblock has an unknown read-only feature flag set */ 10284 /* Journal superblock has an unknown read-only feature flag set */
@@ -10289,7 +10298,7 @@ static const struct e2fsck_problem problem_table[] = {
10289 10298
10290 /* Moving journal to hidden file */ 10299 /* Moving journal to hidden file */
10291 { PR_0_MOVE_JOURNAL, 10300 { PR_0_MOVE_JOURNAL,
10292 N_("Moving @j from /%s to hidden inode.\n\n"), 10301 N_("Moving @j from /%s to hidden @i.\n\n"),
10293 PROMPT_NONE, 0 }, 10302 PROMPT_NONE, 0 },
10294 10303
10295 /* Error moving journal to hidden file */ 10304 /* Error moving journal to hidden file */
@@ -10299,7 +10308,7 @@ static const struct e2fsck_problem problem_table[] = {
10299 10308
10300 /* Clearing V2 journal superblock */ 10309 /* Clearing V2 journal superblock */
10301 { PR_0_CLEAR_V2_JOURNAL, 10310 { PR_0_CLEAR_V2_JOURNAL,
10302 N_("Found invalid V2 @j @S fields (from V1 journal).\n" 10311 N_("Found @n V2 @j @S fields (from V1 @j).\n"
10303 "Clearing fields beyond the V1 @j @S...\n\n"), 10312 "Clearing fields beyond the V1 @j @S...\n\n"),
10304 PROMPT_NONE, 0 }, 10313 PROMPT_NONE, 0 },
10305 10314
@@ -10316,7 +10325,7 @@ static const struct e2fsck_problem problem_table[] = {
10316 10325
10317 /* Resize_inode not enabled, but resize inode is non-zero */ 10326 /* Resize_inode not enabled, but resize inode is non-zero */
10318 { PR_0_CLEAR_RESIZE_INODE, 10327 { PR_0_CLEAR_RESIZE_INODE,
10319 N_("Resize_@i not enabled, but the resize inode is non-zero. "), 10328 N_("Resize_@i not enabled, but the resize @i is non-zero. "),
10320 PROMPT_CLEAR, 0 }, 10329 PROMPT_CLEAR, 0 },
10321 10330
10322 /* Resize inode invalid */ 10331 /* Resize inode invalid */
@@ -10342,7 +10351,7 @@ static const struct e2fsck_problem problem_table[] = {
10342 10351
10343 /* Reserved inode has bad mode */ 10352 /* Reserved inode has bad mode */
10344 { PR_1_RESERVED_BAD_MODE, 10353 { PR_1_RESERVED_BAD_MODE,
10345 N_("Reserved @i %i %Q has bad mode. "), 10354 N_("Reserved @i %i (%Q) has @n mode. "),
10346 PROMPT_CLEAR, PR_PREEN_OK }, 10355 PROMPT_CLEAR, PR_PREEN_OK },
10347 10356
10348 /* Deleted inode has zero dtime */ 10357 /* Deleted inode has zero dtime */
@@ -10449,9 +10458,8 @@ static const struct e2fsck_problem problem_table[] = {
10449 10458
10450 /* Bad primary block prompt */ 10459 /* Bad primary block prompt */
10451 { PR_1_BAD_PRIMARY_BLOCK_PROMPT, 10460 { PR_1_BAD_PRIMARY_BLOCK_PROMPT,
10452 N_("You can clear the this @b (and hope for the best) from the\n" 10461 N_("You can remove this @b from the bad @b list and hope\n"
10453 "bad @b list and hope that @b is really OK, but there are no\n" 10462 "that the @b is really OK. But there are no guarantees.\n\n"),
10454 "guarantees.\n\n"),
10455 PROMPT_CLEAR, PR_PREEN_NOMSG }, 10463 PROMPT_CLEAR, PR_PREEN_NOMSG },
10456 10464
10457 /* Bad primary superblock */ 10465 /* Bad primary superblock */
@@ -10514,12 +10522,12 @@ static const struct e2fsck_problem problem_table[] = {
10514 10522
10515 /* Error allocating inode bitmap */ 10523 /* Error allocating inode bitmap */
10516 { PR_1_ALLOCATE_IBITMAP_ERROR, 10524 { PR_1_ALLOCATE_IBITMAP_ERROR,
10517 "@A @i @B (%N): %m\n", 10525 N_("@A @i @B (%N): %m\n"),
10518 PROMPT_NONE, PR_FATAL }, 10526 PROMPT_NONE, PR_FATAL },
10519 10527
10520 /* Error allocating block bitmap */ 10528 /* Error allocating block bitmap */
10521 { PR_1_ALLOCATE_BBITMAP_ERROR, 10529 { PR_1_ALLOCATE_BBITMAP_ERROR,
10522 "@A @b @B (%N): %m\n", 10530 N_("@A @b @B (%N): %m\n"),
10523 PROMPT_NONE, PR_FATAL }, 10531 PROMPT_NONE, PR_FATAL },
10524 10532
10525 /* Error allocating icount structure */ 10533 /* Error allocating icount structure */
@@ -10579,17 +10587,17 @@ static const struct e2fsck_problem problem_table[] = {
10579 10587
10580 /* Non-zero size for device, fifo or socket inode */ 10588 /* Non-zero size for device, fifo or socket inode */
10581 { PR_1_SET_NONZSIZE, 10589 { PR_1_SET_NONZSIZE,
10582 "Special (@v/socket/fifo) @i %i has non-zero size. ", 10590 N_("Special (@v/socket/fifo) @i %i has non-zero size. "),
10583 PROMPT_FIX, PR_PREEN_OK }, 10591 PROMPT_FIX, PR_PREEN_OK },
10584 10592
10585 /* Filesystem revision is 0, but feature flags are set */ 10593 /* Filesystem revision is 0, but feature flags are set */
10586 { PR_1_FS_REV_LEVEL, 10594 { PR_1_FS_REV_LEVEL,
10587 "@f has feature flag(s) set, but is a revision 0 @f. ", 10595 N_("@f has feature flag(s) set, but is a revision 0 @f. "),
10588 PROMPT_FIX, PR_PREEN_OK | PR_NO_OK }, 10596 PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
10589 10597
10590 /* Journal inode is not in use, but contains data */ 10598 /* Journal inode is not in use, but contains data */
10591 { PR_1_JOURNAL_INODE_NOT_CLEAR, 10599 { PR_1_JOURNAL_INODE_NOT_CLEAR,
10592 "@j @i is not in use, but contains data. ", 10600 N_("@j @i is not in use, but contains data. "),
10593 PROMPT_CLEAR, PR_PREEN_OK }, 10601 PROMPT_CLEAR, PR_PREEN_OK },
10594 10602
10595 /* Journal has bad mode */ 10603 /* Journal has bad mode */
@@ -10599,7 +10607,7 @@ static const struct e2fsck_problem problem_table[] = {
10599 10607
10600 /* Deal with inodes that were part of orphan linked list */ 10608 /* Deal with inodes that were part of orphan linked list */
10601 { PR_1_LOW_DTIME, 10609 { PR_1_LOW_DTIME,
10602 N_("@i %i was part of the orphaned @i list. "), 10610 N_("@i %i was part of the @o @i list. "),
10603 PROMPT_FIX, PR_LATCH_LOW_DTIME, 0 }, 10611 PROMPT_FIX, PR_LATCH_LOW_DTIME, 0 },
10604 10612
10605 /* Deal with inodes that were part of corrupted orphan linked 10613 /* Deal with inodes that were part of corrupted orphan linked
@@ -10610,7 +10618,7 @@ static const struct e2fsck_problem problem_table[] = {
10610 10618
10611 /* Error allocating refcount structure */ 10619 /* Error allocating refcount structure */
10612 { PR_1_ALLOCATE_REFCOUNT, 10620 { PR_1_ALLOCATE_REFCOUNT,
10613 "@A refcount structure (%N): %m\n", 10621 N_("@A refcount structure (%N): %m\n"),
10614 PROMPT_NONE, PR_FATAL }, 10622 PROMPT_NONE, PR_FATAL },
10615 10623
10616 /* Error reading extended attribute block */ 10624 /* Error reading extended attribute block */
@@ -10630,7 +10638,7 @@ static const struct e2fsck_problem problem_table[] = {
10630 10638
10631 /* Extended attribute reference count incorrect */ 10639 /* Extended attribute reference count incorrect */
10632 { PR_1_EXTATTR_REFCOUNT, 10640 { PR_1_EXTATTR_REFCOUNT,
10633 N_("@a @b %b has reference count %B, should be %N. "), 10641 N_("@a @b %b has reference count %B, @s %N. "),
10634 PROMPT_FIX, 0 }, 10642 PROMPT_FIX, 0 },
10635 10643
10636 /* Error writing Extended Attribute block while fixing refcount */ 10644 /* Error writing Extended Attribute block while fixing refcount */
@@ -10640,12 +10648,12 @@ static const struct e2fsck_problem problem_table[] = {
10640 10648
10641 /* Multiple EA blocks not supported */ 10649 /* Multiple EA blocks not supported */
10642 { PR_1_EA_MULTI_BLOCK, 10650 { PR_1_EA_MULTI_BLOCK,
10643 N_("@a @b %b has h_blocks > 1. "), 10651 N_("@a @b %b has h_@bs > 1. "),
10644 PROMPT_CLEAR, 0}, 10652 PROMPT_CLEAR, 0},
10645 10653
10646 /* Error allocating EA region allocation structure */ 10654 /* Error allocating EA region allocation structure */
10647 { PR_1_EA_ALLOC_REGION, 10655 { PR_1_EA_ALLOC_REGION,
10648 N_("Error allocating @a @b %b. "), 10656 N_("@A @a @b %b. "),
10649 PROMPT_ABORT, 0}, 10657 PROMPT_ABORT, 0},
10650 10658
10651 /* Error EA allocation collision */ 10659 /* Error EA allocation collision */
@@ -10655,12 +10663,12 @@ static const struct e2fsck_problem problem_table[] = {
10655 10663
10656 /* Bad extended attribute name */ 10664 /* Bad extended attribute name */
10657 { PR_1_EA_BAD_NAME, 10665 { PR_1_EA_BAD_NAME,
10658 N_("@a @b %b is corrupt (invalid name). "), 10666 N_("@a @b %b is corrupt (@n name). "),
10659 PROMPT_CLEAR, 0}, 10667 PROMPT_CLEAR, 0},
10660 10668
10661 /* Bad extended attribute value */ 10669 /* Bad extended attribute value */
10662 { PR_1_EA_BAD_VALUE, 10670 { PR_1_EA_BAD_VALUE,
10663 N_("@a @b %b is corrupt (invalid value). "), 10671 N_("@a @b %b is corrupt (@n value). "),
10664 PROMPT_CLEAR, 0}, 10672 PROMPT_CLEAR, 0},
10665 10673
10666 /* Inode too big (latch question) */ 10674 /* Inode too big (latch question) */
@@ -10694,7 +10702,7 @@ static const struct e2fsck_problem problem_table[] = {
10694 10702
10695 /* Invalid root node in HTREE directory */ 10703 /* Invalid root node in HTREE directory */
10696 { PR_1_HTREE_BADROOT, 10704 { PR_1_HTREE_BADROOT,
10697 N_("@h %i has an invalid root node.\n"), 10705 N_("@h %i has an @n root node.\n"),
10698 PROMPT_CLEAR_HTREE, PR_PREEN_OK }, 10706 PROMPT_CLEAR_HTREE, PR_PREEN_OK },
10699 10707
10700 /* Unsupported hash version in HTREE directory */ 10708 /* Unsupported hash version in HTREE directory */
@@ -10725,45 +10733,45 @@ static const struct e2fsck_problem problem_table[] = {
10725 10733
10726 /* invalid inode->i_extra_isize */ 10734 /* invalid inode->i_extra_isize */
10727 { PR_1_EXTRA_ISIZE, 10735 { PR_1_EXTRA_ISIZE,
10728 N_("@i %i has a extra size (%IS) which is invalid\n"), 10736 N_("@i %i has a extra size (%IS) which is @n\n"),
10729 PROMPT_FIX, PR_PREEN_OK }, 10737 PROMPT_FIX, PR_PREEN_OK },
10730 10738
10731 /* invalid ea entry->e_name_len */ 10739 /* invalid ea entry->e_name_len */
10732 { PR_1_ATTR_NAME_LEN, 10740 { PR_1_ATTR_NAME_LEN,
10733 N_("@a in @i %i has a namelen (%N) which is invalid\n"), 10741 N_("@a in @i %i has a namelen (%N) which is @n\n"),
10734 PROMPT_CLEAR, PR_PREEN_OK }, 10742 PROMPT_CLEAR, PR_PREEN_OK },
10735 10743
10736 /* invalid ea entry->e_value_size */ 10744 /* invalid ea entry->e_value_size */
10737 { PR_1_ATTR_VALUE_SIZE, 10745 { PR_1_ATTR_VALUE_SIZE,
10738 N_("@a in @i %i has a value size (%N) which is invalid\n"), 10746 N_("@a in @i %i has a value size (%N) which is @n\n"),
10739 PROMPT_CLEAR, PR_PREEN_OK }, 10747 PROMPT_CLEAR, PR_PREEN_OK },
10740 10748
10741 /* invalid ea entry->e_value_offs */ 10749 /* invalid ea entry->e_value_offs */
10742 { PR_1_ATTR_VALUE_OFFSET, 10750 { PR_1_ATTR_VALUE_OFFSET,
10743 N_("@a in @i %i has a value offset (%N) which is invalid\n"), 10751 N_("@a in @i %i has a value offset (%N) which is @n\n"),
10744 PROMPT_CLEAR, PR_PREEN_OK }, 10752 PROMPT_CLEAR, PR_PREEN_OK },
10745 10753
10746 /* invalid ea entry->e_value_block */ 10754 /* invalid ea entry->e_value_block */
10747 { PR_1_ATTR_VALUE_BLOCK, 10755 { PR_1_ATTR_VALUE_BLOCK,
10748 N_("@a in @i %i has a value block (%N) which is invalid (must be 0)\n"), 10756 N_("@a in @i %i has a value @b (%N) which is @n (must be 0)\n"),
10749 PROMPT_CLEAR, PR_PREEN_OK }, 10757 PROMPT_CLEAR, PR_PREEN_OK },
10750 10758
10751 /* invalid ea entry->e_hash */ 10759 /* invalid ea entry->e_hash */
10752 { PR_1_ATTR_HASH, 10760 { PR_1_ATTR_HASH,
10753 N_("@a in @i %i has a hash (%N) which is invalid (must be 0)\n"), 10761 N_("@a in @i %i has a hash (%N) which is @n (must be 0)\n"),
10754 PROMPT_CLEAR, PR_PREEN_OK }, 10762 PROMPT_CLEAR, PR_PREEN_OK },
10755 10763
10756 /* Pass 1b errors */ 10764 /* Pass 1b errors */
10757 10765
10758 /* Pass 1B: Rescan for duplicate/bad blocks */ 10766 /* Pass 1B: Rescan for duplicate/bad blocks */
10759 { PR_1B_PASS_HEADER, 10767 { PR_1B_PASS_HEADER,
10760 N_("Duplicate @bs found... invoking duplicate @b passes.\n" 10768 N_("\nRunning additional passes to resolve @bs claimed by more than one @i...\n"
10761 "Pass 1B: Rescan for duplicate/bad @bs\n"), 10769 "Pass 1B: Rescanning for @m @bs\n"),
10762 PROMPT_NONE, 0 }, 10770 PROMPT_NONE, 0 },
10763 10771
10764 /* Duplicate/bad block(s) header */ 10772 /* Duplicate/bad block(s) header */
10765 { PR_1B_DUP_BLOCK_HEADER, 10773 { PR_1B_DUP_BLOCK_HEADER,
10766 N_("Duplicate/bad @b(s) in @i %i:"), 10774 N_("@m @b(s) in @i %i:"),
10767 PROMPT_NONE, 0 }, 10775 PROMPT_NONE, 0 },
10768 10776
10769 /* Duplicate/bad block(s) in inode */ 10777 /* Duplicate/bad block(s) in inode */
@@ -10783,7 +10791,7 @@ static const struct e2fsck_problem problem_table[] = {
10783 10791
10784 /* Error allocating inode bitmap */ 10792 /* Error allocating inode bitmap */
10785 { PR_1B_ALLOCATE_IBITMAP_ERROR, 10793 { PR_1B_ALLOCATE_IBITMAP_ERROR,
10786 N_("@A @i @B (inode_dup_map): %m\n"), 10794 N_("@A @i @B (@i_dup_map): %m\n"),
10787 PROMPT_NONE, PR_FATAL }, 10795 PROMPT_NONE, PR_FATAL },
10788 10796
10789 /* Error while iterating over blocks */ 10797 /* Error while iterating over blocks */
@@ -10793,25 +10801,25 @@ static const struct e2fsck_problem problem_table[] = {
10793 10801
10794 /* Error adjusting EA refcount */ 10802 /* Error adjusting EA refcount */
10795 { PR_1B_ADJ_EA_REFCOUNT, 10803 { PR_1B_ADJ_EA_REFCOUNT,
10796 N_("Error addjusting refcount for @a @b %b (@i %i): %m\n"), 10804 N_("Error adjusting refcount for @a @b %b (@i %i): %m\n"),
10797 PROMPT_NONE, 0 }, 10805 PROMPT_NONE, 0 },
10798 10806
10799 10807
10800 /* Pass 1C: Scan directories for inodes with dup blocks. */ 10808 /* Pass 1C: Scan directories for inodes with multiply-claimed blocks. */
10801 { PR_1C_PASS_HEADER, 10809 { PR_1C_PASS_HEADER,
10802 N_("Pass 1C: Scan directories for @is with dup @bs.\n"), 10810 N_("Pass 1C: Scanning directories for @is with @m @bs.\n"),
10803 PROMPT_NONE, 0 }, 10811 PROMPT_NONE, 0 },
10804 10812
10805 10813
10806 /* Pass 1D: Reconciling duplicate blocks */ 10814 /* Pass 1D: Reconciling multiply-claimed blocks */
10807 { PR_1D_PASS_HEADER, 10815 { PR_1D_PASS_HEADER,
10808 N_("Pass 1D: Reconciling duplicate @bs\n"), 10816 N_("Pass 1D: Reconciling @m @bs\n"),
10809 PROMPT_NONE, 0 }, 10817 PROMPT_NONE, 0 },
10810 10818
10811 /* File has duplicate blocks */ 10819 /* File has duplicate blocks */
10812 { PR_1D_DUP_FILE, 10820 { PR_1D_DUP_FILE,
10813 N_("File %Q (@i #%i, mod time %IM) \n" 10821 N_("File %Q (@i #%i, mod time %IM) \n"
10814 " has %B duplicate @b(s), shared with %N file(s):\n"), 10822 " has %B @m @b(s), shared with %N file(s):\n"),
10815 PROMPT_NONE, 0 }, 10823 PROMPT_NONE, 0 },
10816 10824
10817 /* List of files sharing duplicate blocks */ 10825 /* List of files sharing duplicate blocks */
@@ -10826,12 +10834,12 @@ static const struct e2fsck_problem problem_table[] = {
10826 10834
10827 /* Report of how many duplicate/bad inodes */ 10835 /* Report of how many duplicate/bad inodes */
10828 { PR_1D_NUM_DUP_INODES, 10836 { PR_1D_NUM_DUP_INODES,
10829 N_("(There are %N @is containing duplicate/bad @bs.)\n\n"), 10837 N_("(There are %N @is containing @m @bs.)\n\n"),
10830 PROMPT_NONE, 0 }, 10838 PROMPT_NONE, 0 },
10831 10839
10832 /* Duplicated blocks already reassigned or cloned. */ 10840 /* Duplicated blocks already reassigned or cloned. */
10833 { PR_1D_DUP_BLOCKS_DEALT, 10841 { PR_1D_DUP_BLOCKS_DEALT,
10834 N_("Duplicated @bs already reassigned or cloned.\n\n"), 10842 N_("@m @bs already reassigned or cloned.\n\n"),
10835 PROMPT_NONE, 0 }, 10843 PROMPT_NONE, 0 },
10836 10844
10837 /* Clone duplicate/bad blocks? */ 10845 /* Clone duplicate/bad blocks? */
@@ -10855,12 +10863,12 @@ static const struct e2fsck_problem problem_table[] = {
10855 10863
10856 /* Bad inode number for '.' */ 10864 /* Bad inode number for '.' */
10857 { PR_2_BAD_INODE_DOT, 10865 { PR_2_BAD_INODE_DOT,
10858 N_("Bad @i number for '.' in @d @i %i.\n"), 10866 N_("@n @i number for '.' in @d @i %i.\n"),
10859 PROMPT_FIX, 0 }, 10867 PROMPT_FIX, 0 },
10860 10868
10861 /* Directory entry has bad inode number */ 10869 /* Directory entry has bad inode number */
10862 { PR_2_BAD_INO, 10870 { PR_2_BAD_INO,
10863 N_("@E has bad @i #: %Di.\n"), 10871 N_("@E has @n @i #: %Di.\n"),
10864 PROMPT_CLEAR, 0 }, 10872 PROMPT_CLEAR, 0 },
10865 10873
10866 /* Directory entry has deleted or unused inode */ 10874 /* Directory entry has deleted or unused inode */
@@ -10905,12 +10913,12 @@ static const struct e2fsck_problem problem_table[] = {
10905 10913
10906 /* First entry in directory inode doesn't contain '.' */ 10914 /* First entry in directory inode doesn't contain '.' */
10907 { PR_2_1ST_NOT_DOT, 10915 { PR_2_1ST_NOT_DOT,
10908 N_("First @e '%Dn' (inode=%Di) in @d @i %i (%p) @s '.'\n"), 10916 N_("First @e '%Dn' (@i=%Di) in @d @i %i (%p) @s '.'\n"),
10909 PROMPT_FIX, 0 }, 10917 PROMPT_FIX, 0 },
10910 10918
10911 /* Second entry in directory inode doesn't contain '..' */ 10919 /* Second entry in directory inode doesn't contain '..' */
10912 { PR_2_2ND_NOT_DOT_DOT, 10920 { PR_2_2ND_NOT_DOT_DOT,
10913 N_("Second @e '%Dn' (inode=%Di) in @d @i %i @s '..'\n"), 10921 N_("Second @e '%Dn' (@i=%Di) in @d @i %i @s '..'\n"),
10914 PROMPT_FIX, 0 }, 10922 PROMPT_FIX, 0 },
10915 10923
10916 /* i_faddr should be zero */ 10924 /* i_faddr should be zero */
@@ -10940,7 +10948,7 @@ static const struct e2fsck_problem problem_table[] = {
10940 10948
10941 /* inode has bad mode */ 10949 /* inode has bad mode */
10942 { PR_2_BAD_MODE, 10950 { PR_2_BAD_MODE,
10943 N_("@i %i (%Q) has a bad mode (%Im).\n"), 10951 N_("@i %i (%Q) has @n mode (%Im).\n"),
10944 PROMPT_CLEAR, 0 }, 10952 PROMPT_CLEAR, 0 },
10945 10953
10946 /* directory corrupted */ 10954 /* directory corrupted */
@@ -10995,7 +11003,7 @@ static const struct e2fsck_problem problem_table[] = {
10995 11003
10996 /* Final rec_len is wrong */ 11004 /* Final rec_len is wrong */
10997 { PR_2_FINAL_RECLEN, 11005 { PR_2_FINAL_RECLEN,
10998 N_("@E has rec_len of %Dr, should be %N.\n"), 11006 N_("@E has rec_len of %Dr, @s %N.\n"),
10999 PROMPT_FIX, 0 }, 11007 PROMPT_FIX, 0 },
11000 11008
11001 /* Error allocating icount structure */ 11009 /* Error allocating icount structure */
@@ -11050,7 +11058,7 @@ static const struct e2fsck_problem problem_table[] = {
11050 11058
11051 /* Directory filetype incorrect */ 11059 /* Directory filetype incorrect */
11052 { PR_2_BAD_FILETYPE, 11060 { PR_2_BAD_FILETYPE,
11053 N_("@E has an incorrect filetype (was %Dt, should be %N).\n"), 11061 N_("@E has an incorrect filetype (was %Dt, @s %N).\n"),
11054 PROMPT_FIX, 0 }, 11062 PROMPT_FIX, 0 },
11055 11063
11056 /* Directory filetype set on filesystem */ 11064 /* Directory filetype set on filesystem */
@@ -11060,17 +11068,17 @@ static const struct e2fsck_problem problem_table[] = {
11060 11068
11061 /* Directory filename is null */ 11069 /* Directory filename is null */
11062 { PR_2_NULL_NAME, 11070 { PR_2_NULL_NAME,
11063 N_("@E has a zero-length name.\n"), 11071 N_("@E has a @z name.\n"),
11064 PROMPT_CLEAR, 0 }, 11072 PROMPT_CLEAR, 0 },
11065 11073
11066 /* Invalid symlink */ 11074 /* Invalid symlink */
11067 { PR_2_INVALID_SYMLINK, 11075 { PR_2_INVALID_SYMLINK,
11068 N_("Symlink %Q (@i #%i) is invalid.\n"), 11076 N_("Symlink %Q (@i #%i) is @n.\n"),
11069 PROMPT_CLEAR, 0 }, 11077 PROMPT_CLEAR, 0 },
11070 11078
11071 /* i_file_acl (extended attribute block) is bad */ 11079 /* i_file_acl (extended attribute block) is bad */
11072 { PR_2_FILE_ACL_BAD, 11080 { PR_2_FILE_ACL_BAD,
11073 N_("@a @b @F invalid (%If).\n"), 11081 N_("@a @b @F @n (%If).\n"),
11074 PROMPT_CLEAR, 0 }, 11082 PROMPT_CLEAR, 0 },
11075 11083
11076 /* Filesystem contains large files, but has no such flag in sb */ 11084 /* Filesystem contains large files, but has no such flag in sb */
@@ -11100,7 +11108,7 @@ static const struct e2fsck_problem problem_table[] = {
11100 11108
11101 /* Clear invalid HTREE directory */ 11109 /* Clear invalid HTREE directory */
11102 { PR_2_HTREE_CLEAR, 11110 { PR_2_HTREE_CLEAR,
11103 N_("Invalid @h %d (%q). "), PROMPT_CLEAR, 0 }, 11111 N_("@n @h %d (%q). "), PROMPT_CLEAR, 0 },
11104 11112
11105 /* Bad block in htree interior node */ 11113 /* Bad block in htree interior node */
11106 { PR_2_HTREE_BADBLK, 11114 { PR_2_HTREE_BADBLK,
@@ -11109,22 +11117,22 @@ static const struct e2fsck_problem problem_table[] = {
11109 11117
11110 /* Error adjusting EA refcount */ 11118 /* Error adjusting EA refcount */
11111 { PR_2_ADJ_EA_REFCOUNT, 11119 { PR_2_ADJ_EA_REFCOUNT,
11112 N_("Error addjusting refcount for @a @b %b (@i %i): %m\n"), 11120 N_("Error adjusting refcount for @a @b %b (@i %i): %m\n"),
11113 PROMPT_NONE, PR_FATAL }, 11121 PROMPT_NONE, PR_FATAL },
11114 11122
11115 /* Invalid HTREE root node */ 11123 /* Invalid HTREE root node */
11116 { PR_2_HTREE_BAD_ROOT, 11124 { PR_2_HTREE_BAD_ROOT,
11117 N_("@p @h %d: root node is invalid\n"), 11125 N_("@p @h %d: root node is @n\n"),
11118 PROMPT_CLEAR_HTREE, PR_PREEN_OK }, 11126 PROMPT_CLEAR_HTREE, PR_PREEN_OK },
11119 11127
11120 /* Invalid HTREE limit */ 11128 /* Invalid HTREE limit */
11121 { PR_2_HTREE_BAD_LIMIT, 11129 { PR_2_HTREE_BAD_LIMIT,
11122 N_("@p @h %d: node (%B) has bad limit (%N)\n"), 11130 N_("@p @h %d: node (%B) has @n limit (%N)\n"),
11123 PROMPT_CLEAR_HTREE, PR_PREEN_OK }, 11131 PROMPT_CLEAR_HTREE, PR_PREEN_OK },
11124 11132
11125 /* Invalid HTREE count */ 11133 /* Invalid HTREE count */
11126 { PR_2_HTREE_BAD_COUNT, 11134 { PR_2_HTREE_BAD_COUNT,
11127 N_("@p @h %d: node (%B) has bad count (%N)\n"), 11135 N_("@p @h %d: node (%B) has @n count (%N)\n"),
11128 PROMPT_CLEAR_HTREE, PR_PREEN_OK }, 11136 PROMPT_CLEAR_HTREE, PR_PREEN_OK },
11129 11137
11130 /* HTREE interior node has out-of-order hashes in table */ 11138 /* HTREE interior node has out-of-order hashes in table */
@@ -11132,9 +11140,9 @@ static const struct e2fsck_problem problem_table[] = {
11132 N_("@p @h %d: node (%B) has an unordered hash table\n"), 11140 N_("@p @h %d: node (%B) has an unordered hash table\n"),
11133 PROMPT_CLEAR_HTREE, PR_PREEN_OK }, 11141 PROMPT_CLEAR_HTREE, PR_PREEN_OK },
11134 11142
11135 /* Node in HTREE directory has bad depth */ 11143 /* Node in HTREE directory has invalid depth */
11136 { PR_2_HTREE_BAD_DEPTH, 11144 { PR_2_HTREE_BAD_DEPTH,
11137 N_("@p @h %d: node (%B) has bad depth\n"), 11145 N_("@p @h %d: node (%B) has @n depth\n"),
11138 PROMPT_NONE, 0 }, 11146 PROMPT_NONE, 0 },
11139 11147
11140 /* Duplicate directory entry found */ 11148 /* Duplicate directory entry found */
@@ -11236,7 +11244,7 @@ static const struct e2fsck_problem problem_table[] = {
11236 11244
11237 /* Couldn't fix parent directory -- couldn't find it */ 11245 /* Couldn't fix parent directory -- couldn't find it */
11238 { PR_3_FIX_PARENT_NOFIND, 11246 { PR_3_FIX_PARENT_NOFIND,
11239 N_("Couldn't fix parent of @i %i: Couldn't find parent @d entry\n\n"), 11247 N_("Couldn't fix parent of @i %i: Couldn't find parent @d @e\n\n"),
11240 PROMPT_NONE, 0 }, 11248 PROMPT_NONE, 0 },
11241 11249
11242 /* Error allocating inode bitmap */ 11250 /* Error allocating inode bitmap */
@@ -11315,12 +11323,12 @@ static const struct e2fsck_problem problem_table[] = {
11315 11323
11316 /* Unattached zero-length inode */ 11324 /* Unattached zero-length inode */
11317 { PR_4_ZERO_LEN_INODE, 11325 { PR_4_ZERO_LEN_INODE,
11318 "@u @z @i %i. ", 11326 N_("@u @z @i %i. "),
11319 PROMPT_CLEAR, PR_PREEN_OK|PR_NO_OK }, 11327 PROMPT_CLEAR, PR_PREEN_OK|PR_NO_OK },
11320 11328
11321 /* Unattached inode */ 11329 /* Unattached inode */
11322 { PR_4_UNATTACHED_INODE, 11330 { PR_4_UNATTACHED_INODE,
11323 "@u @i %i\n", 11331 N_("@u @i %i\n"),
11324 PROMPT_CONNECT, 0 }, 11332 PROMPT_CONNECT, 0 },
11325 11333
11326 /* Inode ref count wrong */ 11334 /* Inode ref count wrong */
@@ -11332,7 +11340,7 @@ static const struct e2fsck_problem problem_table[] = {
11332 N_("WARNING: PROGRAMMING BUG IN E2FSCK!\n" 11340 N_("WARNING: PROGRAMMING BUG IN E2FSCK!\n"
11333 "\tOR SOME BONEHEAD (YOU) IS CHECKING A MOUNTED (LIVE) FILESYSTEM.\n" 11341 "\tOR SOME BONEHEAD (YOU) IS CHECKING A MOUNTED (LIVE) FILESYSTEM.\n"
11334 "@i_link_info[%i] is %N, @i.i_links_count is %Il. " 11342 "@i_link_info[%i] is %N, @i.i_links_count is %Il. "
11335 "They should be the same!\n"), 11343 "They @s the same!\n"),
11336 PROMPT_NONE, 0 }, 11344 PROMPT_NONE, 0 },
11337 11345
11338 /* Pass 5 errors */ 11346 /* Pass 5 errors */
@@ -11430,12 +11438,12 @@ static const struct e2fsck_problem problem_table[] = {
11430 11438
11431 /* Error copying in replacement inode bitmap */ 11439 /* Error copying in replacement inode bitmap */
11432 { PR_5_COPY_IBITMAP_ERROR, 11440 { PR_5_COPY_IBITMAP_ERROR,
11433 "Error copying in replacement @i @B: %m\n", 11441 N_("Error copying in replacement @i @B: %m\n"),
11434 PROMPT_NONE, PR_FATAL }, 11442 PROMPT_NONE, PR_FATAL },
11435 11443
11436 /* Error copying in replacement block bitmap */ 11444 /* Error copying in replacement block bitmap */
11437 { PR_5_COPY_BBITMAP_ERROR, 11445 { PR_5_COPY_BBITMAP_ERROR,
11438 "Error copying in replacement @b @B: %m\n", 11446 N_("Error copying in replacement @b @B: %m\n"),
11439 PROMPT_NONE, PR_FATAL }, 11447 PROMPT_NONE, PR_FATAL },
11440 11448
11441 /* Block range not used, but marked in bitmap */ 11449 /* Block range not used, but marked in bitmap */
@@ -13523,7 +13531,7 @@ static void check_resize_inode(e2fsck_t ctx)
13523 } 13531 }
13524 } 13532 }
13525 13533
13526 /* Read the resizde inode */ 13534 /* Read the resize inode */
13527 pctx.ino = EXT2_RESIZE_INO; 13535 pctx.ino = EXT2_RESIZE_INO;
13528 retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode); 13536 retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode);
13529 if (retval) { 13537 if (retval) {
@@ -14641,7 +14649,7 @@ static void usage(e2fsck_t ctx)
14641 fprintf(stderr, 14649 fprintf(stderr,
14642 _("Usage: %s [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]\n" 14650 _("Usage: %s [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]\n"
14643 "\t\t[-I inode_buffer_blocks] [-P process_inode_size]\n" 14651 "\t\t[-I inode_buffer_blocks] [-P process_inode_size]\n"
14644 "\t\t[-l|-L bad_blocks_file] [-C fd] [-j ext-journal]\n" 14652 "\t\t[-l|-L bad_blocks_file] [-C fd] [-j external_journal]\n"
14645 "\t\t[-E extended-options] device\n"), 14653 "\t\t[-E extended-options] device\n"),
14646 ctx->program_name); 14654 ctx->program_name);
14647 14655
@@ -14655,7 +14663,7 @@ static void usage(e2fsck_t ctx)
14655 " -v Be verbose\n" 14663 " -v Be verbose\n"
14656 " -b superblock Use alternative superblock\n" 14664 " -b superblock Use alternative superblock\n"
14657 " -B blocksize Force blocksize when looking for superblock\n" 14665 " -B blocksize Force blocksize when looking for superblock\n"
14658 " -j external-journal Set location of the external journal\n" 14666 " -j external_journal Set location of the external journal\n"
14659 " -l bad_blocks_file Add to badblocks list\n" 14667 " -l bad_blocks_file Add to badblocks list\n"
14660 " -L bad_blocks_file Set badblocks list\n" 14668 " -L bad_blocks_file Set badblocks list\n"
14661 )); 14669 ));
@@ -15080,16 +15088,19 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
15080 continue; 15088 continue;
15081 } 15089 }
15082 ctx->ext_attr_ver = ea_ver; 15090 ctx->ext_attr_ver = ea_ver;
15083 } else 15091 } else {
15092 fprintf(stderr, _("Unknown extended option: %s\n"),
15093 token);
15084 extended_usage++; 15094 extended_usage++;
15095 }
15085 } 15096 }
15086 if (extended_usage) { 15097 if (extended_usage) {
15087 bb_error_msg_and_die( 15098 bb_error_msg_and_die(
15088 "Extended options are separated by commas, " 15099 "Extended options are separated by commas, "
15089 "and may take an argument which\n" 15100 "and may take an argument which\n"
15090 "is set off by an equals ('=') sign. " 15101 "is set off by an equals ('=') sign. "
15091 "Valid raid options are:\n" 15102 "Valid extended options are:\n"
15092 "\tea_ver=<ea_version (1 or 2)\n\n"); 15103 "\tea_ver=<ea_version (1 or 2)>\n\n");
15093 } 15104 }
15094} 15105}
15095 15106
diff --git a/e2fsprogs/e2p/ls.c b/e2fsprogs/e2p/ls.c
index 0c91345e1..ee83ab64c 100644
--- a/e2fsprogs/e2p/ls.c
+++ b/e2fsprogs/e2p/ls.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <stdio.h> 14#include <stdio.h>
15#include <stdlib.h>
15#include <sys/types.h> 16#include <sys/types.h>
16#include <string.h> 17#include <string.h>
17#include <grp.h> 18#include <grp.h>
diff --git a/e2fsprogs/e2p/ostype.c b/e2fsprogs/e2p/ostype.c
index 46230631e..2ea59cbe1 100644
--- a/e2fsprogs/e2p/ostype.c
+++ b/e2fsprogs/e2p/ostype.c
@@ -9,6 +9,7 @@
9 9
10#include "e2p.h" 10#include "e2p.h"
11#include <string.h> 11#include <string.h>
12#include <stdlib.h>
12 13
13static const char * const os_tab[] = 14static const char * const os_tab[] =
14 { "Linux", 15 { "Linux",
diff --git a/e2fsprogs/ext2fs/bitops.c b/e2fsprogs/ext2fs/bitops.c
index e44e10cf4..77ac2a61f 100644
--- a/e2fsprogs/ext2fs/bitops.c
+++ b/e2fsprogs/ext2fs/bitops.c
@@ -30,7 +30,7 @@
30 * systems, as well as non-32 bit systems. 30 * systems, as well as non-32 bit systems.
31 */ 31 */
32 32
33int ext2fs_set_bit(int nr,void * addr) 33int ext2fs_set_bit(unsigned int nr,void * addr)
34{ 34{
35 int mask, retval; 35 int mask, retval;
36 unsigned char *ADDR = (unsigned char *) addr; 36 unsigned char *ADDR = (unsigned char *) addr;
@@ -42,7 +42,7 @@ int ext2fs_set_bit(int nr,void * addr)
42 return retval; 42 return retval;
43} 43}
44 44
45int ext2fs_clear_bit(int nr, void * addr) 45int ext2fs_clear_bit(unsigned int nr, void * addr)
46{ 46{
47 int mask, retval; 47 int mask, retval;
48 unsigned char *ADDR = (unsigned char *) addr; 48 unsigned char *ADDR = (unsigned char *) addr;
@@ -54,7 +54,7 @@ int ext2fs_clear_bit(int nr, void * addr)
54 return retval; 54 return retval;
55} 55}
56 56
57int ext2fs_test_bit(int nr, const void * addr) 57int ext2fs_test_bit(unsigned int nr, const void * addr)
58{ 58{
59 int mask; 59 int mask;
60 const unsigned char *ADDR = (const unsigned char *) addr; 60 const unsigned char *ADDR = (const unsigned char *) addr;
diff --git a/e2fsprogs/ext2fs/bitops.h b/e2fsprogs/ext2fs/bitops.h
index 4dba050c8..5e727d186 100644
--- a/e2fsprogs/ext2fs/bitops.h
+++ b/e2fsprogs/ext2fs/bitops.h
@@ -15,9 +15,9 @@
15 15
16#include <strings.h> 16#include <strings.h>
17 17
18extern int ext2fs_set_bit(int nr,void * addr); 18extern int ext2fs_set_bit(unsigned int nr,void * addr);
19extern int ext2fs_clear_bit(int nr, void * addr); 19extern int ext2fs_clear_bit(unsigned int nr, void * addr);
20extern int ext2fs_test_bit(int nr, const void * addr); 20extern int ext2fs_test_bit(unsigned int nr, const void * addr);
21extern __u16 ext2fs_swab16(__u16 val); 21extern __u16 ext2fs_swab16(__u16 val);
22extern __u32 ext2fs_swab32(__u32 val); 22extern __u32 ext2fs_swab32(__u32 val);
23 23
diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h
index 7d2a43695..b8752a56e 100644
--- a/e2fsprogs/ext2fs/ext2fs.h
+++ b/e2fsprogs/ext2fs/ext2fs.h
@@ -330,6 +330,7 @@ typedef struct ext2_struct_inode_scan *ext2_inode_scan;
330#define EXT2_MF_ISROOT 2 330#define EXT2_MF_ISROOT 2
331#define EXT2_MF_READONLY 4 331#define EXT2_MF_READONLY 4
332#define EXT2_MF_SWAP 8 332#define EXT2_MF_SWAP 8
333#define EXT2_MF_BUSY 16
333 334
334/* 335/*
335 * Ext2/linux mode flags. We define them here so that we don't need 336 * Ext2/linux mode flags. We define them here so that we don't need
diff --git a/e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/ext2fs/ext2fs_inline.c
index 73d393d20..a363b1992 100644
--- a/e2fsprogs/ext2fs/ext2fs_inline.c
+++ b/e2fsprogs/ext2fs/ext2fs_inline.c
@@ -44,12 +44,14 @@ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
44 unsigned long size, void *ptr) 44 unsigned long size, void *ptr)
45{ 45{
46 void *p; 46 void *p;
47 void **pp = (void **)ptr;
48 47
49 p = realloc(*pp, size); 48 /* Use "memcpy" for pointer assignments here to avoid problems
49 * with C99 strict type aliasing rules. */
50 memcpy(&p, ptr, sizeof (p));
51 p = realloc(p, size);
50 if (!p) 52 if (!p)
51 return EXT2_ET_NO_MEMORY; 53 return EXT2_ET_NO_MEMORY;
52 *pp = p; 54 memcpy(ptr, &p, sizeof (p));
53 return 0; 55 return 0;
54} 56}
55 57
diff --git a/e2fsprogs/ext2fs/getsectsize.c b/e2fsprogs/ext2fs/getsectsize.c
index b561660ba..36871f236 100644
--- a/e2fsprogs/ext2fs/getsectsize.c
+++ b/e2fsprogs/ext2fs/getsectsize.c
@@ -23,7 +23,7 @@
23#include <linux/fd.h> 23#include <linux/fd.h>
24#endif 24#endif
25 25
26#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) 26#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET)
27#define BLKSSZGET _IO(0x12,104)/* get block device sector size */ 27#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
28#endif 28#endif
29 29
diff --git a/e2fsprogs/ext2fs/ismounted.c b/e2fsprogs/ext2fs/ismounted.c
index 2395ccaed..125fe244b 100644
--- a/e2fsprogs/ext2fs/ismounted.c
+++ b/e2fsprogs/ext2fs/ismounted.c
@@ -339,20 +339,18 @@ int main(int argc, char **argv)
339 exit(1); 339 exit(1);
340 } 340 }
341 printf("Device %s reports flags %02x\n", argv[1], mount_flags); 341 printf("Device %s reports flags %02x\n", argv[1], mount_flags);
342 if (mount_flags & EXT2_MF_BUSY)
343 printf("\t%s is apparently in use.\n", argv[1]);
342 if (mount_flags & EXT2_MF_MOUNTED) 344 if (mount_flags & EXT2_MF_MOUNTED)
343 printf("\t%s is mounted.\n", argv[1]); 345 printf("\t%s is mounted.\n", argv[1]);
344
345 if (mount_flags & EXT2_MF_SWAP) 346 if (mount_flags & EXT2_MF_SWAP)
346 printf("\t%s is a swap device.\n", argv[1]); 347 printf("\t%s is a swap device.\n", argv[1]);
347
348 if (mount_flags & EXT2_MF_READONLY) 348 if (mount_flags & EXT2_MF_READONLY)
349 printf("\t%s is read-only.\n", argv[1]); 349 printf("\t%s is read-only.\n", argv[1]);
350
351 if (mount_flags & EXT2_MF_ISROOT) 350 if (mount_flags & EXT2_MF_ISROOT)
352 printf("\t%s is the root filesystem.\n", argv[1]); 351 printf("\t%s is the root filesystem.\n", argv[1]);
353 if (mntpt[0]) 352 if (mntpt[0])
354 printf("\t%s is mounted on %s.\n", argv[1], mntpt); 353 printf("\t%s is mounted on %s.\n", argv[1], mntpt);
355
356 exit(0); 354 exit(0);
357} 355}
358#endif /* DEBUG */ 356#endif /* DEBUG */
diff --git a/e2fsprogs/mke2fs.c b/e2fsprogs/mke2fs.c
index 09d42aacf..e6a1392c9 100644
--- a/e2fsprogs/mke2fs.c
+++ b/e2fsprogs/mke2fs.c
@@ -711,7 +711,7 @@ static void parse_extended_opts(struct ext2_super_block *sb_param,
711 } 711 }
712 fs_stride = strtoul(arg, &p, 0); 712 fs_stride = strtoul(arg, &p, 0);
713 if (*p || (fs_stride == 0)) { 713 if (*p || (fs_stride == 0)) {
714 bb_error_msg("Invalid stride parameter"); 714 bb_error_msg("Invalid stride parameter: %s", arg);
715 r_usage++; 715 r_usage++;
716 continue; 716 continue;
717 } 717 }
@@ -735,7 +735,8 @@ static void parse_extended_opts(struct ext2_super_block *sb_param,
735 continue; 735 continue;
736 } 736 }
737 if (resize <= sb_param->s_blocks_count) { 737 if (resize <= sb_param->s_blocks_count) {
738 bb_error_msg("The resize maximum must be greater than the filesystem size"); 738 bb_error_msg("The resize maximum must be greater "
739 "than the filesystem size");
739 r_usage++; 740 r_usage++;
740 continue; 741 continue;
741 } 742 }
@@ -767,10 +768,10 @@ static void parse_extended_opts(struct ext2_super_block *sb_param,
767 if (r_usage) { 768 if (r_usage) {
768 bb_error_msg_and_die( 769 bb_error_msg_and_die(
769 "\nBad options specified.\n\n" 770 "\nBad options specified.\n\n"
770 "Options are separated by commas, " 771 "Extended options are separated by commas, "
771 "and may take an argument which\n" 772 "and may take an argument which\n"
772 "\tis set off by an equals ('=') sign.\n\n" 773 "\tis set off by an equals ('=') sign.\n\n"
773 "Valid raid options are:\n" 774 "Valid extended options are:\n"
774 "\tstride=<stride length in blocks>\n" 775 "\tstride=<stride length in blocks>\n"
775 "\tresize=<resize maximum size in blocks>\n"); 776 "\tresize=<resize maximum size in blocks>\n");
776 } 777 }
@@ -855,7 +856,7 @@ static int PRS(int argc, char *argv[])
855 if (b < EXT2_MIN_BLOCK_SIZE || 856 if (b < EXT2_MIN_BLOCK_SIZE ||
856 b > EXT2_MAX_BLOCK_SIZE) { 857 b > EXT2_MAX_BLOCK_SIZE) {
857BLOCKSIZE_ERROR: 858BLOCKSIZE_ERROR:
858 bb_error_msg_and_die("bad block size - %s", optarg); 859 bb_error_msg_and_die("invalid block size - %s", optarg);
859 } 860 }
860 mke2fs_warning_msg((blocksize > 4096), 861 mke2fs_warning_msg((blocksize > 4096),
861 "blocksize %d not usable on most systems", 862 "blocksize %d not usable on most systems",
@@ -871,7 +872,7 @@ BLOCKSIZE_ERROR:
871 break; 872 break;
872 case 'f': 873 case 'f':
873 if (safe_strtoi(optarg, &size) || size < EXT2_MIN_BLOCK_SIZE || size > EXT2_MAX_BLOCK_SIZE ){ 874 if (safe_strtoi(optarg, &size) || size < EXT2_MIN_BLOCK_SIZE || size > EXT2_MAX_BLOCK_SIZE ){
874 bb_error_msg_and_die("bad fragment size - %s", optarg); 875 bb_error_msg_and_die("invalid fragment size - %s", optarg);
875 } 876 }
876 param.s_log_frag_size = 877 param.s_log_frag_size =
877 int_log2(size >> EXT2_MIN_BLOCK_LOG_SIZE); 878 int_log2(size >> EXT2_MIN_BLOCK_LOG_SIZE);
@@ -893,7 +894,7 @@ BLOCKSIZE_ERROR:
893 if (safe_strtoi(optarg, &inode_ratio) 894 if (safe_strtoi(optarg, &inode_ratio)
894 || inode_ratio < EXT2_MIN_BLOCK_SIZE 895 || inode_ratio < EXT2_MIN_BLOCK_SIZE
895 || inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) { 896 || inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) {
896 bb_error_msg_and_die("bad inode ratio %s (min %d/max %d)", 897 bb_error_msg_and_die("invalid inode ratio %s (min %d/max %d)",
897 optarg, EXT2_MIN_BLOCK_SIZE, 898 optarg, EXT2_MIN_BLOCK_SIZE,
898 EXT2_MAX_BLOCK_SIZE); 899 EXT2_MAX_BLOCK_SIZE);
899 } 900 }
@@ -912,7 +913,7 @@ BLOCKSIZE_ERROR:
912 break; 913 break;
913 case 'm': 914 case 'm':
914 if (safe_strtoi(optarg, &reserved_ratio) || reserved_ratio > 50 ) { 915 if (safe_strtoi(optarg, &reserved_ratio) || reserved_ratio > 50 ) {
915 bb_error_msg_and_die("bad reserved blocks percent - %s", optarg); 916 bb_error_msg_and_die("invalid reserved blocks percent - %s", optarg);
916 } 917 }
917 break; 918 break;
918 case 'n': 919 case 'n':
@@ -940,7 +941,7 @@ BLOCKSIZE_ERROR:
940#ifdef EXT2_DYNAMIC_REV 941#ifdef EXT2_DYNAMIC_REV
941 case 'I': 942 case 'I':
942 if (safe_strtoi(optarg, &inode_size)) { 943 if (safe_strtoi(optarg, &inode_size)) {
943 bb_error_msg_and_die("bad inode size - %s", optarg); 944 bb_error_msg_and_die("invalid inode size - %s", optarg);
944 } 945 }
945 break; 946 break;
946#endif 947#endif
@@ -1051,7 +1052,7 @@ BLOCKSIZE_ERROR:
1051 if (optind < argc) { 1052 if (optind < argc) {
1052 param.s_blocks_count = parse_num_blocks(argv[optind++], 1053 param.s_blocks_count = parse_num_blocks(argv[optind++],
1053 param.s_log_block_size); 1054 param.s_log_block_size);
1054 mke2fs_error_msg_and_die(!param.s_blocks_count, "bad blocks count - %s", argv[optind - 1]); 1055 mke2fs_error_msg_and_die(!param.s_blocks_count, "invalid blocks count - %s", argv[optind - 1]);
1055 } 1056 }
1056 if (optind < argc) 1057 if (optind < argc)
1057 bb_show_usage(); 1058 bb_show_usage();
@@ -1165,11 +1166,16 @@ BLOCKSIZE_ERROR:
1165 } 1166 }
1166 } 1167 }
1167 1168
1169 if (!force && param.s_blocks_count >= (1 << 31)) {
1170 bb_error_msg_and_die("Filesystem too large. No more than 2**31-1 blocks\n"
1171 "\t (8TB using a blocksize of 4k) are currently supported.");
1172 }
1173
1168 if (inode_size) { 1174 if (inode_size) {
1169 if (inode_size < EXT2_GOOD_OLD_INODE_SIZE || 1175 if (inode_size < EXT2_GOOD_OLD_INODE_SIZE ||
1170 inode_size > EXT2_BLOCK_SIZE(&param) || 1176 inode_size > EXT2_BLOCK_SIZE(&param) ||
1171 inode_size & (inode_size - 1)) { 1177 inode_size & (inode_size - 1)) {
1172 bb_error_msg_and_die("bad inode size %d (min %d/max %d)", 1178 bb_error_msg_and_die("invalid inode size %d (min %d/max %d)",
1173 inode_size, EXT2_GOOD_OLD_INODE_SIZE, 1179 inode_size, EXT2_GOOD_OLD_INODE_SIZE,
1174 blocksize); 1180 blocksize);
1175 } 1181 }
diff --git a/e2fsprogs/util.c b/e2fsprogs/util.c
index 3902f7ef3..537021df7 100644
--- a/e2fsprogs/util.c
+++ b/e2fsprogs/util.c
@@ -89,14 +89,20 @@ void check_mount(const char *device, int force, const char *type)
89 bb_error_msg("Could not determine if %s is mounted", device); 89 bb_error_msg("Could not determine if %s is mounted", device);
90 return; 90 return;
91 } 91 }
92 if (!(mount_flags & EXT2_MF_MOUNTED)) 92 if (mount_flags & EXT2_MF_MOUNTED) {
93 return; 93 bb_error_msg("%s is mounted !", device);
94force_check:
95 if (force)
96 bb_error_msg("badblocks forced anyways");
97 else
98 bb_error_msg_and_die("it's not safe to run badblocks!");
99 }
100
101 if (mount_flags & EXT2_MF_BUSY) {
102 bb_error_msg("%s is apparently in use by the system", device);
103 goto force_check;
104 }
94 105
95 bb_error_msg("%s is mounted !", device);
96 if (force)
97 bb_error_msg("forcing anyways and ignoring /etc/mtab status");
98 else
99 bb_error_msg_and_die("will not make a %s here!", type);
100} 106}
101 107
102void parse_journal_opts(char **journal_device, int *journal_flags, 108void parse_journal_opts(char **journal_device, int *journal_flags,
@@ -189,10 +195,14 @@ int figure_journal_size(int size, ext2_filsys fs)
189 195
190 if (fs->super->s_blocks_count < 32768) 196 if (fs->super->s_blocks_count < 32768)
191 j_blocks = 1024; 197 j_blocks = 1024;
192 else if (fs->super->s_blocks_count < 262144) 198 else if (fs->super->s_blocks_count < 256*1024)
193 j_blocks = 4096; 199 j_blocks = 4096;
194 else 200 else if (fs->super->s_blocks_count < 512*1024)
195 j_blocks = 8192; 201 j_blocks = 8192;
202 else if (fs->super->s_blocks_count < 1024*1024)
203 j_blocks = 16384;
204 else
205 j_blocks = 32768;
196 206
197 return j_blocks; 207 return j_blocks;
198} 208}
diff --git a/include/usage.h b/include/usage.h
index 2e2ef8595..660c9e702 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -579,7 +579,7 @@
579#define e2fsck_trivial_usage \ 579#define e2fsck_trivial_usage \
580 "[-panyrcdfvstDFSV] [-b superblock] [-B blocksize] " \ 580 "[-panyrcdfvstDFSV] [-b superblock] [-B blocksize] " \
581 "[-I inode_buffer_blocks] [-P process_inode_size] " \ 581 "[-I inode_buffer_blocks] [-P process_inode_size] " \
582 "[-l|-L bad_blocks_file] [-C fd] [-j ext-journal] " \ 582 "[-l|-L bad_blocks_file] [-C fd] [-j external_journal] " \
583 "[-E extended-options] device" 583 "[-E extended-options] device"
584#define e2fsck_full_usage \ 584#define e2fsck_full_usage \
585 "Check a Linux ext2/ext3 file system.\n\n" \ 585 "Check a Linux ext2/ext3 file system.\n\n" \