public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arch <linux-arch@vger.kernel.org>
Subject: [PATCH 21/37] adfs: use get/put_endian helpers
Date: Thu, 29 May 2008 13:18:42 -0700	[thread overview]
Message-ID: <1212092322.28403.123.camel@brick> (raw)

Also move the macro to a static function.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 fs/adfs/dir_f.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/adfs/dir_f.c b/fs/adfs/dir_f.c
index ea7df21..c8f2736 100644
--- a/fs/adfs/dir_f.c
+++ b/fs/adfs/dir_f.c
@@ -73,11 +73,13 @@ static inline int adfs_readname(char *buf, char *ptr, int maxlen)
 	  *(u8 *)(bh[_buf]->b_data + _off);	\
 	})
 
-#define dir_u32(idx)				\
-	({ int _buf = idx >> blocksize_bits;	\
-	   int _off = idx - (_buf << blocksize_bits);\
-	  *(__le32 *)(bh[_buf]->b_data + _off);	\
-	})
+static u32 get_dir_u32(int idx, const struct adfs_dir *dir)
+{
+	int buf = (idx >> dir->sb->s_blocksize_bits);
+	int off = idx - (buf << dir->sb->s_blocksize_bits);
+
+	return get_le32((__le32 *)(dir->bh[buf]->b_data + off));
+}
 
 #define bufoff(_bh,_idx)			\
 	({ int _buf = _idx >> blocksize_bits;	\
@@ -108,7 +110,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir)
 	do {
 		last += 26;
 		do {
-			dircheck = le32_to_cpu(dir_u32(i)) ^ ror13(dircheck);
+			dircheck = get_dir_u32(i, dir) ^ ror13(dircheck);
 
 			i += sizeof(u32);
 		} while (i < (last & ~3));
-- 
1.5.6.rc0.277.g804cf

                 reply	other threads:[~2008-05-29 20:18 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=1212092322.28403.123.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    /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