aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-08 07:20:41 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:35 -0500
commit5e0f001736651f6f859aeca95f895c829d223cdb (patch)
treea947fba71ee75b3d12f274c3663be82add9bf5df
parent4daa1b87992ff210c19a6347cabde22335667004 (diff)
udf: convert byte order of constant instead of variable
convert byte order of constant instead of variable, which can be done at compile time (vs run time) Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Acked-by: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/udf/directory.c4
-rw-r--r--fs/udf/inode.c16
-rw-r--r--fs/udf/misc.c12
-rw-r--r--fs/udf/super.c16
4 files changed, 24 insertions, 24 deletions
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index ba79794abced..88d8895bd990 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -225,7 +225,7 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
225 if ((*offset > 0) && (*offset < bufsize)) 225 if ((*offset > 0) && (*offset < bufsize))
226 ptr += *offset; 226 ptr += *offset;
227 fi = (struct fileIdentDesc *)ptr; 227 fi = (struct fileIdentDesc *)ptr;
228 if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID) { 228 if (fi->descTag.tagIdent != cpu_to_le16(TAG_IDENT_FID)) {
229 udf_debug("0x%x != TAG_IDENT_FID\n", 229 udf_debug("0x%x != TAG_IDENT_FID\n",
230 le16_to_cpu(fi->descTag.tagIdent)); 230 le16_to_cpu(fi->descTag.tagIdent));
231 udf_debug("offset: %u sizeof: %lu bufsize: %u\n", 231 udf_debug("offset: %u sizeof: %lu bufsize: %u\n",
@@ -262,7 +262,7 @@ static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset)
262 262
263 fe = (struct fileEntry *)buffer; 263 fe = (struct fileEntry *)buffer;
264 264
265 if (le16_to_cpu(fe->descTag.tagIdent) != TAG_IDENT_FE) { 265 if (fe->descTag.tagIdent != cpu_to_le16(TAG_IDENT_FE)) {
266 udf_debug("0x%x != TAG_IDENT_FE\n", 266 udf_debug("0x%x != TAG_IDENT_FE\n",
267 le16_to_cpu(fe->descTag.tagIdent)); 267 le16_to_cpu(fe->descTag.tagIdent));
268 return NULL; 268 return NULL;
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 42783da9cfe3..487bdb7dc835 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1103,7 +1103,7 @@ static void __udf_read_inode(struct inode *inode)
1103 1103
1104 fe = (struct fileEntry *)bh->b_data; 1104 fe = (struct fileEntry *)bh->b_data;
1105 1105
1106 if (le16_to_cpu(fe->icbTag.strategyType) == 4096) { 1106 if (fe->icbTag.strategyType == cpu_to_le16(4096)) {
1107 struct buffer_head *ibh = NULL, *nbh = NULL; 1107 struct buffer_head *ibh = NULL, *nbh = NULL;
1108 struct indirectEntry *ie; 1108 struct indirectEntry *ie;
1109 1109
@@ -1140,7 +1140,7 @@ static void __udf_read_inode(struct inode *inode)
1140 } else { 1140 } else {
1141 brelse(ibh); 1141 brelse(ibh);
1142 } 1142 }
1143 } else if (le16_to_cpu(fe->icbTag.strategyType) != 4) { 1143 } else if (fe->icbTag.strategyType != cpu_to_le16(4)) {
1144 printk(KERN_ERR "udf: unsupported strategy type: %d\n", 1144 printk(KERN_ERR "udf: unsupported strategy type: %d\n",
1145 le16_to_cpu(fe->icbTag.strategyType)); 1145 le16_to_cpu(fe->icbTag.strategyType));
1146 brelse(bh); 1146 brelse(bh);
@@ -1164,9 +1164,9 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1164 fe = (struct fileEntry *)bh->b_data; 1164 fe = (struct fileEntry *)bh->b_data;
1165 efe = (struct extendedFileEntry *)bh->b_data; 1165 efe = (struct extendedFileEntry *)bh->b_data;
1166 1166
1167 if (le16_to_cpu(fe->icbTag.strategyType) == 4) 1167 if (fe->icbTag.strategyType == cpu_to_le16(4))
1168 UDF_I_STRAT4096(inode) = 0; 1168 UDF_I_STRAT4096(inode) = 0;
1169 else /* if (le16_to_cpu(fe->icbTag.strategyType) == 4096) */ 1169 else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */
1170 UDF_I_STRAT4096(inode) = 1; 1170 UDF_I_STRAT4096(inode) = 1;
1171 1171
1172 UDF_I_ALLOCTYPE(inode) = le16_to_cpu(fe->icbTag.flags) & 1172 UDF_I_ALLOCTYPE(inode) = le16_to_cpu(fe->icbTag.flags) &
@@ -1177,7 +1177,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1177 UDF_I_LENALLOC(inode) = 0; 1177 UDF_I_LENALLOC(inode) = 0;
1178 UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; 1178 UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;
1179 UDF_I_NEXT_ALLOC_GOAL(inode) = 0; 1179 UDF_I_NEXT_ALLOC_GOAL(inode) = 0;
1180 if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_EFE) { 1180 if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) {
1181 UDF_I_EFE(inode) = 1; 1181 UDF_I_EFE(inode) = 1;
1182 UDF_I_USE(inode) = 0; 1182 UDF_I_USE(inode) = 0;
1183 if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - 1183 if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize -
@@ -1189,7 +1189,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1189 bh->b_data + sizeof(struct extendedFileEntry), 1189 bh->b_data + sizeof(struct extendedFileEntry),
1190 inode->i_sb->s_blocksize - 1190 inode->i_sb->s_blocksize -
1191 sizeof(struct extendedFileEntry)); 1191 sizeof(struct extendedFileEntry));
1192 } else if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_FE) { 1192 } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) {
1193 UDF_I_EFE(inode) = 0; 1193 UDF_I_EFE(inode) = 0;
1194 UDF_I_USE(inode) = 0; 1194 UDF_I_USE(inode) = 0;
1195 if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - 1195 if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize -
@@ -1199,7 +1199,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1199 } 1199 }
1200 memcpy(UDF_I_DATA(inode), bh->b_data + sizeof(struct fileEntry), 1200 memcpy(UDF_I_DATA(inode), bh->b_data + sizeof(struct fileEntry),
1201 inode->i_sb->s_blocksize - sizeof(struct fileEntry)); 1201 inode->i_sb->s_blocksize - sizeof(struct fileEntry));
1202 } else if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_USE) { 1202 } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) {
1203 UDF_I_EFE(inode) = 0; 1203 UDF_I_EFE(inode) = 0;
1204 UDF_I_USE(inode) = 1; 1204 UDF_I_USE(inode) = 1;
1205 UDF_I_LENALLOC(inode) = le32_to_cpu( 1205 UDF_I_LENALLOC(inode) = le32_to_cpu(
@@ -1458,7 +1458,7 @@ static int udf_update_inode(struct inode *inode, int do_sync)
1458 fe = (struct fileEntry *)bh->b_data; 1458 fe = (struct fileEntry *)bh->b_data;
1459 efe = (struct extendedFileEntry *)bh->b_data; 1459 efe = (struct extendedFileEntry *)bh->b_data;
1460 1460
1461 if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_USE) { 1461 if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) {
1462 struct unallocSpaceEntry *use = 1462 struct unallocSpaceEntry *use =
1463 (struct unallocSpaceEntry *)bh->b_data; 1463 (struct unallocSpaceEntry *)bh->b_data;
1464 1464
diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index 585e4eaed254..a3a513faddb0 100644
--- a/fs/udf/misc.c
+++ b/fs/udf/misc.c
@@ -74,8 +74,8 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
74 74
75 if (UDF_I_LENEATTR(inode)) { 75 if (UDF_I_LENEATTR(inode)) {
76 /* check checksum/crc */ 76 /* check checksum/crc */
77 if (le16_to_cpu(eahd->descTag.tagIdent) != 77 if (eahd->descTag.tagIdent !=
78 TAG_IDENT_EAHD || 78 cpu_to_le16(TAG_IDENT_EAHD) ||
79 le32_to_cpu(eahd->descTag.tagLocation) != 79 le32_to_cpu(eahd->descTag.tagLocation) !=
80 UDF_I_LOCATION(inode).logicalBlockNum) 80 UDF_I_LOCATION(inode).logicalBlockNum)
81 return NULL; 81 return NULL;
@@ -161,8 +161,8 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type,
161 eahd = (struct extendedAttrHeaderDesc *)ea; 161 eahd = (struct extendedAttrHeaderDesc *)ea;
162 162
163 /* check checksum/crc */ 163 /* check checksum/crc */
164 if (le16_to_cpu(eahd->descTag.tagIdent) != 164 if (eahd->descTag.tagIdent !=
165 TAG_IDENT_EAHD || 165 cpu_to_le16(TAG_IDENT_EAHD) ||
166 le32_to_cpu(eahd->descTag.tagLocation) != 166 le32_to_cpu(eahd->descTag.tagLocation) !=
167 UDF_I_LOCATION(inode).logicalBlockNum) 167 UDF_I_LOCATION(inode).logicalBlockNum)
168 return NULL; 168 return NULL;
@@ -233,8 +233,8 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
233 } 233 }
234 234
235 /* Verify the tag version */ 235 /* Verify the tag version */
236 if (le16_to_cpu(tag_p->descVersion) != 0x0002U && 236 if (tag_p->descVersion != cpu_to_le16(0x0002U) &&
237 le16_to_cpu(tag_p->descVersion) != 0x0003U) { 237 tag_p->descVersion != cpu_to_le16(0x0003U)) {
238 udf_debug("tag version 0x%04x != 0x0002 || 0x0003 block %d\n", 238 udf_debug("tag version 0x%04x != 0x0002 || 0x0003 block %d\n",
239 le16_to_cpu(tag_p->descVersion), block); 239 le16_to_cpu(tag_p->descVersion), block);
240 goto error_out; 240 goto error_out;
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 12fb91d23a83..b10295865e5a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1014,20 +1014,20 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
1014 le32_to_cpu(p->partitionLength); /* blocks */ 1014 le32_to_cpu(p->partitionLength); /* blocks */
1015 map->s_partition_root = 1015 map->s_partition_root =
1016 le32_to_cpu(p->partitionStartingLocation); 1016 le32_to_cpu(p->partitionStartingLocation);
1017 if (le32_to_cpu(p->accessType) == 1017 if (p->accessType ==
1018 PD_ACCESS_TYPE_READ_ONLY) 1018 cpu_to_le32(PD_ACCESS_TYPE_READ_ONLY))
1019 map->s_partition_flags |= 1019 map->s_partition_flags |=
1020 UDF_PART_FLAG_READ_ONLY; 1020 UDF_PART_FLAG_READ_ONLY;
1021 if (le32_to_cpu(p->accessType) == 1021 if (p->accessType ==
1022 PD_ACCESS_TYPE_WRITE_ONCE) 1022 cpu_to_le32(PD_ACCESS_TYPE_WRITE_ONCE))
1023 map->s_partition_flags |= 1023 map->s_partition_flags |=
1024 UDF_PART_FLAG_WRITE_ONCE; 1024 UDF_PART_FLAG_WRITE_ONCE;
1025 if (le32_to_cpu(p->accessType) == 1025 if (p->accessType ==
1026 PD_ACCESS_TYPE_REWRITABLE) 1026 cpu_to_le32(PD_ACCESS_TYPE_REWRITABLE))
1027 map->s_partition_flags |= 1027 map->s_partition_flags |=
1028 UDF_PART_FLAG_REWRITABLE; 1028 UDF_PART_FLAG_REWRITABLE;
1029 if (le32_to_cpu(p->accessType) == 1029 if (p->accessType ==
1030 PD_ACCESS_TYPE_OVERWRITABLE) 1030 cpu_to_le32(PD_ACCESS_TYPE_OVERWRITABLE))
1031 map->s_partition_flags |= 1031 map->s_partition_flags |=
1032 UDF_PART_FLAG_OVERWRITABLE; 1032 UDF_PART_FLAG_OVERWRITABLE;
1033 1033