]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
udf: replace udf_*_offset macros with functions
authormarcin.slusarz@gmail.com <marcin.slusarz@gmail.com>
Wed, 30 Jan 2008 21:03:59 +0000 (22:03 +0100)
committerJan Kara <jack@suse.cz>
Thu, 17 Apr 2008 12:22:29 +0000 (14:22 +0200)
- 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>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/udf_i.h
fs/udf/udfdecl.h

index d6d9a774a1c1b2f13d371912be7cceaa53c22928..4f86b1d98a5d44ffbf1ae64bee4618c2dfcf3b4a 100644 (file)
@@ -12,8 +12,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 {
index 26bc9c237cb7c2f9428f0cc6d8b008e6cd6954c1..cc15f58d497ab79fbf3a7278ab92fee13d1c112a 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "udf_sb.h"
 #include "udfend.h"
+#include "udf_i.h"
 
 #define UDF_PREALLOCATE
 #define UDF_DEFAULT_PREALLOC_BLOCKS    8
@@ -42,16 +43,24 @@ do { \
 #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))