nvdimm_write_bytes(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’Ύ nvdimm_write_bytes(9) β€” the Kernel API Manual page, bestie edition πŸ’Ύ

okay so you opened nvdimm_write_bytes(9) from the Kernel API Manual and you're like "what is this function even doing" β€” don't worry, I got you, we're gonna read it together like it's a group chat 🫢


✨ NAME ✨

nvdimm_write_bytes β€” synchronously write bytes to an nvdimm namespace. that's it, that's the whole vibe. synchronous, no cap. πŸŽ€


🌸 SYNOPSIS 🌸

int nvdimm_write_bytes (struct nd_namespace_common *ndns ,
resource_size_t offset , void *buf , size_t size , unsigned long flags
);

literally just copy that exactly, bestie, don't retype it from memory πŸ™ˆ


πŸ¦‹ ARGUMENTS πŸ¦‹

  • ndns β€” the device you're writing to. the main character of this whole operation πŸ‘‘
  • offset β€” the starting offset, and it's namespace-relative, meaning it's counted from the start of the namespace, not from anywhere else. important detail, iykyk.
  • buf β€” the buffer to drain. yes, drain. that's the word the manual uses, we respect it. πŸ“
  • size β€” transfer length, aka how many bytes are getting sent. πŸ“
  • flags β€” the context you're in: 0 for process context, 1 for atomic context. pick correctly, no pressure πŸ’€

πŸ’… DESCRIPTION πŸ’…

okay so here's the tea β˜• β€” NVDIMM Namespaces disks do not implement sectors internally. that's just not a thing they do.

so depending on the ndns, when this routine returns, the contents of buf may be sitting in cpu cache, in platform buffers, or actually on backing memory media. three possibilities, and it's giving "it depends" energy 😭

and the flushing-to-media part? that's handled internal to the ndns driver β€” if it's handled at all. so don't go assuming it happens, because "if at all" is doing a lot of work in that sentence. πŸ™ˆ


⭐ RETURN ⭐

  • 0 on success πŸŽ‰
  • a negative error code on failure πŸ’€

that's the whole return section, short and iconic.


🌈 SEE ALSO 🌈

  • Kernel file ./include/linux/nd.h
  • struct nvdimm_pmu(9)
  • struct nd_namespace_common(9)
  • struct nd_namespace_io(9)
  • struct nd_namespace_pmem(9)
  • nvdimm_read_bytes(9) β€” the read girlie, the sibling, the counterpart πŸ’œ

and that's the page!! ngl this one was short but she ate. πŸ’–

one last thing: this whole page lives in ./include/linux, and it's dated October 2026 β€” so go forth and write those bytes synchronously, bestie, and remember to check your context flag βœ¨πŸ¦‹πŸ’…
πŸ“¦ where this page comes from