summaryrefslogtreecommitdiff
path: root/libbb/loop.c
AgeCommit message (Collapse)Author
2018-06-28testsuite/mount.tests: fix false positiveDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-16mount: create loop devices with LO_FLAGS_AUTOCLEAR flagDenys Vlasenko
The "autolooped" mount (mount [-oloop] IMAGE /DIR/DIR) always creates AUTOCLEARed loopdevs, so that umounting drops them (and this does not require any code in the umount userspace). This happens since circa linux-2.6.25: commit 96c5865559cee0f9cbc5173f3c949f6ce3525581 Date: Wed Feb 6 01:36:27 2008 -0800 Subject: Allow auto-destruction of loop devices IOW: in this case, umount does not have to use -d to drop the loopdev. The explicit loop mount (mount /dev/loopN /DIR/DIR) does not do this. In this case, umount without -d should not drop loopdev. Unfortunately, bbox umount currently always implies -d, this probably needs fixing. function old new delta set_loop 537 597 +60 singlemount 1101 1138 +37 losetup_main 419 432 +13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 110/0) Total: 110 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07libbb/loop: don't try to re-use existing loop deviceKevin Wallace
loopinfo.lo_file_name is not enough to uniquely identify a file on a system with multiple mount namespaces. We could conceivably change this to dedup on (lo_rdevice, lo_inode), but, as the comment above the deleted code notes, this whole approach of reusing devices is racy anyway, so it seems better to stop doing it entirely. Signed-off-by: Kevin Wallace <k@igneous.io> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-21libbb: if opening /dev/loopN returns ENXIO, don't try N++.Denys Vlasenko
function old new delta set_loop 639 635 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14whitespace cleanup. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-12losetup: implement -r option. Closes 4033.Denys Vlasenko
function old new delta packed_usage 28595 28633 +38 losetup_main 285 290 +5 singlemount 906 908 +2 set_loop 674 672 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-19losetup: support /dev/loop10 and higher. closes bug 1627Denys Vlasenko
function old new delta query_loop 91 95 +4 losetup_main 288 285 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-14loop: correct minor device number limitDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-14mount: add an optional capability to create new /dev/loopN as neededLauri Kasanen
Signed-off-by: Lauri Kasanen <curaga@operamail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18libbb/loop: comment out u32 hackDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-08libbb/loop.c: move #include to its user, improve commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-06libbb/loop.c: use common fix_u32.h trickDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-05libbb/loop.c: style and readability fixes, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)Denys Vlasenko
function old new delta logdirs_reopen 1310 1308 -2 read_line_input 4757 4753 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-05Patches to enable FreeBSD buildDenys Vlasenko
platform.h: fix wrong check for endianness, fix lchown aliasing to chown on uclibc. Code seems to not be affected in my testing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-06-27*: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
2007-08-03mount: print errno on NFS error (again)Denis Vlasenko
2007-04-19loop device code: readability improvementDenis Vlasenko
2007-01-19strdup -> xstrdupDenis Vlasenko
sed: de-obfuscate piece of code
2006-10-08correct largefile support, add comments about it.Denis Vlasenko
2006-10-08attempt to regularize atoi mess.Denis Vlasenko
2006-09-17whitespace cleanupDenis Vlasenko
2006-08-03Remove bb_ prefixes from xfuncs.c (and a few other places), consolidateRob Landley
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-07-16Cleaup read() and write() variants, plus a couple of new functions likeRob Landley
xlseek and fdlength() for the new mkswap.
2006-07-10Replace current verbose GPL stuff in libbb/*.c with one-line GPL boilerplate."Robert P. J. Day"
2006-06-25Whitespace. (Vim's auto-indent is kind of annoying at times, like "daytime"Rob Landley
and "nighttime"...)
2006-06-25Fix a possible race condition if two processes try to claim the same loopRob Landley
device at the same time. We should only CLR_FD if the set status fails, not if the SET_FD fails.
2006-03-18Whitespace cleanup and minor tweak (return -ERRNO instead of ERRNO soRob Landley
EPERM doesn't register as a successful read-only mount.
2006-01-30with 2.4 kernel headers, lo_file_name is char, but with 2.6Eric Andersen
headers we get a u8 for lo_file_name, so always cast to (char *) when treating it as such.
2006-01-25just whitespaceTim Riker
2006-01-22Close bug 644: loop incrementing twice, skipping ever other device.Rob Landley
2005-12-21Trying to losetup a device as a regular user shouldn't result in an endlessRob Landley
loop, and the error messages should display correctly now.
2005-11-29Fix losetup so that it A) actually works again, B) has much better errorRob Landley
messages, C) can show the current association (if any) when called with only one argument. Update the documentation a lot too. Remind me to add a test suite for this thing. I think I've figured out how to handle root-only testsuites...
2005-10-15- don't update copyright years. He might release it, but apparently will haveBernhard Reutner-Fischer
to update the year himself.
2005-10-15- an empty middle term in ?: violates ISO CBernhard Reutner-Fischer
- use shorter boilerplate and use C89 style comments
2005-10-11The check for EROFS was wrong. For example, if you try to mount a filesystemRob Landley
appended to an executable that's being run (yes, I'm doing this) you get EPERM, but mounting readonly fixes it. Doing the fallback all the time shouldn't hurt, and is one less test.
2005-08-10Major rewrite of mount, umount, losetup. Untangled lots of code, shrunkRob Landley
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-07-27move the ifdef to after libbb.h include, so it can do some good.Paul Fox
2005-07-22ifdef all of loop.c with CONFIG_FEATURE_MOUNT_LOOP. won'tPaul Fox
compile due to CONFIG_FEATURE_MOUNT_LOOP_MAX otherwise. reported by Stephane Billiart.
2005-07-19applying fix from:Paul Fox
0000068: mount limited to max 8 loop devices (patch provided) (made minor wording change for config help message)
2005-01-04Dear andersen:Eric Andersen
Is the change on libbb/loop.c which you commited in 2005/1/3 effective really? The __GLIBC__ macro and __UCLIBC__ macro are defined in feature.h in glibc source, so the change may not be effective. If you want to check this with __GLIBC__, feature.h header is needed. Some architectures(e.g. PPC series) need to include linux/posix_types.h in stead of asm/posix_types.h, so the patch which is attached with this mail include <linux/posix_types.h>.
2005-01-03perhaps a better fixEric Andersen
2004-12-09Workaround for uClibc-specific header problem described here:Rob Landley
http://www.busybox.net/lists/busybox/2004-December/013276.html Rob
2004-08-16Use __kernel_old_dev_t for 2.6.x kernelsEric Andersen
2004-08-16Aurelien Jacobs writes:Eric Andersen
with a quick conversion you will see that 132608 == 0x20600 so noticed that the elif will never be matched ! Apparently there was already a try to modify this in CVS which was reverted (it was plain wrong). I don't know when __kernel_old_dev_t is needed, but with a 2.6.7 or a 2.6.8 this is __kernel_dev_t wich is needed. I corrected this with the following patch but maybe older 2.6 still need __kernel_old_dev_t ? I think this should be corrected before 1.0. Thanks Aurel
2004-06-25Revert my previous commitGlenn L McGrath
2004-06-25Fix compile error under 2.6, check for newer versions first or all theGlenn L McGrath
checks wont be considered.
2004-03-15Remove trailing whitespace. Update copyright to include 2004.Eric Andersen
2004-02-06Make the loop support stuff be much less evil, and make it copeEric Andersen
with 2.6.x asm/posix_types.h, which has done singularly evil thing by yanking __kernel_dev_t and renaming it. The loop interface was really poorly designed in the first place. The new 64 bit loop interface looks to be somewhat less horrible, too bad it is only present in 2.6.x kernels. -Erik