Whamcloud - gitweb
LU-12682 llite: fake symlink type of foreign file/dir
[fs/lustre-release.git] / lustre / doc / llapi_unlink_foreign.3
1 .TH lustreapi 3 "2009 Jul 10" The Lustre user application interface library
2 .SH NAME
3 llapi_unlink_foreign \- unlink file/dir with foreign layout on a Lustre filesystem
4 .SH SYNOPSIS
5 .nf
6 .B #include <lustre/lustreapi.h>
7 .sp
8 .BI "int llapi_unlink_foreign(char *" name ");"
9 .sp
10 .fi
11 .SH DESCRIPTION
12 .LP
13 .B llapi_unlink_foreign(\|)
14 will allow to unlink a file/dir of
15 .I name
16 with foreign LOV/LMV, that would be prevented to be using regular unlink/rmdir
17 command/syscall.
18 It also works for regular file/dir.
19 .SH RETURN VALUES
20 .LP
21 .B llapi_unlink_foreign(\|)
22 return:
23 .TP
24 =0
25 on success.
26 .TP
27 <0
28 on failure, the absolute value is an error code.
29 .SH ERRORS
30 .TP 15
31 .SM ENOENT
32 .I name
33 does not exist.
34 .TP
35 .SM ENOTTY
36 .I name
37 may not point to a Lustre filesystem.
38 .SH "EXAMPLE"
39 .nf
40 #include <stdlib.h>
41 #include <unistd.h>
42 #include <stdio.h>
43
44 #include <lustre/lustreapi.h>
45
46 int main(int argc, char **argv)
47 {
48         char *foreign = NULL;
49         int c, rc;
50
51         while ((c = getopt(argc, argv, "hf:")) != -1) {
52                 switch (c) {
53                 case 'f':
54                         foreign = optarg;
55                         break;
56                 case 'h':
57                 default:
58                         fprintf(stderr,
59                                 "Usage: %s [-f <foreign file/dir pathname>]\n",
60                                 argv[0]);
61                         exit(0);
62                         break;
63                 }
64         }
65
66         if (foreign == NULL) {
67                 fprintf(stderr, "a foreign file/dir pathname must be provided\n");
68                 exit(0);
69         }
70
71         rc = llapi_unlink_foreign(foreign);
72         if (rc < 0)
73                 fprintf(stderr, "llapi_unlink_foreign() error: %d\n", rc);
74
75         return rc;
76 }
77 .fi
78 .SH "SEE ALSO"
79 .BR lustre (7),
80 .BR lustreapi (7)