diff options
-rw-r--r-- | misc/ChangeLog | 24 | ||||
-rw-r--r-- | misc/Makefile.in | 5 | ||||
-rw-r--r-- | misc/badblocks.8.in | 4 | ||||
-rw-r--r-- | misc/chattr.1.in | 21 | ||||
-rw-r--r-- | misc/dumpe2fs.8.in | 4 | ||||
-rw-r--r-- | misc/e2label.8.in | 52 | ||||
-rw-r--r-- | misc/e2label.c | 28 | ||||
-rw-r--r-- | misc/lsattr.1.in | 4 | ||||
-rw-r--r-- | misc/mke2fs.8.in | 4 | ||||
-rw-r--r-- | misc/mke2fs.c | 61 | ||||
-rw-r--r-- | misc/mklost+found.8.in | 4 | ||||
-rw-r--r-- | misc/tune2fs.8.in | 11 | ||||
-rw-r--r-- | misc/tune2fs.c | 3 |
13 files changed, 169 insertions, 56 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog index 2b553145..cdcb86c9 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,27 @@ +1998-03-29 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * e2label.c: Fix -Wall warning by making functions static. + +1998-03-28 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * chattr.1.in: Document that the append-only attribute may + only be set or cleared by the superuser. + + * Update all manual pages to that the availability section is + up-to-date. + + * e2label.8.in, tune2fs.8.in: Update manual page to state that + labels must be no longer than 16 characters, or they will + be truncated. + + * e2label.c (change_label), tune2fs.c (main): If the label is + longer than 16 characters, print a warning message stating + that the label will be truncated. + + * mke2fs.c (PRS): If the user specifies a filesystem size, and + it's larger than the apparent size of the device, print a + warning message and ask if the user wants to proceed. + 1998-03-21 Theodore Ts'o <tytso@rsts-11.mit.edu> * mke2fs.c (check_plausibility): Fixed spelling typo in warning diff --git a/misc/Makefile.in b/misc/Makefile.in index a2789a35..a80a5c08 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -14,7 +14,7 @@ INSTALL = @INSTALL@ SPROGS= mke2fs badblocks tune2fs dumpe2fs e2label @FSCK_PROG@ USPROGS= mklost+found SMANPAGES= tune2fs.8 mklost+found.8 mke2fs.8 dumpe2fs.8 badblocks.8 \ - @FSCK_MAN@ + e2label.8 @FSCK_MAN@ UPROGS= chattr lsattr UMANPAGES= chattr.1 lsattr.1 @@ -90,6 +90,9 @@ mklost+found.8: $(DEP_SUBSTITUTE) $(srcdir)/mklost+found.8.in mke2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/mke2fs.8.in $(SUBSTITUTE) $(srcdir)/mke2fs.8.in mke2fs.8 +e2label.8: $(DEP_SUBSTITUTE) $(srcdir)/e2label.8.in + $(SUBSTITUTE) $(srcdir)/e2label.8.in e2label.8 + dumpe2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/dumpe2fs.8.in $(SUBSTITUTE) $(srcdir)/dumpe2fs.8.in dumpe2fs.8 diff --git a/misc/badblocks.8.in b/misc/badblocks.8.in index ca42e991..3692ed87 100644 --- a/misc/badblocks.8.in +++ b/misc/badblocks.8.in @@ -70,8 +70,8 @@ I had no chance to make real tests of this program since I use IDE drives, which remap bad blocks. I only made some tests on floppies. .SH AVAILABILITY .B badblocks -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. +is part of the e2fsprogs package and is available for anonymous +ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs. .SH SEE ALSO .BR e2fsck (8), .BR mke2fs (8) diff --git a/misc/chattr.1.in b/misc/chattr.1.in index aece86df..32b4bf5a 100644 --- a/misc/chattr.1.in +++ b/misc/chattr.1.in @@ -43,31 +43,32 @@ Set the files version. When a file with the 'A' attribute set is modified, its atime record is not modified. This avoids a certain amount of disk I/O for laptop systems. - +.PP A file with the `a' attribute set can only be open in append mode for writing. - +Only the superuser can set or clear this attribute. +.PP A file with the `c' attribute set is automatically compressed on the disk by the kernel. A read from this file returns uncompressed data. A write to this file compresses data before storing them on the disk. - +.PP A file with the `d' attribute set is not candidate for backup when the .BR dump (8) program is run. - +.PP A file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser can set or clear this attribute. - +.PP When a file with the `s' attribute set is deleted, its blocks are zeroed and written back to the disk. - +.PP When a file with the `S' attribute set is modified, the changes are written synchronously on the disk; this is equivalent to the `sync' mount option applied to a subset of the files. - +.PP When a file with the `u' attribute set is deleted, its contents are saved. This allows the user to ask for its undeletion. - +.PP .SH AUTHOR .B chattr was written by Remy Card <card@masi.ibp.fr>, the developer and maintainer @@ -80,7 +81,7 @@ the kernel code. (The noatime code is still in testing.) These attributes will be implemented in a future ext2 fs version. .SH AVAILABILITY .B chattr -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. +is part of the e2fsprogs package and is available for anonymous +ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs. .SH SEE ALSO .BR lsattr (1) diff --git a/misc/dumpe2fs.8.in b/misc/dumpe2fs.8.in index b9da72a7..8db2d8fa 100644 --- a/misc/dumpe2fs.8.in +++ b/misc/dumpe2fs.8.in @@ -42,8 +42,8 @@ was written by Remy Card <card@masi.ibp.fr>, the developer and maintainer of the ext2 fs. .SH AVAILABILITY .B dumpe2fs -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. +is part of the e2fsprogs package and is available for anonymous +ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs. .SH SEE ALSO .BR e2fsck (8), .BR mke2fs (8), diff --git a/misc/e2label.8.in b/misc/e2label.8.in new file mode 100644 index 00000000..fecb8882 --- /dev/null +++ b/misc/e2label.8.in @@ -0,0 +1,52 @@ +.\" -*- nroff -*- +.\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH E2LABEL 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" +.SH NAME +e2label \- Change the label on an ext2 filesystem +.SH SYNOPSIS +.B e2label +device +[ +new-label +] +.SH DESCRIPTION +.BI e2label +will display or change the filesystem label on the ext2 filesystem located on +.I device. +.PP +If the optional argument +.I new-label +is not present, +.B e2label +will simply display the current filesystem label. +.PP +If the optional argument +.I new-label +is present, then +.B e2label +will set the filesystem label to be +.IR new-label . +Ext2 filesystem labels can be at most 16 characters long; if +.I new-label +is longer than 16 characters, +.B e2label +will truncate it and print a warning message. +.PP +It is also possible to set the filesystem label using the +.I -L +option of +.BR tune2fs (8). +.PP +.SH AUTHOR +.B e2label +was written by Andries Brouwer (aeb@cwi.nl). +.SH AVAILABILITY +.B e2label +is part of the e2fsprogs package and is available for anonymous +ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs. +.SH SEE ALSO +.BR mke2fs (8), +.BR tune2fs (8) + diff --git a/misc/e2label.c b/misc/e2label.c index 928a896f..8c0df8b2 100644 --- a/misc/e2label.c +++ b/misc/e2label.c @@ -1,8 +1,14 @@ /* * e2label.c - Print or change the volume label on an ext2 fs * - * aeb, 970714 + * Written by Andries Brouwer (aeb@cwi.nl), 970714 + * + * Copyright 1997, 1998 by Theodore Ts'o. * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Public + * License. + * %End-Header% */ #include <stdio.h> @@ -37,8 +43,8 @@ struct ext2_super_block { char s_dummy2[824]; } sb; -int -open_e2fs (char *dev, int mode) { +static int open_e2fs (char *dev, int mode) +{ int fd; fd = open(dev, mode); @@ -65,23 +71,25 @@ open_e2fs (char *dev, int mode) { return fd; } -void -print_label (char *dev) { +static void print_label (char *dev) +{ char label[VOLNAMSZ+1]; open_e2fs (dev, O_RDONLY); - label[VOLNAMSZ] = 0; strncpy(label, sb.s_volume_name, VOLNAMSZ); + label[VOLNAMSZ] = 0; printf("%s\n", label); } -void -change_label (char *dev, char *label) { +static void change_label (char *dev, char *label) +{ int fd; fd = open_e2fs(dev, O_RDWR); memset(sb.s_volume_name, 0, VOLNAMSZ); strncpy(sb.s_volume_name, label, VOLNAMSZ); + if (strlen(label) > VOLNAMSZ) + fprintf(stderr, "Warning: label too long, truncating.\n"); if (lseek(fd, 1024, SEEK_SET) != 1024) { perror(dev); fprintf (stderr, "e2label: cannot seek to superblock again\n"); @@ -94,8 +102,8 @@ change_label (char *dev, char *label) { } } -int -main (int argc, char ** argv) { +int main (int argc, char ** argv) +{ if (argc == 2) print_label(argv[1]); else if (argc == 3) diff --git a/misc/lsattr.1.in b/misc/lsattr.1.in index 1a3bdffd..03c159d1 100644 --- a/misc/lsattr.1.in +++ b/misc/lsattr.1.in @@ -34,7 +34,7 @@ of the ext2 fs. There are none :-). .SH AVAILABILITY .B lsattr -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. +is part of the e2fsprogs package and is available for anonymous +ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs. .SH SEE ALSO .BR chattr (1) diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in index 9384c0a7..6bb5877e 100644 --- a/misc/mke2fs.8.in +++ b/misc/mke2fs.8.in @@ -187,8 +187,8 @@ extended file system does not support fragments yet. There may be some other ones. Please, report them to the author. .SH AVAILABILITY .B mke2fs -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. +is part of the e2fsprogs package and is available for anonymous +ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs. .SH SEE ALSO .BT badblocks (8), .BR dumpe2fs (8), diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 2a2f428b..0ec17ba1 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -108,6 +108,15 @@ static int log2(int arg) return l; } +static void proceed_question(NOARGS) +{ + fflush(stdout); + fflush(stderr); + printf("Proceed anyway? (y,n) "); + if (getchar() != 'y') + exit(1); +} + static void check_plausibility(NOARGS) { #ifdef HAVE_LINUX_MAJOR_H @@ -117,29 +126,24 @@ static void check_plausibility(NOARGS) val = stat(device_name, &s); if(val == -1) { - printf("Could not stat %s --- %s\n", device_name, - error_message(errno)); + fprintf(stderr, "Could not stat %s --- %s\n", + device_name, error_message(errno)); if (errno == ENOENT) - printf("\nThe device apparently does not exist; " - "did you specify it correctly?\n"); + fprintf(stderr, "\nThe device apparently does " + "not exist; did you specify it correctly?\n"); exit(1); } if(!S_ISBLK(s.st_mode)) { printf("%s is not a block special device.\n", device_name); - printf("Proceed anyway? (y,n) "); - if (getchar() != 'y') - exit(1); + proceed_question(); return; - } - if ((MAJOR(s.st_rdev) == HD_MAJOR && MINOR(s.st_rdev)%64 == 0) || - (MAJOR(s.st_rdev) == SCSI_DISK_MAJOR && - MINOR(s.st_rdev)%16 == 0)) { + } else if ((MAJOR(s.st_rdev) == HD_MAJOR && + MINOR(s.st_rdev)%64 == 0) || + (MAJOR(s.st_rdev) == SCSI_DISK_MAJOR && + MINOR(s.st_rdev)%16 == 0)) { printf("%s is entire device, not just one partition!\n", device_name); - printf("Proceed anyway? (y,n) "); - if (getchar() != 'y') - exit(1); - return; + proceed_question(); } #endif } @@ -607,6 +611,7 @@ static void PRS(int argc, char *argv[]) char *oldpath = getenv("PATH"); struct ext2fs_sb *param_ext2 = (struct ext2fs_sb *) ¶m; char *raid_opts = 0; + blk_t dev_size; /* Update our PATH to include /sbin */ if (oldpath) { @@ -762,15 +767,27 @@ static void PRS(int argc, char *argv[]) param.s_log_frag_size = param.s_log_block_size; + retval = ext2fs_get_device_size(device_name, + EXT2_BLOCK_SIZE(¶m), + &dev_size); + if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) { + com_err(program_name, retval, + "while trying to determine filesystem size"); + exit(1); + } if (!param.s_blocks_count) { - retval = ext2fs_get_device_size(device_name, - EXT2_BLOCK_SIZE(¶m), - ¶m.s_blocks_count); - if (retval) { - com_err(program_name, retval, - "while trying to determine filesystem size"); + if (retval == EXT2_ET_UNIMPLEMENTED) { + com_err(program_name, 0, + "Couldn't determine device size; you " + "must specify\nthe size of the " + "filesystem\n"); exit(1); - } + } else + param.s_blocks_count = dev_size; + } else if (!force && (param.s_blocks_count > dev_size)) { + com_err(program_name, 0, + "Filesystem larger than apparent filesystem size."); + proceed_question(); } if (param.s_blocks_per_group) { diff --git a/misc/mklost+found.8.in b/misc/mklost+found.8.in index bb192ec1..3c6b3b4d 100644 --- a/misc/mklost+found.8.in +++ b/misc/mklost+found.8.in @@ -26,8 +26,8 @@ of the ext2 fs. There are none :-) .SH AVAILABILITY .B mklost+found -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. +is part of the e2fsprogs package and is available for anonymous +ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs. .SH SEE ALSO .BR e2fsck (8), .BR mke2fs (8) diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in index 96139e06..7afba254 100644 --- a/misc/tune2fs.8.in +++ b/misc/tune2fs.8.in @@ -117,7 +117,12 @@ can be a numerical uid or a user name. set the number of times the filesystem has been mounted. .TP .I -L volume-label -set the volume label of the filesystem. +set the volume label of the filesystem. +Ext2 filesystem labels can be at most 16 characters long; if +.I volume-label +is longer than 16 characters, +.B tune2fs +will truncate it and print a warning message. .TP .I -M last-mounted-directory set the last-mounted directory for the filesystem. @@ -146,8 +151,8 @@ This manual page was written by Christian Kuhtz <chk@data-hh.Hanse.DE>. Timedependent checking was added by Uwe Ohse <uwe@tirka.gun.de>. .SH AVAILABILITY .B tune2fs -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. +is part of the e2fsprogs package and is available for anonymous +ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs. .SH SEE ALSO .BR dumpe2fs (8), .BR e2fsck (8), diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 4ecaa619..a82ed5ca 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -415,6 +415,9 @@ int main (int argc, char ** argv) "Recompile with a newer kernel"); #endif if (L_flag) { + if (strlen(new_label) > sizeof(sb->s_volume_name)) + fprintf(stderr, "Warning: label too " + "long, truncating.\n"); memset(sb->s_volume_name, 0, sizeof(sb->s_volume_name)); strncpy(sb->s_volume_name, new_label, sizeof(sb->s_volume_name)); |