This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: STABLE3 - mount.gfs2: Move the endian functions out ofgfs_ondisk.h


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f5f0079dd4dce09e64cbfb254c09c899868bea46
Commit:        f5f0079dd4dce09e64cbfb254c09c899868bea46
Parent:        d3cb3ed1d76f43423b74694a3a4b13dbb80fa6a2
Author:        Steven Whitehouse <swhiteho@redhat.com>
AuthorDate:    Thu Feb 19 08:33:09 2009 +0000
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Thu Feb 19 10:59:59 2009 +0100

mount.gfs2: Move the endian functions out of gfs_ondisk.h

Its only required in two files, so I've moved it into those
directly.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
 gfs/gfs_fsck/ondisk.h |   43 -------------------------------------------
 gfs2/mount/ondisk1.c  |   42 ++++++++++++++++++++++++++++++++++++++++++
 gfs2/mount/util.c     |   42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+), 43 deletions(-)

diff --git a/gfs/gfs_fsck/ondisk.h b/gfs/gfs_fsck/ondisk.h
index 0056132..01875c0 100644
--- a/gfs/gfs_fsck/ondisk.h
+++ b/gfs/gfs_fsck/ondisk.h
@@ -80,49 +80,6 @@
 #ifndef __GFS_ONDISK_DOT_H__
 #define __GFS_ONDISK_DOT_H__
 
-#include <endian.h>
-#include <byteswap.h>
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
-#define be64_to_cpu(x) (x)
-
-#define cpu_to_be16(x) (x)
-#define cpu_to_be32(x) (x)
-#define cpu_to_be64(x) (x)
-
-#define le16_to_cpu(x) (bswap_16((x)))
-#define le32_to_cpu(x) (bswap_32((x)))
-#define le64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_le16(x) (bswap_16((x)))
-#define cpu_to_le32(x) (bswap_32((x)))
-#define cpu_to_le64(x) (bswap_64((x)))
-
-#endif  /*  __BYTE_ORDER == __BIG_ENDIAN  */
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define be16_to_cpu(x) (bswap_16((x)))
-#define be32_to_cpu(x) (bswap_32((x)))
-#define be64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_be16(x) (bswap_16((x)))
-#define cpu_to_be32(x) (bswap_32((x)))
-#define cpu_to_be64(x) (bswap_64((x))) 
-
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
-
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
-
-#endif  /*  __BYTE_ORDER == __LITTLE_ENDIAN  */
-
 #define GFS_MAGIC               (0x01161970) /* for all on-disk headers */
 #define GFS_BASIC_BLOCK         (512)  /* "basic block" = "sector" = 512B */
 #define GFS_BASIC_BLOCK_SHIFT   (9)
diff --git a/gfs2/mount/ondisk1.c b/gfs2/mount/ondisk1.c
index 846a702..8b3d2c4 100644
--- a/gfs2/mount/ondisk1.c
+++ b/gfs2/mount/ondisk1.c
@@ -3,6 +3,8 @@
 #include <string.h>
 #include <stdint.h>
 #include <inttypes.h>
+#include <endian.h>
+#include <byteswap.h>
 
 #define printk printf
 #define pv(struct, member, fmt) printf("  "#member" = "fmt"\n", struct->member);
@@ -12,6 +14,46 @@
 #define RET(x) return
 #define RETURN(x, y) return y
 
+#if __BYTE_ORDER == __BIG_ENDIAN
+
+#define be16_to_cpu(x) (x)
+#define be32_to_cpu(x) (x)
+#define be64_to_cpu(x) (x)
+
+#define cpu_to_be16(x) (x)
+#define cpu_to_be32(x) (x)
+#define cpu_to_be64(x) (x)
+
+#define le16_to_cpu(x) (bswap_16((x)))
+#define le32_to_cpu(x) (bswap_32((x)))
+#define le64_to_cpu(x) (bswap_64((x)))
+
+#define cpu_to_le16(x) (bswap_16((x)))
+#define cpu_to_le32(x) (bswap_32((x)))
+#define cpu_to_le64(x) (bswap_64((x)))
+
+#endif  /*  __BYTE_ORDER == __BIG_ENDIAN  */
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+#define be16_to_cpu(x) (bswap_16((x)))
+#define be32_to_cpu(x) (bswap_32((x)))
+#define be64_to_cpu(x) (bswap_64((x)))
+
+#define cpu_to_be16(x) (bswap_16((x)))
+#define cpu_to_be32(x) (bswap_32((x)))
+#define cpu_to_be64(x) (bswap_64((x))) 
+
+#define le16_to_cpu(x) (x)
+#define le32_to_cpu(x) (x)
+#define le64_to_cpu(x) (x)
+
+#define cpu_to_le16(x) (x)
+#define cpu_to_le32(x) (x)
+#define cpu_to_le64(x) (x)
+
+#endif  /*  __BYTE_ORDER == __LITTLE_ENDIAN  */
+
 #define WANT_GFS_CONVERSION_FUNCTIONS
 #include "gfs_ondisk.h"
 
diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c
index cbe2a3a..ca48fe9 100644
--- a/gfs2/mount/util.c
+++ b/gfs2/mount/util.c
@@ -1,6 +1,48 @@
+#include <endian.h>
+#include <byteswap.h>
 #include "util.h"
 #include "libgfscontrol.h"
 
+#if __BYTE_ORDER == __BIG_ENDIAN
+
+#define be16_to_cpu(x) (x)
+#define be32_to_cpu(x) (x)
+#define be64_to_cpu(x) (x)
+
+#define cpu_to_be16(x) (x)
+#define cpu_to_be32(x) (x)
+#define cpu_to_be64(x) (x)
+
+#define le16_to_cpu(x) (bswap_16((x)))
+#define le32_to_cpu(x) (bswap_32((x)))
+#define le64_to_cpu(x) (bswap_64((x)))
+
+#define cpu_to_le16(x) (bswap_16((x)))
+#define cpu_to_le32(x) (bswap_32((x)))
+#define cpu_to_le64(x) (bswap_64((x)))
+
+#endif  /*  __BYTE_ORDER == __BIG_ENDIAN  */
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+#define be16_to_cpu(x) (bswap_16((x)))
+#define be32_to_cpu(x) (bswap_32((x)))
+#define be64_to_cpu(x) (bswap_64((x)))
+
+#define cpu_to_be16(x) (bswap_16((x)))
+#define cpu_to_be32(x) (bswap_32((x)))
+#define cpu_to_be64(x) (bswap_64((x))) 
+
+#define le16_to_cpu(x) (x)
+#define le32_to_cpu(x) (x)
+#define le64_to_cpu(x) (x)
+
+#define cpu_to_le16(x) (x)
+#define cpu_to_le32(x) (x)
+#define cpu_to_le64(x) (x)
+
+#endif  /*  __BYTE_ORDER == __LITTLE_ENDIAN  */
+
 extern char *prog_name;
 extern char *fsname;
 extern int verbose;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]