dev_coredumpm(9)
π dev_coredumpm(9) β the Kernel API Manual, bestie edition
okay so this is a page from the Kernel API Manual (section 9, kernel developer stuff, iykyk) and it's literally about dev_coredumpm β say it with me: dev-coredump-m. it's giving "my device crashed and we need to preserve the evidence" energy. let's get into it π«Ά
β¨ NAME β¨
dev_coredumpm β create a device coredump with read/free methods π
πΈ SYNOPSIS πΈ
void dev_coredumpm (struct device *dev , struct module *owner , void
*data , size_t datalen , gfp_t gfp , ssize_t (*read)(char *buffer,
loff_t offset, size_t count, void *data, size_t datalen) , void
(*free)(void *data) );
like, that's the whole signature, no cap. it's a void function so it doesn't even return anything β it just does its thing. iconic behavior honestly π
π ARGUMENTS π
devβ thestruct devicefor the crashed device. this is the main character of the whole operation πownerβ the module that contains theread/freefunctions. useTHIS_MODULE, periodt. don't overthink it.dataβ data cookie for theread/freefunctions. it's literally just a lil cookie passed along, cute πdatalenβ length of the data. the size, the amount, the big number energy.gfpβ allocation flags. idk your memory situation bestie, but these are your flags.readβ function to read from the given buffer. function signature isssize_t (*read)(char *buffer, loff_t offset, size_t count, void *data, size_t datalen)β¨freeβ function to free the given buffer. signature:void (*free)(void *data)π§
π¦ DESCRIPTION π¦
Creates a new device coredump for the given device. that's the whole assignment. slay.
here's the important plot twist though: if a previous one hasn't been read yet, the new coredump is discarded. so it's not stacking up old crashes forever, it's like "nope, you didn't read that one, moving on" π
The data lifetime is determined by the device coredump framework β you don't manage it, the framework does, it's very independent girlboss of it β and when it is no longer needed the free function will be called to free the data. so your free callback is the one doing the actual cleanup at the end. don't forget to register it fr fr π«Ά
π SEE ALSO π
Kernel file ./include/linux/devcoredump.h β go read the header bestie, it's right there π
lowkey reminder: passTHIS_MODULEasowner, and remember yourfreegets called by the framework when the data is done being needed. don't be weird about it π
okay that's the whole page!! source is ./include/linux, dated October 2026, and this is dev_coredumpm(9) signing off πβ¨ go crash some devices responsibly, mwah π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms