fs/ntfs/layout.h
Source file repositories/reference/linux-study-clean/fs/ntfs/layout.h
File Facts
- System
- Linux kernel
- Corpus path
fs/ntfs/layout.h- Extension
.h- Size
- 99154 bytes
- Lines
- 2366
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/bitops.hlinux/list.hasm/byteorder.h
Detected Declarations
struct bios_parameter_blockstruct ntfs_boot_sectorstruct ntfs_recordstruct mft_recordstruct mft_record_oldstruct attr_defstruct attr_recordstruct standard_informationstruct attr_list_entrystruct file_name_attrstruct guidstruct object_id_attrstruct ntfs_sidstruct ntfs_acestruct ntfs_aclstruct security_descriptor_relativestruct sii_index_keystruct sdh_index_keystruct volume_informationstruct index_headerstruct index_rootstruct index_blockstruct reparse_index_keystruct quota_control_entrystruct index_entry_headerstruct index_entrystruct reparse_pointstruct mount_point_reparse_datastruct symlink_reparse_datastruct ea_informationstruct ea_attrfunction __ntfs_is_magicfunction __ntfs_is_magicp
Annotated Snippet
struct bios_parameter_block {
__le16 bytes_per_sector;
u8 sectors_per_cluster;
__le16 reserved_sectors;
u8 fats;
__le16 root_entries;
__le16 sectors;
u8 media_type;
__le16 sectors_per_fat;
__le16 sectors_per_track;
__le16 heads;
__le32 hidden_sectors;
__le32 large_sectors;
} __packed;
/*
* NTFS boot sector structure.
*
* @jump: 3-byte jump instruction to boot code (irrelevant for NTFS).
* Typically 0xEB 0x52 0x90 or similar.
* @oem_id: OEM identifier string (8 bytes).
* Always "NTFS " (with trailing spaces) in NTFS volumes.
* @bpb: Legacy BIOS Parameter Block (see struct bios_parameter_block).
* Mostly zeroed or set to fixed values for NTFS compatibility.
* @unused: 4 bytes, reserved/unused.
* NTFS disk editors show it as:
* - physical_drive (0x80 for fixed disk)
* - current_head (0)
* - extended_boot_signature (0x80 or 0x28)
* - unused (0)
* Always zero in practice for NTFS.
* @number_of_sectors: Number of sectors in volume. Gives maximum volume
* size of 2^63 sectors. Assuming standard sector
* size of 512 bytes, the maximum byte size is
* approx. 4.7x10^21 bytes. (-;
* @mft_lcn: Logical cluster number (LCN) of the $MFT data attribute.
* Location of the Master File Table.
* @mftmirr_lcn: LCN of the $MFTMirr (first 3-4 MFT records copy).
* Mirror for boot-time recovery.
* @clusters_per_mft_record:
* Size of each MFT record in clusters.
* @reserved0: 3 bytes, reserved/zero.
* @clusters_per_index_record:
* Size of each index block/record in clusters.
* @reserved1: 3 bytes, reserved/zero.
* @volume_serial_number:
* 64-bit volume serial number.
* Used for identification (irrelevant for NTFS operation).
* @checksum: 32-bit checksum of the boot sector (excluding this field).
* Used to detect boot sector corruption.
* @bootstrap: 426 bytes of bootstrap code.
* Irrelevant for NTFS (contains x86 boot loader stub).
* @end_of_sector_marker:
* 2-byte end-of-sector signature.
* Always 0xAA55 (little-endian magic number).
*/
struct ntfs_boot_sector {
u8 jump[3];
__le64 oem_id;
struct bios_parameter_block bpb;
u8 unused[4];
__le64 number_of_sectors;
__le64 mft_lcn;
__le64 mftmirr_lcn;
s8 clusters_per_mft_record;
u8 reserved0[3];
s8 clusters_per_index_record;
u8 reserved1[3];
__le64 volume_serial_number;
__le32 checksum;
u8 bootstrap[426];
__le16 end_of_sector_marker;
} __packed;
static_assert(sizeof(struct ntfs_boot_sector) == 512);
/*
* Magic identifiers present at the beginning of all ntfs record containing
* records (like mft records for example).
*
* magic_FILE: MFT entry header ("FILE" in ASCII).
* Used in $MFT/$DATA for all master file table records.
* magic_INDX: Index buffer header ("INDX" in ASCII).
* Used in $INDEX_ALLOCATION attributes (directories, $I30 indexes).
* magic_HOLE: Hole marker ("HOLE" in ASCII).
* Introduced in NTFS 3.0+, used for sparse/hole regions in some contexts.
* magic_RSTR: Restart page header ("RSTR" in ASCII).
* Used in LogFile for restart pages (transaction log recovery).
* magic_RCRD: Log record page header ("RCRD" in ASCII).
* Used in LogFile for individual log record pages.
Annotation
- Immediate include surface: `linux/types.h`, `linux/bitops.h`, `linux/list.h`, `asm/byteorder.h`.
- Detected declarations: `struct bios_parameter_block`, `struct ntfs_boot_sector`, `struct ntfs_record`, `struct mft_record`, `struct mft_record_old`, `struct attr_def`, `struct attr_record`, `struct standard_information`, `struct attr_list_entry`, `struct file_name_attr`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.