# HG changeset patch
# User akw@xxxxxxxxxxx
# Node ID 7299065fac68a41644f2860b5a32ea29a19faa40
# Parent 7bfd8efb4fa7d2e2f90bd21af3407cd2fd28744a
Small blktap cleanups.
Signed-off-by: Andrew Warfield <andy@xxxxxxxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c | 8 ++++----
tools/blktap/drivers/block-aio.c | 2 +-
tools/blktap/drivers/block-qcow.c | 2 +-
tools/blktap/drivers/tapdisk.c | 1 +
tools/blktap/lib/xs_api.c | 21 ++++++++++++++-------
5 files changed, 21 insertions(+), 13 deletions(-)
diff -r 7bfd8efb4fa7 -r 7299065fac68
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c Tue Aug 29 14:34:57
2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c Tue Aug 29 15:55:24
2006 -0700
@@ -114,8 +114,8 @@ typedef struct domid_translate {
} domid_translate_t ;
-domid_translate_t translate_domid[MAX_TAP_DEV];
-tap_blkif_t *tapfds[MAX_TAP_DEV];
+static domid_translate_t translate_domid[MAX_TAP_DEV];
+static tap_blkif_t *tapfds[MAX_TAP_DEV];
static int __init set_blkif_reqs(char *str)
{
@@ -1118,7 +1118,7 @@ static int do_block_io_op(blkif_t *blkif
"ring does not exist!\n");
print_dbug = 0; /*We only print this message once*/
}
- return 1;
+ return 0;
}
info = tapfds[blkif->dev_num];
@@ -1127,7 +1127,7 @@ static int do_block_io_op(blkif_t *blkif
WPRINTK("Can't get UE info!\n");
print_dbug = 0;
}
- return 1;
+ return 0;
}
while (rc != rp) {
diff -r 7bfd8efb4fa7 -r 7299065fac68 tools/blktap/drivers/block-aio.c
--- a/tools/blktap/drivers/block-aio.c Tue Aug 29 14:34:57 2006 -0700
+++ b/tools/blktap/drivers/block-aio.c Tue Aug 29 15:55:24 2006 -0700
@@ -161,7 +161,7 @@ int tdaio_open (struct td_state *s, cons
"trying to concurrently use a large number "
"of blktap-based disks, you may need to "
"increase the system-wide aio request limit. "
- "(e.g. 'echo echo 1048576 > /proc/sys/"
+ "(e.g. 'echo echo 1048576 > /proc/sys/fs/"
"aio-max-nr')\n");
} else {
DPRINTF("Couldn't get fd for AIO poll support. This "
diff -r 7bfd8efb4fa7 -r 7299065fac68 tools/blktap/drivers/block-qcow.c
--- a/tools/blktap/drivers/block-qcow.c Tue Aug 29 14:34:57 2006 -0700
+++ b/tools/blktap/drivers/block-qcow.c Tue Aug 29 15:55:24 2006 -0700
@@ -182,7 +182,7 @@ static int init_aio_state(struct td_stat
"trying to concurrently use a large number "
"of blktap-based disks, you may need to "
"increase the system-wide aio request limit. "
- "(e.g. 'echo echo 1048576 > /proc/sys/"
+ "(e.g. 'echo echo 1048576 > /proc/sys/fs/"
"aio-max-nr')\n");
} else {
DPRINTF("Couldn't get fd for AIO poll support. This "
diff -r 7bfd8efb4fa7 -r 7299065fac68 tools/blktap/drivers/tapdisk.c
--- a/tools/blktap/drivers/tapdisk.c Tue Aug 29 14:34:57 2006 -0700
+++ b/tools/blktap/drivers/tapdisk.c Tue Aug 29 15:55:24 2006 -0700
@@ -110,6 +110,7 @@ static void unmap_disk(struct td_state *
free(s->fd_entry);
free(s->blkif);
free(s->ring_info);
+ free(s->private);
free(s);
return;
diff -r 7bfd8efb4fa7 -r 7299065fac68 tools/blktap/lib/xs_api.c
--- a/tools/blktap/lib/xs_api.c Tue Aug 29 14:34:57 2006 -0700
+++ b/tools/blktap/lib/xs_api.c Tue Aug 29 15:55:24 2006 -0700
@@ -204,7 +204,7 @@ int convert_dev_name_to_num(char *name)
int convert_dev_name_to_num(char *name) {
char *p_sd, *p_hd, *p_xvd, *p_plx, *p, *alpha,*ptr;
int majors[10] = {3,22,33,34,56,57,88,89,90,91};
- int maj,i;
+ int maj,i,ret = 0;
asprintf(&p_sd,"/dev/sd");
asprintf(&p_hd,"/dev/hd");
@@ -221,7 +221,7 @@ int convert_dev_name_to_num(char *name)
*ptr++;
}
*p++;
- return BASE_DEV_VAL + (16*i) + atoi(p);
+ ret = BASE_DEV_VAL + (16*i) + atoi(p);
} else if (strstr(name, p_hd) != NULL) {
p = name + strlen(p_hd);
for (i = 0, ptr = alpha; i < strlen(alpha); i++) {
@@ -229,7 +229,7 @@ int convert_dev_name_to_num(char *name)
*ptr++;
}
*p++;
- return (majors[i/2]*256) + atoi(p);
+ ret = (majors[i/2]*256) + atoi(p);
} else if (strstr(name, p_xvd) != NULL) {
p = name + strlen(p_xvd);
@@ -238,16 +238,23 @@ int convert_dev_name_to_num(char *name)
*ptr++;
}
*p++;
- return (202*256) + (16*i) + atoi(p);
+ ret = (202*256) + (16*i) + atoi(p);
} else if (strstr(name, p_plx) != NULL) {
p = name + strlen(p_plx);
- return atoi(p);
+ ret = atoi(p);
} else {
DPRINTF("Unknown device type, setting to default.\n");
- return BASE_DEV_VAL;
- }
+ ret = BASE_DEV_VAL;
+ }
+
+ free(p_sd);
+ free(p_hd);
+ free(p_xvd);
+ free(p_plx);
+ free(alpha);
+
return 0;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|