Whamcloud - gitweb
LU-14462 gss: fix support for namespace in lgss_keyring
[fs/lustre-release.git] / lustre / doc / llapi_file_create_foreign.3
1 .TH lustreapi 3 "2009 Jul 10" The Lustre user application interface library
2 .SH NAME
3 llapi_file_create_foreign \- create a file with foreign layout on a Lustre filesystem
4 .SH SYNOPSIS
5 .nf
6 .B #include <sys/types.h>
7 .B #include <sys/stat.h>
8 .B #include <fcntl.h>
9 .B #include <lustre/lustreapi.h>
10 .sp
11 .BI "int llapi_file_create_foreign(const char *" name ", mode_t " mode ","
12 .BI "                    __u32 " type ", __u32 " flags ", char *" foreign_lov );
13 .sp
14 .fi
15 .SH DESCRIPTION
16 .LP
17 .B llapi_file_create_foreign(\|)
18 creates a file with
19 .I foreign_lov
20 free format layout and
21 .I mode
22 and
23 .I name
24 on a Lustre filesystem, followed by file close.
25 .TP 15
26 .I mode
27 specifies the permission bits.
28 Refer to
29 .BR open(2)
30 man page for a detailed description.
31 .TP 15
32 .I type
33 specifies a type of foreign layout.
34 .TP 15
35 .I flags
36 specifies any flags for foreign layout.
37 .TP 15
38 .I foreign_lov
39 free-format string to be set as file layout/LOV EA.
40 .SH RETURN VALUES
41 .LP
42 .B llapi_file_create_foreign(\|)
43 return:
44 .TP
45 >=0
46 on success, for
47 .B llapi_file_open
48 the return value is a file descriptor.
49 .TP
50 <0
51 on failure, the absolute value is an error code.
52 .SH ERRORS
53 .TP 15
54 .SM EEXIST
55 .I name
56 already exists.
57 .TP
58 .SM ENOTTY
59 .I name
60 may not point to a Lustre filesystem.
61 .SH "EXAMPLE"
62 .nf
63 #include <sys/types.h>
64 #include <sys/stat.h>
65 #include <fcntl.h>
66 #include <errno.h>
67 #include <stdio.h>
68 #include <lustre/lustreapi.h>
69 int main(int argc, char *argv[])
70 {
71         int rc;
72
73         if (argc != 2)
74                 return -1;
75
76         rc = llapi_file_create_foreign(argv[1], 0600, LOV_FOREIGN_TYPE_SYMLINK,
77                                        0xda05, "PUUID/CUUID");
78         if (rc < 0) {
79                 fprintf(stderr, "file creation has failed, %s\\n", strerror(-rc));
80                 return -1;
81         }
82         printf("foreign file %s has been created with 'PUUID/CUUID' layout!\\n",
83                argv[1]);
84         return 0;
85 }
86 .fi
87 .SH "SEE ALSO"
88 .BR llapi_file_open (3)
89 .BR lustre (7),
90 .BR lustreapi (7)
91 .BR open (2),