[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] blktap: cleanups for *BSD.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1196848763 0 # Node ID 1b863ae2bf1e24656b723cd502c807d2c4bafe74 # Parent eb4aa1a07e21f252841a45030574af460a7b5a9c blktap: cleanups for *BSD. Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx> --- tools/blktap/drivers/blktapctrl.c | 4 ++-- tools/blktap/drivers/bswap.h | 7 ++++++- tools/blktap/lib/blktaplib.h | 1 + tools/blktap/lib/list.h | 4 ++++ tools/blktap/lib/xs_api.c | 6 +++--- 5 files changed, 16 insertions(+), 6 deletions(-) diff -r eb4aa1a07e21 -r 1b863ae2bf1e tools/blktap/drivers/blktapctrl.c --- a/tools/blktap/drivers/blktapctrl.c Wed Dec 05 09:57:32 2007 +0000 +++ b/tools/blktap/drivers/blktapctrl.c Wed Dec 05 09:59:23 2007 +0000 @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> -#include <sys/user.h> +#include <sys/stat.h> #include <err.h> #include <errno.h> #include <sys/types.h> @@ -684,7 +684,7 @@ static void write_pidfile(long pid) exit(1); } - len = sprintf(buf, "%ld\n", pid); + len = snprintf(buf, sizeof(buf), "%ld\n", pid); if (write(fd, buf, len) != len) { DPRINTF("Writing pid file failed (%d)\n", errno); exit(1); diff -r eb4aa1a07e21 -r 1b863ae2bf1e tools/blktap/drivers/bswap.h --- a/tools/blktap/drivers/bswap.h Wed Dec 05 09:57:32 2007 +0000 +++ b/tools/blktap/drivers/bswap.h Wed Dec 05 09:59:23 2007 +0000 @@ -5,9 +5,14 @@ #include <inttypes.h> -#if defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) #include <sys/endian.h> #include <sys/types.h> +#elif defined(__OpenBSD__) +#include <machine/endian.h> +#define bswap_16(x) swap16(x) +#define bswap_32(x) swap32(x) +#define bswap_64(x) swap64(x) #else #ifdef HAVE_BYTESWAP_H diff -r eb4aa1a07e21 -r 1b863ae2bf1e tools/blktap/lib/blktaplib.h --- a/tools/blktap/lib/blktaplib.h Wed Dec 05 09:57:32 2007 +0000 +++ b/tools/blktap/lib/blktaplib.h Wed Dec 05 09:59:23 2007 +0000 @@ -33,6 +33,7 @@ #define __BLKTAPLIB_H__ #include <xenctrl.h> +#include <sys/param.h> #include <sys/user.h> #include <xen/xen.h> #include <xen/io/blkif.h> diff -r eb4aa1a07e21 -r 1b863ae2bf1e tools/blktap/lib/list.h --- a/tools/blktap/lib/list.h Wed Dec 05 09:57:32 2007 +0000 +++ b/tools/blktap/lib/list.h Wed Dec 05 09:59:23 2007 +0000 @@ -7,6 +7,10 @@ #ifndef __LIST_H__ #define __LIST_H__ + +#ifdef LIST_HEAD +#undef LIST_HEAD +#endif #define LIST_POISON1 ((void *) 0x00100100) #define LIST_POISON2 ((void *) 0x00200200) diff -r eb4aa1a07e21 -r 1b863ae2bf1e tools/blktap/lib/xs_api.c --- a/tools/blktap/lib/xs_api.c Wed Dec 05 09:57:32 2007 +0000 +++ b/tools/blktap/lib/xs_api.c Wed Dec 05 09:59:23 2007 +0000 @@ -282,7 +282,7 @@ int register_xenbus_watch(struct xs_hand /* Pointer in ascii is the token. */ char token[sizeof(watch) * 2 + 1]; - sprintf(token, "%lX", (long)watch); + snprintf(token, sizeof(token), "%lX", (long)watch); if (find_watch(token)) { DPRINTF("watch collision!\n"); return -EINVAL; @@ -302,7 +302,7 @@ int unregister_xenbus_watch(struct xs_ha { char token[sizeof(watch) * 2 + 1]; - sprintf(token, "%lX", (long)watch); + snprintf(token, sizeof(token), "%lX", (long)watch); if (!find_watch(token)) { DPRINTF("no such watch!\n"); return -EINVAL; @@ -326,7 +326,7 @@ void reregister_xenbus_watches(struct xs char token[sizeof(watch) * 2 + 1]; list_for_each_entry(watch, &watches, list) { - sprintf(token, "%lX", (long)watch); + snprintf(token, sizeof(token), "%lX", (long)watch); xs_watch(h, watch->node, token); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |