summaryrefslogtreecommitdiff
path: root/fs/ntfs3/record.c
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2023-01-17 15:01:00 +0400
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2023-03-27 17:44:35 +0400
commit96de65a9413e0422233b285368e8a9a64e461187 (patch)
treeb90c01696305460d6332cbb76673ed169541c8b6 /fs/ntfs3/record.c
parent75c5e0c9e5cad34deeec7c131c2b1368df5a8c75 (diff)
fs/ntfs3: Code formatting and refactoring
Added minor refactoring. Added and fixed some comments. In some places, the code has been reformatted to fit into 80 columns. clang-format-12 was used to format code according kernel's .clang-format. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/record.c')
-rw-r--r--fs/ntfs3/record.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
index 0603169ee8a0..2a281cead2bc 100644
--- a/fs/ntfs3/record.c
+++ b/fs/ntfs3/record.c
@@ -419,10 +419,9 @@ struct ATTRIB *mi_insert_attr(struct mft_inode *mi, enum ATTR_TYPE type,
struct ntfs_sb_info *sbi = mi->sbi;
u32 used = le32_to_cpu(rec->used);
const u16 *upcase = sbi->upcase;
- int diff;
/* Can we insert mi attribute? */
- if (used + asize > mi->sbi->record_size)
+ if (used + asize > sbi->record_size)
return NULL;
/*
@@ -431,7 +430,7 @@ struct ATTRIB *mi_insert_attr(struct mft_inode *mi, enum ATTR_TYPE type,
*/
attr = NULL;
while ((attr = mi_enum_attr(mi, attr))) {
- diff = compare_attr(attr, type, name, name_len, upcase);
+ int diff = compare_attr(attr, type, name, name_len, upcase);
if (diff < 0)
continue;
@@ -442,9 +441,11 @@ struct ATTRIB *mi_insert_attr(struct mft_inode *mi, enum ATTR_TYPE type,
}
if (!attr) {
- tail = 8; /* Not used, just to suppress warning. */
+ /* Append. */
+ tail = 8;
attr = Add2Ptr(rec, used - 8);
} else {
+ /* Insert before 'attr'. */
tail = used - PtrOffset(rec, attr);
}