snapshot_write_next(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’Ύ snapshot_write_next(9) πŸ’Ύ

okay so this is a page from the Kernel API Manual and honestly it's giving "hibernation internals bestie" energy β€” let's get into it 🫢


✨ NAME ✨

snapshot_write_next β€” get the address to store the next image page. that's the whole gig, no cap.


🌸 SYNOPSIS 🌸

int snapshot_write_next (struct snapshot_handle *handle );

πŸŽ€ ARGUMENTS πŸŽ€

  • handle β€” the snapshot handle structure that guides the writing. think of it as the little tour guide for your image pages ✨

πŸ’… DESCRIPTION πŸ’…

ok so on the first call, handle should point to a zeroed snapshot_handle structure. it gets populated right then and there, and after that you should pass a pointer to it to this function every next time. like, don't lose track of it, bestie πŸ™ˆ

On success, the function returns a positive number. and then? the caller is allowed to write up to the returned number of bytes to the memory location computed by the data_of macro. that's your green light, go off πŸ‘‘

The function returns 0 to indicate the "end of file" condition. iconic, we love a clean ending πŸ’€

Negative numbers are returned on errors β€” and in those cases the structure pointed to by handle is not updated and should not be used any more. like, seriously, don't touch it after that. it's done. periodt 🚫


πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./kernel/power/snapshot.c β€” and the whole friend group:


okay that's the whole thing, mwah πŸ’– this one lives in ./kernel/power, and the version vibes are October 2026, page snapshot_write_next(9) β€” go read it again if you need to, i'll wait πŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from