WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: add printf attribute to libxl_xs_w

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: add printf attribute to libxl_xs_write and fixup resulting warnings
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 Jul 2010 06:05:59 -0700
Delivery-date: Fri, 16 Jul 2010 06:08:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1279121927 -3600
# Node ID 14961eb33aacf8efba6ae8dff944b702ff945e5b
# Parent  c18f43ed379e3d1c56145b491107e32b94cafa50
libxl: add printf attribute to libxl_xs_write and fixup resulting warnings

There is an unfortunate warning for the empty format string by default
which I workaround by adding -Wno-format-zero-length.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/Makefile         |    2 +-
 tools/libxl/libxl.c          |    8 ++++----
 tools/libxl/libxl_dom.c      |    6 +++---
 tools/libxl/libxl_internal.h |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff -r c18f43ed379e -r 14961eb33aac tools/libxl/Makefile
--- a/tools/libxl/Makefile      Wed Jul 14 16:36:47 2010 +0100
+++ b/tools/libxl/Makefile      Wed Jul 14 16:38:47 2010 +0100
@@ -11,7 +11,7 @@ XLUMAJOR = 1.0
 XLUMAJOR = 1.0
 XLUMINOR = 0
 
-CFLAGS += -Werror
+CFLAGS += -Werror -Wno-format-zero-length
 CFLAGS += -I. -fPIC
 CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) 
$(CFLAGS_libblktapctl)
 
diff -r c18f43ed379e -r 14961eb33aac tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Jul 14 16:36:47 2010 +0100
+++ b/tools/libxl/libxl.c       Wed Jul 14 16:38:47 2010 +0100
@@ -523,7 +523,7 @@ int libxl_domain_unpause(struct libxl_ct
         path = libxl_sprintf(ctx, "/local/domain/0/device-model/%d/state", 
domid);
         state = libxl_xs_read(ctx, XBT_NULL, path);
         if (state != NULL && !strcmp(state, "paused")) {
-            libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, 
"/local/domain/0/device-model/%d/command", domid), "continue", 
strlen("continue"));
+            libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, 
"/local/domain/0/device-model/%d/command", domid), "continue");
             libxl_wait_for_device_model(ctx, domid, "running", NULL, NULL);
         }
     }
@@ -2663,7 +2663,7 @@ int libxl_domain_setmaxmem(struct libxl_
     }
 
     if (domid != 0)
-        libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, 
"%s/memory/static-max", dompath), "%lu", max_memkb);
+        libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, 
"%s/memory/static-max", dompath), "%"PRIu32, max_memkb);
 
     return 0;
 }
@@ -2702,14 +2702,14 @@ int libxl_set_memory_target(struct libxl
     videoram_s = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, 
"%s/memory/videoram", dompath));
     videoram = videoram_s ? atoi(videoram_s) : 0;
 
-    libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/memory/target", 
dompath), "%lu", target_memkb);
+    libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/memory/target", 
dompath), "%"PRIu32, target_memkb);
 
     rc = xc_domain_getinfolist(ctx->xch, domid, 1, &info);
     if (rc != 1 || info.domain != domid)
         return rc;
     xcinfo2xlinfo(&info, &ptr);
     uuid = libxl_uuid2string(ctx, ptr.uuid);
-    libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, "/vm/%s/memory", uuid), 
"%lu", target_memkb / 1024);
+    libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, "/vm/%s/memory", uuid), 
"%"PRIu32, target_memkb / 1024);
 
     if (enforce || !domid)
         memorykb = target_memkb;
diff -r c18f43ed379e -r 14961eb33aac tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Wed Jul 14 16:36:47 2010 +0100
+++ b/tools/libxl/libxl_dom.c   Wed Jul 14 16:38:47 2010 +0100
@@ -247,7 +247,7 @@ static int core_suspend_callback(void *d
         return 1;
     }
     path = libxl_sprintf(si->ctx, "%s/control/shutdown", 
libxl_xs_get_dompath(si->ctx, si->domid));
-    libxl_xs_write(si->ctx, XBT_NULL, path, "suspend", strlen("suspend"));
+    libxl_xs_write(si->ctx, XBT_NULL, path, "suspend");
     if (si->hvm) {
         unsigned long hvm_pvdrv, hvm_s_state;
         xc_get_hvm_param(si->ctx->xch, si->domid, HVM_PARAM_CALLBACK_IRQ, 
&hvm_pvdrv);
@@ -275,7 +275,7 @@ static int core_suspend_callback(void *d
     }
     if (!strcmp(state, "suspend")) {
         XL_LOG(si->ctx, XL_LOG_ERROR, "guest didn't suspend in time");
-        libxl_xs_write(si->ctx, XBT_NULL, path, "", 1);
+        libxl_xs_write(si->ctx, XBT_NULL, path, "");
     }
     return 1;
 }
@@ -338,7 +338,7 @@ int save_device_model(struct libxl_ctx *
     char *filename = libxl_sprintf(ctx, "/var/lib/xen/qemu-save.%d", domid);
 
     XL_LOG(ctx, XL_LOG_DEBUG, "Saving device model state to %s", filename);
-    libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, 
"/local/domain/0/device-model/%d/command", domid), "save", strlen("save"));
+    libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, 
"/local/domain/0/device-model/%d/command", domid), "save");
     libxl_wait_for_device_model(ctx, domid, "paused", NULL, NULL);
 
     c = libxl_write_exactly(ctx, fd, QEMU_SIGNATURE, strlen(QEMU_SIGNATURE),
diff -r c18f43ed379e -r 14961eb33aac tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Wed Jul 14 16:36:47 2010 +0100
+++ b/tools/libxl/libxl_internal.h      Wed Jul 14 16:38:47 2010 +0100
@@ -117,7 +117,7 @@ int libxl_xs_writev(struct libxl_ctx *ct
 int libxl_xs_writev(struct libxl_ctx *ctx, xs_transaction_t t,
                     char *dir, char **kvs);
 int libxl_xs_write(struct libxl_ctx *ctx, xs_transaction_t t,
-                   char *path, char *fmt, ...);
+                   char *path, char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
 char *libxl_xs_get_dompath(struct libxl_ctx *ctx, uint32_t domid); // logs errs
 char *libxl_xs_read(struct libxl_ctx *ctx, xs_transaction_t t, char *path);
 char **libxl_xs_directory(struct libxl_ctx *ctx, xs_transaction_t t, char 
*path, unsigned int *nb);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: add printf attribute to libxl_xs_write and fixup resulting warnings, Xen patchbot-unstable <=