1 .\" Copyright (C) 2001, 2002, 2003, 2006 Silicon Graphics, Inc.
2 .\" All rights reserved.
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual. If not, see
21 .\" <http://www.gnu.org/licenses/>.
23 .TH ATTR_MULTI 3 "Extended Attributes" "Dec 2001" "XFS Compatibility API"
25 attr_multi, attr_multif \- manipulate multiple user attributes on a filesystem object at once
30 .B #include <attr/attributes.h>
32 .B "int attr_multi (const char *\f2path\f3, attr_multiop_t *\f2oplist\f3, "
33 .B " int \f2count\f3, int \f2flags\f3);"
35 .B "int attr_multif (int \f2fd\f3, attr_multiop_t *\f2oplist\f3, "
36 .B " int \f2count\f3, int \f2flags\f3);"
43 functions provide a way to operate on multiple attributes of a
44 filesystem object at once.
47 points to a path name for a filesystem object, and
49 refers to the file descriptor associated with a file.
52 is an array of \f4attr_multiop_t\fP structures.
53 Each element in that array describes a single attribute operation
54 and provides all the information required to carry out that operation
55 and to check for success or failure of that operation.
57 tells how many elements are in the
62 The contents of an \f4attr_multiop_t\fP structure include
63 the following members:
69 int am_opcode; /* which operation to perform (see below) */
70 int am_error; /* [out arg] result of this sub-op (an errno) */
71 char *am_attrname; /* attribute name to work with */
72 char *am_attrvalue; /* [in/out arg] attribute value (raw bytes) */
73 int am_length; /* [in/out arg] length of value */
74 int am_flags; /* flags (bit-wise OR of #defines below) */
81 field defines how the remaining fields are to be interpreted
82 and can take on one of the following values:
88 ATTR_OP_GET /* return the indicated attr's value */
89 ATTR_OP_SET /* set/create the indicated attr/value pair */
90 ATTR_OP_REMOVE /* remove the indicated attr */
97 field will contain the appropriate error result code
98 if that sub-operation fails.
99 The result codes for a given sub-operation are a subset of
100 the result codes that are possible from the corresponding
101 single-attribute function call.
102 For example, the result code possible from an \f4ATTR_OP_GET\fP
103 sub-operation are a subset of those that can be returned from an
109 field is a pointer to a NULL terminated string giving the attribute name
110 that the sub-operation should operate on.
117 fields are used to store the value of the named attribute,
118 and some control flags for that sub-operation, respectively.
119 Their use varies depending on the value of the
127 field is a pointer to a empty buffer that will be overwritten
128 with the value of the named attribute.
131 field is initially the total size of the memory buffer that the
134 After the operation, the
136 field contains the actual size of the attribute\'s value.
139 field may be set to the \f4ATTR_ROOT\fP flag.
140 If the process has appropriate priviledges,
141 the ROOT namespace will be searched for the named attribute,
142 otherwise the USER namespace will be searched.
150 fields contain the new value for the given attribute name and its length.
151 The \f4ATTR_ROOT\fP flag may be set in the
154 If the process has appropriate priviledges,
155 the ROOT namespace will be searched for the named attribute,
156 otherwise the USER namespace will be searched.
157 The \f4ATTR_CREATE\fP and the \f4ATTR_REPLACE\fP flags
158 may also be set in the
160 field (but not simultaneously).
161 If the \f4ATTR_CREATE\fP flag is set,
162 the sub-operation will set the
164 field to EEXIST if the named attribute already exists.
165 If the \f4ATTR_REPLACE\fP flag is set,
166 the sub-operation will set the
168 field to ENOATTR if the named attribute does not already exist.
169 If neither of those two flags are set and the attribute does not exist,
170 then the attribute will be created with the given value.
171 If neither of those two flags are set and the attribute already exists,
172 then the value will be replaced with the given value.
180 fields are not used and are ignored.
183 field may be set to the \f4ATTR_ROOT\fP flag.
184 If the process has appropriate priviledges,
185 the ROOT namespace will be searched for the named attribute,
186 otherwise the USER namespace will be searched.
192 call is used to control following of symbolic links in the
195 The default is to follow symbolic links,
197 should be set to ATTR_DONTFOLLOW to not follow symbolic links.
200 will fail if one or more of the following are true:
204 The named file does not exist.
210 does not match the owner of the file
211 and the effective user
223 Search permission is denied on a
229 A bit other than ATTR_DONTFOLLOW was set in the
238 points outside the allocated address space of the process.
242 A path name lookup involved too many symbolic links.
251 or a pathname component is longer than
264 refers to a socket, not a file.
269 points outside the allocated address space of the process.
274 does not refer to a valid descriptor.
276 On success, zero is returned. On error, \-1 is returned, and
278 is set appropriately.
279 Note that the individual operations listed in the
281 array each have their own error return fields.
284 variable only records the result of the
286 call itself, not the result of any of the sub-operations.