blktap: cleanups
PATCH 1/1 blktap: cleanups
Hi!
Attached patch brings in
- build fixes for OpenBSD
- sprintf() -> snprintf()
Signed-off-by Christoph Egger <[email protected]>
Signature · 12 lines
AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
tools/blktap/drivers/blktapctrl.c +2 -2
@@ -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 );
tools/blktap/drivers/bswap.h +6 -1
@@ -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
tools/blktap/lib/blktaplib.h +1 -0
@@ -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>
tools/blktap/lib/list.h +4 -0
@@ -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)
tools/blktap/lib/xs_api.c +3 -3
@@ -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 xschar 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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel