Commit c2104fda authored by marcin.slusarz@gmail.com's avatar marcin.slusarz@gmail.com Committed by Jan Kara

udf: replace all adds to little endians variables with le*_add_cpu

replace all:
	little_endian_variable = cpu_to_leX(leX_to_cpu(little_endian_variable) +
	                                    expression_in_cpu_byteorder);
with:
	leX_add_cpu(&little_endian_variable, expression_in_cpu_byteorder);
sparse didn't generate any new warning with this patch

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 456390de
...@@ -149,8 +149,7 @@ static bool udf_add_free_space(struct udf_sb_info *sbi, ...@@ -149,8 +149,7 @@ static bool udf_add_free_space(struct udf_sb_info *sbi,
return false; return false;
lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data; lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data;
lvid->freeSpaceTable[partition] = cpu_to_le32(le32_to_cpu( le32_add_cpu(&lvid->freeSpaceTable[partition], cnt);
lvid->freeSpaceTable[partition]) + cnt);
return true; return true;
} }
...@@ -589,10 +588,8 @@ static void udf_table_free_blocks(struct super_block *sb, ...@@ -589,10 +588,8 @@ static void udf_table_free_blocks(struct super_block *sb,
sptr = oepos.bh->b_data + epos.offset; sptr = oepos.bh->b_data + epos.offset;
aed = (struct allocExtDesc *) aed = (struct allocExtDesc *)
oepos.bh->b_data; oepos.bh->b_data;
aed->lengthAllocDescs = le32_add_cpu(&aed->lengthAllocDescs,
cpu_to_le32(le32_to_cpu( adsize);
aed->lengthAllocDescs) +
adsize);
} else { } else {
sptr = iinfo->i_ext.i_data + sptr = iinfo->i_ext.i_data +
epos.offset; epos.offset;
...@@ -645,9 +642,7 @@ static void udf_table_free_blocks(struct super_block *sb, ...@@ -645,9 +642,7 @@ static void udf_table_free_blocks(struct super_block *sb,
mark_inode_dirty(table); mark_inode_dirty(table);
} else { } else {
aed = (struct allocExtDesc *)epos.bh->b_data; aed = (struct allocExtDesc *)epos.bh->b_data;
aed->lengthAllocDescs = le32_add_cpu(&aed->lengthAllocDescs, adsize);
cpu_to_le32(le32_to_cpu(
aed->lengthAllocDescs) + adsize);
udf_update_tag(epos.bh->b_data, epos.offset); udf_update_tag(epos.bh->b_data, epos.offset);
mark_buffer_dirty(epos.bh); mark_buffer_dirty(epos.bh);
} }
......
...@@ -46,11 +46,9 @@ void udf_free_inode(struct inode *inode) ...@@ -46,11 +46,9 @@ void udf_free_inode(struct inode *inode)
struct logicalVolIntegrityDescImpUse *lvidiu = struct logicalVolIntegrityDescImpUse *lvidiu =
udf_sb_lvidiu(sbi); udf_sb_lvidiu(sbi);
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
lvidiu->numDirs = le32_add_cpu(&lvidiu->numDirs, -1);
cpu_to_le32(le32_to_cpu(lvidiu->numDirs) - 1);
else else
lvidiu->numFiles = le32_add_cpu(&lvidiu->numFiles, -1);
cpu_to_le32(le32_to_cpu(lvidiu->numFiles) - 1);
mark_buffer_dirty(sbi->s_lvid_bh); mark_buffer_dirty(sbi->s_lvid_bh);
} }
...@@ -104,11 +102,9 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) ...@@ -104,11 +102,9 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
lvhd = (struct logicalVolHeaderDesc *) lvhd = (struct logicalVolHeaderDesc *)
(lvid->logicalVolContentsUse); (lvid->logicalVolContentsUse);
if (S_ISDIR(mode)) if (S_ISDIR(mode))
lvidiu->numDirs = le32_add_cpu(&lvidiu->numDirs, 1);
cpu_to_le32(le32_to_cpu(lvidiu->numDirs) + 1);
else else
lvidiu->numFiles = le32_add_cpu(&lvidiu->numFiles, 1);
cpu_to_le32(le32_to_cpu(lvidiu->numFiles) + 1);
iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID);
if (!(++uniqueID & 0x00000000FFFFFFFFUL)) if (!(++uniqueID & 0x00000000FFFFFFFFUL))
uniqueID += 16; uniqueID += 16;
......
...@@ -1748,9 +1748,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, ...@@ -1748,9 +1748,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos,
if (epos->bh) { if (epos->bh) {
aed = (struct allocExtDesc *)epos->bh->b_data; aed = (struct allocExtDesc *)epos->bh->b_data;
aed->lengthAllocDescs = le32_add_cpu(&aed->lengthAllocDescs, adsize);
cpu_to_le32(le32_to_cpu(
aed->lengthAllocDescs) + adsize);
} else { } else {
iinfo->i_lenAlloc += adsize; iinfo->i_lenAlloc += adsize;
mark_inode_dirty(inode); mark_inode_dirty(inode);
...@@ -1800,9 +1798,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, ...@@ -1800,9 +1798,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos,
mark_inode_dirty(inode); mark_inode_dirty(inode);
} else { } else {
aed = (struct allocExtDesc *)epos->bh->b_data; aed = (struct allocExtDesc *)epos->bh->b_data;
aed->lengthAllocDescs = le32_add_cpu(&aed->lengthAllocDescs, adsize);
cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) +
adsize);
if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
udf_update_tag(epos->bh->b_data, udf_update_tag(epos->bh->b_data,
...@@ -2016,9 +2012,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, ...@@ -2016,9 +2012,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos,
mark_inode_dirty(inode); mark_inode_dirty(inode);
} else { } else {
aed = (struct allocExtDesc *)oepos.bh->b_data; aed = (struct allocExtDesc *)oepos.bh->b_data;
aed->lengthAllocDescs = le32_add_cpu(&aed->lengthAllocDescs, -(2 * adsize));
cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) -
(2 * adsize));
if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
udf_update_tag(oepos.bh->b_data, udf_update_tag(oepos.bh->b_data,
...@@ -2035,9 +2029,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, ...@@ -2035,9 +2029,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos,
mark_inode_dirty(inode); mark_inode_dirty(inode);
} else { } else {
aed = (struct allocExtDesc *)oepos.bh->b_data; aed = (struct allocExtDesc *)oepos.bh->b_data;
aed->lengthAllocDescs = le32_add_cpu(&aed->lengthAllocDescs, -adsize);
cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) -
adsize);
if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
udf_update_tag(oepos.bh->b_data, udf_update_tag(oepos.bh->b_data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment