mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
fs/ntfs3: Add ability to format new mft records with bigger/smaller header
Just define in ntfs.h #define MFTRECORD_FIXUP_OFFSET MFTRECORD_FIXUP_OFFSET_1 or #define MFTRECORD_FIXUP_OFFSET MFTRECORD_FIXUP_OFFSET_3 Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
a81f47c440
commit
33e70701ed
@ -288,6 +288,15 @@ struct MFT_REC {
|
||||
|
||||
#define MFTRECORD_FIXUP_OFFSET_1 offsetof(struct MFT_REC, res)
|
||||
#define MFTRECORD_FIXUP_OFFSET_3 offsetof(struct MFT_REC, fixups)
|
||||
/*
|
||||
* define MFTRECORD_FIXUP_OFFSET as MFTRECORD_FIXUP_OFFSET_3 (0x30)
|
||||
* to format new mft records with bigger header (as current ntfs.sys does)
|
||||
*
|
||||
* define MFTRECORD_FIXUP_OFFSET as MFTRECORD_FIXUP_OFFSET_1 (0x2A)
|
||||
* to format new mft records with smaller header (as old ntfs.sys did)
|
||||
* Both variants are valid.
|
||||
*/
|
||||
#define MFTRECORD_FIXUP_OFFSET MFTRECORD_FIXUP_OFFSET_1
|
||||
|
||||
static_assert(MFTRECORD_FIXUP_OFFSET_1 == 0x2A);
|
||||
static_assert(MFTRECORD_FIXUP_OFFSET_3 == 0x30);
|
||||
|
@ -388,6 +388,8 @@ int mi_format_new(struct mft_inode *mi, struct ntfs_sb_info *sbi, CLST rno,
|
||||
|
||||
rec->seq = cpu_to_le16(seq);
|
||||
rec->flags = RECORD_FLAG_IN_USE | flags;
|
||||
if (MFTRECORD_FIXUP_OFFSET == MFTRECORD_FIXUP_OFFSET_3)
|
||||
rec->mft_record = cpu_to_le32(rno);
|
||||
|
||||
mi->dirty = true;
|
||||
|
||||
|
@ -867,7 +867,7 @@ check_boot:
|
||||
}
|
||||
|
||||
sbi->max_bytes_per_attr =
|
||||
record_size - ALIGN(MFTRECORD_FIXUP_OFFSET_1, 8) -
|
||||
record_size - ALIGN(MFTRECORD_FIXUP_OFFSET, 8) -
|
||||
ALIGN(((record_size >> SECTOR_SHIFT) * sizeof(short)), 8) -
|
||||
ALIGN(sizeof(enum ATTR_TYPE), 8);
|
||||
|
||||
@ -909,10 +909,10 @@ check_boot:
|
||||
|
||||
sbi->new_rec = rec;
|
||||
rec->rhdr.sign = NTFS_FILE_SIGNATURE;
|
||||
rec->rhdr.fix_off = cpu_to_le16(MFTRECORD_FIXUP_OFFSET_1);
|
||||
rec->rhdr.fix_off = cpu_to_le16(MFTRECORD_FIXUP_OFFSET);
|
||||
fn = (sbi->record_size >> SECTOR_SHIFT) + 1;
|
||||
rec->rhdr.fix_num = cpu_to_le16(fn);
|
||||
ao = ALIGN(MFTRECORD_FIXUP_OFFSET_1 + sizeof(short) * fn, 8);
|
||||
ao = ALIGN(MFTRECORD_FIXUP_OFFSET + sizeof(short) * fn, 8);
|
||||
rec->attr_off = cpu_to_le16(ao);
|
||||
rec->used = cpu_to_le32(ao + ALIGN(sizeof(enum ATTR_TYPE), 8));
|
||||
rec->total = cpu_to_le32(sbi->record_size);
|
||||
|
Loading…
Reference in New Issue
Block a user