summaryrefslogtreecommitdiffstats
path: root/sys-utils/losetup.c
diff options
context:
space:
mode:
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;