summaryrefslogtreecommitdiff
path: root/e2fsprogs
diff options
context:
space:
mode:
authorMike Frysinger2006-03-08 07:03:27 +0000
committerMike Frysinger2006-03-08 07:03:27 +0000
commit874af85d5eb08b65476f406f6a1e7edc127ac210 (patch)
tree1cb4ee52f1592350dd9c4471b2a334957cc42b5e /e2fsprogs
parent0f2dd9f4eb9007bf44aa3f0cf30a35c36fbbd5b2 (diff)
downloadbusybox-874af85d5eb08b65476f406f6a1e7edc127ac210.zip
busybox-874af85d5eb08b65476f406f6a1e7edc127ac210.tar.gz
import most of e2fsprogs 1.38 updates
Diffstat (limited to 'e2fsprogs')
-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
21 files changed, 434 insertions, 198 deletions
diff --git a/e2fsprogs/blkid/blkid.h b/e2fsprogs/blkid/blkid.h
index 3bb0e78..c051b2b 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);
extern const char *blkid_dev_devname(blkid_dev dev);
extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
+extern int blkid_dev_set_search(blkid_dev_iterate iter,
+ char *search_type, char *search_value);
extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
@@ -63,6 +65,7 @@ extern char *blkid_devno_to_devname(dev_t devno);
/* devname.c */
extern int blkid_probe_all(blkid_cache cache);
+extern int blkid_probe_all_new(blkid_cache cache);
extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname,
int flags);
@@ -86,7 +89,8 @@ extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
extern int blkid_tag_next(blkid_tag_iterate iterate,
const char **type, const char **value);
extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
-
+extern int blkid_dev_has_tag(blkid_dev dev, const char *type,
+ const char *value);
extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
const char *type,
const char *value);
diff --git a/e2fsprogs/blkid/blkidP.h b/e2fsprogs/blkid/blkidP.h
index 759dfcd..4ae9763 100644
--- a/e2fsprogs/blkid/blkidP.h
+++ b/e2fsprogs/blkid/blkidP.h
@@ -147,65 +147,8 @@ extern int blkid_debug_mask;
#endif
#ifdef CONFIG_BLKID_DEBUG
-static inline void DEB_DUMP_TAG(int mask, blkid_tag tag)
-{
- if (!(mask & blkid_debug_mask))
- return;
-
- if (!tag) {
- printf(" tag: NULL\n");
- return;
- }
-
- printf(" tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
-}
-
-static inline void DEB_DUMP_DEV(int mask, blkid_dev dev)
-{
- struct list_head *p;
-
- if (!(mask & blkid_debug_mask))
- return;
-
- if (!dev) {
- printf(" dev: NULL\n");
- return;
- }
-
- printf(" dev: name = %s\n", dev->bid_name);
- printf(" dev: DEVNO=\"0x%0Lx\"\n", dev->bid_devno);
- printf(" dev: TIME=\"%lu\"\n", dev->bid_time);
- printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
- printf(" dev: flags = 0x%08X\n", dev->bid_flags);
-
- list_for_each(p, &dev->bid_tags) {
- blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
- DEB_DUMP_TAG(mask, tag);
- }
- printf("\n");
-}
-
-static inline void DEB_DUMP_CACHE(int mask, blkid_cache cache)
-{
- struct list_head *p;
-
- if (!cache || !(mask & blkid_debug_mask)) {
- printf("cache: NULL\n");
- return;
- }
-
- printf("cache: time = %lu\n", cache->bic_time);
- printf("cache: flags = 0x%08X\n", cache->bic_flags);
-
- list_for_each(p, &cache->bic_devs) {
- blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
- DEB_DUMP_DEV(mask, dev);
- }
-}
-#else
-#define DEB_DUMP_TAG(mask, tag) do {} while (0)
-#define DEB_DUMP_DEV(mask, dev) do {} while (0)
-#define DEB_DUMP_CACHE(mask, cache) do {} while (0)
+extern void blkid_debug_dump_dev(blkid_dev dev);
+extern void blkid_debug_dump_tag(blkid_tag tag);
#endif
/* lseek.c */
diff --git a/e2fsprogs/blkid/cache.c b/e2fsprogs/blkid/cache.c
index daccb30..9c9b8c7 100644
--- a/e2fsprogs/blkid/cache.c
+++ b/e2fsprogs/blkid/cache.c
@@ -63,7 +63,7 @@ void blkid_put_cache(blkid_cache cache)
DBG(DEBUG_CACHE, printf("freeing cache struct\n"));
- /* DEB_DUMP_CACHE(cache); */
+ /* DBG(DEBUG_CACHE, blkid_debug_dump_cache(cache)); */
while (!list_empty(&cache->bic_devs)) {
blkid_dev dev = list_entry(cache->bic_devs.next,
diff --git a/e2fsprogs/blkid/dev.c b/e2fsprogs/blkid/dev.c
index 04cf8b5..5d56c50 100644
--- a/e2fsprogs/blkid/dev.c
+++ b/e2fsprogs/blkid/dev.c
@@ -35,7 +35,7 @@ void blkid_free_dev(blkid_dev dev)
DBG(DEBUG_DEV,
printf(" freeing dev %s (%s)\n", dev->bid_name, dev->bid_type));
- DEB_DUMP_DEV(DEBUG_DEV, dev);
+ DBG(DEBUG_DEV, blkid_debug_dump_dev(dev));
list_del(&dev->bid_devs);
while (!list_empty(&dev->bid_tags)) {
@@ -57,6 +57,34 @@ const char *blkid_dev_devname(blkid_dev dev)
return dev->bid_name;
}
+#ifdef CONFIG_BLKID_DEBUG
+void blkid_debug_dump_dev(blkid_dev dev)
+{
+ struct list_head *p;
+
+ if (!dev) {
+ printf(" dev: NULL\n");
+ return;
+ }
+
+ printf(" dev: name = %s\n", dev->bid_name);
+ printf(" dev: DEVNO=\"0x%0llx\"\n", dev->bid_devno);
+ printf(" dev: TIME=\"%lu\"\n", dev->bid_time);
+ printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
+ printf(" dev: flags = 0x%08X\n", dev->bid_flags);
+
+ list_for_each(p, &dev->bid_tags) {
+ blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
+ if (tag)
+ printf(" tag: %s=\"%s\"\n", tag->bit_name,
+ tag->bit_val);
+ else
+ printf(" tag: NULL\n");
+ }
+ printf("\n");
+}
+#endif
+
/*
* dev iteration routines for the public libblkid interface.
*
@@ -114,3 +142,72 @@ void blkid_dev_iterate_end(blkid_dev_iterate iter)
free(iter);
}
+#ifdef TEST_PROGRAM
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#else
+extern char *optarg;
+extern int optind;
+#endif
+
+void usage(char *prog)
+{
+ fprintf(stderr, "Usage: %s [-f blkid_file] [-m debug_mask]\n", prog);
+ fprintf(stderr, "\tList all devices and exit\n", prog);
+ exit(1);
+}
+
+int main(int argc, char **argv)
+{
+ blkid_dev_iterate iter;
+ blkid_cache cache = NULL;
+ blkid_dev dev;
+ int c, ret;
+ char *tmp;
+ char *file = NULL;
+ char *search_type = NULL;
+ char *search_value = NULL;
+
+ while ((c = getopt (argc, argv, "m:f:")) != EOF)
+ switch (c) {
+ case 'f':
+ file = optarg;
+ break;
+ case 'm':
+ blkid_debug_mask = strtoul (optarg, &tmp, 0);
+ if (*tmp) {
+ fprintf(stderr, "Invalid debug mask: %d\n",
+ optarg);
+ exit(1);
+ }
+ break;
+ case '?':
+ usage(argv[0]);
+ }
+ if (argc >= optind+2) {
+ search_type = argv[optind];
+ search_value = argv[optind+1];
+ optind += 2;
+ }
+ if (argc != optind)
+ usage(argv[0]);
+
+ if ((ret = blkid_get_cache(&cache, file)) != 0) {
+ fprintf(stderr, "%s: error creating cache (%d)\n",
+ argv[0], ret);
+ exit(1);
+ }
+
+ iter = blkid_dev_iterate_begin(cache);
+ if (search_type)
+ blkid_dev_set_search(iter, search_type, search_value);
+ while (blkid_dev_next(iter, &dev) == 0) {
+ printf("Device: %s\n", blkid_dev_devname(dev));
+ }
+ blkid_dev_iterate_end(iter);
+
+
+ blkid_put_cache(cache);
+ return (0);
+}
+#endif
diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c
index 2979280..8911994 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,
else if (S_ISBLK(st.st_mode) && st.st_rdev == devno) {
*devname = blkid_strdup(path);
DBG(DEBUG_DEVNO,
- printf("found 0x%Lx at %s (%p)\n", devno,
+ printf("found 0x%llx at %s (%p)\n", devno,
path, *devname));
break;
}
@@ -175,7 +175,7 @@ char *blkid_devno_to_devname(dev_t devno)
(unsigned long) devno));
} else {
DBG(DEBUG_DEVNO,
- printf("found devno 0x%04Lx as %s\n", devno, devname));
+ printf("found devno 0x%04llx as %s\n", devno, devname));
}
diff --git a/e2fsprogs/blkid/probe.c b/e2fsprogs/blkid/probe.c
index 36f7177..5ee8a20 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)
static int probe_ext3(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
- const struct blkid_magic *id, unsigned char *buf)
+ struct blkid_magic *id __BLKID_ATTR((unused)),
+ unsigned char *buf)
{
struct ext2_super_block *es;
@@ -124,10 +125,10 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)),
static int probe_ext2(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
- const struct blkid_magic *id, unsigned char *buf)
+ struct blkid_magic *id __BLKID_ATTR((unused)),
+ unsigned char *buf)
{
struct ext2_super_block *es;
-// const char *sec_type = 0, *label = 0;
es = (struct ext2_super_block *)buf;
@@ -303,6 +304,23 @@ static int probe_romfs(int fd __BLKID_ATTR((unused)),
return 0;
}
+static int probe_cramfs(int fd __BLKID_ATTR((unused)),
+ blkid_cache cache __BLKID_ATTR((unused)),
+ blkid_dev dev,
+ struct blkid_magic *id __BLKID_ATTR((unused)),
+ unsigned char *buf)
+{
+ struct cramfs_super_block *csb;
+ const char *label = 0;
+
+ csb = (struct cramfs_super_block *)buf;
+
+ if (strlen((char *) csb->name))
+ label = (char *) csb->name;
+ blkid_set_tag(dev, "LABEL", label, 0);
+ return 0;
+}
+
static int probe_swap0(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
@@ -321,7 +339,6 @@ static int probe_swap1(int fd,
unsigned char *buf __BLKID_ATTR((unused)))
{
struct swap_id_block *sws;
-// const char *label = 0;
probe_swap0(fd, cache, dev, id, buf);
/*
@@ -489,7 +506,7 @@ static const struct blkid_magic type_array[] = {
{ "xfs", 0, 0, 4, "XFSB", probe_xfs },
{ "romfs", 0, 0, 8, "-rom1fs-", probe_romfs },
{ "bfs", 0, 0, 4, "\316\372\173\033", 0 },
- { "cramfs", 0, 0, 4, "E=\315\034", 0 },
+ { "cramfs", 0, 0, 4, "E=\315\050", probe_cramfs },
{ "qnx4", 0, 4, 6, "QNX4FS", 0 },
{ "udf", 32, 1, 5, "BEA01", probe_udf },
{ "udf", 32, 1, 5, "BOOT2", probe_udf },
@@ -647,7 +664,7 @@ found_type:
blkid_set_tag(dev, "TYPE", type, 0);
- DBG(DEBUG_PROBE, printf("%s: devno 0x%04Lx, type %s\n",
+ DBG(DEBUG_PROBE, printf("%s: devno 0x%04llx, type %s\n",
dev->bid_name, st.st_rdev, type));
}
diff --git a/e2fsprogs/blkid/probe.h b/e2fsprogs/blkid/probe.h
index 530b8ef..134913f 100644
--- a/e2fsprogs/blkid/probe.h
+++ b/e2fsprogs/blkid/probe.h
@@ -108,13 +108,28 @@ struct romfs_super_block {
unsigned char ros_volume[16];
};
+struct cramfs_super_block {
+ __u8 magic[4];
+ __u32 size;
+ __u32 flags;
+ __u32 future;
+ __u8 signature[16];
+ struct cramfs_info {
+ __u32 crc;
+ __u32 edition;
+ __u32 blocks;
+ __u32 files;
+ } info;
+ __u8 name[16];
+};
+
struct swap_id_block {
/* unsigned char sws_boot[1024]; */
__u32 sws_version;
__u32 sws_lastpage;
__u32 sws_nrbad;
unsigned char sws_uuid[16];
- unsigned char sws_volume[16];
+ char sws_volume[16];
unsigned char sws_pad[117];
__u32 sws_badpg;
};
@@ -216,22 +231,22 @@ struct ocfs_volume_header {
unsigned char minor_version[4];
unsigned char major_version[4];
unsigned char signature[128];
- unsigned char mount[128];
- unsigned char mount_len[2];
+ char mount[128];
+ unsigned char mount_len[2];
};
struct ocfs_volume_label {
unsigned char disk_lock[48];
- unsigned char label[64];
+ char label[64];
unsigned char label_len[2];
unsigned char vol_id[16];
unsigned char vol_id_len[2];
};
#define ocfsmajor(o) ((__u32)o.major_version[0] \
- + (((__u32) o.major_version[1]) << 8) \
- + (((__u32) o.major_version[2]) << 16) \
- + (((__u32) o.major_version[3]) << 24))
+ + (((__u32) o.major_version[1]) << 8) \
+ + (((__u32) o.major_version[2]) << 16) \
+ + (((__u32) o.major_version[3]) << 24))
#define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8))
#define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8))
@@ -241,7 +256,7 @@ struct ocfs2_super_block {
unsigned char signature[8];
unsigned char s_dummy1[184];
unsigned char s_dummy2[80];
- unsigned char s_label[64];
+ char s_label[64];
unsigned char s_uuid[16];
};
diff --git a/e2fsprogs/blkid/read.c b/e2fsprogs/blkid/read.c
index 08a3162..5f7422b 100644
--- a/e2fsprogs/blkid/read.c
+++ b/e2fsprogs/blkid/read.c
@@ -33,6 +33,11 @@
#include <stdlib.h>
+#ifdef TEST_PROGRAM
+#define blkid_debug_dump_dev(dev) (debug_dump_dev(dev))
+static void debug_dump_dev(blkid_dev dev);
+#endif
+
/*
* File format:
*
@@ -355,7 +360,7 @@ static int blkid_parse_line(blkid_cache cache, blkid_dev *dev_p, char *cp)
blkid_free_dev(dev);
}
- DEB_DUMP_DEV(DEBUG_READ, dev);
+ DBG(DEBUG_READ, blkid_debug_dump_dev(dev));
return ret;
}
@@ -433,6 +438,32 @@ errout:
}
#ifdef TEST_PROGRAM
+static void debug_dump_dev(blkid_dev dev)
+{
+ struct list_head *p;
+
+ if (!dev) {
+ printf(" dev: NULL\n");
+ return;
+ }
+
+ printf(" dev: name = %s\n", dev->bid_name);
+ printf(" dev: DEVNO=\"0x%0llx\"\n", dev->bid_devno);
+ printf(" dev: TIME=\"%lu\"\n", dev->bid_time);
+ printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
+ printf(" dev: flags = 0x%08X\n", dev->bid_flags);
+
+ list_for_each(p, &dev->bid_tags) {
+ blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
+ if (tag)
+ printf(" tag: %s=\"%s\"\n", tag->bit_name,
+ tag->bit_val);
+ else
+ printf(" tag: NULL\n");
+ }
+ printf("\n");
+}
+
int main(int argc, char**argv)
{
blkid_cache cache = NULL;
diff --git a/e2fsprogs/blkid/tag.c b/e2fsprogs/blkid/tag.c
index 51615d4..6164246 100644
--- a/e2fsprogs/blkid/tag.c
+++ b/e2fsprogs/blkid/tag.c
@@ -29,6 +29,18 @@ static blkid_tag blkid_new_tag(void)
return tag;
}
+#ifdef CONFIG_BLKID_DEBUG
+void blkid_debug_dump_tag(blkid_tag tag)
+{
+ if (!tag) {
+ printf(" tag: NULL\n");
+ return;
+ }
+
+ printf(" tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
+}
+#endif
+
void blkid_free_tag(blkid_tag tag)
{
if (!tag)
@@ -36,7 +48,7 @@ void blkid_free_tag(blkid_tag tag)
DBG(DEBUG_TAG, printf(" freeing tag %s=%s\n", tag->bit_name,
tag->bit_val ? tag->bit_val : "(NULL)"));
- DEB_DUMP_TAG(DEBUG_TAG, tag);
+ DBG(DEBUG_TAG, blkid_debug_dump_tag(tag));
list_del(&tag->bit_tags); /* list of tags for this device */
list_del(&tag->bit_names); /* list of tags with this type */
@@ -330,3 +342,90 @@ try_again:
}
return dev;
}
+
+#ifdef TEST_PROGRAM
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#else
+extern char *optarg;
+extern int optind;
+#endif
+
+void usage(char *prog)
+{
+ fprintf(stderr, "Usage: %s [-f blkid_file] [-m debug_mask] device "
+ "[type value]\n",
+ prog);
+ fprintf(stderr, "\tList all tags for a device and exit\n", prog);
+ exit(1);
+}
+
+int main(int argc, char **argv)
+{
+ blkid_tag_iterate iter;
+ blkid_cache cache = NULL;
+ blkid_dev dev;
+ int c, ret, found;
+ int flags = BLKID_DEV_FIND;
+ char *tmp;
+ char *file = NULL;
+ char *devname = NULL;
+ char *search_type = NULL;
+ char *search_value = NULL;
+ const char *type, *value;
+
+ while ((c = getopt (argc, argv, "m:f:")) != EOF)
+ switch (c) {
+ case 'f':
+ file = optarg;
+ break;
+ case 'm':
+ blkid_debug_mask = strtoul (optarg, &tmp, 0);
+ if (*tmp) {
+ fprintf(stderr, "Invalid debug mask: %d\n",
+ optarg);
+ exit(1);
+ }
+ break;
+ case '?':
+ usage(argv[0]);
+ }
+ if (argc > optind)
+ devname = argv[optind++];
+ if (argc > optind)
+ search_type = argv[optind++];
+ if (argc > optind)
+ search_value = argv[optind++];
+ if (!devname || (argc != optind))
+ usage(argv[0]);
+
+ if ((ret = blkid_get_cache(&cache, file)) != 0) {
+ fprintf(stderr, "%s: error creating cache (%d)\n",
+ argv[0], ret);
+ exit(1);
+ }
+
+ dev = blkid_get_dev(cache, devname, flags);
+ if (!dev) {
+ fprintf(stderr, "%s: Can not find device in blkid cache\n");
+ exit(1);
+ }
+ if (search_type) {
+ found = blkid_dev_has_tag(dev, search_type, search_value);
+ printf("Device %s: (%s, %s) %s\n", blkid_dev_devname(dev),
+ search_type, search_value ? search_value : "NULL",
+ found ? "FOUND" : "NOT FOUND");
+ return(!found);
+ }
+ printf("Device %s...\n", blkid_dev_devname(dev));
+
+ iter = blkid_tag_iterate_begin(dev);
+ while (blkid_tag_next(iter, &type, &value) == 0) {
+ printf("\tTag %s has value %s\n", type, value);
+ }
+ blkid_tag_iterate_end(iter);
+
+ blkid_put_cache(cache);
+ return (0);
+}
+#endif
diff --git a/e2fsprogs/e2fsbb.h b/e2fsprogs/e2fsbb.h
index 74c4e5b..ddd1966 100644
--- a/e2fsprogs/e2fsbb.h
+++ b/e2fsprogs/e2fsbb.h
@@ -11,8 +11,8 @@
#include "libbb.h"
/* version we've last synced against */
-#define E2FSPROGS_VERSION "1.37"
-#define E2FSPROGS_DATE "21-Mar-2005"
+#define E2FSPROGS_VERSION "1.38"
+#define E2FSPROGS_DATE "30-Jun-2005"
/* make sure com_err.h isnt included before us */
#ifdef __COM_ERR_H__
@@ -51,7 +51,7 @@ typedef long errcode_t;
#define HAVE_UNISTD_H 1
/* Endianness */
-#if __BYTE_ORDER== __BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
#define ENABLE_SWAPFS 1
#define WORDS_BIGENDIAN 1
#endif
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c
index 18dfd00..fb1e772 100644
--- a/e2fsprogs/e2fsck.c
+++ b/e2fsprogs/e2fsck.c
@@ -3712,6 +3712,8 @@ err_out:
* @j journal
* @l lost+found
* @L is a link
+ * @m multiply-claimed
+ * @n invalid
* @o orphaned
* @p problem in
* @r root inode
@@ -3749,6 +3751,8 @@ static const char * const abbrevs[] = {
N_("hHTREE @d @i"),
N_("llost+found"),
N_("Lis a link"),
+ N_("mmultiply-claimed"),
+ N_("ninvalid"),
N_("oorphaned"),
N_("pproblem in"),
N_("rroot @i"),
@@ -4698,7 +4702,8 @@ static void e2fsck_pass1(e2fsck_t ctx)
if (ctx->progress)
if ((ctx->progress)(ctx, 1, 0, ctx->fs->group_desc_count))
return;
- if (fs->super->s_wtime < fs->super->s_inodes_count)
+ if ((fs->super->s_wtime < fs->super->s_inodes_count) ||
+ (fs->super->s_mtime < fs->super->s_inodes_count))
busted_fs_time = 1;
while (1) {
@@ -5052,6 +5057,11 @@ static void e2fsck_pass1(e2fsck_t ctx)
ctx->flags |= E2F_FLAG_ABORT;
return;
}
+ e2fsck_read_inode(ctx, EXT2_RESIZE_INO, inode,
+ "recreate inode");
+ inode->i_mtime = time(0);
+ e2fsck_write_inode(ctx, EXT2_RESIZE_INO, inode,
+ "recreate inode");
fs->block_map = save_bmap;
ctx->flags &= ~E2F_FLAG_RESIZE_INODE;
}
@@ -6702,7 +6712,7 @@ static void pass1d(e2fsck_t ctx, char *block_buf)
shared_len = 0;
file_ok = 1;
ino = (ext2_ino_t)VOIDPTR_TO_INT(dnode_getkey(n));
- if (ino == EXT2_BAD_INO)
+ if (ino == EXT2_BAD_INO || ino == EXT2_RESIZE_INO)
continue;
/*
@@ -10052,7 +10062,7 @@ static const char * const prompt[] = {
N_("Abort"), /* 11 */
N_("Split"), /* 12 */
N_("Continue"), /* 13 */
- N_("Clone duplicate/bad blocks"), /* 14 */
+ N_("Clone multiply-claimed blocks"), /* 14 */
N_("Delete file"), /* 15 */
N_("Suppress messages"),/* 16 */
N_("Unlink"), /* 17 */
@@ -10080,7 +10090,7 @@ static const char * const preen_msg[] = {
N_("ABORTED"), /* 11 */
N_("SPLIT"), /* 12 */
N_("CONTINUING"), /* 13 */
- N_("DUPLICATE/BAD BLOCKS CLONED"), /* 14 */
+ N_("MULTIPLY-CLAIMED BLOCKS CLONED"), /* 14 */
N_("FILE DELETED"), /* 15 */
N_("SUPPRESSED"), /* 16 */
N_("UNLINKED"), /* 17 */
@@ -10147,12 +10157,11 @@ static const struct e2fsck_problem problem_table[] = {
/* Relocate hint */
{ PR_0_RELOCATE_HINT,
- N_("Note: if there is several inode or block bitmap blocks\n"
- "which require relocation, or one part of the inode table\n"
- "which must be moved, you may wish to try running e2fsck\n"
- "with the '-b %S' option first. The problem may lie only\n"
- "with the primary block group descriptor, and the backup\n"
- "block group descriptor may be OK.\n\n"),
+ N_("Note: if several inode or block bitmap blocks or part\n"
+ "of the inode table require relocation, you may wish to try\n"
+ "running e2fsck with the '-b %S' option first. The problem\n"
+ "may lie only with the primary block group descriptors, and\n"
+ "the backup block group descriptors may be OK.\n\n"),
PROMPT_NONE, PR_PREEN_OK | PR_NOCOLLATE },
/* Miscellaneous superblock corruption */
@@ -10167,7 +10176,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Inode count in superblock is incorrect */
{ PR_0_INODE_COUNT_WRONG,
- N_("@i count in @S is %i, should be %j.\n"),
+ N_("@i count in @S is %i, @s %j.\n"),
PROMPT_FIX, 0 },
{ PR_0_HURD_CLEAR_FILETYPE,
@@ -10176,7 +10185,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Journal inode is invalid */
{ PR_0_JOURNAL_BAD_INODE,
- N_("@S has a bad ext3 @j (@i %i).\n"),
+ N_("@S has an @n ext3 @j (@i %i).\n"),
PROMPT_CLEAR, PR_PREEN_OK },
/* The external journal has (unsupported) multiple filesystems */
@@ -10224,7 +10233,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Journal has data, but recovery flag is clear */
{ PR_0_JOURNAL_RECOVERY_CLEAR,
- N_("ext3 recovery flag clear, but @j has data.\n"),
+ N_("ext3 recovery flag is clear, but @j has data.\n"),
PROMPT_NONE, 0 },
/* Ask if we should clear the journal */
@@ -10269,7 +10278,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Filesystem revision is 0, but feature flags are set */
{ PR_0_FS_REV_LEVEL,
- "@f has feature flag(s) set, but is a revision 0 @f. ",
+ N_("@f has feature flag(s) set, but is a revision 0 @f. "),
PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
/* Journal superblock has an unknown read-only feature flag set */
@@ -10289,7 +10298,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Moving journal to hidden file */
{ PR_0_MOVE_JOURNAL,
- N_("Moving @j from /%s to hidden inode.\n\n"),
+ N_("Moving @j from /%s to hidden @i.\n\n"),
PROMPT_NONE, 0 },
/* Error moving journal to hidden file */
@@ -10299,7 +10308,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Clearing V2 journal superblock */
{ PR_0_CLEAR_V2_JOURNAL,
- N_("Found invalid V2 @j @S fields (from V1 journal).\n"
+ N_("Found @n V2 @j @S fields (from V1 @j).\n"
"Clearing fields beyond the V1 @j @S...\n\n"),
PROMPT_NONE, 0 },
@@ -10316,7 +10325,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Resize_inode not enabled, but resize inode is non-zero */
{ PR_0_CLEAR_RESIZE_INODE,
- N_("Resize_@i not enabled, but the resize inode is non-zero. "),
+ N_("Resize_@i not enabled, but the resize @i is non-zero. "),
PROMPT_CLEAR, 0 },
/* Resize inode invalid */
@@ -10342,7 +10351,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Reserved inode has bad mode */
{ PR_1_RESERVED_BAD_MODE,
- N_("Reserved @i %i %Q has bad mode. "),
+ N_("Reserved @i %i (%Q) has @n mode. "),
PROMPT_CLEAR, PR_PREEN_OK },
/* Deleted inode has zero dtime */
@@ -10449,9 +10458,8 @@ static const struct e2fsck_problem problem_table[] = {
/* Bad primary block prompt */
{ PR_1_BAD_PRIMARY_BLOCK_PROMPT,
- N_("You can clear the this @b (and hope for the best) from the\n"
- "bad @b list and hope that @b is really OK, but there are no\n"
- "guarantees.\n\n"),
+ N_("You can remove this @b from the bad @b list and hope\n"
+ "that the @b is really OK. But there are no guarantees.\n\n"),
PROMPT_CLEAR, PR_PREEN_NOMSG },
/* Bad primary superblock */
@@ -10514,12 +10522,12 @@ static const struct e2fsck_problem problem_table[] = {
/* Error allocating inode bitmap */
{ PR_1_ALLOCATE_IBITMAP_ERROR,
- "@A @i @B (%N): %m\n",
+ N_("@A @i @B (%N): %m\n"),
PROMPT_NONE, PR_FATAL },
/* Error allocating block bitmap */
{ PR_1_ALLOCATE_BBITMAP_ERROR,
- "@A @b @B (%N): %m\n",
+ N_("@A @b @B (%N): %m\n"),
PROMPT_NONE, PR_FATAL },
/* Error allocating icount structure */
@@ -10579,17 +10587,17 @@ static const struct e2fsck_problem problem_table[] = {
/* Non-zero size for device, fifo or socket inode */
{ PR_1_SET_NONZSIZE,
- "Special (@v/socket/fifo) @i %i has non-zero size. ",
+ N_("Special (@v/socket/fifo) @i %i has non-zero size. "),
PROMPT_FIX, PR_PREEN_OK },
/* Filesystem revision is 0, but feature flags are set */
{ PR_1_FS_REV_LEVEL,
- "@f has feature flag(s) set, but is a revision 0 @f. ",
+ N_("@f has feature flag(s) set, but is a revision 0 @f. "),
PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
/* Journal inode is not in use, but contains data */
{ PR_1_JOURNAL_INODE_NOT_CLEAR,
- "@j @i is not in use, but contains data. ",
+ N_("@j @i is not in use, but contains data. "),
PROMPT_CLEAR, PR_PREEN_OK },
/* Journal has bad mode */
@@ -10599,7 +10607,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Deal with inodes that were part of orphan linked list */
{ PR_1_LOW_DTIME,
- N_("@i %i was part of the orphaned @i list. "),
+ N_("@i %i was part of the @o @i list. "),
PROMPT_FIX, PR_LATCH_LOW_DTIME, 0 },
/* Deal with inodes that were part of corrupted orphan linked
@@ -10610,7 +10618,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Error allocating refcount structure */
{ PR_1_ALLOCATE_REFCOUNT,
- "@A refcount structure (%N): %m\n",
+ N_("@A refcount structure (%N): %m\n"),
PROMPT_NONE, PR_FATAL },
/* Error reading extended attribute block */
@@ -10630,7 +10638,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Extended attribute reference count incorrect */
{ PR_1_EXTATTR_REFCOUNT,
- N_("@a @b %b has reference count %B, should be %N. "),
+ N_("@a @b %b has reference count %B, @s %N. "),
PROMPT_FIX, 0 },
/* Error writing Extended Attribute block while fixing refcount */
@@ -10640,12 +10648,12 @@ static const struct e2fsck_problem problem_table[] = {
/* Multiple EA blocks not supported */
{ PR_1_EA_MULTI_BLOCK,
- N_("@a @b %b has h_blocks > 1. "),
+ N_("@a @b %b has h_@bs > 1. "),
PROMPT_CLEAR, 0},
/* Error allocating EA region allocation structure */
{ PR_1_EA_ALLOC_REGION,
- N_("Error allocating @a @b %b. "),
+ N_("@A @a @b %b. "),
PROMPT_ABORT, 0},
/* Error EA allocation collision */
@@ -10655,12 +10663,12 @@ static const struct e2fsck_problem problem_table[] = {
/* Bad extended attribute name */
{ PR_1_EA_BAD_NAME,
- N_("@a @b %b is corrupt (invalid name). "),
+ N_("@a @b %b is corrupt (@n name). "),
PROMPT_CLEAR, 0},
/* Bad extended attribute value */
{ PR_1_EA_BAD_VALUE,
- N_("@a @b %b is corrupt (invalid value). "),
+ N_("@a @b %b is corrupt (@n value). "),
PROMPT_CLEAR, 0},
/* Inode too big (latch question) */
@@ -10694,7 +10702,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Invalid root node in HTREE directory */
{ PR_1_HTREE_BADROOT,
- N_("@h %i has an invalid root node.\n"),
+ N_("@h %i has an @n root node.\n"),
PROMPT_CLEAR_HTREE, PR_PREEN_OK },
/* Unsupported hash version in HTREE directory */
@@ -10725,45 +10733,45 @@ static const struct e2fsck_problem problem_table[] = {
/* invalid inode->i_extra_isize */
{ PR_1_EXTRA_ISIZE,
- N_("@i %i has a extra size (%IS) which is invalid\n"),
+ N_("@i %i has a extra size (%IS) which is @n\n"),
PROMPT_FIX, PR_PREEN_OK },
/* invalid ea entry->e_name_len */
{ PR_1_ATTR_NAME_LEN,
- N_("@a in @i %i has a namelen (%N) which is invalid\n"),
+ N_("@a in @i %i has a namelen (%N) which is @n\n"),
PROMPT_CLEAR, PR_PREEN_OK },
/* invalid ea entry->e_value_size */
{ PR_1_ATTR_VALUE_SIZE,
- N_("@a in @i %i has a value size (%N) which is invalid\n"),
+ N_("@a in @i %i has a value size (%N) which is @n\n"),
PROMPT_CLEAR, PR_PREEN_OK },
/* invalid ea entry->e_value_offs */
{ PR_1_ATTR_VALUE_OFFSET,
- N_("@a in @i %i has a value offset (%N) which is invalid\n"),
+ N_("@a in @i %i has a value offset (%N) which is @n\n"),
PROMPT_CLEAR, PR_PREEN_OK },
/* invalid ea entry->e_value_block */
{ PR_1_ATTR_VALUE_BLOCK,
- N_("@a in @i %i has a value block (%N) which is invalid (must be 0)\n"),
+ N_("@a in @i %i has a value @b (%N) which is @n (must be 0)\n"),
PROMPT_CLEAR, PR_PREEN_OK },
/* invalid ea entry->e_hash */
{ PR_1_ATTR_HASH,
- N_("@a in @i %i has a hash (%N) which is invalid (must be 0)\n"),
+ N_("@a in @i %i has a hash (%N) which is @n (must be 0)\n"),
PROMPT_CLEAR, PR_PREEN_OK },
/* Pass 1b errors */
/* Pass 1B: Rescan for duplicate/bad blocks */
{ PR_1B_PASS_HEADER,
- N_("Duplicate @bs found... invoking duplicate @b passes.\n"
- "Pass 1B: Rescan for duplicate/bad @bs\n"),
+ N_("\nRunning additional passes to resolve @bs claimed by more than one @i...\n"
+ "Pass 1B: Rescanning for @m @bs\n"),
PROMPT_NONE, 0 },
/* Duplicate/bad block(s) header */
{ PR_1B_DUP_BLOCK_HEADER,
- N_("Duplicate/bad @b(s) in @i %i:"),
+ N_("@m @b(s) in @i %i:"),
PROMPT_NONE, 0 },
/* Duplicate/bad block(s) in inode */
@@ -10783,7 +10791,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Error allocating inode bitmap */
{ PR_1B_ALLOCATE_IBITMAP_ERROR,
- N_("@A @i @B (inode_dup_map): %m\n"),
+ N_("@A @i @B (@i_dup_map): %m\n"),
PROMPT_NONE, PR_FATAL },
/* Error while iterating over blocks */
@@ -10793,25 +10801,25 @@ static const struct e2fsck_problem problem_table[] = {
/* Error adjusting EA refcount */
{ PR_1B_ADJ_EA_REFCOUNT,
- N_("Error addjusting refcount for @a @b %b (@i %i): %m\n"),
+ N_("Error adjusting refcount for @a @b %b (@i %i): %m\n"),
PROMPT_NONE, 0 },
- /* Pass 1C: Scan directories for inodes with dup blocks. */
+ /* Pass 1C: Scan directories for inodes with multiply-claimed blocks. */
{ PR_1C_PASS_HEADER,
- N_("Pass 1C: Scan directories for @is with dup @bs.\n"),
+ N_("Pass 1C: Scanning directories for @is with @m @bs.\n"),
PROMPT_NONE, 0 },
- /* Pass 1D: Reconciling duplicate blocks */
+ /* Pass 1D: Reconciling multiply-claimed blocks */
{ PR_1D_PASS_HEADER,
- N_("Pass 1D: Reconciling duplicate @bs\n"),
+ N_("Pass 1D: Reconciling @m @bs\n"),
PROMPT_NONE, 0 },
/* File has duplicate blocks */
{ PR_1D_DUP_FILE,
N_("File %Q (@i #%i, mod time %IM) \n"
- " has %B duplicate @b(s), shared with %N file(s):\n"),
+ " has %B @m @b(s), shared with %N file(s):\n"),
PROMPT_NONE, 0 },
/* List of files sharing duplicate blocks */
@@ -10826,12 +10834,12 @@ static const struct e2fsck_problem problem_table[] = {
/* Report of how many duplicate/bad inodes */
{ PR_1D_NUM_DUP_INODES,
- N_("(There are %N @is containing duplicate/bad @bs.)\n\n"),
+ N_("(There are %N @is containing @m @bs.)\n\n"),
PROMPT_NONE, 0 },
/* Duplicated blocks already reassigned or cloned. */
{ PR_1D_DUP_BLOCKS_DEALT,
- N_("Duplicated @bs already reassigned or cloned.\n\n"),
+ N_("@m @bs already reassigned or cloned.\n\n"),
PROMPT_NONE, 0 },
/* Clone duplicate/bad blocks? */
@@ -10855,12 +10863,12 @@ static const struct e2fsck_problem problem_table[] = {
/* Bad inode number for '.' */
{ PR_2_BAD_INODE_DOT,
- N_("Bad @i number for '.' in @d @i %i.\n"),
+ N_("@n @i number for '.' in @d @i %i.\n"),
PROMPT_FIX, 0 },
/* Directory entry has bad inode number */
{ PR_2_BAD_INO,
- N_("@E has bad @i #: %Di.\n"),
+ N_("@E has @n @i #: %Di.\n"),
PROMPT_CLEAR, 0 },
/* Directory entry has deleted or unused inode */
@@ -10905,12 +10913,12 @@ static const struct e2fsck_problem problem_table[] = {
/* First entry in directory inode doesn't contain '.' */
{ PR_2_1ST_NOT_DOT,
- N_("First @e '%Dn' (inode=%Di) in @d @i %i (%p) @s '.'\n"),
+ N_("First @e '%Dn' (@i=%Di) in @d @i %i (%p) @s '.'\n"),
PROMPT_FIX, 0 },
/* Second entry in directory inode doesn't contain '..' */
{ PR_2_2ND_NOT_DOT_DOT,
- N_("Second @e '%Dn' (inode=%Di) in @d @i %i @s '..'\n"),
+ N_("Second @e '%Dn' (@i=%Di) in @d @i %i @s '..'\n"),
PROMPT_FIX, 0 },
/* i_faddr should be zero */
@@ -10940,7 +10948,7 @@ static const struct e2fsck_problem problem_table[] = {
/* inode has bad mode */
{ PR_2_BAD_MODE,
- N_("@i %i (%Q) has a bad mode (%Im).\n"),
+ N_("@i %i (%Q) has @n mode (%Im).\n"),
PROMPT_CLEAR, 0 },
/* directory corrupted */
@@ -10995,7 +11003,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Final rec_len is wrong */
{ PR_2_FINAL_RECLEN,
- N_("@E has rec_len of %Dr, should be %N.\n"),
+ N_("@E has rec_len of %Dr, @s %N.\n"),
PROMPT_FIX, 0 },
/* Error allocating icount structure */
@@ -11050,7 +11058,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Directory filetype incorrect */
{ PR_2_BAD_FILETYPE,
- N_("@E has an incorrect filetype (was %Dt, should be %N).\n"),
+ N_("@E has an incorrect filetype (was %Dt, @s %N).\n"),
PROMPT_FIX, 0 },
/* Directory filetype set on filesystem */
@@ -11060,17 +11068,17 @@ static const struct e2fsck_problem problem_table[] = {
/* Directory filename is null */
{ PR_2_NULL_NAME,
- N_("@E has a zero-length name.\n"),
+ N_("@E has a @z name.\n"),
PROMPT_CLEAR, 0 },
/* Invalid symlink */
{ PR_2_INVALID_SYMLINK,
- N_("Symlink %Q (@i #%i) is invalid.\n"),
+ N_("Symlink %Q (@i #%i) is @n.\n"),
PROMPT_CLEAR, 0 },
/* i_file_acl (extended attribute block) is bad */
{ PR_2_FILE_ACL_BAD,
- N_("@a @b @F invalid (%If).\n"),
+ N_("@a @b @F @n (%If).\n"),
PROMPT_CLEAR, 0 },
/* Filesystem contains large files, but has no such flag in sb */
@@ -11100,7 +11108,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Clear invalid HTREE directory */
{ PR_2_HTREE_CLEAR,
- N_("Invalid @h %d (%q). "), PROMPT_CLEAR, 0 },
+ N_("@n @h %d (%q). "), PROMPT_CLEAR, 0 },
/* Bad block in htree interior node */
{ PR_2_HTREE_BADBLK,
@@ -11109,22 +11117,22 @@ static const struct e2fsck_problem problem_table[] = {
/* Error adjusting EA refcount */
{ PR_2_ADJ_EA_REFCOUNT,
- N_("Error addjusting refcount for @a @b %b (@i %i): %m\n"),
+ N_("Error adjusting refcount for @a @b %b (@i %i): %m\n"),
PROMPT_NONE, PR_FATAL },
/* Invalid HTREE root node */
{ PR_2_HTREE_BAD_ROOT,
- N_("@p @h %d: root node is invalid\n"),
+ N_("@p @h %d: root node is @n\n"),
PROMPT_CLEAR_HTREE, PR_PREEN_OK },
/* Invalid HTREE limit */
{ PR_2_HTREE_BAD_LIMIT,
- N_("@p @h %d: node (%B) has bad limit (%N)\n"),
+ N_("@p @h %d: node (%B) has @n limit (%N)\n"),
PROMPT_CLEAR_HTREE, PR_PREEN_OK },
/* Invalid HTREE count */
{ PR_2_HTREE_BAD_COUNT,
- N_("@p @h %d: node (%B) has bad count (%N)\n"),
+ N_("@p @h %d: node (%B) has @n count (%N)\n"),
PROMPT_CLEAR_HTREE, PR_PREEN_OK },
/* HTREE interior node has out-of-order hashes in table */
@@ -11132,9 +11140,9 @@ static const struct e2fsck_problem problem_table[] = {
N_("@p @h %d: node (%B) has an unordered hash table\n"),
PROMPT_CLEAR_HTREE, PR_PREEN_OK },
- /* Node in HTREE directory has bad depth */
+ /* Node in HTREE directory has invalid depth */
{ PR_2_HTREE_BAD_DEPTH,
- N_("@p @h %d: node (%B) has bad depth\n"),
+ N_("@p @h %d: node (%B) has @n depth\n"),
PROMPT_NONE, 0 },
/* Duplicate directory entry found */
@@ -11236,7 +11244,7 @@ static const struct e2fsck_problem problem_table[] = {
/* Couldn't fix parent directory -- couldn't find it */
{ PR_3_FIX_PARENT_NOFIND,
- N_("Couldn't fix parent of @i %i: Couldn't find parent @d entry\n\n"),
+ N_("Couldn't fix parent of @i %i: Couldn't find parent @d @e\n\n"),
PROMPT_NONE, 0 },
/* Error allocating inode bitmap */
@@ -11315,12 +11323,12 @@ static const struct e2fsck_problem problem_table[] = {
/* Unattached zero-length inode */
{ PR_4_ZERO_LEN_INODE,
- "@u @z @i %i. ",
+ N_("@u @z @i %i. "),
PROMPT_CLEAR, PR_PREEN_OK|PR_NO_OK },
/* Unattached inode */
{ PR_4_UNATTACHED_INODE,
- "@u @i %i\n",
+ N_("@u @i %i\n"),
PROMPT_CONNECT, 0 },
/* Inode ref count wrong */
@@ -11332,7 +11340,7 @@ static const struct e2fsck_problem problem_table[] = {
N_("WARNING: PROGRAMMING BUG IN E2FSCK!\n"
"\tOR SOME BONEHEAD (YOU) IS CHECKING A MOUNTED (LIVE) FILESYSTEM.\n"
"@i_link_info[%i] is %N, @i.i_links_count is %Il. "
- "They should be the same!\n"),
+ "They @s the same!\n"),
PROMPT_NONE, 0 },
/* Pass 5 errors */
@@ -11430,12 +11438,12 @@ static const struct e2fsck_problem problem_table[] = {
/* Error copying in replacement inode bitmap */
{ PR_5_COPY_IBITMAP_ERROR,
- "Error copying in replacement @i @B: %m\n",
+ N_("Error copying in replacement @i @B: %m\n"),
PROMPT_NONE, PR_FATAL },
/* Error copying in replacement block bitmap */
{ PR_5_COPY_BBITMAP_ERROR,
- "Error copying in replacement @b @B: %m\n",
+ N_("Error copying in replacement @b @B: %m\n"),
PROMPT_NONE, PR_FATAL },
/* Block range not used, but marked in bitmap */
@@ -13523,7 +13531,7 @@ static void check_resize_inode(e2fsck_t ctx)
}
}
- /* Read the resizde inode */
+ /* Read the resize inode */
pctx.ino = EXT2_RESIZE_INO;
retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode);
if (retval) {
@@ -14641,7 +14649,7 @@ static void usage(e2fsck_t ctx)
fprintf(stderr,
_("Usage: %s [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]\n"
"\t\t[-I inode_buffer_blocks] [-P process_inode_size]\n"
- "\t\t[-l|-L bad_blocks_file] [-C fd] [-j ext-journal]\n"
+ "\t\t[-l|-L bad_blocks_file] [-C fd] [-j external_journal]\n"
"\t\t[-E extended-options] device\n"),
ctx->program_name);
@@ -14655,7 +14663,7 @@ static void usage(e2fsck_t ctx)
" -v Be verbose\n"
" -b superblock Use alternative superblock\n"
" -B blocksize Force blocksize when looking for superblock\n"
- " -j external-journal Set location of the external journal\n"
+ " -j external_journal Set location of the external journal\n"
" -l bad_blocks_file Add to badblocks list\n"
" -L bad_blocks_file Set badblocks list\n"
));
@@ -15080,16 +15088,19 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
continue;
}
ctx->ext_attr_ver = ea_ver;
- } else
+ } else {
+ fprintf(stderr, _("Unknown extended option: %s\n"),
+ token);
extended_usage++;
+ }
}
if (extended_usage) {
bb_error_msg_and_die(
"Extended options are separated by commas, "
"and may take an argument which\n"
"is set off by an equals ('=') sign. "
- "Valid raid options are:\n"
- "\tea_ver=<ea_version (1 or 2)\n\n");
+ "Valid extended options are:\n"
+ "\tea_ver=<ea_version (1 or 2)>\n\n");
}
}
diff --git a/e2fsprogs/e2p/ls.c b/e2fsprogs/e2p/ls.c
index 0c91345..ee83ab6 100644
--- a/e2fsprogs/e2p/ls.c
+++ b/e2fsprogs/e2p/ls.c
@@ -12,6 +12,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <grp.h>
diff --git a/e2fsprogs/e2p/ostype.c b/e2fsprogs/e2p/ostype.c
index 4623063..2ea59cb 100644
--- a/e2fsprogs/e2p/ostype.c
+++ b/e2fsprogs/e2p/ostype.c
@@ -9,6 +9,7 @@
#include "e2p.h"
#include <string.h>
+#include <stdlib.h>
static const char * const os_tab[] =
{ "Linux",
diff --git a/e2fsprogs/ext2fs/bitops.c b/e2fsprogs/ext2fs/bitops.c
index e44e10c..77ac2a6 100644
--- a/e2fsprogs/ext2fs/bitops.c
+++ b/e2fsprogs/ext2fs/bitops.c
@@ -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;
diff --git a/e2fsprogs/ext2fs/bitops.h b/e2fsprogs/ext2fs/bitops.h
index 4dba050..5e727d1 100644
--- a/e2fsprogs/ext2fs/bitops.h
+++ b/e2fsprogs/ext2fs/bitops.h
@@ -15,9 +15,9 @@
#include <strings.h>
-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);
diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h
index 7d2a436..b8752a5 100644
--- a/e2fsprogs/ext2fs/ext2fs.h
+++ b/e2fsprogs/ext2fs/ext2fs.h
@@ -330,6 +330,7 @@ typedef struct ext2_struct_inode_scan *ext2_inode_scan;
#define EXT2_MF_ISROOT 2
#define EXT2_MF_READONLY 4
#define EXT2_MF_SWAP 8
+#define EXT2_MF_BUSY 16
/*
* 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 73d393d..a363b19 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,
unsigned long size, void *ptr)
{
void *p;
- void **pp = (void **)ptr;
- p = realloc(*pp, size);
+ /* Use "memcpy" for pointer assignments here to avoid problems
+ * with C99 strict type aliasing rules. */
+ memcpy(&p, ptr, sizeof (p));
+ p = realloc(p, size);
if (!p)
return EXT2_ET_NO_MEMORY;
- *pp = p;
+ memcpy(ptr, &p, sizeof (p));
return 0;
}
diff --git a/e2fsprogs/ext2fs/getsectsize.c b/e2fsprogs/ext2fs/getsectsize.c
index b561660..36871f2 100644
--- a/e2fsprogs/ext2fs/getsectsize.c
+++ b/e2fsprogs/ext2fs/getsectsize.c
@@ -23,7 +23,7 @@
#include <linux/fd.h>
#endif
-#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE)
+#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET)
#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
#endif
diff --git a/e2fsprogs/ext2fs/ismounted.c b/e2fsprogs/ext2fs/ismounted.c
index 2395cca..125fe24 100644
--- a/e2fsprogs/ext2fs/ismounted.c
+++ b/e2fsprogs/ext2fs/ismounted.c
@@ -339,20 +339,18 @@ int main(int argc, char **argv)
exit(1);
}
printf("Device %s reports flags %02x\n", argv[1], mount_flags);
+ if (mount_flags & EXT2_MF_BUSY)
+ printf("\t%s is apparently in use.\n", argv[1]);
if (mount_flags & EXT2_MF_MOUNTED)
printf("\t%s is mounted.\n", argv[1]);
-
if (mount_flags & EXT2_MF_SWAP)
printf("\t%s is a swap device.\n", argv[1]);
-
if (mount_flags & EXT2_MF_READONLY)
printf("\t%s is read-only.\n", argv[1]);
-
if (mount_flags & EXT2_MF_ISROOT)
printf("\t%s is the root filesystem.\n", argv[1]);
if (mntpt[0])
printf("\t%s is mounted on %s.\n", argv[1], mntpt);
-
exit(0);
}
#endif /* DEBUG */
diff --git a/e2fsprogs/mke2fs.c b/e2fsprogs/mke2fs.c
index 09d42aa..e6a1392 100644
--- a/e2fsprogs/mke2fs.c
+++ b/e2fsprogs/mke2fs.c
@@ -711,7 +711,7 @@ static void parse_extended_opts(struct ext2_super_block *sb_param,
}
fs_stride = strtoul(arg, &p, 0);
if (*p || (fs_stride == 0)) {
- bb_error_msg("Invalid stride parameter");
+ bb_error_msg("Invalid stride parameter: %s", arg);
r_usage++;
continue;
}
@@ -735,7 +735,8 @@ static void parse_extended_opts(struct ext2_super_block *sb_param,
continue;
}
if (resize <= sb_param->s_blocks_count) {
- bb_error_msg("The resize maximum must be greater than the filesystem size");
+ bb_error_msg("The resize maximum must be greater "
+ "than the filesystem size");
r_usage++;
continue;
}
@@ -767,10 +768,10 @@ static void parse_extended_opts(struct ext2_super_block *sb_param,
if (r_usage) {
bb_error_msg_and_die(
"\nBad options specified.\n\n"
- "Options are separated by commas, "
+ "Extended options are separated by commas, "
"and may take an argument which\n"
"\tis set off by an equals ('=') sign.\n\n"
- "Valid raid options are:\n"
+ "Valid extended options are:\n"
"\tstride=<stride length in blocks>\n"
"\tresize=<resize maximum size in blocks>\n");
}
@@ -855,7 +856,7 @@ static int PRS(int argc, char *argv[])
if (b < EXT2_MIN_BLOCK_SIZE ||
b > EXT2_MAX_BLOCK_SIZE) {
BLOCKSIZE_ERROR:
- bb_error_msg_and_die("bad block size - %s", optarg);
+ bb_error_msg_and_die("invalid block size - %s", optarg);
}
mke2fs_warning_msg((blocksize > 4096),
"blocksize %d not usable on most systems",
@@ -871,7 +872,7 @@ BLOCKSIZE_ERROR:
break;
case 'f':
if (safe_strtoi(optarg, &size) || size < EXT2_MIN_BLOCK_SIZE || size > EXT2_MAX_BLOCK_SIZE ){
- bb_error_msg_and_die("bad fragment size - %s", optarg);
+ bb_error_msg_and_die("invalid fragment size - %s", optarg);
}
param.s_log_frag_size =
int_log2(size >> EXT2_MIN_BLOCK_LOG_SIZE);
@@ -893,7 +894,7 @@ BLOCKSIZE_ERROR:
if (safe_strtoi(optarg, &inode_ratio)
|| inode_ratio < EXT2_MIN_BLOCK_SIZE
|| inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) {
- bb_error_msg_and_die("bad inode ratio %s (min %d/max %d)",
+ bb_error_msg_and_die("invalid inode ratio %s (min %d/max %d)",
optarg, EXT2_MIN_BLOCK_SIZE,
EXT2_MAX_BLOCK_SIZE);
}
@@ -912,7 +913,7 @@ BLOCKSIZE_ERROR:
break;
case 'm':
if (safe_strtoi(optarg, &reserved_ratio) || reserved_ratio > 50 ) {
- bb_error_msg_and_die("bad reserved blocks percent - %s", optarg);
+ bb_error_msg_and_die("invalid reserved blocks percent - %s", optarg);
}
break;
case 'n':
@@ -940,7 +941,7 @@ BLOCKSIZE_ERROR:
#ifdef EXT2_DYNAMIC_REV
case 'I':
if (safe_strtoi(optarg, &inode_size)) {
- bb_error_msg_and_die("bad inode size - %s", optarg);
+ bb_error_msg_and_die("invalid inode size - %s", optarg);
}
break;
#endif
@@ -1051,7 +1052,7 @@ BLOCKSIZE_ERROR:
if (optind < argc) {
param.s_blocks_count = parse_num_blocks(argv[optind++],
param.s_log_block_size);
- mke2fs_error_msg_and_die(!param.s_blocks_count, "bad blocks count - %s", argv[optind - 1]);
+ mke2fs_error_msg_and_die(!param.s_blocks_count, "invalid blocks count - %s", argv[optind - 1]);
}
if (optind < argc)
bb_show_usage();
@@ -1165,11 +1166,16 @@ BLOCKSIZE_ERROR:
}
}
+ if (!force && param.s_blocks_count >= (1 << 31)) {
+ bb_error_msg_and_die("Filesystem too large. No more than 2**31-1 blocks\n"
+ "\t (8TB using a blocksize of 4k) are currently supported.");
+ }
+
if (inode_size) {
if (inode_size < EXT2_GOOD_OLD_INODE_SIZE ||
inode_size > EXT2_BLOCK_SIZE(&param) ||
inode_size & (inode_size - 1)) {
- bb_error_msg_and_die("bad inode size %d (min %d/max %d)",
+ bb_error_msg_and_die("invalid inode size %d (min %d/max %d)",
inode_size, EXT2_GOOD_OLD_INODE_SIZE,
blocksize);
}
diff --git a/e2fsprogs/util.c b/e2fsprogs/util.c
index 3902f7e..537021d 100644
--- a/e2fsprogs/util.c
+++ b/e2fsprogs/util.c
@@ -89,14 +89,20 @@ void check_mount(const char *device, int force, const char *type)
bb_error_msg("Could not determine if %s is mounted", device);
return;
}
- if (!(mount_flags & EXT2_MF_MOUNTED))
- return;
+ if (mount_flags & EXT2_MF_MOUNTED) {
+ bb_error_msg("%s is mounted !", device);
+force_check:
+ if (force)
+ bb_error_msg("badblocks forced anyways");
+ else
+ bb_error_msg_and_die("it's not safe to run badblocks!");
+ }
+
+ if (mount_flags & EXT2_MF_BUSY) {
+ bb_error_msg("%s is apparently in use by the system", device);
+ goto force_check;
+ }
- bb_error_msg("%s is mounted !", device);
- if (force)
- bb_error_msg("forcing anyways and ignoring /etc/mtab status");
- else
- bb_error_msg_and_die("will not make a %s here!", type);
}
void parse_journal_opts(char **journal_device, int *journal_flags,
@@ -189,10 +195,14 @@ int figure_journal_size(int size, ext2_filsys fs)
if (fs->super->s_blocks_count < 32768)
j_blocks = 1024;
- else if (fs->super->s_blocks_count < 262144)
+ else if (fs->super->s_blocks_count < 256*1024)
j_blocks = 4096;
- else
+ else if (fs->super->s_blocks_count < 512*1024)
j_blocks = 8192;
+ else if (fs->super->s_blocks_count < 1024*1024)
+ j_blocks = 16384;
+ else
+ j_blocks = 32768;
return j_blocks;
}