LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: marcin.slusarz@gmail.com
To: LKML <linux-kernel@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>, Marcin Slusarz <marcin.slusarz@gmail.com>
Subject: [PATCH 09/10] udf: replace udf_*_offset macros with functions
Date: Wed, 30 Jan 2008 22:03:59 +0100	[thread overview]
Message-ID: <1201727040-6769-10-git-send-email-marcin.slusarz@gmail.com> (raw)
In-Reply-To: <1201727040-6769-1-git-send-email-marcin.slusarz@gmail.com>

- translate udf_file_entry_alloc_offset macro into function
- translate udf_ext0_offset macro into function
- add comment about crypticly named fields in struct udf_inode_info

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Jan Kara <jack@suse.cz>
---
 fs/udf/udfdecl.h         |   29 +++++++++++++++++++----------
 include/linux/udf_fs_i.h |    4 ++--
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index c6c457b..375be1b 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -12,6 +12,7 @@
 #include <linux/buffer_head.h>
 
 #include "udfend.h"
+#include "udf_i.h"
 
 #define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) )
 #define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) )
@@ -23,16 +24,24 @@
 #define UDF_NAME_LEN		256
 #define UDF_PATH_LEN		1023
 
-#define udf_file_entry_alloc_offset(inode)\
-	(UDF_I(inode)->i_use ?\
-		sizeof(struct unallocSpaceEntry) :\
-		((UDF_I(inode)->i_efe ?\
-			sizeof(struct extendedFileEntry) :\
-			sizeof(struct fileEntry)) + UDF_I(inode)->i_lenEAttr))
-
-#define udf_ext0_offset(inode)\
-	(UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ?\
-		udf_file_entry_alloc_offset(inode) : 0)
+static inline size_t udf_file_entry_alloc_offset(struct inode *inode)
+{
+	struct udf_inode_info *iinfo = UDF_I(inode);
+	if (iinfo->i_use)
+		return sizeof(struct unallocSpaceEntry);
+	else if (iinfo->i_efe)
+		return sizeof(struct extendedFileEntry) + iinfo->i_lenEAttr;
+	else
+		return sizeof(struct fileEntry) + iinfo->i_lenEAttr;
+}
+
+static inline size_t udf_ext0_offset(struct inode *inode)
+{
+	if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
+		return udf_file_entry_alloc_offset(inode);
+	else
+		return 0;
+}
 
 #define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset))
 
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index ffaf056..6281a52 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -27,8 +27,8 @@ struct udf_inode_info
 	__u32			i_next_alloc_block;
 	__u32			i_next_alloc_goal;
 	unsigned		i_alloc_type : 3;
-	unsigned		i_efe : 1;
-	unsigned		i_use : 1;
+	unsigned		i_efe : 1; /* extendedFileEntry */
+	unsigned		i_use : 1; /* unallocSpaceEntry */
 	unsigned		i_strat4096 : 1;
 	unsigned		reserved : 26;
 	union
-- 
1.5.3.7


  parent reply	other threads:[~2008-01-30 21:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30 21:03 [PATCH 00/10] udf: cleanups marcin.slusarz
2008-01-30 21:03 ` [PATCH 01/10] udf: udf_CS0toUTF8 cleanup marcin.slusarz
2008-01-31  9:57   ` Jan Kara
2008-01-30 21:03 ` [PATCH 02/10] udf: fix udf_build_ustr marcin.slusarz
2008-01-31 10:45   ` Jan Kara
2008-01-31 19:57     ` Marcin Slusarz
2008-02-04 19:31       ` Jan Kara
2008-02-04 21:27         ` Marcin Slusarz
2008-02-05 15:29           ` Jan Kara
2008-02-05 19:17             ` Marcin Slusarz
2008-01-30 21:03 ` [PATCH 03/10] udf: udf_CS0toNLS cleanup marcin.slusarz
2008-01-31 12:23   ` Jan Kara
2008-01-30 21:03 ` [PATCH 04/10] udf: constify crc marcin.slusarz
2008-01-31 12:58   ` Jan Kara
2008-01-30 21:03 ` [PATCH 05/10] udf: simple cleanup of truncate.c marcin.slusarz
2008-01-31 13:01   ` Jan Kara
2008-01-30 21:03 ` [PATCH 06/10] udf: truncate: create function for updating of Allocation Ext Descriptor marcin.slusarz
2008-01-31 17:08   ` Jan Kara
2008-01-31 18:18     ` Marcin Slusarz
2008-01-30 21:03 ` [PATCH 07/10] udf: replace all adds to little endians variables with le*_add_cpu marcin.slusarz
2008-01-31 16:42   ` Jan Kara
2008-01-30 21:03 ` [PATCH 08/10] udf: simplify __udf_read_inode marcin.slusarz
2008-01-31 16:46   ` Jan Kara
2008-01-30 21:03 ` marcin.slusarz [this message]
2008-01-31 16:48   ` [PATCH 09/10] udf: replace udf_*_offset macros with functions Jan Kara
2008-01-30 21:04 ` [PATCH 10/10] udf: constify udf_bitmap_lookup array marcin.slusarz
2008-01-31 16:52   ` Jan Kara
2008-02-02 21:37     ` Marcin Slusarz
2008-02-04 19:15       ` 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=1201727040-6769-10-git-send-email-marcin.slusarz@gmail.com \
    --to=marcin.slusarz@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 09/10] udf: replace udf_*_offset macros with functions' \
    /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

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 NNTP newsgroup(s).