2000-02-09 01:28:47 +05:30
|
|
|
/* vi: set sw=4 ts=4: */
|
1999-10-05 21:54:54 +05:30
|
|
|
/*
|
1999-10-07 14:00:23 +05:30
|
|
|
* Mini mount implementation for busybox
|
|
|
|
*
|
1999-10-21 03:38:37 +05:30
|
|
|
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
|
2004-03-15 13:59:22 +05:30
|
|
|
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
2006-03-14 23:46:25 +05:30
|
|
|
* Copyright (C) 2005-2006 by Rob Landley <rob@landley.net>
|
1999-10-07 14:00:23 +05:30
|
|
|
*
|
2005-12-20 22:48:01 +05:30
|
|
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
2000-01-13 12:08:14 +05:30
|
|
|
*/
|
1999-10-05 21:54:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
/* todo:
|
|
|
|
* bb_getopt_ulflags();
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Design notes: There is no spec for this. Remind me to write one.
|
|
|
|
|
|
|
|
mount_main() calls singlemount() which calls mount_it_now().
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
mount_main() can loop through /etc/fstab for mount -a
|
|
|
|
singlemount() can loop through /etc/filesystems for fstype detection.
|
|
|
|
mount_it_now() does the actual mount.
|
|
|
|
*/
|
|
|
|
|
2001-05-03 02:47:38 +05:30
|
|
|
#include <limits.h>
|
1999-10-05 21:54:54 +05:30
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <mntent.h>
|
|
|
|
#include <ctype.h>
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <fcntl.h> // for CONFIG_FEATURE_MOUNT_LOOP
|
|
|
|
#include <sys/ioctl.h> // for CONFIG_FEATURE_MOUNT_LOOP
|
2001-04-25 22:40:30 +05:30
|
|
|
#include "busybox.h"
|
2000-07-09 00:25:24 +05:30
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
// These two aren't always defined in old headers
|
|
|
|
#ifndef MS_BIND
|
|
|
|
#define MS_BIND 4096
|
|
|
|
#endif
|
|
|
|
#ifndef MS_MOVE
|
|
|
|
#define MS_MOVE 8192
|
2000-01-13 12:08:14 +05:30
|
|
|
#endif
|
2006-03-14 23:46:25 +05:30
|
|
|
#ifndef MS_SILENT
|
|
|
|
#define MS_SILENT 32768
|
|
|
|
#endif
|
2000-01-13 12:08:14 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Not real flags, but we want to be able to check for this.
|
|
|
|
#define MOUNT_NOAUTO (1<<29)
|
|
|
|
#define MOUNT_SWAP (1<<30)
|
|
|
|
/* Standard mount options (from -o options or --options), with corresponding
|
|
|
|
* flags */
|
2000-07-09 00:50:49 +05:30
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
struct {
|
2000-02-09 01:28:47 +05:30
|
|
|
const char *name;
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
long flags;
|
2006-03-14 23:46:25 +05:30
|
|
|
} static const mount_options[] = {
|
|
|
|
// NOP flags.
|
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
{"loop", 0},
|
|
|
|
{"defaults", 0},
|
2006-03-14 23:46:25 +05:30
|
|
|
{"quiet", 0},
|
|
|
|
|
2006-03-20 23:37:50 +05:30
|
|
|
// vfs flags
|
2006-03-14 23:46:25 +05:30
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
{"ro", MS_RDONLY},
|
|
|
|
{"rw", ~MS_RDONLY},
|
|
|
|
{"nosuid", MS_NOSUID},
|
|
|
|
{"suid", ~MS_NOSUID},
|
|
|
|
{"dev", ~MS_NODEV},
|
|
|
|
{"nodev", MS_NODEV},
|
|
|
|
{"exec", ~MS_NOEXEC},
|
|
|
|
{"noexec", MS_NOEXEC},
|
|
|
|
{"sync", MS_SYNCHRONOUS},
|
|
|
|
{"async", ~MS_SYNCHRONOUS},
|
2006-01-10 08:07:20 +05:30
|
|
|
{"atime", ~MS_NOATIME},
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
{"noatime", MS_NOATIME},
|
2006-01-10 08:07:20 +05:30
|
|
|
{"diratime", ~MS_NODIRATIME},
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
{"nodiratime", MS_NODIRATIME},
|
2006-03-14 23:46:25 +05:30
|
|
|
{"loud", ~MS_SILENT},
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// action flags
|
|
|
|
|
|
|
|
{"remount", MS_REMOUNT},
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
{"bind", MS_BIND},
|
2006-03-14 23:46:25 +05:30
|
|
|
{"move", MS_MOVE},
|
|
|
|
{"noauto",MOUNT_NOAUTO},
|
|
|
|
{"swap",MOUNT_SWAP}
|
1999-10-05 21:54:54 +05:30
|
|
|
};
|
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
/* Append mount options to string */
|
|
|
|
static void append_mount_options(char **oldopts, char *newopts)
|
|
|
|
{
|
|
|
|
if(*oldopts && **oldopts) {
|
|
|
|
char *temp=bb_xasprintf("%s,%s",*oldopts,newopts);
|
|
|
|
free(*oldopts);
|
|
|
|
*oldopts=temp;
|
|
|
|
} else {
|
|
|
|
if (ENABLE_FEATURE_CLEAN_UP) free(*oldopts);
|
|
|
|
*oldopts = bb_xstrdup(newopts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Use the mount_options list to parse options into flags.
|
|
|
|
* Return list of unrecognized options in *strflags if strflags!=NULL */
|
|
|
|
static int parse_mount_options(char *options, char **unrecognized)
|
1999-10-05 21:54:54 +05:30
|
|
|
{
|
2006-03-14 23:46:25 +05:30
|
|
|
int flags = MS_SILENT;
|
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
// Loop through options
|
2006-03-14 23:46:25 +05:30
|
|
|
for (;;) {
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
int i;
|
2000-02-09 01:28:47 +05:30
|
|
|
char *comma = strchr(options, ',');
|
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (comma) *comma = 0;
|
2000-02-09 01:28:47 +05:30
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
// Find this option in mount_options
|
2006-03-14 23:46:25 +05:30
|
|
|
for (i = 0; i < (sizeof(mount_options) / sizeof(*mount_options)); i++) {
|
|
|
|
if (!strcasecmp(mount_options[i].name, options)) {
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
long fl = mount_options[i].flags;
|
2006-03-14 23:46:25 +05:30
|
|
|
if(fl < 0) flags &= fl;
|
|
|
|
else flags |= fl;
|
2000-02-09 01:28:47 +05:30
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-03-14 23:46:25 +05:30
|
|
|
// If unrecognized not NULL, append unrecognized mount options */
|
|
|
|
if (unrecognized
|
|
|
|
&& i == (sizeof(mount_options) / sizeof(*mount_options)))
|
2006-03-20 23:37:50 +05:30
|
|
|
{
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
// Add it to strflags, to pass on to kernel
|
2006-03-14 23:46:25 +05:30
|
|
|
i = *unrecognized ? strlen(*unrecognized) : 0;
|
|
|
|
*unrecognized = xrealloc(*unrecognized, i+strlen(options)+2);
|
2006-03-20 23:37:50 +05:30
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
// Comma separated if it's not the first one
|
2006-03-14 23:46:25 +05:30
|
|
|
if (i) (*unrecognized)[i++] = ',';
|
|
|
|
strcpy((*unrecognized)+i, options);
|
2000-02-09 01:28:47 +05:30
|
|
|
}
|
2006-03-20 23:37:50 +05:30
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
// Advance to next option, or finish
|
|
|
|
if(comma) {
|
2000-02-09 01:28:47 +05:30
|
|
|
*comma = ',';
|
|
|
|
options = ++comma;
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
} else break;
|
1999-10-08 22:44:14 +05:30
|
|
|
}
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
return flags;
|
1999-10-05 21:54:54 +05:30
|
|
|
}
|
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Return a list of all block device backed filesystems
|
2001-10-18 09:40:22 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
static llist_t *get_block_backed_filesystems(void)
|
2001-04-17 10:02:50 +05:30
|
|
|
{
|
2006-03-14 23:46:25 +05:30
|
|
|
char *fs, *buf,
|
|
|
|
*filesystems[] = {"/etc/filesystems", "/proc/filesystems", 0};
|
|
|
|
llist_t *list = 0;
|
|
|
|
int i;
|
|
|
|
FILE *f;
|
|
|
|
|
|
|
|
for(i = 0; filesystems[i]; i++) {
|
|
|
|
if(!(f = fopen(filesystems[i], "r"))) continue;
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
for(fs = buf = 0; (fs = buf = bb_get_chomped_line_from_file(f));
|
|
|
|
free(buf))
|
|
|
|
{
|
|
|
|
if(!strncmp(buf,"nodev",5) && isspace(buf[5])) continue;
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
while(isspace(*fs)) fs++;
|
|
|
|
if(*fs=='#' || *fs=='*') continue;
|
|
|
|
if(!*fs) continue;
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
list=llist_add_to_end(list,bb_xstrdup(fs));
|
|
|
|
}
|
|
|
|
if (ENABLE_FEATURE_CLEAN_UP) fclose(f);
|
|
|
|
}
|
2001-04-17 10:02:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
return list;
|
|
|
|
}
|
2002-08-23 00:11:20 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
llist_t *fslist = 0;
|
2001-04-17 10:02:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
#if ENABLE_FEATURE_CLEAN_UP
|
|
|
|
static void delete_block_backed_filesystems(void)
|
|
|
|
{
|
|
|
|
llist_free(fslist);
|
|
|
|
}
|
2006-03-29 20:00:49 +05:30
|
|
|
#else
|
|
|
|
void delete_block_backed_filesystems(void);
|
2006-03-14 23:46:25 +05:30
|
|
|
#endif
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
#if ENABLE_FEATURE_MTAB_SUPPORT
|
|
|
|
static int useMtab;
|
2006-03-20 23:37:13 +05:30
|
|
|
static int fakeIt;
|
2006-03-14 23:46:25 +05:30
|
|
|
#else
|
|
|
|
#define useMtab 0
|
2006-03-20 23:37:13 +05:30
|
|
|
#define fakeIt 0
|
2006-03-14 23:46:25 +05:30
|
|
|
#endif
|
|
|
|
|
|
|
|
// Perform actual mount of specific filesystem at specific location.
|
|
|
|
|
2006-03-29 20:00:49 +05:30
|
|
|
static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
|
2006-03-14 23:46:25 +05:30
|
|
|
{
|
|
|
|
int rc;
|
2006-03-18 08:28:11 +05:30
|
|
|
|
2006-03-20 23:37:13 +05:30
|
|
|
if (fakeIt) { return 0; }
|
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Mount, with fallback to read-only if necessary.
|
|
|
|
|
|
|
|
for(;;) {
|
|
|
|
rc = mount(mp->mnt_fsname, mp->mnt_dir, mp->mnt_type,
|
|
|
|
vfsflags, filteropts);
|
|
|
|
if(!rc || (vfsflags&MS_RDONLY) || (errno!=EACCES && errno!=EROFS))
|
2004-04-12 20:32:53 +05:30
|
|
|
break;
|
2006-03-14 23:46:25 +05:30
|
|
|
bb_error_msg("%s is write-protected, mounting read-only",
|
|
|
|
mp->mnt_fsname);
|
|
|
|
vfsflags |= MS_RDONLY;
|
2001-04-17 10:18:51 +05:30
|
|
|
}
|
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Abort entirely if permission denied.
|
2002-08-23 00:11:20 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (rc && errno == EPERM)
|
|
|
|
bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
/* If the mount was successful, and we're maintaining an old-style
|
|
|
|
* mtab file by hand, add the new entry to it now. */
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if(ENABLE_FEATURE_MTAB_SUPPORT && useMtab && !rc) {
|
|
|
|
FILE *mountTable = setmntent(bb_path_mtab_file, "a+");
|
|
|
|
int i;
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if(!mountTable)
|
|
|
|
bb_error_msg("No %s\n",bb_path_mtab_file);
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Add vfs string flags
|
|
|
|
|
|
|
|
for(i=0; mount_options[i].flags != MS_REMOUNT; i++)
|
|
|
|
if (mount_options[i].flags > 0)
|
|
|
|
append_mount_options(&(mp->mnt_opts),
|
|
|
|
// Shut up about the darn const. It's not important. I don't care.
|
|
|
|
(char *)mount_options[i].name);
|
|
|
|
|
|
|
|
// Remove trailing / (if any) from directory we mounted on
|
|
|
|
|
|
|
|
i = strlen(mp->mnt_dir);
|
|
|
|
if(i>1 && mp->mnt_dir[i-1] == '/') mp->mnt_dir[i-1] = 0;
|
|
|
|
|
|
|
|
// Write and close.
|
|
|
|
|
|
|
|
if(!mp->mnt_type || !*mp->mnt_type) mp->mnt_type="--bind";
|
|
|
|
addmntent(mountTable, mp);
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
endmntent(mountTable);
|
2006-03-14 23:46:25 +05:30
|
|
|
if (ENABLE_FEATURE_CLEAN_UP)
|
|
|
|
if(strcmp(mp->mnt_type,"--bind")) mp->mnt_type = 0;
|
2001-05-04 20:19:58 +05:30
|
|
|
}
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
return rc;
|
|
|
|
}
|
2001-05-03 02:47:38 +05:30
|
|
|
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Mount one directory. Handles NFS, loopback, autobind, and filesystem type
|
|
|
|
// detection. Returns 0 for success, nonzero for failure.
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
static int singlemount(struct mntent *mp)
|
|
|
|
{
|
2006-03-18 08:28:11 +05:30
|
|
|
int rc = 1, vfsflags;
|
2006-03-29 20:00:49 +05:30
|
|
|
char *loopFile = 0, *filteropts = 0;
|
2006-03-14 23:46:25 +05:30
|
|
|
llist_t *fl = 0;
|
|
|
|
struct stat st;
|
|
|
|
|
2006-03-29 20:00:49 +05:30
|
|
|
vfsflags = parse_mount_options(mp->mnt_opts, &filteropts);
|
2006-03-14 23:46:25 +05:30
|
|
|
|
2006-03-18 08:28:11 +05:30
|
|
|
// Treat fstype "auto" as unspecified.
|
|
|
|
|
|
|
|
if (mp->mnt_type && !strcmp(mp->mnt_type,"auto")) mp->mnt_type = 0;
|
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Might this be an NFS filesystem?
|
|
|
|
|
|
|
|
if (ENABLE_FEATURE_MOUNT_NFS &&
|
|
|
|
(!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) &&
|
|
|
|
strchr(mp->mnt_fsname, ':') != NULL)
|
|
|
|
{
|
2006-03-29 20:00:49 +05:30
|
|
|
if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &filteropts, 1)) {
|
2006-03-14 23:46:25 +05:30
|
|
|
bb_perror_msg("nfsmount failed");
|
|
|
|
return 1;
|
2006-03-29 20:00:49 +05:30
|
|
|
} else {
|
|
|
|
// Strangely enough, nfsmount() doesn't actually mount() anything.
|
|
|
|
rc = mount_it_now(mp, vfsflags, filteropts);
|
|
|
|
if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
|
|
|
|
|
|
|
|
return rc;
|
2006-03-14 23:46:25 +05:30
|
|
|
}
|
|
|
|
}
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Look at the file. (Not found isn't a failure for remount.)
|
|
|
|
|
|
|
|
if (lstat(mp->mnt_fsname, &st));
|
|
|
|
|
2006-03-20 23:37:50 +05:30
|
|
|
if (!(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))) {
|
2006-03-14 23:46:25 +05:30
|
|
|
// Do we need to allocate a loopback device for it?
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (ENABLE_FEATURE_MOUNT_LOOP && S_ISREG(st.st_mode)) {
|
2006-03-18 08:28:11 +05:30
|
|
|
loopFile = bb_simplify_path(mp->mnt_fsname);
|
2006-03-14 23:46:25 +05:30
|
|
|
mp->mnt_fsname = 0;
|
|
|
|
switch(set_loop(&(mp->mnt_fsname), loopFile, 0)) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bb_error_msg( errno == EPERM || errno == EACCES
|
|
|
|
? bb_msg_perm_denied_are_you_root
|
|
|
|
: "Couldn't setup loop device");
|
|
|
|
return errno;
|
|
|
|
}
|
2006-03-18 08:28:11 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Autodetect bind mounts
|
2001-08-10 20:35:27 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
} else if (S_ISDIR(st.st_mode) && !mp->mnt_type) vfsflags |= MS_BIND;
|
|
|
|
}
|
1999-10-05 21:54:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
/* If we know the fstype (or don't need to), jump straight
|
|
|
|
* to the actual mount. */
|
2000-03-07 13:11:42 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (mp->mnt_type || (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)))
|
2006-03-29 20:00:49 +05:30
|
|
|
rc = mount_it_now(mp, vfsflags, filteropts);
|
2006-01-25 05:38:53 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Loop through filesystem types until mount succeeds or we run out
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-18 08:28:11 +05:30
|
|
|
else {
|
|
|
|
|
|
|
|
/* Initialize list of block backed filesystems. This has to be
|
|
|
|
* done here so that during "mount -a", mounts after /proc shows up
|
|
|
|
* can autodetect. */
|
|
|
|
|
|
|
|
if (!fslist) {
|
|
|
|
fslist = get_block_backed_filesystems();
|
|
|
|
if (ENABLE_FEATURE_CLEAN_UP && fslist)
|
|
|
|
atexit(delete_block_backed_filesystems);
|
|
|
|
}
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-18 08:28:11 +05:30
|
|
|
for (fl = fslist; fl; fl = fl->link) {
|
|
|
|
mp->mnt_type = fl->data;
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-29 20:00:49 +05:30
|
|
|
if (!(rc = mount_it_now(mp,vfsflags, filteropts))) break;
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-18 08:28:11 +05:30
|
|
|
mp->mnt_type = 0;
|
|
|
|
}
|
2006-03-14 23:46:25 +05:30
|
|
|
}
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-29 20:00:49 +05:30
|
|
|
if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
|
|
|
|
|
|
|
|
// If mount failed, clean up loop file (if any).
|
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (rc && loopFile) {
|
|
|
|
del_loop(mp->mnt_fsname);
|
2006-03-29 20:00:49 +05:30
|
|
|
if (ENABLE_FEATURE_CLEAN_UP) {
|
2006-03-18 08:28:11 +05:30
|
|
|
free(loopFile);
|
|
|
|
free(mp->mnt_fsname);
|
|
|
|
}
|
2006-03-14 23:46:25 +05:30
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Parse options, if necessary parse fstab/mtab, and call singlemount for
|
|
|
|
// each directory to be mounted.
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
int mount_main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
char *cmdopts = bb_xstrdup(""), *fstabname, *fstype=0, *storage_path=0;
|
|
|
|
FILE *fstab;
|
|
|
|
int i, opt, all = FALSE, rc = 1;
|
|
|
|
struct mntent mtpair[2], *mtcur = mtpair;
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
/* parse long options, like --bind and --move. Note that -o option
|
|
|
|
* and --option are synonymous. Yes, this means --remount,rw works. */
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
for (i = opt = 0; i < argc; i++) {
|
|
|
|
if (argv[i][0] == '-' && argv[i][1] == '-') {
|
2006-03-20 23:37:50 +05:30
|
|
|
append_mount_options(&cmdopts,argv[i]+2);
|
2006-03-14 23:46:25 +05:30
|
|
|
} else argv[opt++] = argv[i];
|
|
|
|
}
|
|
|
|
argc = opt;
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Parse remaining options
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
while ((opt = getopt(argc, argv, "o:t:rwavnf")) > 0) {
|
|
|
|
switch (opt) {
|
|
|
|
case 'o':
|
|
|
|
append_mount_options(&cmdopts, optarg);
|
|
|
|
break;
|
|
|
|
case 't':
|
|
|
|
fstype = optarg;
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
append_mount_options(&cmdopts, "ro");
|
|
|
|
break;
|
|
|
|
case 'w':
|
|
|
|
append_mount_options(&cmdopts, "rw");
|
|
|
|
break;
|
|
|
|
case 'a':
|
|
|
|
all = TRUE;
|
|
|
|
break;
|
|
|
|
case 'n':
|
|
|
|
USE_FEATURE_MTAB_SUPPORT(useMtab = FALSE;)
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
USE_FEATURE_MTAB_SUPPORT(fakeIt = FALSE;)
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
break; // ignore -v
|
|
|
|
default:
|
|
|
|
bb_show_usage();
|
|
|
|
}
|
|
|
|
}
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Three or more non-option arguments? Die with a usage message.
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (optind-argc>2) bb_show_usage();
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// If we have no arguments, show currently mounted filesystems
|
|
|
|
|
|
|
|
if (optind == argc) {
|
|
|
|
if (!all) {
|
|
|
|
FILE *mountTable = setmntent(bb_path_mtab_file, "r");
|
2006-01-25 05:38:53 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if(!mountTable) bb_error_msg_and_die("No %s",bb_path_mtab_file);
|
2002-08-23 00:11:20 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
while (getmntent_r(mountTable,mtpair,bb_common_bufsiz1,
|
|
|
|
sizeof(bb_common_bufsiz1)))
|
2003-02-28 11:59:27 +05:30
|
|
|
{
|
2006-03-14 23:46:25 +05:30
|
|
|
// Don't show rootfs.
|
|
|
|
if (!strcmp(mtpair->mnt_fsname, "rootfs")) continue;
|
|
|
|
|
|
|
|
if (!fstype || !strcmp(mtpair->mnt_type, fstype))
|
|
|
|
printf("%s on %s type %s (%s)\n", mtpair->mnt_fsname,
|
|
|
|
mtpair->mnt_dir, mtpair->mnt_type,
|
|
|
|
mtpair->mnt_opts);
|
2000-08-03 00:18:26 +05:30
|
|
|
}
|
2006-03-14 23:46:25 +05:30
|
|
|
if (ENABLE_FEATURE_CLEAN_UP) endmntent(mountTable);
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
2002-08-23 00:11:20 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// When we have two arguments, the second is the directory and we can
|
|
|
|
// skip looking at fstab entirely. We can always abspath() the directory
|
|
|
|
// argument when we get it.
|
|
|
|
|
|
|
|
if (optind+2 == argc) {
|
|
|
|
mtpair->mnt_fsname = argv[optind];
|
|
|
|
mtpair->mnt_dir = argv[optind+1];
|
|
|
|
mtpair->mnt_type = fstype;
|
|
|
|
mtpair->mnt_opts = cmdopts;
|
|
|
|
rc = singlemount(mtpair);
|
|
|
|
goto clean_up;
|
|
|
|
}
|
2002-08-23 00:11:20 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// If we have at least one argument, it's the storage location
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (optind < argc) storage_path = bb_simplify_path(argv[optind]);
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Open either fstab or mtab
|
|
|
|
|
|
|
|
if (parse_mount_options(cmdopts,0) & MS_REMOUNT)
|
|
|
|
fstabname = (char *)bb_path_mtab_file; // Again with the evil const.
|
|
|
|
else fstabname="/etc/fstab";
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (!(fstab=setmntent(fstabname,"r")))
|
|
|
|
bb_perror_msg_and_die("Cannot read %s",fstabname);
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Loop through entries until we find what we're looking for.
|
|
|
|
|
|
|
|
memset(mtpair,0,sizeof(mtpair));
|
|
|
|
for (;;) {
|
|
|
|
struct mntent *mtnext = mtpair + (mtcur==mtpair ? 1 : 0);
|
2006-01-25 05:38:53 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Get next fstab entry
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (!getmntent_r(fstab, mtcur, bb_common_bufsiz1,
|
|
|
|
sizeof(bb_common_bufsiz1)))
|
|
|
|
{
|
|
|
|
// Were we looking for something specific?
|
|
|
|
|
|
|
|
if (optind != argc) {
|
|
|
|
|
|
|
|
// If we didn't find anything, complain.
|
|
|
|
|
|
|
|
if (!mtnext->mnt_fsname)
|
|
|
|
bb_error_msg_and_die("Can't find %s in %s",
|
|
|
|
argv[optind], fstabname);
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Mount the last thing we found.
|
|
|
|
|
|
|
|
mtcur = mtnext;
|
|
|
|
mtcur->mnt_opts=bb_xstrdup(mtcur->mnt_opts);
|
|
|
|
append_mount_options(&(mtcur->mnt_opts),cmdopts);
|
|
|
|
rc = singlemount(mtcur);
|
|
|
|
free(mtcur->mnt_opts);
|
2000-09-19 06:51:13 +05:30
|
|
|
}
|
2006-03-14 23:46:25 +05:30
|
|
|
break;
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
}
|
2006-03-18 08:28:11 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
/* If we're trying to mount something specific and this isn't it,
|
|
|
|
* skip it. Note we must match both the exact text in fstab (ala
|
|
|
|
* "proc") or a full path from root */
|
|
|
|
|
|
|
|
if (optind != argc) {
|
|
|
|
|
|
|
|
// Is this what we're looking for?
|
|
|
|
|
|
|
|
if(strcmp(argv[optind],mtcur->mnt_fsname) &&
|
|
|
|
strcmp(storage_path,mtcur->mnt_fsname) &&
|
|
|
|
strcmp(argv[optind],mtcur->mnt_dir) &&
|
|
|
|
strcmp(storage_path,mtcur->mnt_dir)) continue;
|
|
|
|
|
|
|
|
// Remember this entry. Something later may have overmounted
|
|
|
|
// it, and we want the _last_ match.
|
|
|
|
|
|
|
|
mtcur = mtnext;
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// If we're mounting all.
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
|
|
|
} else {
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Do we need to match a filesystem type?
|
|
|
|
if (fstype && strcmp(mtcur->mnt_type,fstype)) continue;
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
// Skip noauto and swap anyway.
|
|
|
|
|
|
|
|
if (parse_mount_options(mtcur->mnt_opts,0)
|
|
|
|
& (MOUNT_NOAUTO | MOUNT_SWAP)) continue;
|
|
|
|
|
|
|
|
// Mount this thing.
|
|
|
|
|
|
|
|
rc = singlemount(mtcur);
|
|
|
|
if (rc) {
|
|
|
|
// Don't whine about already mounted fs when mounting all.
|
|
|
|
if (errno == EBUSY) rc = 0;
|
|
|
|
else break;
|
2002-08-23 11:47:46 +05:30
|
|
|
}
|
2000-02-09 01:28:47 +05:30
|
|
|
}
|
1999-10-05 21:54:54 +05:30
|
|
|
}
|
2006-03-14 23:46:25 +05:30
|
|
|
if (ENABLE_FEATURE_CLEAN_UP) endmntent(fstab);
|
|
|
|
|
|
|
|
clean_up:
|
2002-08-23 00:11:20 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if (ENABLE_FEATURE_CLEAN_UP) {
|
|
|
|
free(storage_path);
|
|
|
|
free(cmdopts);
|
2005-12-20 22:48:01 +05:30
|
|
|
}
|
2006-03-20 23:37:50 +05:30
|
|
|
|
2006-03-14 23:46:25 +05:30
|
|
|
if(rc)
|
|
|
|
bb_perror_msg("Mounting %s on %s failed",
|
|
|
|
mtcur->mnt_fsname, mtcur->mnt_dir);
|
Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on). Probably broke several
other things, but it's fixable. (Bang on it, tell me what doesn't work for
you...)
Note: you no longer need to say "-o loop". It does that for you when
necessary.
Still need to add "user mount" support, which involves making mount suid. Not
too hard to do under the new infrastructure, just haven't done it yet...
The previous code had the following notes, that belong in the version
control comments:
- * 3/21/1999 Charles P. Wright <cpwright@cpwright.com>
- * searches through fstab when -a is passed
- * will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17 Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07 Erik Andersen <andersen@codepoet.org>.
- * Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
- * dieting all around.
- *
- * 1999-11-06 mtab support is back - andersee
- *
- * 2000-01-12 Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- * mount to add loop support.
- *
- * 2000-04-30 Dave Cinege <dcinege@psychosis.com>
- * Rewrote fstab while loop and lower mount section. Can now do
- * single mounts from fstab. Can override fstab options for single
- * mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-11 02:05:54 +05:30
|
|
|
|
2005-08-15 00:16:34 +05:30
|
|
|
return rc;
|
1999-10-05 21:54:54 +05:30
|
|
|
}
|