diff options
Diffstat (limited to 'xen/block.c')
-rw-r--r-- | xen/block.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/xen/block.c b/xen/block.c index 4253ef04..d98b31e2 100644 --- a/xen/block.c +++ b/xen/block.c @@ -214,10 +214,10 @@ void hyp_block_init(void) { continue; } if (partition) - sprintf(device_name, "%s%us%u", prefix, disk, partition); + sprintf(device_name, "%s%ds%d", prefix, disk, partition); else - sprintf(device_name, "%s%u", prefix, disk); - bd->name = (char*) kalloc(strlen(device_name)); + sprintf(device_name, "%s%d", prefix, disk); + bd->name = (char*) kalloc(strlen(device_name) + 1); strcpy(bd->name, device_name); /* Get domain id of backend driver. */ @@ -238,7 +238,7 @@ void hyp_block_init(void) { grant = hyp_grant_give(domid, atop(addr), 0); /* and give it to backend. */ - i = sprintf(port_name, "%u", grant); + i = sprintf(port_name, "%d", grant); c = hyp_store_write(t, port_name, 5, VBD_PATH, "/", vbds[n], "/", "ring-ref"); if (!c) panic("%s: couldn't store ring reference (%s)", device_name, hyp_store_error); @@ -382,8 +382,8 @@ device_open (ipc_port_t reply_port, mach_msg_type_name_t reply_port_type, port = ipc_port_alloc_kernel(); if (port == IP_NULL) { - err = KERN_RESOURCE_SHORTAGE; - goto out; + device_close(bd); + return KERN_RESOURCE_SHORTAGE; } bd->port = port; @@ -396,7 +396,6 @@ device_open (ipc_port_t reply_port, mach_msg_type_name_t reply_port_type, ipc_port_nsrequest (bd->port, 1, notify, ¬ify); assert (notify == IP_NULL); -out: if (IP_VALID (reply_port)) ds_device_open_reply (reply_port, reply_port_type, D_SUCCESS, port); else @@ -670,7 +669,7 @@ device_write(void *d, ipc_port_t reply_port, hyp_grant_takeback(gref[j]); if (err) { - printf("error writing %d bytes at sector %d\n", count, bn); + printf("error writing %u bytes at sector %d\n", count, bn); break; } } |