Commit Graph

322 Commits

Author SHA1 Message Date
Rob Landley
6e98521d68 Stephane Billiart noticed that the return code of the new mount was horked.
(Cleaned up the return code path to consistently use numbers so I don't keep
confusing EXIT_SUCCESS with TRUE and EXIT_FAILURE with FALSE...)
2005-08-14 18:46:34 +00:00
Rob Landley
6a6798b8e4 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-10 20:35:54 +00:00
Eric Andersen
93d7fba892 Tito, farmatito at tiscali dot it writes:
Hi to all,
This patch is useful for:
1) remove an unused var from extern char *find_real_root_device_name(const char* name)
    changing it to extern char *find_real_root_device_name(void).
2) fixes include/libbb.h, coreutils/df.c, util-linux/mount.c and  util-linux/umount.c accordingly.
3) fixes a bug, really a false positive,  in find_real_root_device_name() that happens if
    in the /dev directory exists a link named root (/dev/root) that should be skipped but
    is not. This affects applets like df that display wrong results
2004-08-03 00:14:02 +00:00
Eric Andersen
86af052d25 Kevin P. Fleming writes:
Yes, I know busybox is in feature freeze. If this two-liner is too much
that's fine, but it's handy.

This patch allows busybox mount to support "-o move" just like it
supports "-o bind", which is the equivalent of util-linux "mount --move".

Usage is:

mount -o move /mnt/point/1 /mnt/point/2

where /mnt/point/1 is an already mounted filesystem; it will be moved to
/mnt/point/2.
2004-05-26 21:26:07 +00:00
Eric Andersen
aff114c33d Larry Doolittle writes:
This is a bulk spelling fix patch against busybox-1.00-pre10.
If anyone gets a corrupted copy (and cares), let me know and
I will make alternate arrangements.

Erik - please apply.

Authors - please check that I didn't corrupt any meaning.

Package importers - see if any of these changes should be
passed to the upstream authors.

I glossed over lots of sloppy capitalizations, missing apostrophes,
mixed American/British spellings, and German-style compound words.

What is "pretect redefined for test" in cmdedit.c?

Good luck on the 1.00 release!

      - Larry
2004-04-14 17:51:38 +00:00
Eric Andersen
ee4b7d496d make mount ignore -n when CONFIG_FEATURE_MTAB_SUPPORT is disabled 2004-04-12 15:02:53 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Eric Andersen
c1893c5801 Doh! I broke automatic filesystem type guessing. Fix mount so
it will properly fall back to /proc/mounts when /etc/filesystems
is missing, allowing mount to guess the correct fs type when a
fs type is not explicitly specified.
 -Erik
2003-12-12 07:01:14 +00:00
Eric Andersen
d5c746f3a8 Fix indenting.
Fix a bug noticed by Pete Flugstad.  Make certain we close what we open, and
don't try to close invalid files when /etc/filesystems exists and is used.
2003-12-09 23:50:24 +00:00
Eric Andersen
d9fe958921 Error out early if people try to build mount with nfs support
using uClibc, but have not enabled UCLIBC_HAS_RPC...
 -Erik
2003-07-22 08:25:37 +00:00
Eric Andersen
cb81e6484d Update a bunch of docs. Run a script to update my email addr. 2003-07-14 21:21:08 +00:00
Eric Andersen
9d7f0f0fe8 Somewhere in the 2.4.x kernel series, /proc/mounts was changed to display a
"rootfs" entry as well as the traditional "/dev/root" entry.  This caused
applets such as mount and df to display two root filesystem entries....

This teaches the relevant utilities to ignore the "rootfs" entry.
 -Erik
2003-06-20 09:36:49 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Eric Andersen
5ef448285b There is no good reason to prevent nfs mounts from being mounted
during 'mount -a'.  If the user wants to do that, hey, its their
lifs.  If the nfs server is down and they don't want to wait for
nfs to time out, that is their problem.
 -Erik
2003-02-28 06:29:27 +00:00
Eric Andersen
deca106b6d Kill CONFIG_FEATURE_USE_DEVPS_PATCH and the devps patch. I'm not
maintaining it anymore, and it is now terribly out of date.
 -Erik
2002-12-05 07:24:08 +00:00
Glenn L McGrath
8042f65398 Run through indent, style 2002-08-23 06:17:46 +00:00
Glenn L McGrath
9fef17dec3 Run through indent, fix comments 2002-08-22 18:41:20 +00:00
Robert Griebl
d0dd3d31e2 Fix for bug #1255 -- support for mount -t <type> 2002-07-25 14:17:19 +00:00
Robert Griebl
2a4a8d8ffb Add support for /etc/filesystem when searching for an "auto" filesystem
This is bug #1246
2002-07-24 01:41:30 +00:00
Eric Andersen
3ece93ba0f Kill dead email address
-Erik
2002-06-22 17:23:45 +00:00
Eric Andersen
8b1aa4d749 Apply last_patch46 from vodz, to fix buffer overflows noted by
Gerardo Puga, and to optimize for size a little bit.  Thanks vodz
2002-06-22 17:20:50 +00:00
Robert Griebl
aa385d4015 Entries with "noauto" options are ignored correctly when mounting all
("mount -a"), but mount fails when these entries are specified explicitly
In these cases the "noauto" option has to be simply ignored.
2002-05-14 22:56:29 +00:00
Eric Andersen
defd998c42 Patch from Kevin Hilman <khilman@equator.com> to fix potential
memory corruption from long pathnames in /etc/fstab.
2002-04-13 13:47:39 +00:00
Eric Andersen
1d1d2f9b18 Update some missing copyright notices 2002-04-13 08:31:59 +00:00
Eric Andersen
fcffa2cc1a Apply lash_patch35 from vodz, which brings several nice size_optimizations. 2002-04-06 05:17:57 +00:00
Matt Kraai
1f0c43668a Remove == TRUE' tests and convert != TRUE' and `== FALSE' tests to use !. 2001-12-20 23:13:26 +00:00
Eric Andersen
6834ee941a Avoid NULL pointer problems. Patch from "Frank P. MacLachlan"
<fpm-plutus@tgs.indyme.com>
2001-12-06 21:33:55 +00:00
Matt Kraai
c8227639db Change strdup calls to xstrdup (patch from Steve Merrifield). 2001-11-12 16:57:27 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Eric Andersen
8acbf1d307 Make mount default to using /proc/filesystems to avoid
ever trying to mount a nodev filesystem.
 -Erik
2001-10-18 04:10:22 +00:00
Eric Andersen
3b1525e444 Don't automount things as "usbdevfs" -- patch from
Ethan Benson <erbenson@alaska.net>
2001-09-03 16:49:25 +00:00
Matt Kraai
a7cecbc917 Commit Vladimir's simplify_path. 2001-08-10 15:05:27 +00:00
Eric Andersen
044228d5ec This is vodz' latest patch. Sorry it took so long...
1) ping cleanup (compile fix from this patch already applied).
    2) traceroute call not spare ntohl() now (and reduce size);
    3) Fix for functions not declared static in insmod, ash, vi and mount.
    4) a more simple API cmdedit :))
    5) adds "stopped jobs" warning to ash on Ctrl-D and fixes "ignoreeof" option
    6) reduce exporting library function index->strchr (traceroute), bzero->memset (syslogd)
2001-07-17 01:12:36 +00:00
Matt Kraai
94f3a570e1 Fix a thinko (the symptoms of which were reported by
David Douthitt in bug #1111).
2001-07-05 14:46:07 +00:00
Matt Kraai
9344f7575e Don't whine about already mounted filesystems when invoked with -a. 2001-06-03 02:21:38 +00:00
Eric Andersen
2f6e1f880b Patch from Gernot Poerner <gp@it-netservice.de>. Adds in
mount bind support.
2001-05-21 15:59:34 +00:00
Eric Andersen
c911a4389b Patch from Vladimir:
1) fixed a bug that could crash df, mount, and umount applets if the root
    device name was longer then the word "root" (/dev/loop1 vs /dev/root) -
    2) severl functions needed static declaration in the umount applet
    3) update declaration for function in last_char_is() in libbb
2001-05-15 17:42:16 +00:00
Glenn L McGrath
cc0aa0f2d7 Actually we dont need to check if the device is nfs as it wont be stat'ed 2001-05-07 01:51:24 +00:00
Glenn L McGrath
1b62619446 woops, i shouldnt be so presumtuous? about what the error will be 2001-05-07 01:40:59 +00:00
Glenn L McGrath
3aae10014c Device may not be a real filename 2001-05-07 01:38:03 +00:00
Matt Kraai
e6bf66eada Fix two bugs reported by Ralph Jones. 2001-05-04 14:49:58 +00:00
Matt Kraai
3425111bb9 Fix bug #1108 by always canonicalizing arguments. 2001-05-02 21:17:38 +00:00
Mark Whitley
4b541a8817 Moved some #ifdefs down below #include "busybox.h" where they belong. 2001-04-25 17:10:30 +00:00
Matt Kraai
a3045dfd25 Convert mount to use getopt. 2001-04-17 04:48:51 +00:00
Matt Kraai
1240082e37 Further cleanup of mount option handling. 2001-04-17 04:32:50 +00:00
Matt Kraai
24ed3bee0c Fix -a support (broken by previous patch). 2001-04-17 04:26:05 +00:00
Matt Kraai
3d406da0c9 Fix segfault on `mount -t nfs' reported by Gratien D'haese. 2001-04-17 04:22:22 +00:00
Eric Andersen
e76c3b08e1 A number of cleanups. Now compiles with libc5, glibc, and uClibc. Fix a few
shadowed variables.  Move (almost) all syscalls to libbb/syscalls.c, so I can
handle them sanely and all at once.
 -Erik
2001-04-05 03:14:39 +00:00
Eric Andersen
c4cef5ab06 Move the mtab support stuff into libbb
-Erik
2001-04-01 16:01:11 +00:00
Glenn L McGrath
1e117b4752 Dont try and automount devfs, rename some variables 2001-03-30 01:28:13 +00:00
Mark Whitley
20f61d35de The patch I previously applied from Brian Webb was 2 lines off. Oops. 2001-03-14 17:30:44 +00:00
Mark Whitley
bd2e42f162 Applied a patch from Brian Webb to fix a problem with mount on the Agenda PDA.
Apparently, the mount() call does not like taking a stack allocated pointer.
2001-03-12 23:17:26 +00:00
Eric Andersen
3e6ff9017f A cleanup patch from Jeff Garzik to static-ify a number of
namespace polluting things that really should be static.
2001-03-09 21:24:12 +00:00
Glenn L McGrath
323434be42 Dont try to automount some specific filesystem types 2001-03-02 22:21:34 +00:00
Eric Andersen
de4406747b Bah. I missed a header file. 2001-03-01 07:55:49 +00:00
Eric Andersen
7b91f02021 Reduce the size of mount (and bypass /proc/filesystems) by using the sysfs
system call, based on work done by Glenn McGrath in December.
 -Erik
2001-03-01 07:50:04 +00:00
Matt Kraai
93ba60f01d Keep trying if an NFS mount fails, and eliminate a call to exit(3). 2001-02-28 15:33:12 +00:00
Mark Whitley
e677dfedd1 Applied patch from Magnus Damm <damm@opensource.se> to fix a 'inner scope var
masking outer scope var with same name' bug that was preventing the loopback
device from being unmounted if mount() fails.
2001-02-26 17:45:58 +00:00
Eric Andersen
cbe31dace5 It turns out that DODMALLOC was broken when I reorganized busybox.h
header file usage before the 0.49 release.  To fix it, I had to move
the '#include "busybox.h"' to the end of the list of #include files.
 -Erik
2001-02-20 06:14:08 +00:00
Eric Andersen
67991cf824 This patch, put together by Manuel Novoa III, is a merge of work
done by Evin Robertson (bug#1105) and work from Manuel to make
usage messages occupy less space and simplify how usage messages
are displayed.
2001-02-14 21:23:06 +00:00
Eric Andersen
af4ac77d9d Apply a patch from Larry Doolittle to add "-all" and "-none" switches
to multibuild.pl.  I did a little formatting adjustments to make it
_very_ obvious when things stop working.  I also removed the USE_PROCFS
config option -- just do the right thing when USE_DEVPS_PATCH is enabled.
 -Erik
2001-02-01 22:43:49 +00:00
Matt Kraai
dd19c69904 Removed trailing \n from error_msg{,_and_die} messages. 2001-01-31 19:00:21 +00:00
Mark Whitley
59ab025363 #define -> static const int. Also got rid of some big static buffers. 2001-01-23 22:30:04 +00:00
Eric Andersen
6f65a3a7e8 More printf cleanups 2001-01-20 01:10:07 +00:00
Matt Kraai
a9819b2908 Use busybox error handling functions wherever possible. 2000-12-22 01:48:07 +00:00
Matt Kraai
1fa1adea2a Change calls to error_msg.* and strerror to use perror_msg.*. 2000-12-18 03:57:16 +00:00
Eric Andersen
d9d03b83f8 Mount error return code fix from Kent Robotti -- we must reset the error
code when looping...
2000-12-12 23:20:37 +00:00
Mark Whitley
f57c944e09 Changed names of functions in utility.c and all affected files, to make
compliant with the style guide. Everybody rebuild your tags file!
2000-12-07 19:56:48 +00:00
Matt Kraai
92ed8a3519 Fix exit status on failure. 2000-12-06 15:55:23 +00:00
Matt Kraai
3e856ce428 Stop using TRUE and FALSE for exit status. 2000-12-01 02:55:13 +00:00
Eric Andersen
3570a34de4 Renamed "internal.h" to the more sensible "busybox.h".
-Erik
2000-09-25 21:45:58 +00:00
Eric Andersen
8847b9a03a Remove a warning. Patch from Bryan Rittmeyer <bryan@ixiacom.com> 2000-09-21 01:33:05 +00:00
Eric Andersen
0cccdfaf36 When mounting a ro fs rw, print warning and then mount it ro. Patch
from Dave Cinege.
 -Erik
2000-09-20 06:23:36 +00:00
Eric Andersen
252bacc9ea Apply a patch from Chip Rosenthal <chip@unicom.com> to fix NFS mounting,
which had been inadvertantly broken...
 -Erik
2000-09-19 01:21:13 +00:00
Matt Kraai
322ae93a5e Fix calls to {m,c,re}alloc so that they use x{m,c,re}alloc instead of
segfaulting or handling errors the same way themselves.
2000-09-13 02:46:14 +00:00
Pavel Roskin
32f2769800 From Ken Chalmers <chalmers@norscan.com>:
The current CVS mount.c is missing a semicolon, causing building to fail
if NFS is enabled (#define BB_NFSMOUNT).
2000-08-22 15:35:31 +00:00
Eric Andersen
0c8e2a6580 Fixed the "-f" option.
-Erik
2000-08-02 18:56:25 +00:00
Eric Andersen
fdd5103348 Merge in two patches from Dave Cinege:
the first is a cleanup of tar --exclude
    the second changes mount so mtab works more as it should, and
    also allows mount to use the traditional short form (i.e.
    'mount / -o remount,rw' now works.

While inside tar, I changed it to use getopt...
 -Erik
2000-08-02 18:48:26 +00:00
Eric Andersen
b040d4f3da Use BB_FEATURE_CLEAN_UP where appropriate
-Erik
2000-07-25 18:01:20 +00:00
Matt Kraai
bf181b9338 Extract usage information into a separate file. 2000-07-16 20:57:15 +00:00
Eric Andersen
e7413a9cde A couple of minor warning cleanups.
-Erik
2000-07-14 06:19:41 +00:00
Matt Kraai
d537a95fdb Use errorMsg rather than fprintf. 2000-07-14 01:51:25 +00:00
Matt Kraai
be84cd4ef6 Always report the applet name when doing error reporting. 2000-07-12 17:02:35 +00:00
Eric Andersen
c674d70699 Comment on kernel stuff
-Erik
2000-07-10 22:57:14 +00:00
Eric Andersen
a57ba4db64 Argh. More cross libc cleanup. Should be ok now...
-Erik
2000-07-08 19:20:49 +00:00
Eric Andersen
bd22ed8067 Update files to reduce dependance on kernel version...
-Erik
2000-07-08 18:55:24 +00:00
Eric Andersen
89bc256c94 Remove misguided klude around for 2.4.x-test* brokenness. Al Viro
will be removing this stuff from /proc/mounts real soon now I am assured.
 -Erik
2000-07-05 19:29:59 +00:00
Eric Andersen
10dc9d4d17 Updates to handle Linux 2.4.0 kernels (kludged around the "none" entries in
/proc/mounts, added a hack to make sysinfo work with both old and new kernels).
 -Erik
2000-06-26 10:45:52 +00:00
Eric Andersen
a42982e8f5 * Fixed 'swapon -a' and 'swapoff -a', which were broken.
* Fixed 'mount -a' so it works as expected.
* Implemented 'ls -R' (enabled by enabling BB_FEATURE_LS_RECURSIVE)
 -Erik
2000-06-07 17:28:53 +00:00
Pavel Roskin
680d65a646 "mount" now reports errors from nfsmount() and assumes NFS mount
if ':' is present in the device name - Pavel Roskin
2000-06-06 17:03:55 +00:00
Erik Andersen
7ab9c7ee52 Lots of updates. Finished implementing BB_FEATURE_TRIVIAL_HELP
which lets you compile out most of the "--help" output, saving
up to 17k.

Renamed mnc to nc.
 -Erik
2000-05-12 19:41:47 +00:00
Erik Andersen
6c5f2c6021 Add support for "noatime" and "nodiratime" mount flags to mount.
Change umount "-f" to mean force, and actually use umount2.
Change umount "-l" to mean "Do not free loop device".
Updates docs accordingly.
 -Erik
2000-05-05 19:49:33 +00:00
Erik Andersen
4f3f757d56 Latest and greatest. Some effort at libc5 (aiming towards newlib)
compatability.
 -Erik
2000-04-28 00:18:56 +00:00
Erik Andersen
9cf3bfa7c1 More doc updates for BusyBox, with fixes to apps for bugs revealed
while trying to write docs . :-)
 -Erik
2000-04-13 18:49:43 +00:00
Erik Andersen
983b51b17b minor changes to mount/umount to support-by-ignoring the "-v" flag.
Added optional core dumping as a feature for init, and include a rewrite
of syslogd so that it now supports multiple concurrent connections.
 -Erik
2000-04-04 18:14:25 +00:00
Erik Andersen
298854f029 My latest ramblings.
-Erik
2000-03-23 01:09:18 +00:00
Erik Andersen
ec5bd90916 Use the nice new find_real_root_device function to find the
name of the root device, instead of having libc read whatever
lies happen to be in /etc/mtab.
 -Erik
2000-03-22 07:12:05 +00:00
Erik Andersen
ce91732416 Some bug fixes I forgot to check-in the other day.
Mounting loop devices w/o specifying the filesystem
type choked if it didn't guess right the first time.
 -Erik
2000-03-13 04:07:02 +00:00
Erik Andersen
269bba2514 Change BB_FEATURE_USE_DEVPS_N_DEVMTAB to the simpler
BB_FEATURE_USE_DEVPS_PATCH.
 -Erik
2000-03-08 14:50:47 +00:00
Erik Andersen
246cc6dddd Wrote killall.
Adjusted mount, ps, utility.c, etc to handle my nifty new kernel
patches the allow busybox to run perfectly without /proc.
 -Erik
2000-03-07 07:41:42 +00:00
Erik Andersen
e132f4b09e Fixed the init problem where it wouldn't unmount filesystems
on reboot.  Also fixed swapoff -a so it works.
 -Erik
2000-02-09 04:16:43 +00:00
Erik Andersen
e49d5ecbbe Some formatting updates (ran the code through indent)
-Erik
2000-02-08 19:58:47 +00:00
Erik Andersen
04e97024e7 Clear up some ambiguity with old style assignments.
-Erik
2000-01-29 07:06:24 +00:00
Erik Andersen
de7965ca7e Shuffle location of generic code into utility.c
-Erik
2000-01-26 23:49:21 +00:00
Erik Andersen
5cbdd712f5 mount and umount could leak loop device allocations causing the system to
quickly run out.  Also disable init's SIGHUP handler during shutdown.
 -Erik
2000-01-26 20:06:48 +00:00
Erik Andersen
5509af7073 * added (and documented) "-n" option for head -
contributed Friedrich Vedder <fwv@myrtle.lahn.de>
* Cleanup for a number of usage messages -- also
    contributed Friedrich Vedder <fwv@myrtle.lahn.de>
 -Erik
2000-01-23 18:19:02 +00:00
Erik Andersen
3163821967 Sync up busybox with the latest and greatest. This is not stuff for
the Embedix release.
 -Erik
2000-01-15 22:28:50 +00:00
Erik Andersen
b7cc49d992 * Added -o loop option for mount, and support in umount for loop
devices. Support is toggled by MOUNT_LOOP feature -- Ben Collins
    <bcollins@debian.org>

 -Erik
2000-01-13 06:38:14 +00:00
Erik Andersen
0881de706e The latest and greatest. init basically works, though needs
a minor inittab design change to accomodate specifying the device
to run each process on.
 -Erik
2000-01-05 09:34:26 +00:00
Eric Andersen
0ecb54a0f3 Stuf 1999-12-05 23:24:55 +00:00
Eric Andersen
a9c95ea655 Updates 1999-11-15 17:33:30 +00:00
Eric Andersen
d73dc5b073 Updates to usage, and made tar work.
-Erik
1999-11-10 23:13:02 +00:00
Eric Andersen
29d2e362de Fixed ln, df, and removed redundant stuff from mtab. 1999-11-06 06:07:27 +00:00
Eric Andersen
d0246fb72b More stuff. 1999-11-04 21:18:07 +00:00
Eric Andersen
3ae0c78962 Stuf 1999-11-04 01:13:21 +00:00
Eric Andersen
c49960189a Fixed up copyright notices and such 1999-10-20 22:08:37 +00:00
Eric Andersen
e77ae3a2c0 Added sfdisk. Ststic-ified a bunch of stuff. 1999-10-19 20:03:34 +00:00
Eric Andersen
cb6e25655f More stuff 1999-10-16 15:48:40 +00:00
Eric Andersen
3c163822d8 Fixed cp -[aR] and some other stuf. 1999-10-14 22:16:57 +00:00
Eric Andersen
8341a15653 Finally mount works properly. Made debugging work (no more -s ld flag
when debugging is on).
1999-10-08 17:14:14 +00:00
Eric Andersen
596e5469d0 more stuff 1999-10-07 08:30:23 +00:00
Eric Andersen
cc8ed39b24 Initial revision 1999-10-05 16:24:54 +00:00