public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: gfs2-utils: master - mount.gfs2: Move the endian functions out of gfs_ondisk.h Date: Thu, 19 Feb 2009 09:45:00 -0000 [thread overview] Message-ID: <20090219094518.59F0F12030E@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=aa9d5f4680f56ef527d85c1561be82db7a4b5f48 Commit: aa9d5f4680f56ef527d85c1561be82db7a4b5f48 Parent: 06da4a72b8262be8380dde551f4ecfb59511fd37 Author: Steven Whitehouse <swhiteho@redhat.com> AuthorDate: Thu Feb 19 08:33:09 2009 +0000 Committer: Steven Whitehouse <swhiteho@redhat.com> CommitterDate: Thu Feb 19 08:33:09 2009 +0000 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> --- gfs2/mount/gfs_ondisk.h | 43 ------------------------------------------- gfs2/mount/ondisk1.c | 42 ++++++++++++++++++++++++++++++++++++++++++ gfs2/mount/util.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 43 deletions(-) diff --git a/gfs2/mount/gfs_ondisk.h b/gfs2/mount/gfs_ondisk.h index 61cf30d..0648d28 100644 --- a/gfs2/mount/gfs_ondisk.h +++ b/gfs2/mount/gfs_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;
reply other threads:[~2009-02-19 9:45 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=20090219094518.59F0F12030E@lists.fedorahosted.org \ --to=swhiteho@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).