diff options
author | Karel Zak | 2007-06-18 15:44:02 +0200 |
---|---|---|
committer | Karel Zak | 2007-06-18 15:44:02 +0200 |
commit | ba3809b01233e6afb24e90018700b3f145c2aee7 (patch) | |
tree | 9bd037d95f4df8be1bfd37ceb7c973821845db3a /mount/losetup.8 | |
parent | tests: add mount /dev/symlink test (diff) | |
download | kernel-qcow2-util-linux-ba3809b01233e6afb24e90018700b3f145c2aee7.tar.gz kernel-qcow2-util-linux-ba3809b01233e6afb24e90018700b3f145c2aee7.tar.xz kernel-qcow2-util-linux-ba3809b01233e6afb24e90018700b3f145c2aee7.zip |
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>
Diffstat (limited to 'mount/losetup.8')
-rw-r--r-- | mount/losetup.8 | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mount/losetup.8 b/mount/losetup.8 index 1bfcf883c..5b44a4d8a 100644 --- a/mount/losetup.8 +++ b/mount/losetup.8 @@ -37,7 +37,7 @@ Setup loop device: .IR pfd ] .RB [ \-r ] .in +8 -.RB { \-f | \fIloop_device\fP } +.RB { \-f [ \-s ] | \fIloop_device\fP } .I file .in -13 .ad b @@ -90,6 +90,13 @@ Read the passphrase from file descriptor with number instead of from the terminal. .IP \fB\-r\fP Setup read-only loop device. +.IP \fB\-s\fP +Print device name if the +.I -f +option and a +.I file +argument are present. + .SH RETURN VALUE .B losetup returns 0 on success, nonzero on failure. When |