From patchwork Mon Jul 7 10:47:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 33143 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4F73920C88 for ; Mon, 7 Jul 2014 10:48:36 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id m5sf13282352qaj.10 for ; Mon, 07 Jul 2014 03:48:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type; bh=+KnNONoSGHpvS0qLse/gAssNVqyJaBpTaz6H/EhfQL0=; b=XLD1JY4n2HWsVNhG20xoonHoleItHWAKPoGD++Vr+54er6J0LvKqGrXO/gnct5ya7d 89K+TbrvW5A5WH8t3TTYGPUMxCF7lty52JlEn22zZgsoMBORowzTTmGxKQ3lzRXrjlDr 2NHk1iI1kWWz9Zc3OzlzqZr/IrSMCuQGWB/YI1YVaD70Q2+EOtBcAuWeBpFT2AoZzW7w f4cXRvVMHDf0Y7oB8o3uIZ1u3OQd4Tmph/e0+KIW6u2315jOGSOdRl1cbH82dD8DjUpl ScujgIzUQl3SMmCs13aGvoHgaf8OYKo+44AwxdNFTxAn49YuXdstlDqf8o2e0fFT/STu H2ww== X-Gm-Message-State: ALoCoQlaQHE7Q8E+oZLkxoDqUtZC+yd2zmSrUJjkDJcIRInkDwgc5CFojfcyOB8EW71yCSl04jpr X-Received: by 10.236.202.143 with SMTP id d15mr11780471yho.18.1404730116429; Mon, 07 Jul 2014 03:48:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.165 with SMTP id d34ls1716994qgd.25.gmail; Mon, 07 Jul 2014 03:48:36 -0700 (PDT) X-Received: by 10.58.49.98 with SMTP id t2mr12194656ven.29.1404730116051; Mon, 07 Jul 2014 03:48:36 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id py18si15472573vdb.2.2014.07.07.03.48.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Jul 2014 03:48:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.170 as permitted sender) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id i13so3891739veh.1 for ; Mon, 07 Jul 2014 03:48:36 -0700 (PDT) X-Received: by 10.58.18.144 with SMTP id w16mr1834764ved.50.1404730115966; Mon, 07 Jul 2014 03:48:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp656071vcb; Mon, 7 Jul 2014 03:48:35 -0700 (PDT) X-Received: by 10.140.25.112 with SMTP id 103mr714998qgs.95.1404730115567; Mon, 07 Jul 2014 03:48:35 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q6si11955952qan.104.2014.07.07.03.48.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 07 Jul 2014 03:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X46TL-00014e-5R for patch@linaro.org; Mon, 07 Jul 2014 06:48:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X46Si-0000ct-K0 for qemu-devel@nongnu.org; Mon, 07 Jul 2014 06:48:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X46Se-0006Fw-9n for qemu-devel@nongnu.org; Mon, 07 Jul 2014 06:47:56 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:25208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X46Se-0006Fo-55 for qemu-devel@nongnu.org; Mon, 07 Jul 2014 06:47:52 -0400 X-IronPort-AV: E=Sophos;i="5.01,617,1400025600"; d="scan'208";a="150408788" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 07 Jul 2014 10:47:51 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Mon, 7 Jul 2014 06:47:50 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1X46SX-0000aJ-OE; Mon, 07 Jul 2014 11:47:45 +0100 From: Stefano Stabellini To: Date: Mon, 7 Jul 2014 11:47:00 +0100 Message-ID: <1404730021-23411-1-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org, Stefano Stabellini Subject: [Qemu-devel] [PULL 1/2] xen_backend: introduce xenstore_read_uint64 and xenstore_read_fe_uint64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Stefano Stabellini Reviewed-by: Peter Maydell --- hw/xen/xen_backend.c | 18 ++++++++++++++++++ include/hw/xen/xen_backend.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index 3cd45b4..b2cb22b 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -111,6 +111,19 @@ int xenstore_read_int(const char *base, const char *node, int *ival) return rc; } +int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval) +{ + char *val; + int rc = -1; + + val = xenstore_read_str(base, node); + if (val && 1 == sscanf(val, "%"SCNu64, uval)) { + rc = 0; + } + g_free(val); + return rc; +} + int xenstore_write_be_str(struct XenDevice *xendev, const char *node, const char *val) { return xenstore_write_str(xendev->be, node, val); @@ -146,6 +159,11 @@ int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int *ival) return xenstore_read_int(xendev->fe, node, ival); } +int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node, uint64_t *uval) +{ + return xenstore_read_uint64(xendev->fe, node, uval); +} + /* ------------------------------------------------------------- */ const char *xenbus_strstate(enum xenbus_state state) diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h index 3b7d96d..3b4125e 100644 --- a/include/hw/xen/xen_backend.h +++ b/include/hw/xen/xen_backend.h @@ -74,6 +74,8 @@ char *xenstore_read_be_str(struct XenDevice *xendev, const char *node); int xenstore_read_be_int(struct XenDevice *xendev, const char *node, int *ival); char *xenstore_read_fe_str(struct XenDevice *xendev, const char *node); int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int *ival); +int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval); +int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node, uint64_t *uval); const char *xenbus_strstate(enum xenbus_state state); struct XenDevice *xen_be_find_xendev(const char *type, int dom, int dev);