Commit Graph

26 Commits

Author SHA1 Message Date
Randy Dunlap 830d6af099 losetup: clean up gcc warnings
Fix strict gcc warnings that come from using:
  ("-Wall -Wp,-D_FORTIFY_SOURCE=2")

lomount.c:98: warning: pointer targets in initialization differ in signedness
lomount.c:111: warning: format '%04x' expects type 'unsigned int', but argument 4 has type '__kernel_old_dev_t'
lomount.c:300: warning: pointer targets in passing argument 1 of 'xstrncpy' differ in signedness
lomount.c:307: warning: pointer targets in passing argument 1 of '__builtin___snprintf_chk' differ in signedness
lomount.c:339: warning: pointer targets in passing argument 1 of 'xstrncpy' differ in signedness

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
2007-10-11 13:02:45 +02:00
Sascha Sommer 5c62eb4d06 mount: free loop device on failure
Testcase:
$ mount -oloop /etc/group /mnt
ioctl: LOOP_CLR_FD: Device or resource busy
mount: you must specify the filesystem type
$ losetup /dev/loop0
/dev/loop0: [0803]:1931929 (/etc/group)

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
2007-08-27 10:22:06 +02:00
Masatake YAMATO d33279c2e3 lomount.c: don't use mlockall if CRYPT_NONE
loop back mounting emits two system calls: mount and mlockall.
mount is obviously needed. mlockall is needed for encryption.
As the result both CAP_SYS_ADMIN and CAP_IPC_LOCK are needed
to do loopback mounting.

The problem is that CAP_IPC_LOCK is always needed through my
command doesn't need encryption.

With the following patch, mount calls mlockall only when
encryption is needed.

Signed-off-by: Masatake YAMATO <jet@gyve.org>
2007-07-10 14:05:45 +02:00
Karel Zak d99f0140f7 losetup: add long options and fix man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-27 17:32:51 +02:00
Matthias Koenig 6ffa7c9383 mount: loop device race condition
Fix race in losetup

Retry acquiring a loop device if set_loop failed with EBUSY

Signed-Off-By: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-27 16:15:50 +02:00
Matthias Koenig 95ba33f7a4 mount: loop device race condition
Fix race in mount -o loop

Retry acquiring a loop device if the setup failed with EBUSY.

Signed-Off-By: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-27 14:55:00 +02:00
Karel Zak ba3809b012 losetup: add a new option -s
The losetup provides an -f option to discover an unused loop device.  As
implemented, it is racy. The problem is that -f prints the loop device
to stdout only when used standalone.  This means a script has to do:

 lodev=$(losetup -f)
 losetup $lodev $filename

which is racy if another script may be running.

This patch add a new option '-s'. The '-s' option prints device name
if the -f option and a file argument are present. For example:

 lodev=$(losetup -f -s $filename)

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-18 15:44:02 +02:00
Karel Zak faf142b65a losetup: add support read-only loops
This feature has been already supported by mount, but it wasn't accessible by
losetup command. Now you can use "losetup -r".

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-22 20:54:07 +01:00
Karel Zak 8b125fae1c losetup: add -a option to list all used loop devices
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-22 14:22:10 +01:00
Karel Zak 756bfd018e Imported from util-linux-2.12o tarball. 2006-12-07 00:26:31 +01:00
Karel Zak b22550fa15 Imported from util-linux-2.12k tarball. 2006-12-07 00:26:26 +01:00
Karel Zak d162fcb550 Imported from util-linux-2.12j tarball. 2006-12-07 00:26:24 +01:00
Karel Zak d26aa358f4 Imported from util-linux-2.12h tarball. 2006-12-07 00:26:19 +01:00
Karel Zak c129767e06 Imported from util-linux-2.12b tarball. 2006-12-07 00:26:16 +01:00
Karel Zak d03dd60840 Imported from util-linux-2.12a tarball. 2006-12-07 00:26:14 +01:00
Karel Zak a21409f54e Imported from util-linux-2.12pre tarball. 2006-12-07 00:26:13 +01:00
Karel Zak df1dddf9ff Imported from util-linux-2.12 tarball. 2006-12-07 00:26:12 +01:00
Karel Zak 95f1bdeee4 Imported from util-linux-2.11x tarball. 2006-12-07 00:26:05 +01:00
Karel Zak ffc4374869 Imported from util-linux-2.11o tarball. 2006-12-07 00:25:53 +01:00
Karel Zak c07ebfa1e0 Imported from util-linux-2.11b tarball. 2006-12-07 00:25:46 +01:00
Karel Zak 66ee8158b6 Imported from util-linux-2.10s tarball. 2006-12-07 00:25:44 +01:00
Karel Zak 22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +01:00
Karel Zak 7eda085c41 Imported from util-linux-2.9v tarball. 2006-12-07 00:25:39 +01:00
Karel Zak 2b6fc908bc Imported from util-linux-2.8 tarball. 2006-12-07 00:25:35 +01:00
Karel Zak fd6b7a7ffc Imported from util-linux-2.7.1 tarball. 2006-12-07 00:25:34 +01:00
Karel Zak 6dbe3af945 Imported from util-linux-2.2 tarball. 2006-12-07 00:25:32 +01:00