ia64/xen-unstable
changeset 16944:0343aa136101
ioemu: strip tap subtype prefix from image name
Currently I am not able to mount or boot from an HVM CDROM when it is
configured for 'tap:aio' instead of 'file'.
disk=[ 'tap:aio:/var/lib/xen/images/sles10-sp2-fv/disk0,hda,w', '
tap:aio:/home/iso/sles/SLES10.iso,hdc:cdrom,r', ]
With this patch I am able to boot from the CDROM and or mount it.
Patch changes xenstore.c:xenstore_process_event() to strip the tap
subtype prefix from the image name.
Signed-off-by: Pat Campbell <plc@novell.com>
Currently I am not able to mount or boot from an HVM CDROM when it is
configured for 'tap:aio' instead of 'file'.
disk=[ 'tap:aio:/var/lib/xen/images/sles10-sp2-fv/disk0,hda,w', '
tap:aio:/home/iso/sles/SLES10.iso,hdc:cdrom,r', ]
With this patch I am able to boot from the CDROM and or mount it.
Patch changes xenstore.c:xenstore_process_event() to strip the tap
subtype prefix from the image name.
Signed-off-by: Pat Campbell <plc@novell.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Wed Jan 30 14:25:55 2008 +0000 (2008-01-30) |
parents | 625c923f7b4a |
children | 5f997b5b8a58 |
files | tools/ioemu/xenstore.c |
line diff
1.1 --- a/tools/ioemu/xenstore.c Wed Jan 30 14:24:20 2008 +0000 1.2 +++ b/tools/ioemu/xenstore.c Wed Jan 30 14:25:55 2008 +0000 1.3 @@ -419,7 +419,7 @@ void xenstore_record_dm_state(char *stat 1.4 1.5 void xenstore_process_event(void *opaque) 1.6 { 1.7 - char **vec, *image = NULL; 1.8 + char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL; 1.9 unsigned int len, num, hd_index; 1.10 1.11 vec = xs_read_watch(xsh, &num); 1.12 @@ -441,8 +441,28 @@ void xenstore_process_event(void *opaque 1.13 goto out; 1.14 hd_index = vec[XS_WATCH_TOKEN][2] - 'a'; 1.15 image = xs_read(xsh, XBT_NULL, vec[XS_WATCH_PATH], &len); 1.16 - if (image == NULL || !strcmp(image, bs_table[hd_index]->filename)) 1.17 - goto out; /* gone or identical */ 1.18 + if (image == NULL) 1.19 + goto out; /* gone */ 1.20 + 1.21 + /* Strip off blktap sub-type prefix */ 1.22 + bpath = strdup(vec[XS_WATCH_PATH]); 1.23 + if (bpath) 1.24 + goto out; 1.25 + if ((offset = strrchr(bpath, '/')) != NULL) 1.26 + *offset = '\0'; 1.27 + if (pasprintf(&buf, "%s/type", bpath) == -1) 1.28 + goto out; 1.29 + drv = xs_read(xsh, XBT_NULL, buf, &len); 1.30 + if (drv) { 1.31 + if (!strcmp(drv, "tap")) { 1.32 + offset = strchr(image, ':'); 1.33 + if (offset) 1.34 + memmove(image, offset+1, strlen(offset+1)+1 ); 1.35 + } 1.36 + } 1.37 + 1.38 + if (!strcmp(image, bs_table[hd_index]->filename)) 1.39 + goto out; /* identical */ 1.40 1.41 do_eject(0, vec[XS_WATCH_TOKEN]); 1.42 bs_table[hd_index]->filename[0] = 0; 1.43 @@ -457,6 +477,9 @@ void xenstore_process_event(void *opaque 1.44 } 1.45 1.46 out: 1.47 + free(drv); 1.48 + free(buf); 1.49 + free(bpath); 1.50 free(image); 1.51 free(vec); 1.52 }