diff options
author | Karel Zak | 2006-12-07 00:25:53 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:53 +0100 |
commit | ffc4374869b9ac10539a3c18e13b29d1b0c64484 (patch) | |
tree | 1b8054e83f7f70e8fa77499fc9246d1cc16faa15 /disk-utils | |
parent | Imported from util-linux-2.11n tarball. (diff) | |
download | kernel-qcow2-util-linux-ffc4374869b9ac10539a3c18e13b29d1b0c64484.tar.gz kernel-qcow2-util-linux-ffc4374869b9ac10539a3c18e13b29d1b0c64484.tar.xz kernel-qcow2-util-linux-ffc4374869b9ac10539a3c18e13b29d1b0c64484.zip |
Imported from util-linux-2.11o tarball.
Diffstat (limited to 'disk-utils')
-rw-r--r-- | disk-utils/Makefile | 4 | ||||
-rw-r--r-- | disk-utils/README.bootutils-0.1 | 104 | ||||
-rw-r--r-- | disk-utils/blockdev.c | 1 | ||||
-rw-r--r-- | disk-utils/elvtune.c | 2 | ||||
-rw-r--r-- | disk-utils/isosize.c | 2 | ||||
-rw-r--r-- | disk-utils/mkfs.bfs.c | 2 | ||||
-rw-r--r-- | disk-utils/mkfs.c | 2 | ||||
-rw-r--r-- | disk-utils/mkfs.minix.c | 2 | ||||
-rw-r--r-- | disk-utils/raw.c | 18 |
9 files changed, 19 insertions, 118 deletions
diff --git a/disk-utils/Makefile b/disk-utils/Makefile index af15ee410..044a97e69 100644 --- a/disk-utils/Makefile +++ b/disk-utils/Makefile @@ -25,9 +25,7 @@ USRBIN:=$(USRBIN) setfdprm MAN8:=$(MAN8) setfdprm.8 endif -# raw.c does not compile on 2.2.*. -# find out later where it does and add tests to config -ifeq "$(ADD_RAW)" "yes" +ifeq "$(HAVE_RAW_H)" "yes" USRBIN:=$(USRBIN) raw MAN8:=$(MAN8) raw.8 endif diff --git a/disk-utils/README.bootutils-0.1 b/disk-utils/README.bootutils-0.1 deleted file mode 100644 index d87437e89..000000000 --- a/disk-utils/README.bootutils-0.1 +++ /dev/null @@ -1,104 +0,0 @@ -bootutils-0.1 - -* ALPHA RELEASE: Use at your own risk! * - -* You MUST have 0.99pl10 or later kernel to make use of all of the - facilities of this package. If you can live without the unmount-root - feature, then 0.99pl9 will work. * - -This is the first release of a set of utilities designed to automate -the management and checking of filesystems at boot time and shutdown. -It supports automatic and safe 'fsck' of all filesystems (including -root) at boot time by booting with root readonly; if the fsck succeeds -then root is remounted read-write and booting can continue. - -Why bother? - -Well, many people like to have a safe and reliable check of all their -filesystems during boot. This is especially true for ext2fs, because -all ext2fs filesystems have a special 'clean' flag which gets set when -the filesystem is cleaned (by e2fsck) or is unmounted cleanly, and -which gets unset when the filesystem is active. e2fsck can sense this -flag, and will skip over filesystems which are clean. - -This means that e2fsck won't bother you with a laborious filesystem -check at each startup, as long as you always shut down cleanly; but it -will check your filesystems automatically if you ever have a crash, -because afterwards the filesystem 'clean' flags will not be set. You -*can* still mount an unclean filesystem, but ext2fs will give you a -warning and will not mark it clean when it gets unmounted. - -One of the problems with automatic fsck'ing is that it is unsafe to -check mounted, active filesystems. The solution is to initially mount -only the root filesystem, and to mount it in readonly mode. In this -situation, fsck can run safely on all filesystems, without the danger -that the kernel might start conflicting with the repairs being done to -the filesystem. - -If any repairs were done, it is unsafe to proceed any further because -the kernel might have cached old information about the filesystems -which has been updated by fsck. However, if the fsck succeeded, then -we can remount the root filesystem in read-write mode and proceed to -mount all of the other filesystems. - -Finally, in order to ensure that filesystems are correctly tidied up -on shutdown, we need to unmount the root at shutdown. This is usually -done automatically; the standard Linux shutdown programs do a 'umount -- -a' command to unmount all mounted filesystems. You MUST have a -0.99pl10 or later kernel for this to work. Many versions of umount -explicitly do not try to unmount the root, since pre-99pl10 kernels -forbade this. The umount included here will unmount even the root -filesystem. (A special kernel trick in pl10 allows this to work by -keeping the filesystem alive in readonly mode after it has been tidied -up.) - -The bootup operation of this package is invoked by the /etc/rc shell -script, an example of which is in mount/etc/rc. It contains the -following important lines: - - # Check the integrity of all filesystems - /bin/fsck -A -a - # If there was a failure, drop into single-user mode. - if [ $? -gt 1 ] ; then - echo fsck failed. Please reboot. - sh - fi - - # Remount the root filesystem in read-write mode - /etc/mount -n -o remount /dev/hda3 / - - # remove /etc/mtab* so that mount will create it with a root entry - /bin/rm -f /etc/mtab* /etc/nologin /etc/utmp - - # mount file systems in fstab (and create an entry for /) - # but not NFS because TCP/IP is not yet configured - /etc/mount -avt nonfs - - -This is the first attempt at a complete package for automated clean -fsck support, so you may well find that you would like a slightly -different behaviour. Please feel free to send me comments, bug -reports and improvements! - - -This package includes three separate items, shamelessly adapted from -other, more or less standard Linux programs. - -* rdev.c: a modified rdev which is extended to allow the - readonly/readwrite status of the kernel image to be altered. Use - rdev -R <kernel> 1 - to make the kernel mount in readonly mode. This can be overridden - by the use of the 'read-only' or 'read-write' keywords of the most - recent version of LILO. - -* Mount/umount package: This was recently posted to the net, and - implements the '-o remount' mount option which allows filesystems to - be remounted. Unlike the previous post, the version included here - also attempts to unmount the root filesystem on 'umount -a'. I have - also tried to clean up the man-pages. - -* fsck package: David Engel's fsck front-end. Read the README for it. - This package implements the 'fsck -A' command which will check all - filesystems in /etc/fstab automatically. - -Stephen Tweedie <sct@dcs.ed.ac.uk> diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index 367eeb23b..b1422a823 100644 --- a/disk-utils/blockdev.c +++ b/disk-utils/blockdev.c @@ -5,7 +5,6 @@ #include <stdio.h> #include <fcntl.h> -#include <getopt.h> #include <stdlib.h> #include <string.h> #include <unistd.h> diff --git a/disk-utils/elvtune.c b/disk-utils/elvtune.c index 75ab57c0e..2c49b4440 100644 --- a/disk-utils/elvtune.c +++ b/disk-utils/elvtune.c @@ -69,7 +69,7 @@ main(int argc, char * argv[]) { int opt; opt = getopt(argc, argv, "r:w:b:hv"); - if (opt < 0) + if (opt == -1) break; switch (opt) { case 'r': diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c index bff45d923..005077a83 100644 --- a/disk-utils/isosize.c +++ b/disk-utils/isosize.c @@ -184,7 +184,7 @@ main(int argc, char * argv[]) { int opt; opt = getopt(argc, argv, "xd:"); - if (opt < 0) + if (opt == -1) break; switch (opt) { case 'd': diff --git a/disk-utils/mkfs.bfs.c b/disk-utils/mkfs.bfs.c index b27fd2eb6..47863bb1c 100644 --- a/disk-utils/mkfs.bfs.c +++ b/disk-utils/mkfs.bfs.c @@ -123,7 +123,7 @@ main(int argc, char *argv[]) { volume = fsname = " "; /* is there a default? */ inodes = 0; - while (EOF != (c = getopt(argc, argv, "vF:N:V:cl:"))) { + while ((c = getopt(argc, argv, "vF:N:V:cl:")) != -1) { switch (c) { case 'N': inodes = atol(optarg); diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c index 51b18f301..c5aa7566b 100644 --- a/disk-utils/mkfs.c +++ b/disk-utils/mkfs.c @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) /* Check commandline options. */ opterr = 0; - while ((more == 0) && ((i = getopt(argc, argv, "Vt:")) != EOF)) + while ((more == 0) && ((i = getopt(argc, argv, "Vt:")) != -1)) switch (i) { case 'V': verbose++; diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index 55d97e01e..b56b095f5 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -652,7 +652,7 @@ main(int argc, char ** argv) { die(_("bad inode size")); #endif opterr = 0; - while ((i = getopt(argc, argv, "ci:l:n:v")) != EOF) + while ((i = getopt(argc, argv, "ci:l:n:v")) != -1) switch (i) { case 'c': check=1; break; diff --git a/disk-utils/raw.c b/disk-utils/raw.c index 6e20fe262..d58c58ec3 100644 --- a/disk-utils/raw.c +++ b/disk-utils/raw.c @@ -29,6 +29,7 @@ #define RAWCTLDEV "/dev/rawctl" #define RAWDEVDIR "/dev/raw/" #endif +#define DEVFS_RAWCTLDEV "/dev/raw/rawctl" char * progname; @@ -69,7 +70,7 @@ int main(int argc, char *argv[]) progname = argv[0]; - while ((c = getopt(argc, argv, "ahq")) != EOF) { + while ((c = getopt(argc, argv, "ahq")) != -1) { switch (c) { case 'a': do_query_all = 1; @@ -173,12 +174,19 @@ int main(int argc, char *argv[]) void open_raw_ctl(void) { + int errsv; + master_fd = open(RAWCTLDEV, O_RDWR, 0); if (master_fd < 0) { - fprintf (stderr, - "Cannot open master raw device '" RAWCTLDEV "' (%s)\n", - strerror(errno)); - exit(2); + errsv = errno; + master_fd = open(DEVFS_RAWCTLDEV, O_RDWR, 0); + if (master_fd < 0) { + fprintf (stderr, + "Cannot open master raw device '" + RAWCTLDEV + "' (%s)\n", strerror(errsv)); + exit(2); + } } } |