[Ocfs-tools-commits]
jlbec commits r199 - in trunk/ocfs2: debugfs.ocfs2 libocfs2
libocfs2/include mkfs.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Aug 12 14:58:55 CDT 2004
Author: jlbec
Date: 2004-08-12 13:58:53 -0500 (Thu, 12 Aug 2004)
New Revision: 199
Modified:
trunk/ocfs2/debugfs.ocfs2/
trunk/ocfs2/libocfs2/include/byteorder.h
trunk/ocfs2/libocfs2/mkjournal.c
trunk/ocfs2/mkfs.ocfs2/
trunk/ocfs2/mkfs.ocfs2/Makefile
trunk/ocfs2/mkfs.ocfs2/mkfs.c
Log:
o Added a proper byteorder.h so folks will be happy.
Property changes on: trunk/ocfs2/debugfs.ocfs2
___________________________________________________________________
Name: svn:ignore
- cscope.out
debugfs.ocfs2
cscope.files
.*.sw?
+ cscope.out
debugfs.ocfs2
cscope.files
.*.sw?
debugfs.ocfs2.8
Modified: trunk/ocfs2/libocfs2/include/byteorder.h
===================================================================
--- trunk/ocfs2/libocfs2/include/byteorder.h 2004-08-10 00:59:43 UTC (rev 198)
+++ trunk/ocfs2/libocfs2/include/byteorder.h 2004-08-12 18:58:53 UTC (rev 199)
@@ -27,13 +27,94 @@
#ifndef _BYTEORDER_H
#define _BYTEORDER_H
+
+#include <endian.h>
+#include <byteswap.h>
+#include <stdint.h>
+
/*
- * This is a hack, using the kernel parts, until we get something
- * stable in userspace....unless everyone is happy with this??
+ * All OCFS2 on-disk values are in little endian, except for the
+ * autoconfig areas and the journal areas. The journal code has the
+ * right bits for itself, and the autoconfig areas use htonl(), so
+ * they are OK.
*/
-#define __KERNEL__
-#include <asm/byteorder.h>
-#undef __KERNEL__
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# ifndef cpu_to_le16
+# define cpu_to_le16(x) ((uint16_t)(x))
+# endif
+# ifndef le16_to_cpu
+# define le16_to_cpu(x) ((uint16_t)(x))
+# endif
+# ifndef cpu_to_le32
+# define cpu_to_le32(x) ((uint32_t)(x))
+# endif
+# ifndef le32_to_cpu
+# define le32_to_cpu(x) ((uint32_t)(x))
+# endif
+# ifndef cpu_to_le64
+# define cpu_to_le64(x) ((uint64_t)(x))
+# endif
+# ifndef le64_to_cpu
+# define le64_to_cpu(x) ((uint64_t)(x))
+# endif
+# ifndef cpu_to_be16
+# define cpu_to_be16(x) ((uint16_t)bswap_16(x))
+# endif
+# ifndef be16_to_cpu
+# define be16_to_cpu(x) ((uint16_t)bswap_16(x))
+# endif
+# ifndef cpu_to_be32
+# define cpu_to_be32(x) ((uint32_t)bswap_32(x))
+# endif
+# ifndef be32_to_cpu
+# define be32_to_cpu(x) ((uint32_t)bswap_32(x))
+# endif
+# ifndef cpu_to_be64
+# define cpu_to_be64(x) ((uint64_t)bswap_64(x))
+# endif
+# ifndef be64_to_cpu
+# define be64_to_cpu(x) ((uint64_t)bswap_64(x))
+# endif
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# ifndef cpu_to_le16
+# define cpu_to_le16(x) ((uint16_t)bswap_16(x))
+# endif
+# ifndef le16_to_cpu
+# define le16_to_cpu(x) ((uint16_t)bswap_16(x))
+# endif
+# ifndef cpu_to_le32
+# define cpu_to_le32(x) ((uint32_t)bswap_32(x))
+# endif
+# ifndef le32_to_cpu
+# define le32_to_cpu(x) ((uint32_t)bswap_32(x))
+# endif
+# ifndef cpu_to_le64
+# define cpu_to_le64(x) ((uint64_t)bswap_64(x))
+# endif
+# ifndef le64_to_cpu
+# define le64_to_cpu(x) ((uint64_t)bswap_64(x))
+# endif
+# ifndef cpu_to_be16
+# define cpu_to_be16(x) ((uint16_t)(x))
+# endif
+# ifndef be16_to_cpu
+# define be16_to_cpu(x) ((uint16_t)(x))
+# endif
+# ifndef cpu_to_be32
+# define cpu_to_be32(x) ((uint32_t)(x))
+# endif
+# ifndef be32_to_cpu
+# define be32_to_cpu(x) ((uint32_t)(x))
+# endif
+# ifndef cpu_to_be64
+# define cpu_to_be64(x) ((uint64_t)(x))
+# endif
+# ifndef be64_to_cpu
+# define be64_to_cpu(x) ((uint64_t)(x))
+# endif
+#else
+# error Invalid byte order __BYTE_ORDER
+#endif /* __BYTE_ORDER */
#endif /* _BYTEORDER_H */
Modified: trunk/ocfs2/libocfs2/mkjournal.c
===================================================================
--- trunk/ocfs2/libocfs2/mkjournal.c 2004-08-10 00:59:43 UTC (rev 198)
+++ trunk/ocfs2/libocfs2/mkjournal.c 2004-08-12 18:58:53 UTC (rev 199)
@@ -31,6 +31,7 @@
#define _LARGEFILE64_SOURCE
#include <string.h>
+#include <netinet/in.h>
#include "ocfs2.h"
Property changes on: trunk/ocfs2/mkfs.ocfs2
___________________________________________________________________
Name: svn:ignore
- .*.sw?
stamp-md5
mkfs.ocfs2
cscope*
+ .*.sw?
stamp-md5
mkfs.ocfs2
cscope*
mkfs.ocfs2.8
Modified: trunk/ocfs2/mkfs.ocfs2/Makefile
===================================================================
--- trunk/ocfs2/mkfs.ocfs2/Makefile 2004-08-10 00:59:43 UTC (rev 198)
+++ trunk/ocfs2/mkfs.ocfs2/Makefile 2004-08-12 18:58:53 UTC (rev 199)
@@ -41,8 +41,6 @@
DIST_RULES = dist-incdir
-#MANS = mkfs.ocfs2.8
-
INSTALL_RULES = install-sbin-links install-man-links
##########################
Modified: trunk/ocfs2/mkfs.ocfs2/mkfs.c
===================================================================
--- trunk/ocfs2/mkfs.ocfs2/mkfs.c 2004-08-10 00:59:43 UTC (rev 198)
+++ trunk/ocfs2/mkfs.ocfs2/mkfs.c 2004-08-12 18:58:53 UTC (rev 199)
@@ -37,6 +37,7 @@
#include <errno.h>
#include <malloc.h>
#include <time.h>
+#include <netinet/in.h>
#include <asm/bitops.h>
More information about the Ocfs-tools-commits
mailing list