Commit Graph

205 Commits

Author SHA1 Message Date
Denis Vlasenko
6d655be5df removed a lot of trailing \n in bb_msg() calls. It is added
automatically by function itself.
2006-09-06 19:02:46 +00:00
Rob Landley
4cb035dd23 Vladimir Dronnikov (ybrnj80 at yandex dot ru) pointed out that my cleanup of
his code introduced a bug (an extra backslash in the CIFS mount string).
2006-09-05 14:00:21 +00:00
Rob Landley
4d609cb5a3 Thinko. 2006-09-04 19:43:26 +00:00
Rob Landley
89d9d4d5f7 Vladimir Dronnikov also submitted a CIFS support patch to mount, which I
heavily reworked here and probably broke.  Tomorrow I need to set up a
copy of samba to test against.  (This compiles, I make no promises beyond that.)
2006-09-01 08:10:44 +00:00
Rob Landley
3ba7bd143e Vladimir Dronnikov convinced me to twiddle the semantics of the new shared
subtree stuff to look more like http://lwn.net/Articles/159077/ thinks
they should.
2006-08-09 19:51:13 +00:00
Rob Landley
721b46e0e6 Fix a typo (|| instead of |) and remove two comments about a problem fixed
in the previous patch.
2006-08-08 12:54:02 +00:00
Rob Landley
e3781b7312 Add shared subtree support, suggested by Vladimir Dronnikov. Also break out a
few new (unfinished) config options, which I intend to make hidden (but
enabled) when CONFIG_NITPICK is disabled.  Getting the .config infrastructure
to do that is non-obvious, it seems...
2006-08-08 01:39:49 +00:00
Rob Landley
47b16a6fe9 Using lstat() instead of stat() means that attempting to loopback mount
a symlink doesn't work.
2006-08-08 00:47:17 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
Rob Landley
0cc2c2c289 Patch from Paul Fox to improve mount's error handling behavior, which I beat
on a bit.
2006-06-21 03:53:33 +00:00
Rob Landley
dbfb5a3cb7 Andre (armcc2200@yahoo) patched a bug where successful mounts could sometimes
produce an error, due to a missing rc assignment.
2006-06-21 02:39:57 +00:00
Rob Landley
22d26fc6ae Patch from Yann Morin to put BLKGETSIZE64 in platform.h had rather a lot of
fallout due to the #include <sys/mount.h>.  Removed that #include from various
applets and fixed up those that were unhappy when that #include was made
because they'd block copied stuff out of it.  (Sigh.)
2006-06-15 15:49:36 +00:00
Rob Landley
8bb50782a5 Change llist_add_* to take the address of the list rather than returning the new
head, and change all the callers.
2006-05-26 23:44:51 +00:00
Bernhard Reutner-Fischer
08421e1d0c - work around bug in gcc-3.4.x on ARM 2006-05-26 14:05:48 +00:00
Rob Landley
a6b5b60942 Fiddling with llist to make memory management easier. Specifically, the
option to delete the contents of the list when we delete the list is a
good thing.
2006-05-08 19:03:07 +00:00
Rob Landley
49159c7f94 Patch from Jason Schoon to make mount -a not abort on the first failure. 2006-05-05 15:01:38 +00:00
Rob Landley
19af279d16 Kumar spotted another bug: if we autodetect nfs and they haven't specified the
fstype, it should be set to nfs.
2006-04-05 01:43:39 +00:00
Rob Landley
ab8736064b You'd think there'd be a compiler warning for "pointless if", wouldn't you? 2006-04-04 16:56:04 +00:00
Rob Landley
20fef96dd8 Bug spotted by Kumar Gala. Hopefully this fixes it... 2006-04-01 17:32:52 +00:00
Rob Landley
fe908fda28 Kumar Gala tracked down a problem with NFS mounting. This is a different fix
from his, but to the same problem.
2006-03-29 14:30:49 +00:00
Rob Landley
92fff34de6 Bernhard Fischer spotted that we shouldn't free fstype if we didn't allocate
it.
2006-03-28 19:19:19 +00:00
Eric Andersen
9601a1c8c2 whitespace cleanup 2006-03-20 18:07:50 +00:00
Eric Andersen
19b5b8ff6a Fix some obvious compile problems. Make the -f' fakeIt option actually work. 2006-03-20 18:07:13 +00:00
Rob Landley
eaa34ca5b4 More fixes. Type "auto" should mean unspecified from fstab as well as the
command line, initialize singlemount's rc to an error value so it doesn't
think it succeeded when it didn't, use absolute path when associating a
loop device (and the previous FEATURE_CLEAN_UP logic related to that was
freeing the wrong thing), move reading of /proc/filesystems to where we can
re-read it (when it's empty) for every entry on a "mount -a" so that when
/proc is mounted as the first entry, the later filesystems can autodetect
filesystem type.
2006-03-18 02:58:11 +00:00
Rob Landley
dc0955b603 The new, new mount rewrite. (Mount double prime?) Still being debugged, but
the new infrastructure is reentrant so in theory it's capable of handling
mount -a sanely.  It can also re-use existing flags with remount, handle
-t auto, mount -a -t, and several smaller bugfixes.
2006-03-14 18:16:25 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
Rob Landley
71d6ccd801 With -a, the jump to mount_it_now can skip the initialization of f, and
if we don't zero it after closing it we re-close a filehandle that isn't
open, and since this is a file _pointer_ it segfaults on a double free.

Yeah, subtle bug.  I need to break this out into separate functions if I can
figure out how to avoid making the code larger while doing so.  Part of
the general -a and -o remount work I need to do, but that's after 1.1.0...
2006-01-10 05:30:28 +00:00
Rob Landley
8b0efdb1a1 Both atime and diratime should switch _off_ the corresponding no* flag. 2006-01-10 02:37:20 +00:00
Rob Landley
7b363fd3c9 Some minor cleanups/bugfixes split off from the big remount work:
Shorten GPL boilerplate.
  Enabling FEATURE_CLEAN_UP broke things in two places.
  Move the NFS with uClibc check to nfsmount.c
2005-12-20 17:18:01 +00:00
Bernhard Reutner-Fischer
126da9ec2d - typo: s/sucess/success/g
What's up with loginutils/su.c line 42: "SYSLOG_SUCESS" ? Please have a look..
2005-12-12 11:20:39 +00:00
Rob Landley
4a7252babd Rename CONFIG_NFSMOUNT to CONFIG_FEATURE_MOUNT_NFS so allbaseconfig can
find it (and tweak defconfig to catch up).
2005-10-08 18:49:45 +00:00
Rob Landley
9a643149de Amir Shalem found some bugs in the new mount code; unknown options didn't get
added to the list, and my assumption that nfsmount() actually called
mount() was incorrect (and I coded it wrong anyway; I hate having to touch
codepaths I can't personally test).
2005-08-30 17:07:49 +00:00
Rob Landley
de5fd23f25 If we goto singlemount, do _not_ try to continue through the loop we jumped
into.  (That means "mount -t ext2 /dev/thingy thingy" would segfault if
it failed instead of giving us an error message.)
2005-08-14 19:26:14 +00:00
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