From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Campbell <Ian.Campbell@citrix.com>
Subject: [PATCH] tools/libxc: Annotate xc_osdep_log with __attribute__((format))
Date: Tue, 3 Jun 2014 18:33:23 +0100 [thread overview]
Message-ID: <1401816803-29559-1-git-send-email-andrew.cooper3@citrix.com> (raw)
This helps the compiler spot printf formatting errors.
Provide (void*) casts for the xc_osdev_handle in xenctrl_osdep_ENOSYS to
satisfy the %p formatting in the error messages.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
tools/libxc/xenctrl_osdep_ENOSYS.c | 30 +++++++++++++++---------------
tools/libxc/xenctrlosdep.h | 3 ++-
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/tools/libxc/xenctrl_osdep_ENOSYS.c b/tools/libxc/xenctrl_osdep_ENOSYS.c
index 4821342..fada26c 100644
--- a/tools/libxc/xenctrl_osdep_ENOSYS.c
+++ b/tools/libxc/xenctrl_osdep_ENOSYS.c
@@ -21,14 +21,14 @@ static xc_osdep_handle ENOSYS_privcmd_open(xc_interface *xch)
static int ENOSYS_privcmd_close(xc_interface *xch, xc_osdep_handle h)
{
- IPRINTF(xch, "ENOSYS_privcmd: closing handle %p\n", h);
+ IPRINTF(xch, "ENOSYS_privcmd: closing handle %p\n", (void*)h);
return 0;
}
static int ENOSYS_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall)
{
IPRINTF(xch, "ENOSYS_privcmd %p: hypercall: %02lld(%#llx,%#llx,%#llx,%#llx,%#llx)\n",
- h, hypercall->op,
+ (void*)h, hypercall->op,
hypercall->arg[0], hypercall->arg[1], hypercall->arg[2],
hypercall->arg[3], hypercall->arg[4]);
return -ENOSYS;
@@ -37,21 +37,21 @@ static int ENOSYS_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcm
static void *ENOSYS_privcmd_map_foreign_batch(xc_interface *xch, xc_osdep_handle h, uint32_t dom, int prot,
xen_pfn_t *arr, int num)
{
- IPRINTF(xch, "ENOSYS_privcmd %p: map_foreign_batch: dom%d prot %#x arr %p num %d\n", h, dom, prot, arr, num);
+ IPRINTF(xch, "ENOSYS_privcmd %p: map_foreign_batch: dom%d prot %#x arr %p num %d\n", (void*)h, dom, prot, arr, num);
return MAP_FAILED;
}
static void *ENOSYS_privcmd_map_foreign_bulk(xc_interface *xch, xc_osdep_handle h, uint32_t dom, int prot,
const xen_pfn_t *arr, int *err, unsigned int num)
{
- IPRINTF(xch, "ENOSYS_privcmd %p: map_foreign_buld: dom%d prot %#x arr %p err %p num %d\n", h, dom, prot, arr, err, num);
+ IPRINTF(xch, "ENOSYS_privcmd %p: map_foreign_buld: dom%d prot %#x arr %p err %p num %d\n", (void*)h, dom, prot, arr, err, num);
return MAP_FAILED;
}
static void *ENOSYS_privcmd_map_foreign_range(xc_interface *xch, xc_osdep_handle h, uint32_t dom, int size, int prot,
unsigned long mfn)
{
- IPRINTF(xch, "ENOSYS_privcmd %p: map_foreign_range: dom%d size %#x prot %#x mfn %ld\n", h, dom, size, prot, mfn);
+ IPRINTF(xch, "ENOSYS_privcmd %p: map_foreign_range: dom%d size %#x prot %#x mfn %ld\n", (void*)h, dom, size, prot, mfn);
return MAP_FAILED;
}
@@ -59,7 +59,7 @@ static void *ENOSYS_privcmd_map_foreign_ranges(xc_interface *xch, xc_osdep_handl
size_t chunksize, privcmd_mmap_entry_t entries[],
int nentries)
{
- IPRINTF(xch, "ENOSYS_privcmd %p: map_foreign_ranges: dom%d size %zd prot %#x chunksize %zd entries %p num %d\n", h, dom, size, prot, chunksize, entries, nentries);
+ IPRINTF(xch, "ENOSYS_privcmd %p: map_foreign_ranges: dom%d size %zd prot %#x chunksize %zd entries %p num %d\n", (void*)h, dom, size, prot, chunksize, entries, nentries);
return MAP_FAILED;
}
@@ -85,59 +85,59 @@ static xc_osdep_handle ENOSYS_evtchn_open(xc_interface *xce)
static int ENOSYS_evtchn_close(xc_interface *xce, xc_osdep_handle h)
{
- IPRINTF(xce, "ENOSYS_evtchn: closing handle %p\n", h);
+ IPRINTF(xce, "ENOSYS_evtchn: closing handle %p\n", (void*)h);
return 0;
}
static int ENOSYS_evtchn_fd(xc_interface *xce, xc_osdep_handle h)
{
- IPRINTF(xce, "ENOSYS_fd %p: fd\n", h);
+ IPRINTF(xce, "ENOSYS_fd %p: fd\n", (void*)h);
return (int)h;
}
static int ENOSYS_evtchn_notify(xc_interface *xce, xc_osdep_handle h, evtchn_port_t port)
{
- IPRINTF(xce, "ENOSYS_evtchn %p: notify: %d\n", h, port);
+ IPRINTF(xce, "ENOSYS_evtchn %p: notify: %d\n", (void*)h, port);
return -ENOSYS;
}
static int ENOSYS_evtchn_bind_unbound_port(xc_interface *xce, xc_osdep_handle h, int domid)
{
- IPRINTF(xce, "ENOSYS_evtchn %p: bind_unbound_port: dom%d\n", h, domid);
+ IPRINTF(xce, "ENOSYS_evtchn %p: bind_unbound_port: dom%d\n", (void*)h, domid);
return -ENOSYS;
}
static int ENOSYS_evtchn_bind_interdomain(xc_interface *xce, xc_osdep_handle h, int domid, evtchn_port_t remote_port)
{
- IPRINTF(xce, "ENOSYS_evtchn %p: bind_interdomain: dmo%d %d\n", h, domid, remote_port);
+ IPRINTF(xce, "ENOSYS_evtchn %p: bind_interdomain: dmo%d %d\n", (void*)h, domid, remote_port);
return -ENOSYS;
}
static int ENOSYS_evtchn_bind_virq(xc_interface *xce, xc_osdep_handle h, unsigned int virq)
{
- IPRINTF(xce, "ENOSYS_evtchn %p: bind_virq: %d\n", h, virq);
+ IPRINTF(xce, "ENOSYS_evtchn %p: bind_virq: %d\n", (void*)h, virq);
return -ENOSYS;
}
static int ENOSYS_evtchn_unbind(xc_interface *xce, xc_osdep_handle h, evtchn_port_t port)
{
- IPRINTF(xce, "ENOSYS_evtchn %p: unbind: %d\n", h, port);
+ IPRINTF(xce, "ENOSYS_evtchn %p: unbind: %d\n", (void*)h, port);
return -ENOSYS;
}
static evtchn_port_or_error_t ENOSYS_evtchn_pending(xc_interface *xce, xc_osdep_handle h)
{
- IPRINTF(xce, "ENOSYS_evtchn %p: pending\n", h);
+ IPRINTF(xce, "ENOSYS_evtchn %p: pending\n", (void*)h);
return -ENOSYS;
}
static int ENOSYS_evtchn_unmask(xc_interface *xce, xc_osdep_handle h, evtchn_port_t port)
{
- IPRINTF(xce, "ENOSYS_evtchn %p: unmask: %d\n", h, port);
+ IPRINTF(xce, "ENOSYS_evtchn %p: unmask: %d\n", (void*)h, port);
return -ENOSYS;
}
diff --git a/tools/libxc/xenctrlosdep.h b/tools/libxc/xenctrlosdep.h
index e610a24..e97944b 100644
--- a/tools/libxc/xenctrlosdep.h
+++ b/tools/libxc/xenctrlosdep.h
@@ -157,7 +157,8 @@ void *xc_map_foreign_bulk_compat(xc_interface *xch, xc_osdep_handle h,
const xen_pfn_t *arr, int *err, unsigned int num);
/* Report errors through xc_interface */
-void xc_osdep_log(xc_interface *xch, xentoollog_level level, int code, const char *fmt, ...);
+void xc_osdep_log(xc_interface *xch, xentoollog_level level, int code,
+ const char *fmt, ...) __attribute__((format(printf, 4, 5)));
#endif
--
1.7.10.4
reply other threads:[~2014-06-03 17:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1401816803-29559-1-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/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).