.fi
.SH DESCRIPTION
.PP
+The functions
.BR llapi_layout_get_by_xattr() ,
.BR llapi_layout_get_by_fd() ,
.BR llapi_layout_get_by_fid() ,
.IR fd ,
.IR fid ,
or
-.IR path .
-The
+.IR path ,
+respectively. The
.B struct llapi_layout
is an opaque entity containing the layout information for a file in a
Lustre filesystem. Its internal structure should not be directly
a Lustre filesystem. The
.I lov_xattr
should be the raw xattr without being byte-swapped, since this function will
-swap it properly.
+swap it to the local machine endianness properly.
.PP
For
.BR llapi_layout_get_by_fd() ,
.PP
For
.BR llapi_layout_get_by_fid() ,
-the
.I lustre_path
-argument serves to identify the Lustre filesystem containing the file
-represented by
+identifies the Lustre filesystem containing the file represented by
.IR fid .
-It is typically the filesystem root, but may also be any path beneath
+It is typically the filesystem root directory, but may also be any path beneath
the root. Use the function
.BR llapi_path2fid (3)
to obtain a
.PP
Zero or more flags may be bitwise-or'd together in
.I flags
-or
-.I xattr_flags
to control how a layout is retrieved. Currently
-.B llapi_layout_get_by_path()
-accepts only one flag, while
.B llapi_layout_get_by_fd()
and
.B llapi_layout_get_by_fid()
-do not use any flags. The list of flags that can be used in
-.I flags
-is as follows:
+do not accept any values for
+.IR flags ,
+while
+.B llapi_layout_get_by_path()
+accepts only one flag as follows:
.TP 5
.SM LLAPI_LAYOUT_GET_EXPECTED
Unspecified attribute values are replaced by the literal default values
reports the literal value 1048576. Both forms report a stripe count
of 2, since that attribute is specified.
.PP
-The values that can be used by
-.B llapi_layout_get_by_xattr()
+Valid arguments for
.I flags
-argument is as follows:
+with
+.B llapi_layout_get_by_xattr()
+are:
.TP 5
.SM LLAPI_LAYOUT_GET_CHECK
If the
unmodified. Otherwise, the byte swapping will be done to the fields of the
.I lov_xattr
buffer directly.
+.SH NOTE
+When using these functions to copy an existing file's layout to create a
+new file with
+.B llapi_layout_file_open (3)
+for mirroring, migration, or as the template for a new file,
+.BR llapi_layout_ost_index_reset (3)
+should be called to reset the OST index values for each component, so that
+the file copy is not created on exactly the same OSTs as the original file.
.SH RETURN VALUES
-.LP
-.BR llapi_layout_get_by_fd() ,
-.BR llapi_layout_get_by_fid() ,
-and
-.B llapi_layout_get_by_path()
-return a valid pointer on success or
+These functions return a valid pointer on success or
.B NULL
on failure with
.B errno
The kernel returned less than the expected amount of data.
.SH "SEE ALSO"
.BR llapi_layout_file_open (3),
+.BR llapi_layout_ost_index_reset (3),
.BR llapi_path2fid (3),
.BR llapi_layout (7),
.BR lustreapi (7)