simple_write_to_buffer(9)
π simple_write_to_buffer(9) β like, the Kernel API Manual page, bestie π
okay so real talk, we're in the Kernel API Manual today and the star of the show is simple_write_to_buffer(9). She's a libfs girlie, she copies stuff from user space into your buffer, and honestly? She ate. Let's get into it β¨
πΈ SYNOPSIS πΈ
ssize_t simple_write_to_buffer (void *to , size_t available , loff_t
*ppos , const void __user *from , size_t count );
that's the whole signature, copy it exactly, no cap π«Ά
π¦ ARGUMENTS π¦
toβ the buffer you're writing into. the destination. the moment. πavailableβ how big that buffer is. like, the vibe check on how much room you actually have.pposβ the current position in the buffer. she's a pointer to the offset and yes she gets updated (more on that below π).fromβ the user space buffer you're reading from. the source. the origin story.countβ the maximum number of bytes to read. the ceiling. the limit. respect it π
β¨ DESCRIPTION β¨
so here's the tea π β simple_write_to_buffer reads up to count bytes from the user space address starting at from and drops them into the buffer to at offset ppos. literally that simple, iykyk.
On success, the number of bytes written is returned and the offset ppos is advanced by this number. she moves forward, she's growing, she's main character energy π. Or, if things go sideways, a negative value is returned on error π. that's it, that's the whole deal.
ngl bestie, watch that return value. negative means error, not "wrote negative bytes" (that's not a thing, please don't). π
π SEE ALSO π
Kernel file ./fs/libfs.c β and like, the entire libfs friend group, honestly, they all roll together π§:
simple_offset_init(9)simple_offset_add(9)simple_offset_remove(9)simple_offset_rename(9)simple_offset_rename_exchange(9)simple_offset_destroy(9)offset_dir_llseek(9)offset_readdir(9)simple_rename_timestamp(9)simple_setattr(9)simple_write_end(9)simple_read_from_buffer(9)memory_read_from_buffer(9)generic_encode_ino32_fh(9)generic_fh_to_dentry(9)generic_fh_to_parent(9)simple_fsync_noflush(9)simple_fsync(9)generic_check_addressable(9)simple_get_link(9)generic_ci_d_compare(9)generic_ci_d_hash(9)generic_ci_match(9)generic_set_sb_d_ops(9)inode_maybe_inc_iversion(9)inode_query_iversion(9)simple_inode_init_ts(9)path_from_stashed(9)simple_start_creating(9)
and that's the page!! π she lives in ./fs and the version stamp says October 2026 β so like, mark your calendars bestie, this one's from the future π¦β¨ periodt. π
π¦ 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