fs/ntfs/logfile.h
Source file repositories/reference/linux-study-clean/fs/ntfs/logfile.h
File Facts
- System
- Linux kernel
- Corpus path
fs/ntfs/logfile.h- Extension
.h- Size
- 12113 bytes
- Lines
- 246
- 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
layout.h
Detected Declarations
struct restart_page_headerstruct restart_areastruct log_client_record
Annotated Snippet
struct restart_page_header {
__le32 magic;
__le16 usa_ofs;
__le16 usa_count;
__le64 chkdsk_lsn;
__le32 system_page_size;
__le32 log_page_size;
__le16 restart_area_offset;
__le16 minor_ver;
__le16 major_ver;
} __packed;
/*
* Constant for the log client indices meaning that there are no client records
* in this particular client array. Also inside the client records themselves,
* this means that there are no client records preceding or following this one.
*/
#define LOGFILE_NO_CLIENT cpu_to_le16(0xffff)
#define LOGFILE_NO_CLIENT_CPU 0xffff
/*
* These are the so far known RESTART_AREA_* flags (16-bit) which contain
* information about the log file in which they are present.
* gcc: Force enum bit width to 16.
*/
enum {
RESTART_VOLUME_IS_CLEAN = cpu_to_le16(0x0002),
RESTART_SPACE_FILLER = cpu_to_le16(0xffff),
} __packed;
/*
* Log file restart area record. The offset of this record is found by adding
* the offset of the RESTART_PAGE_HEADER to the restart_area_offset value found
* in it. See notes at restart_area_offset above.
*
* @current_lsn: The current, i.e. last LSN inside the log when
* the restart area was last written. This happens often but what is
* the interval? Is it just fixed time or is it every time a check point
* is written or somethine else? On create set to 0.
* @log_clients: Number of log client records in the array of log client
* records which follows this restart area. Must be 1.
* @client_free_list: The index of the first free log client record in
* the array of log client records. LOGFILE_NO_CLIENT means that there
* are no free log client records in the array. If != LOGFILE_NO_CLIENT,
* check that log_clients > client_free_list. On Win2k and presumably
* earlier, on a clean volume this is != LOGFILE_NO_CLIENT, and it should
* be 0, i.e. the first (and only) client record is free and thus
* the logfile is closed and hence clean. A dirty volume would have left
* the logfile open and hence this would be LOGFILE_NO_CLIENT. On WinXP
* and presumably later, the logfile is always open, even on clean
* shutdown so this should always be LOGFILE_NO_CLIENT.
* @client_in_use_list: The index of the first in-use log client record in
* the array of log client records. LOGFILE_NO_CLIENT means that there
* are no in-use log client records in the array.
* If != LOGFILE_NO_CLIENT check that log_clients > client_in_use_list.
* On Win2k and presumably earlier, on a clean volume this is
* LOGFILE_NO_CLIENT, i.e. there are no client records in use and thus
* the logfile is closed and hence clean. A dirty volume would have left
* the logfile open and hence this would be != LOGFILE_NO_CLIENT, and it
* should be 0, i.e. the first (and only) client record is in use. On
* WinXP and presumably later, the logfile is always open, even on clean
* shutdown so this should always be 0.
* @flags: Flags modifying LFS behaviour. On Win2k and presumably earlier
* this is always 0. On WinXP and presumably later, if the logfile was
* shutdown cleanly, the second bit, RESTART_VOLUME_IS_CLEAN, is set.
* This bit is cleared when the volume is mounted by WinXP and set when
* the volume is dismounted, thus if the logfile is dirty, this bit is
* clear. Thus we don't need to check the Windows version to determine
* if the logfile is clean. Instead if the logfile is closed, we know
* it must be clean. If it is open and this bit is set, we also know
* it must be clean. If on the other hand the logfile is open and this
* bit is clear, we can be almost certain that the logfile is dirty.
* @seq_number_bits: How many bits to use for the sequence number. This
* is calculated as 67 - the number of bits required to store the logfile
* size in bytes and this can be used in with the specified file_size as
* a consistency check.
* @restart_area_length: Length of the restart area including the client
* array. Following checks required if version matches. Otherwise,
* skip them. restart_area_offset + restart_area_length has to be
* <= system_page_size. Also, restart_area_length has to be >=
* client_array_offset + (log_clients * sizeof(log client record)).
* @client_array_offset: Offset from the start of this record to the first
* log client record if versions are matched. When creating, set this
* to be after this restart area structure, aligned to 8-bytes boundary.
* If the versions do not match, this is ignored and the offset is
* assumed to be (sizeof(RESTART_AREA) + 7) & ~7, i.e. rounded up to
* first 8-byte boundary. Either way, client_array_offset has to be
* aligned to an 8-byte boundary. Also, restart_area_offset +
* client_array_offset has to be <= 510. Finally, client_array_offset +
* (log_clients * sizeof(log client record)) has to be <= system_page_size.
Annotation
- Immediate include surface: `layout.h`.
- Detected declarations: `struct restart_page_header`, `struct restart_area`, `struct log_client_record`.
- 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.