LLAPI\_DIR\_CREATE\_FOREIGN(3) Lustre Library Functions LLAPI\_DIR\_CREATE\_FOREIGN(3)

# [NAME](#NAME)

llapi\_dir\_create\_foreign - create a foreign directory entry

# [SYNOPSIS](#SYNOPSIS)

```
#include <lustre/lustreapi.h>
```

```
int llapi_dir_create_foreign(const char *name, mode_t mode,
                             __u32 type, __u32 flags,
                             const char *value)
```

# [DESCRIPTION](#DESCRIPTION)

**llapi\_dir\_create\_foreign**() creates a foreign directory entry that stores a reference to external storage or metadata. This allows Lustre to track and manage directories that reside outside the Lustre filesystem.

The arguments are as follows:

[*name*](#name)

The pathname of the directory entry to create. The parent directory must already exist and be on a Lustre filesystem.

[*mode*](#mode)

The permission bits for the new directory, as described in [**open**(2)](/man/enterprise-packages/lustre/open.2).

[*type*](#type)

The type of foreign directory. This identifies what kind of external storage or system the foreign reference points to.

[*flags*](#flags)

Flags controlling the behavior of the foreign directory entry.

[*value*](#value)

A string value containing the foreign reference information, such as a path or identifier in the external system.

# [RETURN VALUE](#RETURN_VALUE)

**llapi\_dir\_create\_foreign**() returns 0 on success, or a negative errno value on failure.

# [ERRORS](#ERRORS)

[**-EACCES**](#EACCES)

Permission denied on parent directory.

[**-EALREADY**](#EALREADY)

Stripe already set on existing directory.

[**-EEXIST**](#EEXIST)

Directory already exists.

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

An invalid argument was specified.

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

Parent directory does not exist.

[**-ENOMEM**](#ENOMEM)

Not enough memory to allocate a resource.

# [AVAILABILITY](#AVAILABILITY)

**llapi\_dir\_create\_foreign ()** is part of the [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7) user application interface library since release 2.13.0.

# [SEE ALSO](#SEE_ALSO)

[**llapi\_dir\_create**(3)](/man/enterprise-packages/lustre/llapi_dir_create.3), [**llapi\_dir\_create\_pool**(3)](/man/enterprise-packages/lustre/llapi_dir_create_pool.3), [**lustreapi**(7)](/man/enterprise-packages/lustre/lustreapi.7)

2026-01-26 Lustre User API

---

Document: llapi_dir_create_foreign(3) from lustre 2.17.60-r0 (Chainguard OS)
Source: https://github.com/lustre/lustre-release
