LLAPI_PATH2PARENT(3)

πŸ“¦ version 2.17.58, in ubuntu stonking

πŸ’– LLAPI_PATH2PARENT πŸ’–

okay bestie, this is llapi_path2parent(3) β€” a Lustre library functions page, and it's giving "find my file's parent directory and its name" energy. let's get into it 🫢


✨ NAME ✨

llapi_path2parent, llapi_fd2parent β€” retrieve <parent FID>/name(s) for an entry in Lustre. yes literally, that's the whole job πŸ’…


🌸 SYNOPSIS 🌸

#include <lustre/lustreapi.h>

int llapi_path2parent(const char *path, unsigned int linkno,
                      struct lu_fid *parent_fid, char *name,
                      size_t name_size);

int llapi_fd2parent(int fd, unsigned int linkno,
                    struct lu_fid *parent_fid, char *name,
                    size_t name_size);

two functions, same shape, different entry point. iconic behavior fr fr ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so <italic>llapi_path2parent()</italic> does the thing: for link number linkno, it drops the FID of the parent directory into parent_fid, and it puts the NUL-terminated name of the entry into the buffer name, which is expected to be of size name_size. πŸŽ€

and here's the part people always mess up πŸ‘€ β€” linkno should be initialized to -1 when you're starting to iterate over all links of a file. note it down, no cap.

<italic>llapi_fd2parent()</italic> is the twin 🧚 it behaves similarly except it operates on an open file descriptor instead of a path. same vibe, different door.


πŸ”₯ RETURN VALUES πŸ”₯

0 is returned on success, or a negative errno value on failure. that's it, that's the tea β˜•


πŸ‘‘ ERRORS πŸ‘‘

here's where it gets real bestie β€” the glow-down list πŸ’€

  • -ENODATA β€” linkno has reached the total link count of the file. you've gone too far, wrap it up 🏁
  • -ENOTTY β€” path or fd does not reside on a Lustre filesystem. not our turf, sorry πŸ™ˆ
  • -ENOENT β€” path does not exist. ghosted πŸ‘»
  • -EINVAL β€” an invalid argument was specified. check ur args bb 🌸
  • -EOVERFLOW β€” the given buffer was too small to hold the pathname. name_size said "i cannot", size up πŸ“
  • -EPERM β€” the file cannot be open by user or CAP_DAC_READ_SEARCH is not granted. permission slip denied 🚫

🌈 AVAILABILITY 🌈

llapi_path2parent() and llapi_fd2parent() are part of the lustre(7) user application interface library since release 2.4.0 ⭐ so if you're on anything older, that's a you problem (affectionately) πŸ’œ


πŸ’… SEE ALSO πŸ’…

go read those too, iykyk πŸ“šβœ¨


aaaand that's the whole page, bestie πŸŽ€ this was the Lustre User API, dated 2024-08-28, and it lives at LLAPI_PATH2PARENT(3). slay, read responsibly, and remember: linkno starts at -1 πŸ˜ŒπŸ’–

πŸ“¦ where this page comes from