data_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– data_read(9) β€” Kernel API Manual, but make it a group chat πŸ’–

okay so bestie, welcome to data_read β€” the read function for the "data" sysfs attribute. yes, that one. she's a sysfs read callback and she's literally the main character of this page. come on, let's get into it ✨


🌸 SYNOPSIS 🌸

like, the whole vibe in one block:

ssize_t data_read (struct file *file , struct kobject *kobj , const
struct bin_attribute *attr , char *buffer , loff_t off , size_t size );

bestie she returns an ssize_t. noted. moving on πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

six params, six little besties, let's meet them:

  • file β€” the open file pointer 🫢
  • kobj β€” the kobject of the sclp_sd_file object, iykyk
  • attr β€” the data attribute (she's a data attribute, that's the whole thing)
  • buffer β€” the target buffer, aka where the good stuff goes πŸ“
  • off β€” the requested file offset, like where in the file we're peeking πŸ‘€
  • size β€” the requested number of bytes, the how-much-are-we-reading number

πŸ¦‹ DESCRIPTION πŸ¦‹

so what she does: she takes the requested portion of the Store Data entity contents and stores it into the specified buffer. that's it. that's the function. she ate πŸ’…

and the return value? on success she hands you back the number of bytes she stored, or 0 on EOF. yes queen, 0 means EOF, don't @ me 😭

ngl, this is the part where you actually remember the return semantics: bytes stored on success, 0 on EOF. write it on your hand if you have to.

✨ SEE ALSO ✨

the whole friend group, no cap β€” they all live in the kernel file ./drivers/s390/char/sclp_sd.c:

go read them all, they're iconic, periodt πŸ‘‘


🌈 the cute little sign-off 🌈

this page lives in ./drivers/s390/char, and it's dated October 2026. so she's from the future AND from the s390 char drivers folder. obsessed. bye bestie, go read some sysfs attributes πŸ§šπŸ’œ

πŸ“¦ where this page comes from