LLAPI\_UNLINK\_FOREIGN(3) Lustre Library Functions LLAPI\_UNLINK\_FOREIGN(3)

# [NAME](#NAME)

llapi\_unlink\_foreign - unlink file/dir with foreign layout on a Lustre filesystem

# [SYNOPSIS](#SYNOPSIS)

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

```
int llapi_unlink_foreign(char *name);
```

# [DESCRIPTION](#DESCRIPTION)

**llapi\_unlink\_foreign()** will allow to unlink a file/dir of *name* with foreign LOV/LMV, that would be prevented to be using regular unlink/rmdir command/syscall. It also works for regular file/dir.

# [RETURN VALUES](#RETURN_VALUES)

**llapi\_unlink\_foreign()** return:

=0

on success.

&lt;0

on failure, the absolute value is an error code.

# [ERRORS](#ERRORS)

[**ENOENT**](#ENOENT)

*name* does not exist.

[**ENOTTY**](#ENOTTY)

*name* may not point to a Lustre filesystem.

# [EXAMPLES](#EXAMPLES)

```
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <lustre/lustreapi.h>
int main(int argc, char **argv)
{
	char *foreign = NULL;
	int c, rc;
	while ((c = getopt(argc, argv, "hf:")) != -1) {
		switch (c) {
		case 'f':
			foreign = optarg;
			break;
		case 'h':
		default:
			fprintf(stderr,
				"Usage: %s [-f <foreign file/dir pathname>]0,
				argv[0]);
			exit(0);
			break;
		}
	}
	if (foreign == NULL) {
		fprintf(stderr, "a foreign file/dir pathname must be provided0);
		exit(0);
	}
	rc = llapi_unlink_foreign(foreign);
	if (rc < 0)
		fprintf(stderr, "llapi_unlink_foreign() error: %d0, rc);
	return rc;
}
```

# [AVAILABILITY](#AVAILABILITY)

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

# [SEE ALSO](#SEE_ALSO)

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

2024-08-28 Lustre User API

---

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