include/linux/pstore.h
Source file repositories/reference/linux-study-clean/include/linux/pstore.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/pstore.h- Extension
.h- Size
- 7953 bytes
- Lines
- 290
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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/compiler.hlinux/errno.hlinux/kmsg_dump.hlinux/mutex.hlinux/spinlock.hlinux/time.hlinux/types.h
Detected Declarations
struct modulestruct pstore_infostruct pstore_recordstruct pstore_infostruct pstore_ftrace_recordenum pstore_type_idfunction pstore_ftrace_encode_cpufunction pstore_ftrace_decode_cpufunction pstore_ftrace_read_timestampfunction pstore_ftrace_write_timestampfunction pstore_ftrace_encode_cpufunction pstore_ftrace_decode_cpufunction pstore_ftrace_read_timestampfunction pstore_ftrace_write_timestamp
Annotated Snippet
struct pstore_record {
struct pstore_info *psi;
enum pstore_type_id type;
u64 id;
struct timespec64 time;
char *buf;
ssize_t size;
ssize_t ecc_notice_size;
void *priv;
int count;
enum kmsg_dump_reason reason;
unsigned int part;
bool compressed;
};
/**
* struct pstore_info - backend pstore driver structure
*
* @owner: module which is responsible for this backend driver
* @name: name of the backend driver
*
* @buf_lock: spinlock to serialize access to @buf
* @buf: preallocated crash dump buffer
* @bufsize: size of @buf available for crash dump bytes (must match
* smallest number of bytes available for writing to a
* backend entry, since compressed bytes don't take kindly
* to being truncated)
*
* @read_mutex: serializes @open, @read, @close, and @erase callbacks
* @flags: bitfield of frontends the backend can accept writes for
* @max_reason: Used when PSTORE_FLAGS_DMESG is set. Contains the
* kmsg_dump_reason enum value. KMSG_DUMP_UNDEF means
* "use existing kmsg_dump() filtering, based on the
* printk.always_kmsg_dump boot param" (which is either
* KMSG_DUMP_OOPS when false, or KMSG_DUMP_MAX when
* true); see printk.always_kmsg_dump for more details.
* @data: backend-private pointer passed back during callbacks
*
* Callbacks:
*
* @open:
* Notify backend that pstore is starting a full read of backend
* records. Followed by one or more @read calls, and a final @close.
*
* @psi: in: pointer to the struct pstore_info for the backend
*
* Returns 0 on success, and non-zero on error.
*
* @close:
* Notify backend that pstore has finished a full read of backend
* records. Always preceded by an @open call and one or more @read
* calls.
*
* @psi: in: pointer to the struct pstore_info for the backend
*
* Returns 0 on success, and non-zero on error. (Though pstore will
* ignore the error.)
*
* @read:
* Read next available backend record. Called after a successful
* @open.
*
* @record:
* pointer to record to populate. @buf should be allocated
* by the backend and filled. At least @type and @id should
* be populated, since these are used when creating pstorefs
* file names.
*
* Returns record size on success, zero when no more records are
* available, or negative on error.
*
* @write:
* A newly generated record needs to be written to backend storage.
*
* @record:
* pointer to record metadata. When @type is PSTORE_TYPE_DMESG,
* @buf will be pointing to the preallocated @psi.buf, since
* memory allocation may be broken during an Oops. Regardless,
* @buf must be proccesed or copied before returning. The
* backend is also expected to write @id with something that
* can help identify this record to a future @erase callback.
* The @time field will be prepopulated with the current time,
* when available. The @size field will have the size of data
* in @buf.
*
* Returns 0 on success, and non-zero on error.
*
* @write_user:
* Perform a frontend write to a backend record, using a specified
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/errno.h`, `linux/kmsg_dump.h`, `linux/mutex.h`, `linux/spinlock.h`, `linux/time.h`, `linux/types.h`.
- Detected declarations: `struct module`, `struct pstore_info`, `struct pstore_record`, `struct pstore_info`, `struct pstore_ftrace_record`, `enum pstore_type_id`, `function pstore_ftrace_encode_cpu`, `function pstore_ftrace_decode_cpu`, `function pstore_ftrace_read_timestamp`, `function pstore_ftrace_write_timestamp`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.