* [PATCH][TOOLS] blktap: cleanups
@ 2007-12-04 13:09 Christoph Egger
0 siblings, 0 replies; only message in thread
From: Christoph Egger @ 2007-12-04 13:09 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 576 bytes --]
Hi!
Attached patch brings in
- build fixes for OpenBSD
- sprintf() -> snprintf()
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
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
[-- Attachment #2: tools_blktap.diff --]
[-- Type: text/plain, Size: 2933 bytes --]
diff -r 6706934cdf9d tools/blktap/drivers/blktapctrl.c
--- a/tools/blktap/drivers/blktapctrl.c Tue Dec 04 11:23:05 2007 +0000
+++ b/tools/blktap/drivers/blktapctrl.c Tue Dec 04 15:06:49 2007 +0100
@@ -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 6706934cdf9d tools/blktap/drivers/bswap.h
--- a/tools/blktap/drivers/bswap.h Tue Dec 04 11:23:05 2007 +0000
+++ b/tools/blktap/drivers/bswap.h Tue Dec 04 15:06:49 2007 +0100
@@ -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 6706934cdf9d tools/blktap/lib/blktaplib.h
--- a/tools/blktap/lib/blktaplib.h Tue Dec 04 11:23:05 2007 +0000
+++ b/tools/blktap/lib/blktaplib.h Tue Dec 04 15:06:49 2007 +0100
@@ -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 6706934cdf9d tools/blktap/lib/list.h
--- a/tools/blktap/lib/list.h Tue Dec 04 11:23:05 2007 +0000
+++ b/tools/blktap/lib/list.h Tue Dec 04 15:06:49 2007 +0100
@@ -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 6706934cdf9d tools/blktap/lib/xs_api.c
--- a/tools/blktap/lib/xs_api.c Tue Dec 04 11:23:05 2007 +0000
+++ b/tools/blktap/lib/xs_api.c Tue Dec 04 15:06:49 2007 +0100
@@ -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);
}
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-12-04 13:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-04 13:09 [PATCH][TOOLS] blktap: cleanups Christoph Egger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.