llapi_layout_file_open(3) llapi_layout_file_open(3) NAME llapi_layout_file_open, llapi_layout_file_create - open and apply a layout to a Lustre file SYNOPSIS #include int llapi_layout_file_open(char *path, int open_flags, int mode, const struct llapi_layout *layout); int llapi_layout_file_create(char *path, int open_flags, int mode, const struct llapi_layout *layout); DESCRIPTION The functions llapi_layout_file_open() and llapi_layout_file_create() open and possibly create a file at path with the permissions specified in mode using the Lustre layout attributes in layout. The returned file descriptor may be used in subsequent system calls (read(2), write(2), lseek(2), etc.), and closed with close(2). One access mode and zero or more file creation flags and file status flags may be bit- wise-or'd in open_flags. See open(2). If layout is non-NULL and path is not on a Lustre filesystem this function will fail and set errno to ENOTTY. The function call llapi_layout_file_create(path, open_flags, mode, layout) shall be equivalent to: llapi_layout_file_open(path, open_flags|O_CREAT|O_EXCL, mode, lay- out) The layout and mode will not be applied to a file which already exists. Callers requiring a guarantee that the opened file is created with the specified layout and mode should use llapi_layout_file_create(). A NULL layout may be specified, in which case the standard Lustre behavior for assigning layouts to newly-created files will apply. If the pool name attribute of layout has been set, it must refer to an OST pool that exists and contains one or more OSTs, otherwise these functions will fail and set errno to EINVAL. See llapi_lay- out_pool_name_set(3). RETURN VALUES llapi_layout_file_open() and llapi_layout_file_create() return a new file descriptor, or -1 if an error occurred (in which case, errno is set appropriately). ERRORS ENOTTY path does not reside on a Lustre filesystem. EINVAL An invalid argument was specified. SEE ALSO llapi_layout(7), liblustreapi(7), llapi_layout_alloc(3), llapi_lay- out_pool_name_set(3), open(2), close(2) Lustre User API 2013 Oct 31 llapi_layout_file_open(3)