1 .TH lustreapi 3 "2009 Jul 10" The Lustre user application interface library
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 <lustre/lustreapi.h>
11 .BI "int llapi_file_open(const char *"name ", int " flags ", int " mode ","
12 .BI " unsigned long long " stripe_size ", int " stripe_offset ","
13 .BI " int " stripe_count ", int " stripe_pattern );
15 .BI "int llapi_file_create(const char *" name ", unsigned long long " stripe_size ","
16 .BI " int " stripe_offset ", int " stripe_count ","
17 .BI " int " stripe_pattern );
22 .B llapi_file_create(\|)
33 followed by file close.
35 .B llapi_file_open(\|)
36 opens a file with a given
38 on a Lustre filesystem.
41 can be a combination of
61 man page for a detailed description.
64 specifies the permission bits to be used for a new file when
70 man page for a detailed description.
73 specifies stripe size in bytes and should be multiple of 64 KiB not exceeding 4 GiB.
76 specifies an OST index from which the file should start, -1 to use the default setting.
79 specifies number of OSTs to stripe the file across, -1 to use the default setting.
82 specifies striping pattern, only LOV_PATTERN_RAID0 is available in this Lustre version, 0 to use the default setting.
85 .B llapi_file_open(\|)
87 .B llapi_file_create(\|)
93 the return value is a file descriptor.
96 on failure, the absolute value is an error code.
110 Striping information has already been set and cannot be altered.
116 Striping information has already been set and cannot be altered.
120 may not point to a Lustre filesystem.
123 #include <sys/types.h>
124 #include <sys/stat.h>
128 #include <lustre/lustreapi.h>
129 int main(int argc, char *argv[])
136 rc = llapi_file_create(argv[1], 1048576, 0, 2, LOV_PATTERN_RAID0);
138 fprintf(stderr, "file creation has failed, %s\\n", strerror(-rc));
141 printf("%s with stripe size 1048576, striped across 2 OSTs,"
142 " has been created!\\n", argv[1]);