STRUCT LUO_FILE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct luo_file β€” NAME πŸ’…

okay bestie, welcome to the struct luo_file(9) glow-up ✨ this is the kernel-API page for struct luo_file, and it's literally just: Represents a single preserved file instance. That's it, that's the vibe πŸŽ€


🌸 SYNOPSIS 🌸

struct luo_file {
    struct liveupdate_file_handler *fh;
    struct file *file;
    u64 serialized_data;
    void *private_data;
    int retrieve_status;
    struct mutex mutex;
    struct list_head list;
    u64 token;
 };

no cap, that's the whole shape of it πŸ¦‹


πŸ‘‘ Members πŸ‘‘

  • fh β€” pointer to the struct liveupdate_file_handler that manages this type of file. like, the handler that owns this whole situation πŸ’β€β™€οΈ
  • file β€” pointer to the kernel's struct file that's being preserved. ⚠️ it's NULL in the new kernel until the file is successfully retrieved β€” so don't go dereferencing it early, bestie 😭
  • serialized_data β€” the opaque u64 handle to the serialized state of the file. this handle gets passed back to the handler's .freeze, .retrieve, and .finish callbacks, so the handler can track and update its serialized state across phases πŸ”₯
  • private_data β€” pointer to the private data for the file, used to hold runtime state that is not preserved. it's set by the handler's .preserve callback, and it must be freed in the handler's .unpreserve callback 🫢 (yes, that's you, free it)
  • retrieve_status β€” status code telling you whether a user/kernel in the new kernel has successfully called retrieve on this file. it's giving gatekeeper: it prevents multiple retrieval attempts πŸ’… so the values are:
    • 0 β†’ a retrieve has not been attempted
    • a positive value β†’ the retrieve was successful ✨
    • a negative value β†’ the retrieve failed, and that value is the error code of the call πŸ’€
  • mutex β€” a mutex that protects the fields of this specific instance (e.g., retrieved, file), keeping stuff like retrieving or finishing a file atomic. iconic locking behaviour, we stan πŸ”’
  • list β€” the list_head that links this instance into its parent file_set's list of preserved files 🌈
  • token β€” the user-provided unique token used to identify this file. iykyk πŸŽ€

🧚 Description 🧚

this structure is the core in-kernel representation of a single file being managed through a live update. main character energy fr fr πŸ‘‘

an instance gets created by luo_preserve_file, and it links a 'struct file' to its corresponding handler, a user-provided token, and the serialized state handle returned by the handler's .preserve operation. three things, one struct, slay 🫢

these instances are tracked in a per-file_set list. the serialized_data field β€” which holds a handle to the file's serialized state β€” may be updated during the .freeze callback before being serialized for the next kernel. then after reboot, these structures get recreated by luo_file_deserialize πŸ’« and are finally cleaned up by luo_file_finish. full lifecycle, no loose ends ✨


πŸ‘€ SEE ALSO πŸ‘€

go read them, bestie, they're all linked in the group chat πŸ¦‹


and that's the page!! πŸŽ€πŸ’– source/version: ./kernel/liveupdate Β· dated October 2026 Β· manual struct luo_file(9) β€” mwah, periodt πŸ’…πŸ«Ά

πŸ“¦ where this page comes from