include/linux/crash_dump.h

Source file repositories/reference/linux-study-clean/include/linux/crash_dump.h

File Facts

System
Linux kernel
Corpus path
include/linux/crash_dump.h
Extension
.h
Size
6477 bytes
Lines
193
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct vmcore_cb {
	bool (*pfn_is_ram)(struct vmcore_cb *cb, unsigned long pfn);
	int (*get_device_ram)(struct vmcore_cb *cb, struct list_head *list);
	struct list_head next;
};
extern void register_vmcore_cb(struct vmcore_cb *cb);
extern void unregister_vmcore_cb(struct vmcore_cb *cb);

struct vmcore_range {
	struct list_head list;
	unsigned long long paddr;
	unsigned long long size;
	loff_t offset;
};

/* Allocate a vmcore range and add it to the list. */
static inline int vmcore_alloc_add_range(struct list_head *list,
		unsigned long long paddr, unsigned long long size)
{
	struct vmcore_range *m = kzalloc_obj(*m);

	if (!m)
		return -ENOMEM;
	m->paddr = paddr;
	m->size = size;
	list_add_tail(&m->list, list);
	return 0;
}

/* Free a list of vmcore ranges. */
static inline void vmcore_free_ranges(struct list_head *list)
{
	struct vmcore_range *m, *tmp;

	list_for_each_entry_safe(m, tmp, list, list) {
		list_del(&m->list);
		kfree(m);
	}
}

#else /* !CONFIG_CRASH_DUMP */
static inline bool is_kdump_kernel(void) { return false; }
#endif /* CONFIG_CRASH_DUMP */

/* Device Dump information to be filled by drivers */
struct vmcoredd_data {
	char dump_name[VMCOREDD_MAX_NAME_BYTES]; /* Unique name of the dump */
	unsigned int size;                       /* Size of the dump */
	/* Driver's registered callback to be invoked to collect dump */
	int (*vmcoredd_callback)(struct vmcoredd_data *data, void *buf);
};

#ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP
int vmcore_add_device_dump(struct vmcoredd_data *data);
#else
static inline int vmcore_add_device_dump(struct vmcoredd_data *data)
{
	return -EOPNOTSUPP;
}
#endif /* CONFIG_PROC_VMCORE_DEVICE_DUMP */

#ifdef CONFIG_PROC_VMCORE
ssize_t read_from_oldmem(struct iov_iter *iter, size_t count,
			 u64 *ppos, bool encrypted);
#else
static inline ssize_t read_from_oldmem(struct iov_iter *iter, size_t count,
				       u64 *ppos, bool encrypted)
{
	return -EOPNOTSUPP;
}
#endif /* CONFIG_PROC_VMCORE */

#endif /* LINUX_CRASHDUMP_H */

Annotation

Implementation Notes