ChangeLog, dumpe2fs.8.in, dumpe2fs.c, mke2fs.8.in, mke2fs.c, partinfo.c:
partinfo.c: Fix minor compilation bugs pointed out by Yann Dirson.
mke2fs.c: Don't turn on sparse superblocks by default on pre-2.2 kernels.
mke2fs.8.in: Add the possible valid block sizes for mke2fs. Document
the -n flag, and the new defaults for the -s flag.
dumpe2fs.c, dumpe2fs.8.in: Add new options -f (force) and -h (header-only).
mke2fs.c (PRS): Fix logic for turning on/off the sparse superblock option.
Many files:
Updated copyright statements to reflect the GPL with permission of the
original authors.
diff --git a/misc/ChangeLog b/misc/ChangeLog
index 9356dae..c919cfb 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,4 +1,24 @@
-1999-07-18 Theodore Ts'o <tytso@rsts-11.mit.edu>
+1999-09-08 <tytso@valinux.com>
+
+ * partinfo.c: Fix minor compilation bugs pointed out by Yann
+ Dirson.
+
+ * mke2fs.c: Don't turn on sparse superblocks by default on pre-2.2
+ kernels.
+
+ * mke2fs.8.in: Add the possible valid block sizes for mke2fs.
+ Document the -n flag, and the new defaults for the -s
+ flag.
+
+ * dumpe2fs.c, dumpe2fs.8.in: Add new options -f (force) and -h
+ (header-only).
+
+1999-08-13 <tytso@valinux.com>
+
+ * mke2fs.c (PRS): Fix logic for turning on/off the sparse
+ superblock option.
+
+1999-07-18 Theodore Ts'o <tytso@valinux.com>
* Release of E2fsprogs 1.15
diff --git a/misc/dumpe2fs.8.in b/misc/dumpe2fs.8.in
index d7d4149..1dac7e3 100644
--- a/misc/dumpe2fs.8.in
+++ b/misc/dumpe2fs.8.in
@@ -8,7 +8,7 @@
.SH SYNOPSIS
.B dumpe2fs
[
-.B -b
+.B -bfhV
]
[
.B -ob superblock
@@ -16,9 +16,6 @@
[
.B -oB blocksize
]
-[
-.B -V
-]
device
.SH DESCRIPTION
.BI dumpe2fs
@@ -45,6 +42,15 @@
This option is not usually needed except by a filesystem wizard who
is examining the remains of a very badly corupted filesystem.
.TP
+.I -f
+force dumpe2fs to display a filesystem even though it may have some
+filesystem feature flags which dumpe2fs may not understand (and which
+can cause some of dumpe2fs's display to be suspect).
+.TP
+.I -h
+only display the superblock information and not any of the block
+group descriptor detail information.
+.TP
.I -V
print the version number of
.B dumpe2fs
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index e4ff27a..da02512 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -180,6 +180,8 @@
int print_badblocks = 0;
int use_superblock = 0;
int use_blocksize = 0;
+ int force = 0;
+ int header_only = 0;
int big_endian;
int c;
@@ -190,11 +192,17 @@
if (argc && *argv)
program_name = *argv;
- while ((c = getopt (argc, argv, "bVo:")) != EOF) {
+ while ((c = getopt (argc, argv, "bfhVo:")) != EOF) {
switch (c) {
case 'b':
print_badblocks++;
break;
+ case 'f':
+ force++;
+ break;
+ case 'h':
+ header_only++;
+ break;
case 'o':
if (optarg[0] == 'b')
use_superblock = atoi(optarg+1);
@@ -217,8 +225,9 @@
device_name = argv[optind++];
if (use_superblock && !use_blocksize)
use_blocksize = 1024;
- retval = ext2fs_open (device_name, 0, use_superblock,
- use_blocksize, unix_io_manager, &fs);
+ retval = ext2fs_open (device_name, force ? EXT2_FLAG_FORCE : 0,
+ use_superblock, use_blocksize,
+ unix_io_manager, &fs);
if (retval) {
com_err (program_name, retval, "while trying to open %s",
device_name);
@@ -228,6 +237,17 @@
if (print_badblocks) {
dump_bad_blocks(fs);
} else {
+ big_endian = ((fs->flags & EXT2_FLAG_SWAP_BYTES) != 0);
+ if (!i386_byteorder())
+ big_endian = !big_endian;
+ if (big_endian)
+ printf("Note: This is a byte-swapped filesystem\n");
+ list_super (fs->super);
+ list_bad_blocks (fs);
+ if (header_only) {
+ ext2fs_close (fs);
+ exit (0);
+ }
retval = ext2fs_read_bitmaps (fs);
if (retval) {
com_err (program_name, retval,
@@ -236,13 +256,6 @@
ext2fs_close (fs);
exit (1);
}
- big_endian = ((fs->flags & EXT2_FLAG_SWAP_BYTES) != 0);
- if (!i386_byteorder())
- big_endian = !big_endian;
- if (big_endian)
- printf("Note: This is a byte-swapped filesystem\n");
- list_super (fs->super);
- list_bad_blocks (fs);
list_desc (fs);
}
ext2fs_close (fs);
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 4e0a3d9..62725e4 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -33,6 +33,9 @@
.I number-of-inodes
]
[
+.B -n
+]
+[
.B \-m
.I reserved-blocks-percentage
]
@@ -95,7 +98,8 @@
.SH OPTIONS
.TP
.I -b block-size
-Specify the size of blocks in bytes.
+Specify the size of blocks in bytes. Valid block size vales are 1024,
+2048 and 4096 bytes per block.
.TP
.I -c
Check the device for bad blocks before creating the file system, using a
@@ -117,6 +121,10 @@
filesystem after it is created, so be careful decided the correct
value for this parameter.
.TP
+.I -n
+causes mke2fs to not actually create a filesystem, but display what it
+would do if it were to create a filesystem.
+.TP
.I -N number-of-inodes
overrides the default calculation of the number of inodes that should be
reserved for the filesystem (which is based on the number of blocks and
@@ -151,11 +159,13 @@
.I -s sparse-super-flag
If sparse-super-flag is 1, then turn on the sparse superblock flag.
If 0, then turn off the sparse superblock flag. (Currently, the sparse
-superblock flag defaults to off.)
+superblock flag is off by default if the kernel version is less than
+2.2; otherwise it defaults to on.)
.B Warning:
-The Linux 2.0 kernel does not properly support this feature. Neither do
-all Linux 2.1 kernels; please don't use this unless you know what you're
-doing!
+The Linux 2.0 kernel (and some Linux 2.1 kernel) does not properly
+support sparse superblocks. Filesystems that may need to mounted
+on pre-2.2 kernels should not be created with the sparse superblocks
+feature.
.TP
.I -v
Verbose execution.
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index d552993..c8ac45e 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -21,6 +21,9 @@
#include <ctype.h>
#include <termios.h>
#include <time.h>
+#ifdef linux
+#include <sys/utsname.h>
+#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
@@ -190,10 +193,10 @@
/*
* This function sets the default parameters for a filesystem
*
- * The type is specified by the user. The size is minimum size for
- * which a set of parameters applies, with a size of zero meaning that
- * it is the default parameter for the type. Note that order is
- * important in the table below.
+ * The type is specified by the user. The size is the maximum size
+ * (in megabytes) for which a set of parameters applies, with a size
+ * of zero meaning that it is the default parameter for the type.
+ * Note that order is important in the table below.
*/
static char default_str[] = "default";
struct mke2fs_defaults {
@@ -716,7 +719,17 @@
char *raid_opts = 0;
char *fs_type = 0;
blk_t dev_size;
-
+#ifdef linux
+ struct utsname ut;
+
+ if (uname(&ut)) {
+ perror("uname");
+ exit(1);
+ }
+ if (ut.release[0] == '2' && ut.release[1] == '.' &&
+ ut.release[2] < '2' && ut.release[3] == '.')
+ sparse_option = 0;
+#endif
/* Update our PATH to include /sbin */
if (oldpath) {
char *newpath;
@@ -936,16 +949,8 @@
*/
param.s_r_blocks_count = (param.s_blocks_count * reserved_ratio) / 100;
- /*
- * If we are using revision #1, use the sparse super feature
- * by default
- */
#ifdef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER
- if ((sparse_option == 1)
-#ifdef EXT2_DYNAMIC_REV
- || ((param.s_rev_level >= EXT2_DYNAMIC_REV) && (!sparse_option))
-#endif
- )
+ if (sparse_option)
param_ext2->s_feature_ro_compat |=
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
#endif
diff --git a/misc/partinfo.c b/misc/partinfo.c
index c85f30e..6ae850f 100644
--- a/misc/partinfo.c
+++ b/misc/partinfo.c
@@ -14,6 +14,7 @@
#include <linux/hdreg.h>
#include <unistd.h>
#include <stdlib.h>
+#include <errno.h>
void print_error(char *operation, int error, char *device)
{
@@ -40,19 +41,19 @@
fd = open(argv[i], O_RDONLY);
if (fd < 0) {
- print_error("open", errno, argv[1]);
+ print_error("open", errno, argv[i]);
continue;
}
if (ioctl(fd, HDIO_GETGEO, &loc) < 0) {
- print_error("HDIO_GETGEO ioctl", errno, argv[1]);
+ print_error("HDIO_GETGEO ioctl", errno, argv[i]);
close(fd);
continue;
}
if (ioctl(fd, BLKGETSIZE, &size) < 0) {
- print_error("BLKGETSIZE ioctl", errno, argv[1]);
+ print_error("BLKGETSIZE ioctl", errno, argv[i]);
close(fd);
continue;
}