]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
losetup: add --partscan option
authorKarel Zak <kzak@redhat.com>
Mon, 9 Jan 2012 22:27:53 +0000 (23:27 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 9 Jan 2012 22:28:50 +0000 (23:28 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
include/loopdev.h
sys-utils/losetup.8
sys-utils/losetup.c

index 238b308fefa1c01d130d3c77f6d986906c9b980d..4e68da81fe7658d291081d33d9379cc171643394 100644 (file)
@@ -37,7 +37,8 @@
 enum {
        LO_FLAGS_READ_ONLY  = 1,
        LO_FLAGS_USE_AOPS   = 2,
-       LO_FLAGS_AUTOCLEAR  = 4, /* New in 2.6.25 */
+       LO_FLAGS_AUTOCLEAR  = 4,        /* kernel >= 2.6.25 */
+       LO_FLAGS_PARTSCAN   = 8,        /* kernel >= 3.2 */
 };
 
 #define LO_NAME_SIZE   64
index 43dc76815cad40e037928d829f7eadf73c9f5e53..3d407217a41d457e09dcd5ac0ebfb2f86cf20ed6 100644 (file)
@@ -49,7 +49,7 @@ Setup loop device:
 .in +8
 .RB [ \-p
 .IR pfd ]
-.RB [ \-r ]
+.RB [ \-rP ]
 .RB { \-f [ \-\-show ]| \fIloopdev\fP }
 .I file
 .sp
@@ -99,6 +99,8 @@ the data end is set to no more than \fIsize\fP bytes after the data start
 read the passphrase from file descriptor with number
 .I num
 instead of from the terminal
+.IP "\fB\-P, \-\-partscan\fP"
+force kernel to scan partition table on newly created loop device
 .IP "\fB\-r, \-\-read-only\fP"
 setup read-only loop device
 .IP "\fB\-\-show\fP"
index 35c1c919d58a9fb5202143979b845578c7065ea8..7e80ee51357ea07cca31b7a9ee13d0477361b9b4 100644 (file)
@@ -206,6 +206,7 @@ static void usage(FILE *out)
                " -o, --offset <num>            start at offset <num> into file\n"
                "     --sizelimit <num>         device limited to <num> bytes of the file\n"
                " -p, --pass-fd <num>           read passphrase from file descriptor <num>\n"
+               " -P, --partscan                create partitioned loop device\n"
                " -r, --read-only               setup read-only loop device\n"
                "     --show                    print device name after setup (with -f)\n"
                " -v, --verbose                 verbose mode\n"), out);
@@ -243,6 +244,7 @@ int main(int argc, char **argv)
                { "offset", 1, 0, 'o' },
                { "sizelimit", 1, 0, OPT_SIZELIMIT },
                { "pass-fd", 1, 0, 'p' },
+               { "partscan", 0, 0, 'P' },
                { "read-only", 0, 0, 'r' },
                { "show", 0, 0, OPT_SHOW },
                { "verbose", 0, 0, 'v' },
@@ -257,7 +259,7 @@ int main(int argc, char **argv)
        loopcxt_init(&lc, 0);
        loopcxt_enable_debug(&lc, getenv("LOOPDEV_DEBUG") ? TRUE : FALSE);
 
-       while ((c = getopt_long(argc, argv, "ac:d:De:E:fhj:o:p:rvV",
+       while ((c = getopt_long(argc, argv, "ac:d:De:E:fhj:o:p:PrvV",
                                longopts, NULL)) != -1) {
 
                if (act && strchr("acdDfj", c))
@@ -307,6 +309,9 @@ int main(int argc, char **argv)
                        passfd = strtol_or_err(optarg,
                                        _("invalid passphrase file descriptor"));
                        break;
+               case 'P':
+                       lo_flags |= LO_FLAGS_PARTSCAN;
+                       break;
                case OPT_SHOW:
                        showdev = 1;
                        break;