From: Karel Zak Date: Wed, 21 Dec 2011 14:38:59 +0000 (+0100) Subject: losetup: rewrite -f X-Git-Tag: v2.21-rc1~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcdbdc72cb1a8817729902725071506e6f9b49c7;p=thirdparty%2Futil-linux.git losetup: rewrite -f Signed-off-by: Karel Zak --- diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c index d4a97a3903..0d8bd858d0 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;