]> xenbits.xensource.com Git - people/dstodden/blktap.git/commitdiff
CA-10471: add option to mount tapdisks read-only
authorJake Wires <Jake.Wires@citrix.com>
Wed, 26 Jan 2011 22:28:43 +0000 (14:28 -0800)
committerJake Wires <Jake.Wires@citrix.com>
Wed, 26 Jan 2011 22:28:43 +0000 (14:28 -0800)
From 6ee06eff2f182097579a486f74899dc77a1955a9 Mon Sep 17 00:00:00 2001
Date: Wed, 1 Sep 2010 14:08:33 -0700

Signed-off-by: Jake Wires <jake.wires@citrix.com>
control/tap-ctl.c

index 91368aa224920cbf247f2eedd55768538a6d689e..35881671db39887a4e9f83eb09c69e513daa4022 100644 (file)
@@ -251,11 +251,11 @@ usage:
 static void
 tap_cli_create_usage(FILE *stream)
 {
-       fprintf(stream, "usage: create <-a args> [-d device name] [-e <minor> "
-                       "stack on existing tapdisk for the parent chain] "
-                       "[-r turn on read caching into leaf node] [-2 <path> "
-                       "use secondary image (in mirror mode if no -s)] [-s "
-                       "fail over to the secondary image on ENOSPC]\n");
+       fprintf(stream, "usage: create <-a args> [-d device name] [-R readonly] "
+               "[-e <minor> stack on existing tapdisk for the parent chain] "
+               "[-r turn on read caching into leaf node] [-2 <path> "
+               "use secondary image (in mirror mode if no -s)] [-s "
+               "fail over to the secondary image on ENOSPC]\n");
 }
 
 static int
@@ -271,7 +271,7 @@ tap_cli_create(int argc, char **argv)
        flags     = 0;
 
        optind = 0;
-       while ((c = getopt(argc, argv, "a:d:e:r2:sh")) != -1) {
+       while ((c = getopt(argc, argv, "a:Rd:e:r2:sh")) != -1) {
                switch (c) {
                case 'a':
                        args = optarg;
@@ -279,6 +279,9 @@ tap_cli_create(int argc, char **argv)
                case 'd':
                        devname = optarg;
                        break;
+               case 'R':
+                       flags |= TAPDISK_MESSAGE_FLAG_RDONLY;
+                       break;
                case 'r':
                        flags |= TAPDISK_MESSAGE_FLAG_ADD_LCACHE;
                        break;
@@ -696,11 +699,11 @@ usage:
 static void
 tap_cli_open_usage(FILE *stream)
 {
-       fprintf(stream, "usage: open <-p pid> <-m minor> <-a args> [-e <minor> "
-                       "stack on existing tapdisk for the parent chain] "
-                       "[-r turn on read caching into leaf node] [-2 <path> "
-                       "use secondary image (in mirror mode if no -s)] [-s "
-                       "fail over to the secondary image on ENOSPC]\n");
+       fprintf(stream, "usage: open <-p pid> <-m minor> <-a args> [-R readonly] "
+               "[-e <minor> stack on existing tapdisk for the parent chain] "
+               "[-r turn on read caching into leaf node] [-2 <path> "
+               "use secondary image (in mirror mode if no -s)] [-s "
+               "fail over to the secondary image on ENOSPC]\n");
 }
 
 static int
@@ -717,7 +720,7 @@ tap_cli_open(int argc, char **argv)
        secondary = NULL;
 
        optind = 0;
-       while ((c = getopt(argc, argv, "a:m:p:e:r2:sh")) != -1) {
+       while ((c = getopt(argc, argv, "a:Rm:p:e:r2:sh")) != -1) {
                switch (c) {
                case 'p':
                        pid = atoi(optarg);
@@ -728,6 +731,9 @@ tap_cli_open(int argc, char **argv)
                case 'a':
                        args = optarg;
                        break;
+               case 'R':
+                       flags |= TAPDISK_MESSAGE_FLAG_RDONLY;
+                       break;
                case 'r':
                        flags |= TAPDISK_MESSAGE_FLAG_ADD_LCACHE;
                        break;