LLAPI\_PATH2PARENT(3) Lustre Library Functions LLAPI\_PATH2PARENT(3)

# [NAME](#NAME)

llapi\_path2parent, llapi\_fd2parent - Retrieve &lt;parent FID&gt;/name(s) for an entry in Lustre.

# [SYNOPSIS](#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](#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](#RETURN_VALUES)

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

# [ERRORS](#ERRORS)

[**-ENODATA**](#ENODATA)

linkno has reached the total link count of the file.

[**-ENOTTY**](#ENOTTY)

*path* or *fd* does not reside on a Lustre filesystem.

[**-ENOENT**](#ENOENT)

*path* does not exist.

[**-EINVAL**](#EINVAL)

An invalid argument was specified.

[**-EOVERFLOW**](#EOVERFLOW)

The given buffer was too small to hold the pathname.

[**-EPERM**](#EPERM)

The file cannot be open by user or CAP\_DAC\_READ\_SEARCH is not granted.

# [AVAILABILITY](#AVAILABILITY)

**llapi\_path2parent()** and **llapi\_fd2parent()** are part of the [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7) user application interface library since release 2.4.0

# [SEE ALSO](#SEE_ALSO)

[**lfs-path2fid**(1)](/man/enterprise-packages/lustre/lfs-path2fid.1), [**llapi\_fid2path**(3)](/man/enterprise-packages/lustre/llapi_fid2path.3), [**llapi\_path2fid**(3)](/man/enterprise-packages/lustre/llapi_path2fid.3), [**lustreapi**(7)](/man/enterprise-packages/lustre/lustreapi.7)

2024-08-28 Lustre User API

---

Document: llapi_fd2parent(3) from lustre 2.17.59-r1 (Chainguard OS)
Source: https://github.com/lustre/lustre-release
