e2label.c: Fix -Wall warning by making functions static.
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-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
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
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
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)
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
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)
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),
--- /dev/null
+.\" -*- 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)
+
/*
* 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>
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);
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");
}
}
-int
-main (int argc, char ** argv) {
+int main (int argc, char ** argv)
+{
if (argc == 2)
print_label(argv[1]);
else if (argc == 3)
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)
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),
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
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
}
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) {
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) {
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)
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.
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),
"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));