[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 02 of 18] tools/blktap: fix params and physical-device parsing
# HG changeset patch # User Olaf Hering <olaf@xxxxxxxxx> # Date 1333046227 -7200 # Node ID 5c77f79cc3064b575c1da2b8fb28eec53dd8bfdc # Parent 1c86e2e5268d14587c736e3f575d0aa42869de83 tools/blktap: fix params and physical-device parsing If parsing the "physical-device" property fails the physical device node should come from the "params" property. But since the deverr value was overwritten during read of the "mode" property, the "params" property was never parsed. Fix this by reading "mode" before "physical-device" so that deverr can be reused to check the "params" property. Simplify ->pdev assignment. Signed-off-by: Olaf Hering <olaf@xxxxxxxxx> diff -r 1c86e2e5268d -r 5c77f79cc306 tools/blktap/lib/xenbus.c --- a/tools/blktap/lib/xenbus.c +++ b/tools/blktap/lib/xenbus.c @@ -335,6 +335,15 @@ static void ueblktap_setup(struct xs_han goto fail; } + /* Check to see if device is to be opened read-only. */ + 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; + + /* deverr reused later during params parsing */ deverr = xs_gather(h, bepath, "physical-device", "%li", &pdev, NULL); if (!deverr) { DPRINTF("pdev set to %ld\n",pdev); @@ -345,14 +354,6 @@ static void ueblktap_setup(struct xs_han be->pdev = pdev; } - /* Check to see if device is to be opened read-only. */ - 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) { /* Front end dir is a number, which is used as the handle. */ p = strrchr(be->frontpath, '/') + 1; @@ -375,11 +376,9 @@ static void ueblktap_setup(struct xs_han goto fail; be->blkif->info = blk; - if (deverr) { - /*Dev number was not available, try to set manually*/ - pdev = convert_dev_name_to_num(blk->params); - be->pdev = pdev; - } + /*Dev number was not available, try to set manually*/ + if (deverr) + be->pdev = convert_dev_name_to_num(blk->params); if (check_image(h, be, &errmsg)) goto fail; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |