llapi_layout_get_by_fd(3) llapi_layout_get_by_fd(3) NAME llapi_layout_get_by_fd, llapi_layout_get_by_fid, llapi_lay- out_get_by_path, - obtain the layout of a Lustre file SYNOPSIS #include struct llapi_layout *llapi_layout_get_by_fd(int fd, uint32_t flags); struct llapi_layout *llapi_layout_get_by_fid(const char *lustre_path, const lustre_fid *fid, uint32_t flags); struct llapi_layout *llapi_layout_get_by_path(const char *path, uint32_t flags); DESCRIPTION llapi_layout_get_by_fd(), llapi_layout_get_by_fid(), and llapi_lay- out_get_by_path() return a pointer to a newly-allocated struct llapi_layout containing the layout information for the file referenced by fd, fid, or path. The struct llapi_layout is an opaque entity con- taining the layout information for a file in a Lustre filesystem. Its internal structure should not be directly accessed by an application. See llapi_layout(7). The pointer should be freed with llapi_lay- out_free() when it is no longer needed. For llapi_layout_get_by_fd(), fd is a valid open file descriptor for a file or directory in a Lustre filesystem. For llapi_layout_get_by_fid(), the path named by lustre_path serves to identify the Lustre filesystem containing the file represented by fid. It is typically the filesystem root, but may also be any path beneath the root. Use the function llapi_path2fid(3) to obtain a lustre_fid associated with a given path. The function llapi_layout_get_by_path() accepts a path argument that names a file or directory in a Lustre filesystem. Zero or more flags may be bitwise-or'd together in flags to control how a layout is retrieved. Currently llapi_layout_get_by_path() accepts only one flag, and llapi_layout_get_by_fd() and llapi_lay- out_get_by_fid() do not accept any flags. The list of flags is as fol- lows: LAYOUT_GET_EXPECTED Unspecified attribute values are replaced by the literal default values that will be assigned when the file is created or first written to. A default value is inherited from the parent direc- tory if the attribute is specified there, otherwise it is inher- ited from the filesystem root. This flag is only recognized by llapi_layout_get_by_path(). Unspecified attributes may belong to directories and never-written-to files. By default, layouts report the abstract value LLAPI_LAYOUT_DEFAULT to indicate an unspecified attribute. Use LAYOUT_GET_EXPECTED to discover the expected literal values for new files in a given directory. Do not use it if you need to distinguish between spec- ified and unspecified attributes. The flag has no effect if path names a file or directory with a fully specified layout. For concreteness, consider a Lustre filesystem with a default stripe size of 1048576 and a default stripe count of 1. A user sets the stripe count for directory D to 2 (thus overriding the filesystem-wide default) but leaves the stripe size unspecified. Newly created files in D inherit a stripe count of 2 from D and a stripe size of 1048576 from the filesystem default. The layout of D returned by llapi_layout_get_by_path(D, 0) has the abstract stripe size value LLAPI_LAYOUT_DEFAULT, since stripe size is unspecified, while llapi_layout_get_by_path(D, LAY- OUT_GET_EXPECTED) reports the literal value 1048576. Both forms report a stripe count of 2, since that attribute is specified. RETURN VALUES llapi_layout_get_by_fd(), llapi_layout_get_by_fid(), and llapi_lay- out_get_by_path() return a valid pointer on success or NULL on failure with errno set to an approporiate error code. ERRORS ENOMEM Insufficient storage space is available. ENOTTY file does not reside on a Lustre filesystem. ENOENT path does not exist. EINVAL An invalid argument was specified. SEE ALSO llapi_layout_file_open(3), llapi_path2fid(3), llapi_layout(7), liblus- treapi(7) Lustre User API 2013 Oct 31 llapi_layout_get_by_fd(3)