LLAPI\_SEARCH\_TGT(3) Lustre Library Functions LLAPI\_SEARCH\_TGT(3)

# [NAME](#NAME)

llapi\_search\_tgt, llapi\_search\_mdt, llapi\_search\_ost - verify OST or MDT is in specified pool

# [SYNOPSIS](#SYNOPSIS)

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

```
int llapi_search_tgt(const char *fsname, const char *pool_name,
                     const char *tgt_name, bool is_mdt);
```

```
int llapi_search_mdt(const char *fsname, const char *pool_name,
                     const char *tgt_name);
```

```
int llapi_search_ost(const char *fsname, const char *pool_name,
                     const char *tgt_name);
```

# [DESCRIPTION](#DESCRIPTION)

**llapi\_search\_tgt()** verifies that the specified *tgt\_name* is a valid MDT or OST (depending on whether *is\_mdt* is **true** or **false**, respectively) in the filesystem named *fsname* and (if specified) in the pool named *pool\_name* of that filesystem. At least *fsname* must be non-NULL, but *pool\_name* may be **NULL** if just checking for the existence of the target, and *tgt\_name* may be **NULL**, if only checking the existence of *pool\_name*.

The **llapi\_search\_mdt()** and **llapi\_search\_ost()** functions are simple convenience/compatibility wrappers of **llapi\_search\_tgt()** that set *is\_mdt* appropriately for the target type.

# [RETURN VALUES](#RETURN_VALUES)

**llapi\_search\_tgt()** returns 1 if *tgt\_name* (or *pool\_name* if *tgt\_name* is **NULL**) is found in the specified pool (or *filesystem* if *pool\_name* is **NULL**). It returns 0 if *tgt\_name* (*pool\_name*) if it is not found in the specified pool (*filesystem*). A negative errno is returned if an error occurred, in which case errno is also set appropriately.

# [ERRORS](#ERRORS)

[**EINVAL**](#EINVAL)

*fsname* is NULL or zero-length, or both *pool\_name* and *tgt\_name* are **NULL**.

[**ENOENT**](#ENOENT)

*pool\_name* is specified but is not part of *fsname*.

# [AVAILABILITY](#AVAILABILITY)

**llapi\_search\_tgt()**, **llapi\_search\_mdt()** and **llapi\_search\_ost()** is part of the [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7) user application interface library since release 2.4.0

# [SEE ALSO](#SEE_ALSO)

[**llapi\_pool\_name\_verify**(3)](/man/enterprise-packages/lustre/llapi_pool_name_verify.3), [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7), [**lustreapi**(7)](/man/enterprise-packages/lustre/lustreapi.7)

2024-08-28 Lustre User API

---

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