simple_xattr_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… simple_xattr_get(9) β€” from the Kernel API Manual, bestie

okay so picture this: you're deep in the kernel, you've got a simple_xattr_cache, and you just need ONE xattr back. That's literally this function. Welcome to the simple_xattr_get glow-up, brought to you by the Kernel API Manual, section 9 (kernel interfaces, iykyk). πŸ¦‹


✨ NAME ✨

simple_xattr_get β€” get an xattr object. that's it. that's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

int simple_xattr_get (struct simple_xattr_cache *cache , struct
       list_head *xattrs , const char *name , void *buffer , size_t size );

like yes, it's a long signature, but we're gonna get through it together, fr fr. πŸ’–


🌸 ARGUMENTS 🌸

  • cache β€” anchor for the hash table. it's the home base, the main character of the lookup. πŸ‘‘
  • xattrs β€” the header of the xattr object. the starting point of the list.
  • name β€” the name of the xattr to retrieve. tell her what you're looking for.
  • buffer β€” the buffer to store the value into. if you're handing this over, she's putting the value in it.
  • size β€” the size of buffer. gotta know how much room we're working with.

πŸ’« DESCRIPTION πŸ’«

So, the assignment: try to find and retrieve the xattr object associated with name.

If buffer is provided, store the value of the xattr in buffer. If you don't provide a buffer, no stress β€” just return the length. That's the whole trick, ngl, it's giving "let me check how big this is first" energy. πŸ™ˆ

Heads up, bestie β€” the size of buffer is limited to XATTR_SIZE_MAX, which currently is 65536. don't try to be extra about it. πŸ’€

πŸ”₯ RETURN πŸ”₯

  • On success, the length of the xattr value is returned. slay. ✨
  • On error, a negative error code is returned. not the moment, but at least you know. 😭

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./fs/xattr.c β€” plus the whole friend group: may_write_xattr(9), __vfs_setxattr_noperm(9), __vfs_setxattr_locked(9), vfs_listxattr(9), __vfs_removexattr_locked(9), generic_listxattr(9), xattr_full_name(9), simple_xattr_space(9), simple_xattr_free(9), simple_xattr_free_rcu(9), simple_xattr_alloc(9), simple_xattr_set(9), simple_xattr_set_limited(9), simple_xattr_list(9), simple_xattr_add(9), simple_xattr_add_limited(9), simple_xattrs_free(9), simple_xattr_cache_cleanup(9). they all ate, honestly. πŸ’…


mwah, that's the page!! sourced from ./fs, October 2026 edition, and filed under simple_xattr_get(9) β€” go get your xattr, bestie, you've got this 🫢🌈⭐

πŸ“¦ where this page comes from