]> err.no Git - util-linux/commitdiff
losetup: add support read-only loops
authorKarel Zak <kzak@redhat.com>
Thu, 22 Mar 2007 19:54:07 +0000 (20:54 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 22 Mar 2007 19:54:07 +0000 (20:54 +0100)
This feature has been already supported by mount, but it wasn't accessible by
losetup command. Now you can use "losetup -r".

Signed-off-by: Karel Zak <kzak@redhat.com>
mount/lomount.c
mount/losetup.8

index da1d2e427d4553a3cac03bfe7b0cd50cc767d753..88214f71c12f83012d6626d3fa5bbeb2a287d8e9 100644 (file)
@@ -443,7 +443,8 @@ usage(void) {
   "  %1$s -d loop_device                                    # delete\n"
   "  %1$s -f                                                # find unused\n"
   "  %1$s -a                                                # list all used\n"
-  "  %1$s [-e encryption] [-o offset] {-f|loop_device} file # setup\n"),
+  "  %1$s -r                                                # read-only loop\n"
+  "  %1$s [-e encryption] [-o offset] [-r] {-f|loop_device} file # setup\n"),
                progname);
        exit(1);
 }
@@ -496,11 +497,14 @@ main(int argc, char **argv) {
        if ((p = strrchr(progname, '/')) != NULL)
                progname = p+1;
 
-       while ((c = getopt(argc, argv, "ade:E:fo:p:v")) != -1) {
+       while ((c = getopt(argc, argv, "ade:E:fo:p:vr")) != -1) {
                switch (c) {
                case 'a':
                        all = 1;
                        break;
+               case 'r':
+                       ro = 1;
+                       break;
                case 'd':
                        delete = 1;
                        break;
index f2bb5c8321d0b8d14b3fafe983d343d3b76b94b7..673fba0fcffe53eccea82c4e6c583895230945e5 100644 (file)
@@ -35,6 +35,7 @@ Setup loop device:
 .IR offset ]
 .RB [ \-p
 .IR pfd ]
+.RB [ \-r ]
 .in +8
 .RB { \-f | \fIloop_device\fP }
 .I file
@@ -87,6 +88,8 @@ device.
 Read the passphrase from file descriptor with number
 .I num
 instead of from the terminal.
+.IP \fB\-r\fP
+Setup read-only loop device.
 .SH RETURN VALUE
 .B losetup
 returns 0 on success, nonzero on failure. When