From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: qemu-devel@nongnu.org
Cc: anthony.perard@citrix.com, xen-devel@lists.xensource.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PATCH v2 1/2] xen_backend: introduce xenstore_read_uint64 and xenstore_read_fe_uint64
Date: Wed, 18 Dec 2013 19:17:31 +0000 [thread overview]
Message-ID: <1387394252-9676-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1312181913120.8667@kaball.uk.xensource.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
Changes in v2:
- use SCNu64 instead of PRIu64 with sscanf.
---
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 197795f..c1d7ae5 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -112,6 +112,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);
@@ -147,6 +160,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);
--
1.7.10.4
next prev parent reply other threads:[~2013-12-18 19:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 19:15 [Qemu-devel] [PATCH v2 0/2] build QEMU with Xen support on ARM Stefano Stabellini
2013-12-18 19:17 ` Stefano Stabellini [this message]
2013-12-18 19:17 ` [Qemu-devel] [PATCH v2 2/2] xen: build " Stefano Stabellini
2013-12-18 21:22 ` [Qemu-devel] [Xen-devel] [PATCH v2 0/2] build QEMU with Xen support " Konrad Rzeszutek Wilk
2013-12-20 7:25 ` Fabio Fantoni
2014-01-03 12:55 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387394252-9676-1-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=anthony.perard@citrix.com \
--cc=qemu-devel@nongnu.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).