LLAPI\_NAME\_VALIDATE(3) Lustre Library Functions LLAPI\_NAME\_VALIDATE(3)

# [NAME](#NAME)

llapi\_name\_validate() - check string contains only valid characters

# [SYNOPSIS](#SYNOPSIS)

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

```
int llapi_name_validate(const char *name, const char *extra_chars,
                        unsigned int maxlen);
```

# [DESCRIPTION](#DESCRIPTION)

**llapi\_name\_validate()** verifies that the characters in *name* contain only alphanumeric characters, plus a limited number of other characters in *extra\_chars*, and is not longer than *maxlen* bytes in length (excluding NUL terminator). This ensures that *name* is suitable for use in filesystem identifiers such as the filesystem name, OST pool name, nodemap name, and similar.

# [RETURN VALUE](#RETURN_VALUE)

**llapi\_name\_validate()** returns 0 on success, or a negative errno value on failure.

# [ERRORS](#ERRORS)

EINVAL

The supplied **name** contained an illegal character.

ENAMETOOLONG

The supplied **name** exceeded **maxlen** characters without a NUL terminator.

ENXIO

The **name** was NULL or empty.

# [EXAMPLES](#EXAMPLES)

Check if **fsname** contains only alphanumeric, dash ('**-**'), and underscore ('**\_**') characters and does not exceed the maximum filesystem name length:

```
#include <string.h>
#include <lustre/lustreapi.h>
int main(int argc, char *argv[])
{


        char fsname[] = "newfs123";


        rc = llapi_name_validate(fsname, "-_", LUSTRE_MAXFSNAME);


        if (rc < 0) {


                fprintf(stderr, "%s: fsname '%s' invalid: %s\n",


                        argv[1], fsname, strerror(errno));


                return rc;


        }
}
```

# [AVAILABILITY](#AVAILABILITY)

**llapi\_name\_validate** is part of the [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7) filesystem package since release 2.18.0.

# [SEE ALSO](#SEE_ALSO)

[**lustreapi**(7)](/man/enterprise-packages/lustre/lustreapi.7)

2026-08-23 Lustre User API

---

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