summaryrefslogtreecommitdiffstats
path: root/sys-utils/losetup.c
diff options
context:
space:
mode:
authorKarel Zak2011-12-21 15:38:59 +0100
committerKarel Zak2011-12-22 12:19:38 +0100
commitbcdbdc72cb1a8817729902725071506e6f9b49c7 (patch)
tree0fe9e66f8ff5c263dc99f6e7fe6d78b01596924c /sys-utils/losetup.c
parentlosetup: rewrite -d and -D (diff)
downloadkernel-qcow2-util-linux-bcdbdc72cb1a8817729902725071506e6f9b49c7.tar.gz
kernel-qcow2-util-linux-bcdbdc72cb1a8817729902725071506e6f9b49c7.tar.xz
kernel-qcow2-util-linux-bcdbdc72cb1a8817729902725071506e6f9b49c7.zip
losetup: rewrite -f
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/losetup.c')
-rw-r--r--sys-utils/losetup.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index d4a97a390..0d8bd858d 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -1038,6 +1038,7 @@ int main(int argc, char **argv)
encryption = optarg;
break;
case 'f':
+ act = A_FIND_FREE;
find = 1;
break;
case 'h':
@@ -1087,6 +1088,12 @@ int main(int argc, char **argv)
case A_DELETE_ALL:
res = delete_all_loops(&lc);
break;
+ case A_FIND_FREE:
+ if (loopcxt_find_unused(&lc))
+ warn(_("find unused loop device failed"));
+ else
+ printf("%s\n", loopcxt_get_device(&lc));
+ break;
case A_SHOW:
res = show_all_loops(&lc, file, offset, flags);
break;