1 .TH LLAPI_FILE_OPEN 3 "2009 Jul 10" Lustre API
3 llapi_file_open, llapi_file_create \- open and possibly create a file or a device on a Lustre filesystem
6 .B #include <sys/types.h>
7 .B #include <sys/stat.h>
9 .B #include <liblustre.h>
10 .B #include <lustre/lustre_idl.h>
11 .B #include <lustre/liblustreapi.h>
12 .B #include <lustre/lustre_user.h>
14 .BI "int llapi_file_open(const char *"name ", int " flags ", int " mode ","
15 .BI " unsigned long long " stripe_size ", int " stripe_offset ","
16 .BI " int " stripe_count ", int " stripe_pattern );
18 .BI "int llapi_file_create(const char *" name ", unsigned long long " stripe_size ","
19 .BI " int " stripe_offset ", int " stripe_count ","
20 .BI " int " stripe_pattern );
25 .B llapi_file_create(\|)
36 followed by file close.
38 .B llapi_file_open(\|)
39 opens a file with a given
41 on a Lustre filesystem.
44 can be a combination of
64 man page for a detailed description.
67 specifies the permission bits to be used for a new file when
73 man page for a detailed description.
76 specifies stripe size in bytes and should be multiple of 64 KiB not exceeding 4 GiB.
79 specifies an OST index from which the file should start, -1 to use the default setting.
82 specifies number of OSTs to stripe the file across, -1 to use the default setting.
85 specifies striping pattern, only LOV_PATTERN_RAID0 is available in this Lustre version, 0 to use the default setting.
88 .B llapi_file_open(\|)
90 .B llapi_file_create(\|)
96 the return value is a file descriptor.
99 on failure, the absolute value is an error code.
113 Striping information has already been set and cannot be altered.
119 Striping information has already been set and cannot be altered.
123 may not point to a Lustre filesystem.
126 #include <sys/types.h>
127 #include <sys/stat.h>
131 #include <liblustre.h>
132 #include <lustre/lustre_idl.h>
133 #include <lustre/liblustreapi.h>
134 #include <lustre/lustre_user.h>
135 int main(int argc, char *argv[])
142 rc = llapi_file_create(argv[1], 1048576, 0, 2, LOV_PATTERN_RAID0);
144 fprintf(stderr, "file creation has failed, %s\\n", strerror(-rc));
147 printf("%s with stripe size 1048576, striped across 2 OSTs,"
148 " has been created!\\n", argv[1]);