diff options
author | Venkateswararao Jujjuri (JV) | 2010-10-07 02:09:42 +0200 |
---|---|---|
committer | Anthony Liguori | 2010-10-20 19:10:59 +0200 |
commit | 45b23ff8f05d8f145d680476dd08e7f444cef547 (patch) | |
tree | c05c6a1b3ea64ed5271a87087a09fb78dad39c48 | |
parent | [virtio-9p] Use preadv/pwritev instead of readv/writev (diff) | |
download | qemu-45b23ff8f05d8f145d680476dd08e7f444cef547.tar.gz qemu-45b23ff8f05d8f145d680476dd08e7f444cef547.tar.xz qemu-45b23ff8f05d8f145d680476dd08e7f444cef547.zip |
[virtio-9p] Add support to v9fs_string_alloc_printf() for handling %lu.
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
-rw-r--r-- | hw/virtio-9p.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index 0e8772257b..daade77ed9 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -321,6 +321,14 @@ static int number_to_string(void *arg, char type) } while (num); break; } + case 'U': { + unsigned long num = *(unsigned long *)arg; + do { + ret++; + num = num/10; + } while (num); + break; + } default: printf("Number_to_string: Unknown number format\n"); return -1; @@ -338,6 +346,7 @@ v9fs_string_alloc_printf(char **strp, const char *fmt, va_list ap) int nr_args = 0; char *arg_char_ptr; unsigned int arg_uint; + unsigned long arg_ulong; /* Find the number of %'s that denotes an argument */ for (iter = strstr(iter, "%"); iter; iter = strstr(iter, "%")) { @@ -363,6 +372,14 @@ v9fs_string_alloc_printf(char **strp, const char *fmt, va_list ap) arg_uint = va_arg(ap2, unsigned int); len += number_to_string((void *)&arg_uint, 'u'); break; + case 'l': + if (*++iter == 'u') { + arg_ulong = va_arg(ap2, unsigned long); + len += number_to_string((void *)&arg_ulong, 'U'); + } else { + return -1; + } + break; case 's': arg_char_ptr = va_arg(ap2, char *); len += strlen(arg_char_ptr); |