family of functions functions provides an abstract interface to
manipulating the layout information of a file in a Lustre filesystem.
Layouts are represented by the opaque data type
-.B llapi_layout_t
+.B struct llapi_layout
which is passed as a handle to the various functions.
.PP
A layout has a number of attributes that describe how a file's data are
stored in the filesystem. These include stripe count, stripe size, RAID
-pattern, pool name, and the OST index associated with each stripe. Refer
-to the Lustre Operations Manual for detailed descriptions of these
-attributes. For each attribute, there exists a pair of functions with
-the suffixes
+pattern, pool name, and the OST index associated with each stripe. In more
+complex layouts, a file may have multiple components that describe a different
+layout for separate regions of the file. Refer to the Lustre Operations Manual
+for detailed descriptions of these attributes. For each attribute, there
+exists a pair of functions with the suffixes
.B _get
and
.B _set
.PP
Using this interface to create a file might consist of the following steps.
.IP \[bu]
-Allocate a layout with
+Allocate
+.B struct layout
+with
.BR llapi_layout_alloc (3).
.IP \[bu]
Assign attribute values using the
.PP
Similarly, these steps might be used to read a file layout:
.IP \[bu]
-Obtain the layout with
+One can allocate and initialize a new
+.B struct layout
+from an existing file with one of the
.BR llapi_layout_get_by_path (3),
.BR llapi_layout_get_by_fd (3),
or
-.BR llapi_layout_get_by_fid (3).
+.BR llapi_layout_get_by_fid (3)
+functions.
.IP \[bu]
-Read attribute values using the
+To access attribute values from
+.B struct llapi_layout
+use the
.B llapi_layout_*_get (3)
functions.
.IP \[bu]
-Free the layout memory using
+To free the previously allocated layout memory use
.BR llapi_layout_free (3).
.PP
Using this interface to create a file with composite layout consists of the
-following steps.
+following steps:
.IP \[bu]
Allocate first layout component with
.BR llapi_layout_alloc (3).
.nf
{
/* Allocate layout */
- layout = llapi_layout_alloc();
+ struct llapi_layout *layout = llapi_layout_alloc();
/* Set attributes of layout */
llapi_layout_stripe_count_set(layout, count);
.PP
.nf
{
+ struct llapi_layout *head, *comp;
+
/* Create first component */
head = llapi_layout_alloc();
llapi_layout_stripe_count_set(head, 1);
.TH llapi_layout_alloc 3 "2013 Oct 31" "Lustre User API"
.SH NAME
llapi_layout_alloc, llapi_layout_free \- allocate and destroy
-.B llapi_layout_t
+.B struct llapi_layout
objects.
.SH SYNOPSIS
.nf
.LP
.B llapi_layout_alloc()
returns a pointer to a newly-allocated
-.BR struct llapi_layout .
+.BR "struct llapi_layout" .
The
-.B llapi_layout_t
+.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
accessed by an application. It may be used in
layout.
.PP
The returned
-.B llapi_layout_t
+.B struct llapi_layout
object is initialized with default attribute values that will effect the
standard Lustre behavior for assigning layouts to newly-created files.
These values may be modified using the group of
-functions in the
-.B llapi_layout
+functions in
+.B struct llapi_layout
API whose names end with
.BR _set .
The pointer should be freed with
.BR llapi_layout_comp_add (3)
adds the layout component
.I comp
-into the in-memory
-.IR layout
-under construction. The
-.IR layout
+into the existing in-memory
+.I layout
+under construction, and
+.I comp
+is freed. The
+.I layout
will be turned into composite if it was plain before adding. All layout
attributes of
.I comp
.B llapi_layout_comp_add()
and
.B llapi_layout_comp_del()
-return 0 on success, or -1 if an error occurred (in which case, errno is
-set appropriately).
+return 0 on success, or -1 if an error occurred (in which case,
+.B errno
+is set appropriately).
.SH ERRORS
.TP 15
.SM EINVAL