mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: marcin.slusarz@gmail.com
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ben Fennema <bfennema@falcon.csc.calpoly.edu>,
	Jan Kara <jack@suse.cz>,
	Marcin Slusarz <marcin.slusarz@gmail.com>
Subject: [PATCH 08/24] udf: convert UDF_SB_ANCHOR macro to udf_sb_anchor function
Date: Sun, 23 Dec 2007 02:50:58 +0100	[thread overview]
Message-ID: <1198374674-12128-9-git-send-email-marcin.slusarz@gmail.com> (raw)
In-Reply-To: <1198374674-12128-1-git-send-email-marcin.slusarz@gmail.com>

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
CC: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
CC: Jan Kara <jack@suse.cz>
---
 fs/udf/super.c  |   44 ++++++++++++++++++++++----------------------
 fs/udf/udf_sb.h |    6 +++++-
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/fs/udf/super.c b/fs/udf/super.c
index 903c0ec..0120ac6 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -677,20 +677,20 @@ static void udf_find_anchor(struct super_block *sb)
 			if (ident == TAG_IDENT_AVDP) {
 				if (location == last[i] - udf_sb_session(sb)) {
 					lastblock = last[i] - udf_sb_session(sb);
-					UDF_SB_ANCHOR(sb)[0] = lastblock;
-					UDF_SB_ANCHOR(sb)[1] = lastblock - 256;
+					udf_sb_anchor(sb)[0] = lastblock;
+					udf_sb_anchor(sb)[1] = lastblock - 256;
 				} else if (location == udf_variable_to_fixed(last[i]) - udf_sb_session(sb)) {
 					UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
 					lastblock = udf_variable_to_fixed(last[i]) - udf_sb_session(sb);
-					UDF_SB_ANCHOR(sb)[0] = lastblock;
-					UDF_SB_ANCHOR(sb)[1] = lastblock - 256 - udf_sb_session(sb);
+					udf_sb_anchor(sb)[0] = lastblock;
+					udf_sb_anchor(sb)[1] = lastblock - 256 - udf_sb_session(sb);
 				} else {
 					udf_debug("Anchor found at block %d, location mismatch %d.\n",
 						  last[i], location);
 				}
 			} else if (ident == TAG_IDENT_FE || ident == TAG_IDENT_EFE) {
 				lastblock = last[i];
-				UDF_SB_ANCHOR(sb)[3] = 512;
+				udf_sb_anchor(sb)[3] = 512;
 			} else {
 				ident = location = 0;
 				if (last[i] >= 256) {
@@ -706,7 +706,7 @@ static void udf_find_anchor(struct super_block *sb)
 				if (ident == TAG_IDENT_AVDP &&
 				    location == last[i] - 256 - udf_sb_session(sb)) {
 					lastblock = last[i];
-					UDF_SB_ANCHOR(sb)[1] = last[i] - 256;
+					udf_sb_anchor(sb)[1] = last[i] - 256;
 				} else {
 					ident = location = 0;
 					if (last[i] >= 312 + udf_sb_session(sb)) {
@@ -723,7 +723,7 @@ static void udf_find_anchor(struct super_block *sb)
 					    location == udf_variable_to_fixed(last[i]) - 256) {
 						UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
 						lastblock = udf_variable_to_fixed(last[i]);
-						UDF_SB_ANCHOR(sb)[1] = lastblock - 256;
+						udf_sb_anchor(sb)[1] = lastblock - 256;
 					}
 				}
 			}
@@ -744,17 +744,17 @@ static void udf_find_anchor(struct super_block *sb)
 		}
 	}
 
-	for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) {
-		if (UDF_SB_ANCHOR(sb)[i]) {
-			bh = udf_read_tagged(sb, UDF_SB_ANCHOR(sb)[i],
-					     UDF_SB_ANCHOR(sb)[i], &ident);
+	for (i = 0; i < ARRAY_SIZE(udf_sb(sb)->s_anchor); i++) {
+		if (udf_sb_anchor(sb)[i]) {
+			bh = udf_read_tagged(sb, udf_sb_anchor(sb)[i],
+					     udf_sb_anchor(sb)[i], &ident);
 			if (!bh)
-				UDF_SB_ANCHOR(sb)[i] = 0;
+				udf_sb_anchor(sb)[i] = 0;
 			else {
 				brelse(bh);
 				if ((ident != TAG_IDENT_AVDP) &&
 				    (i || (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE)))
-					UDF_SB_ANCHOR(sb)[i] = 0;
+					udf_sb_anchor(sb)[i] = 0;
 			}
 		}
 	}
@@ -1280,10 +1280,10 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
 	if (!sb)
 		return 1;
 
-	for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) {
-		if (UDF_SB_ANCHOR(sb)[i] &&
-		    (bh = udf_read_tagged(sb, UDF_SB_ANCHOR(sb)[i],
-					  UDF_SB_ANCHOR(sb)[i], &ident))) {
+	for (i = 0; i < ARRAY_SIZE(udf_sb(sb)->s_anchor); i++) {
+		if (udf_sb_anchor(sb)[i] &&
+		    (bh = udf_read_tagged(sb, udf_sb_anchor(sb)[i],
+					  udf_sb_anchor(sb)[i], &ident))) {
 			anchor = (struct anchorVolDescPtr *)bh->b_data;
 
 			/* Locate the main sequence */
@@ -1308,11 +1308,11 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
 		}
 	}
 
-	if (i == ARRAY_SIZE(UDF_SB_ANCHOR(sb))) {
+	if (i == ARRAY_SIZE(udf_sb(sb)->s_anchor)) {
 		udf_debug("No Anchor block found\n");
 		return 1;
 	} else
-		udf_debug("Using anchor in block %d\n", UDF_SB_ANCHOR(sb)[i]);
+		udf_debug("Using anchor in block %d\n", udf_sb_anchor(sb)[i]);
 
 	for (i = 0; i < udf_sb_num_parts(sb); i++) {
 		kernel_lb_addr uninitialized_var(ino);
@@ -1513,9 +1513,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 	udf_debug("Multi-session=%d\n", udf_sb_session(sb));
 
 	UDF_SB_LASTBLOCK(sb) = uopt.lastblock;
-	UDF_SB_ANCHOR(sb)[0] = UDF_SB_ANCHOR(sb)[1] = 0;
-	UDF_SB_ANCHOR(sb)[2] = uopt.anchor;
-	UDF_SB_ANCHOR(sb)[3] = 256;
+	udf_sb_anchor(sb)[0] = udf_sb_anchor(sb)[1] = 0;
+	udf_sb_anchor(sb)[2] = uopt.anchor;
+	udf_sb_anchor(sb)[3] = 256;
 
 	if (udf_check_valid(sb, uopt.novrs, silent)) {
 		/* read volume recognition sequences */
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index f33d38e..f00524f 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -75,6 +75,11 @@ static inline __s32 udf_sb_session(struct super_block *sb)
 	return udf_sb(sb)->s_session;
 }
 
+static inline __u32 *udf_sb_anchor(struct super_block *sb)
+{
+	return udf_sb(sb)->s_anchor;
+}
+
 #define UDF_SB_ALLOC_PARTMAPS(X,Y)\
 {\
 	udf_sb(X)->s_partmaps = kmalloc(sizeof(struct udf_part_map) * Y, GFP_KERNEL);\
@@ -139,7 +144,6 @@ static inline __s32 udf_sb_session(struct super_block *sb)
 #define UDF_SB_BITMAP(X,Y,Z,I)			( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_block_bitmap[I] )
 #define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z)		( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_nr_groups )
 
-#define UDF_SB_ANCHOR(X)			( udf_sb(X)->s_anchor )
 #define UDF_SB_LASTBLOCK(X)			( udf_sb(X)->s_lastblock )
 #define UDF_SB_LVIDBH(X)			( udf_sb(X)->s_lvidbh )
 #define UDF_SB_LVID(X)				( (struct logicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data )
-- 
1.5.3.4


  parent reply	other threads:[~2007-12-23  1:52 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-23  1:50 [PATCH 00/24] udf: convert super_block macros to functions marcin.slusarz
2007-12-23  1:50 ` [PATCH 01/24] udf: fix coding style of super.c marcin.slusarz
2008-01-07 11:13   ` Jan Kara
2007-12-23  1:50 ` [PATCH 02/24] udf: rename UDF_SB to udf_sb marcin.slusarz
2007-12-23 12:04   ` Christoph Hellwig
2007-12-23  1:50 ` [PATCH 03/24] udf: convert some macros to inline functions marcin.slusarz
2007-12-23  1:50 ` [PATCH 04/24] udf: convert UDF_SB_VOLIDENT macro to udf_sb_volume_ident function marcin.slusarz
2007-12-23 12:08   ` Christoph Hellwig
2007-12-23  1:50 ` [PATCH 05/24] udf: convert UDF_SB_NUMPARTS macro to udf_sb_num_parts function marcin.slusarz
2007-12-23 12:09   ` Christoph Hellwig
2007-12-23  1:50 ` [PATCH 06/24] udf: convert UDF_SB_PARTITION macro to udf_sb_partition function marcin.slusarz
2007-12-23  1:50 ` [PATCH 07/24] udf: convert UDF_SB_SESSION macro to udf_sb_session function marcin.slusarz
2007-12-23  1:50 ` marcin.slusarz [this message]
2007-12-23  1:50 ` [PATCH 09/24] udf: convert UDF_SB_LASTBLOCK macro to udf_sb_last_block function marcin.slusarz
2007-12-23  1:51 ` [PATCH 10/24] udf: convert UDF_SB_LVIDBH macro to udf_sb_lvid_bh function marcin.slusarz
2007-12-23  1:51 ` [PATCH 11/24] udf: convert UDF_SB_LVID macro to udf_sb_lvid function marcin.slusarz
2007-12-23  1:51 ` [PATCH 12/24] udf: convert UDF_SB_LVIDIU macro to udf_sb_lvidiu function marcin.slusarz
2007-12-23  1:51 ` [PATCH 13/24] udf: remove unused macros marcin.slusarz
2007-12-23  1:51 ` [PATCH 14/24] udf: convert UDF_SB_RECORDTIME macro to udf_sb_record_time function marcin.slusarz
2007-12-23  1:51 ` [PATCH 15/24] udf: convert UDF_SB_SERIALNUM macro to udf_sb_serial_number function marcin.slusarz
2007-12-23  1:51 ` [PATCH 16/24] udf: convert UDF_SB_UDFREV macro to udf_sb_revision function marcin.slusarz
2007-12-23  1:51 ` [PATCH 17/24] udf: convert UDF_SB_VAT macro to udf_sb_vat_inode function marcin.slusarz
2007-12-23  1:51 ` [PATCH 18/24] udf: convert UDF_SB_ALLOC_PARTMAPS macro to udf_sb_alloc_partition_maps function marcin.slusarz
2007-12-23  1:51 ` [PATCH 19/24] udf: check if udf_load_logicalvol failed marcin.slusarz
2008-01-07 11:29   ` Jan Kara
2008-01-07 19:19     ` Marcin Slusarz
2007-12-23  1:51 ` [PATCH 20/24] udf: convert UDF_UPDATE_UDFREV macro to udf_update_revision function marcin.slusarz
2007-12-23  1:51 ` [PATCH 21/24] udf: remove some UDF_SB_* macros marcin.slusarz
2008-01-07 11:34   ` Jan Kara
2007-12-23  1:51 ` [PATCH 22/24] udf: convert UDF_SB_ALLOC_BITMAP macro to udf_sb_alloc_bitmap function marcin.slusarz
2008-01-07 11:35   ` Jan Kara
2007-12-23  1:51 ` [PATCH 23/24] udf: convert UDF_SB_FREE_BITMAP macro to udf_sb_free_bitmap function marcin.slusarz
2008-01-07 11:36   ` Jan Kara
2007-12-23  1:51 ` [PATCH 24/24] udf: fix sparse warnings (shadowing & mismatch between declaration and definition) marcin.slusarz
2008-01-07 11:37   ` Jan Kara

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=1198374674-12128-9-git-send-email-marcin.slusarz@gmail.com \
    --to=marcin.slusarz@gmail.com \
    --cc=bfennema@falcon.csc.calpoly.edu \
    --cc=jack@suse.cz \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®