llapi_path2parent(3)

NAME
llapi_path2parent, llapi_fd2parent - Retrieve <parent FID>/name(s) for an entry in Lustre.

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);

DESCRIPTION

llapi_path2parent() for link number linkno stores the FID of the parent directory into parent_fid and the NUL-terminated name of the entry into the buffer name which is expected to be of size name_size. If linkno should be initialized to -1 when starting to iterate over all links of a file. The function llapi_fd2parent() behaves similarly except that it operates on an open file descriptor instead of a path.

RETURN VALUES

0 is returned on success or a negative errno value on failure.

ERRORS

-ENODATA
    linkno has reached the total link count of the file.

-ENOTTY
    path or fd does not reside on a Lustre filesystem.

-ENOENT
    path does not exist.

-EINVAL
    An invalid argument was specified.

-EOVERFLOW
    The given buffer was too small to hold the pathname.

-EPERM
    The file cannot be open by user or CAP_DAC_READ_SEARCH is not granted.

SEE ALSO
lfs-path2fid(1), llapi_fid2path(3), llapi_path2fid(3), lustreapi(7)