From: "Paolo 'Blaisorblade' Giarrusso" <blaisorblade@yahoo.it>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: Jeff Dike <jdike@addtoit.com>,
linux-kernel@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] [PATCH 5/6] uml: cleanup byte order macros for COW driver
Date: Sun, 09 Oct 2005 21:37:45 +0200 [thread overview]
Message-ID: <20051009193745.26019.3947.stgit@zion.home.lan> (raw)
In-Reply-To: <200510092118.21032.blaisorblade@yahoo.it>
From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
After restoring the existing code, make it work also when included in
kernelspace code (which isn't currently the case, but at least this will prevent
people from "fixing" it as just happened).
Whitespace is fixed in next patch - it cluttered the diff too much.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---
arch/um/drivers/cow.h | 27 ++++++++++++++++++++++++++-
arch/um/drivers/cow_user.c | 1 -
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h
--- a/arch/um/drivers/cow.h
+++ b/arch/um/drivers/cow.h
@@ -3,6 +3,26 @@
#include <asm/types.h>
+#if defined(__KERNEL__)
+
+# include <asm/byteorder.h>
+
+# if defined(__BIG_ENDIAN)
+# define ntohll(x) (x)
+# define htonll(x) (x)
+# elif defined(__LITTLE_ENDIAN)
+# define ntohll(x) be64_to_cpu(x)
+# define htonll(x) cpu_to_be64(x)
+# else
+# error "Could not determine byte order"
+# endif
+
+#else
+/* For the definition of ntohl, htonl and __BYTE_ORDER */
+#include <endian.h>
+#include <netinet/in.h>
+#if defined(__BYTE_ORDER)
+
#if __BYTE_ORDER == __BIG_ENDIAN
# define ntohll(x) (x)
# define htonll(x) (x)
@@ -10,8 +30,13 @@
# define ntohll(x) bswap_64(x)
# define htonll(x) bswap_64(x)
#else
-#error "__BYTE_ORDER not defined"
+# error "Could not determine byte order: __BYTE_ORDER uncorrectly defined"
+#endif
+
+#else /* ! defined(__BYTE_ORDER) */
+# error "Could not determine byte order: __BYTE_ORDER not defined"
#endif
+#endif /* ! defined(__KERNEL__) */
extern int init_cow_file(int fd, char *cow_file, char *backing_file,
int sectorsize, int alignment, int *bitmap_offset_out,
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -9,7 +9,6 @@
#include <sys/time.h>
#include <sys/param.h>
#include <sys/user.h>
-#include <netinet/in.h>
#include "os.h"
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2005-10-09 19:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-09 19:18 [uml-devel] Uml left showstopper bugs for 2.6.14 Blaisorblade
2005-10-09 19:37 ` [uml-devel] [PATCH 1/6] Uml: hide commands when not being verbose Paolo 'Blaisorblade' Giarrusso
2005-10-09 19:37 ` [uml-devel] [PATCH 2/6] uml: add mode=skas0 as a synonym of skas0 Paolo 'Blaisorblade' Giarrusso
2005-10-09 19:37 ` [uml-devel] [PATCH 3/6] uml: allow building .s/.i/.lst files from userspace files Paolo 'Blaisorblade' Giarrusso
2005-10-09 19:37 ` [uml-devel] [PATCH 4/6] uml: restore include breakage, breaking binary format of COW driver Paolo 'Blaisorblade' Giarrusso
2005-10-09 19:37 ` Paolo 'Blaisorblade' Giarrusso [this message]
2005-10-09 19:37 ` [uml-devel] [PATCH 6/6] uml: cleanup whitespace for " Paolo 'Blaisorblade' Giarrusso
2005-10-09 19:42 ` [uml-devel] Uml left showstopper bugs for 2.6.14 Blaisorblade
2005-11-02 21:44 ` Kai Tan
2005-11-02 22:47 ` Blaisorblade
2005-10-09 22:41 ` [uml-devel] " Jeff Dike
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=20051009193745.26019.3947.stgit@zion.home.lan \
--to=blaisorblade@yahoo.it \
--cc=akpm@osdl.org \
--cc=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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