From: "Christoph Egger" <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH][TOOLS] blktap: cleanups
Date: Tue, 4 Dec 2007 14:09:25 +0100 [thread overview]
Message-ID: <200712041409.26091.Christoph.Egger@amd.com> (raw)
[-- 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
reply other threads:[~2007-12-04 13:09 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=200712041409.26091.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--cc=xen-devel@lists.xensource.com \
/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 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.