LLAPI_PATH2PARENT(3)
π 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βlinknohas reached the total link count of the file. you've gone too far, wrap it up π-ENOTTYβpathorfddoes not reside on a Lustre filesystem. not our turf, sorry π-ENOENTβpathdoes 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_sizesaid "i cannot", size up π-EPERMβ the file cannot be open by user orCAP_DAC_READ_SEARCHis 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 π
lfs-path2fid(1)llapi_fid2path(3)llapi_path2fid(3)lustreapi(7)
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
- ubuntu stonking: lustre-client-utils 2.17.58+dfsg-0ubuntu2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms