aboutsummaryrefslogtreecommitdiffstats
path: root/tools/blktap/lib
diff options
context:
space:
mode:
authorJake Wires <jwires@xensource.com>2007-02-23 17:26:07 -0800
committerJake Wires <jwires@xensource.com>2007-02-23 17:26:07 -0800
commita3d17a18e59a22c7be99d6e82910af29568d0057 (patch)
treef87c22e4b2de1edb7ebd3212fedc7431029d33ca /tools/blktap/lib
parent99a8295b9686e4addbc1469f8eea0014238e9e02 (diff)
downloadxen-a3d17a18e59a22c7be99d6e82910af29568d0057.tar.gz
xen-a3d17a18e59a22c7be99d6e82910af29568d0057.tar.bz2
xen-a3d17a18e59a22c7be99d6e82910af29568d0057.zip
[TAPDISK] honor read-only attributes when creating tap-based VBDs
Signed-off-by: Jake Wires <jwires@xensource.com>
Diffstat (limited to 'tools/blktap/lib')
-rw-r--r--tools/blktap/lib/blktaplib.h1
-rw-r--r--tools/blktap/lib/xenbus.c7
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/blktap/lib/blktaplib.h b/tools/blktap/lib/blktaplib.h
index 0ba3c04ec8..078a293185 100644
--- a/tools/blktap/lib/blktaplib.h
+++ b/tools/blktap/lib/blktaplib.h
@@ -173,6 +173,7 @@ typedef struct msg_hdr {
uint16_t len;
uint16_t drivertype;
uint16_t cookie;
+ uint8_t readonly;
} msg_hdr_t;
typedef struct msg_newdev {
diff --git a/tools/blktap/lib/xenbus.c b/tools/blktap/lib/xenbus.c
index d50e492784..fb36e748fe 100644
--- a/tools/blktap/lib/xenbus.c
+++ b/tools/blktap/lib/xenbus.c
@@ -177,8 +177,11 @@ static void ueblktap_setup(struct xs_handle *h, char *bepath)
}
/* Check to see if device is to be opened read-only. */
- asprintf(&path, "%s/%s", bepath, "read-only");
- if (xs_exists(h, path))
+ deverr = xs_gather(h, bepath, "mode", NULL, &path, NULL);
+ if (deverr) {
+ DPRINTF("ERROR: could not find read/write mode\n");
+ goto fail;
+ } else if (path[0] == 'r')
be->readonly = 1;
if (be->blkif == NULL) {