From patchwork Mon Oct 18 18:24:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 68225 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 40987B70FF for ; Tue, 19 Oct 2010 05:07:28 +1100 (EST) Received: from localhost ([127.0.0.1]:53211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7u7J-0004pB-Ez for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2010 14:07:25 -0400 Received: from [140.186.70.92] (port=37026 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7u5Q-0004W0-6o for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:05:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7u5O-0005LV-Mr for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:05:27 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:39139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7u5O-0005Jc-Hc for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:05:26 -0400 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e34.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o9IHtZZV020707 for ; Mon, 18 Oct 2010 11:55:35 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o9II5Ew1095514 for ; Mon, 18 Oct 2010 12:05:14 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o9II5Ehk015847 for ; Mon, 18 Oct 2010 12:05:14 -0600 Received: from localhost.localdomain (elm9m80.beaverton.ibm.com [9.47.81.80]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o9II5Djn013998; Mon, 18 Oct 2010 12:05:13 -0600 From: "Venkateswararao Jujjuri (JV)" To: qemu-devel@nongnu.org Date: Mon, 18 Oct 2010 11:24:16 -0700 Message-Id: <1287426256-31862-1-git-send-email-jvrao@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.0.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: aliguori@us.ibm.com, "Venkateswararao Jujjuri \(JV\)" Subject: [Qemu-devel] [PATCH] [virtio-9p] Add support to v9fs_string_alloc_printf() for handling %lu. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Venkateswararao Jujjuri --- 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 3b2d49c..9575698 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -325,6 +325,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; @@ -342,6 +350,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, "%")) { @@ -367,6 +376,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);