[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] Introduce 64 bit integer write interface to xenstore



commit 2b4260da6d510def4067cc06c439c88a457d016e
Author:     Felipe Franciosi <felipe.franciosi@xxxxxxxxxx>
AuthorDate: Fri Apr 5 15:37:32 2013 +0000
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
CommitDate: Fri Apr 5 23:31:34 2013 +0000

    Introduce 64 bit integer write interface to xenstore
    
    The current implementation of xen_backend only provides 32 bit integer
    functions to write to xenstore. This patch adds two functions that
    allow writing 64 bit integers (one generic function and another for
    the backend only).
    
    This patch also fixes the size of the char arrays used to represent
    these integers as strings (originally 32 bytes, however no more than
    12 bytes are needed for 32 bit integers and no more than 21 bytes are
    needed for 64 bit integers).
    
    upstream-commit-id: 10bb3c623478117aee5117c312736f10833decc2
    
    Signed-off-by: Felipe Franciosi <felipe@xxxxxxxxxxxx>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 hw/xen_backend.c |   15 ++++++++++++++-
 hw/xen_backend.h |    2 ++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index f83a1e1..008cdb3 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -85,12 +85,20 @@ char *xenstore_read_str(const char *base, const char *node)
 
 int xenstore_write_int(const char *base, const char *node, int ival)
 {
-    char val[32];
+    char val[12];
 
     snprintf(val, sizeof(val), "%d", ival);
     return xenstore_write_str(base, node, val);
 }
 
+int xenstore_write_int64(const char *base, const char *node, int64_t ival)
+{
+    char val[21];
+
+    snprintf(val, sizeof(val), "%"PRId64, ival);
+    return xenstore_write_str(base, node, val);
+}
+
 int xenstore_read_int(const char *base, const char *node, int *ival)
 {
     char *val;
@@ -114,6 +122,11 @@ int xenstore_write_be_int(struct XenDevice *xendev, const 
char *node, int ival)
     return xenstore_write_int(xendev->be, node, ival);
 }
 
+int xenstore_write_be_int64(struct XenDevice *xendev, const char *node, 
int64_t ival)
+{
+    return xenstore_write_int64(xendev->be, node, ival);
+}
+
 char *xenstore_read_be_str(struct XenDevice *xendev, const char *node)
 {
     return xenstore_read_str(xendev->be, node);
diff --git a/hw/xen_backend.h b/hw/xen_backend.h
index fea86dd..7b3b09d 100644
--- a/hw/xen_backend.h
+++ b/hw/xen_backend.h
@@ -64,11 +64,13 @@ extern const char *xen_protocol;
 /* xenstore helper functions */
 int xenstore_write_str(const char *base, const char *node, const char *val);
 int xenstore_write_int(const char *base, const char *node, int ival);
+int xenstore_write_int64(const char *base, const char *node, int64_t ival);
 char *xenstore_read_str(const char *base, const char *node);
 int xenstore_read_int(const char *base, const char *node, int *ival);
 
 int xenstore_write_be_str(struct XenDevice *xendev, const char *node, const 
char *val);
 int xenstore_write_be_int(struct XenDevice *xendev, const char *node, int 
ival);
+int xenstore_write_be_int64(struct XenDevice *xendev, const char *node, 
int64_t ival);
 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);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.