LLAPI_UNLINK_FOREIGN(3)

NAME
llapi_unlink_foreign - unlink file/dir with foreign layout on a Lustre filesystem

SYNOPSIS
#include <lustre/lustreapi.h>

int llapi_unlink_foreign(char *name);

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
llapi_unlink_foreign() return:

=0  on success.

<0  on failure, the absolute value is an error code.

ERRORS

ENOENT
    name does not exist.

ENOTTY
    name may not point to a Lustre filesystem.

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>],
				argv[0]);
			exit(0);
			break;
		}
	}

	if (foreign == NULL) {
		fprintf(stderr, "a foreign file/dir pathname must be provided);
		exit(0);
	}

	rc = llapi_unlink_foreign(foreign);
	if (rc < 0)
		fprintf(stderr, "llapi_unlink_foreign() error: %d, rc);

	return rc;
}

AVAILABILITY
llapi_unlink_foreign() is part of the lustre(7) user application interface library since release 2.9.0

SEE ALSO
lustre(7), lustreapi(7)