1ATTR_MULTI(3)                XFS Compatibility API               ATTR_MULTI(3)
2
3
4

NAME

6       attr_multi,  attr_multif  -  manipulate  multiple  user attributes on a
7       filesystem object at once
8

C SYNOPSIS

10       #include <attr/attributes.h>
11
12       int attr_multi (const char *path, attr_multiop_t *oplist,
13                       int count, int flags);
14
15       int attr_multif (int fd, attr_multiop_t *oplist,
16                        int count, int flags);
17

DESCRIPTION

19       The attr_multi and attr_multif functions provide a way  to  operate  on
20       multiple attributes of a filesystem object at once.
21
22       Path  points  to  a path name for a filesystem object, and fd refers to
23       the file descriptor associated with a file.  The oplist is an array  of
24       attr_multiop_t structures.  Each element in that array describes a sin‐
25       gle attribute operation and provides all the  information  required  to
26       carry  out  that  operation and to check for success or failure of that
27       operation.  Count tells how many elements are in the oplist array.
28
29       The contents of an attr_multiop_t structure include the following  mem‐
30       bers:
31
32          int am_opcode; /* which operation to perform (see below) */
33          int am_error; /* [out arg] result of this sub-op (an errno) */
34          char *am_attrname; /* attribute name to work with */
35          char *am_attrvalue; /* [in/out arg] attribute value (raw bytes) */
36          int am_length; /* [in/out arg] length of value */
37          int am_flags; /* flags (bit-wise OR of #defines below) */
38
39       The  am_opcode  field defines how the remaining fields are to be inter‐
40       preted and can take on one of the following values:
41
42          ATTR_OP_GET /* return the indicated attr's value */
43          ATTR_OP_SET /* set/create the indicated attr/value pair */
44          ATTR_OP_REMOVE /* remove the indicated attr */
45
46       The am_error field will contain the appropriate error  result  code  if
47       that  sub-operation  fails.  The result codes for a given sub-operation
48       are a subset of the result codes that are possible from the correspond‐
49       ing  single-attribute function call.  For example, the result code pos‐
50       sible from an ATTR_OP_GET sub-operation are a subset of those that  can
51       be returned from an attr_get function call.
52
53       The  am_attrname  field is a pointer to a NULL terminated string giving
54       the attribute name that the sub-operation should operate on.
55
56       The am_attrvalue, am_length and am_flags fields are used to  store  the
57       value of the named attribute, and some control flags for that sub-oper‐
58       ation, respectively.  Their use varies depending on the  value  of  the
59       am_opcode field.
60
61       ATTR_OP_GET
62              The  am_attrvalue field is a pointer to a empty buffer that will
63              be overwritten with the  value  of  the  named  attribute.   The
64              am_length field is initially the total size of the memory buffer
65              that the am_attrvalue field points to.  After the operation, the
66              am_length  field  contains  the  actual  size of the attribute´s
67              value.  The am_flags field may be set to the ATTR_ROOT flag.  If
68              the process has appropriate priviledges, the ROOT namespace will
69              be searched for the named attribute, otherwise  the  USER  name‐
70              space will be searched.
71
72       ATTR_OP_SET
73              The  am_attrvalue and am_length fields contain the new value for
74              the given attribute name and its length.  The ATTR_ROOT flag may
75              be  set  in  the am_flags field.  If the process has appropriate
76              priviledges, the ROOT namespace will be searched for  the  named
77              attribute,  otherwise  the USER namespace will be searched.  The
78              ATTR_CREATE and the ATTR_REPLACE flags may also be  set  in  the
79              am_flags  field  (but  not  simultaneously).  If the ATTR_CREATE
80              flag is set, the sub-operation will set the  am_error  field  to
81              EEXIST  if  the named attribute already exists.  If the ATTR_RE‐
82              PLACE flag is set, the sub-operation will set the am_error field
83              to  ENOATTR  if  the named attribute does not already exist.  If
84              neither of those two flags are set and the  attribute  does  not
85              exist,  then the attribute will be created with the given value.
86              If neither of those two flags are set and the attribute  already
87              exists, then the value will be replaced with the given value.
88
89       ATTR_OP_REMOVE
90              The  am_attrvalue  and am_length fields are not used and are ig‐
91              nored.  The am_flags field may be set to the ATTR_ROOT flag.  If
92              the process has appropriate priviledges, the ROOT namespace will
93              be searched for the named attribute, otherwise  the  USER  name‐
94              space will be searched.
95
96       The  flags argument to the attr_multi call is used to control following
97       of symbolic links in the path argument.  The default is to follow  sym‐
98       bolic  links, flags should be set to ATTR_DONTFOLLOW to not follow sym‐
99       bolic links.
100
101       attr_multi will fail if one or more of the following are true:
102
103       [ENOENT]         The named file does not exist.
104
105       [EPERM]          The effective user ID does not match the owner of  the
106                        file and the effective user ID is not super-user.
107
108       [ENOTDIR]        A component of the path prefix is not a directory.
109
110       [EACCES]         Search permission is denied on a component of the path
111                        prefix.
112
113       [EINVAL]         A bit other than ATTR_DONTFOLLOW was set in  the  flag
114                        argument.
115
116       [EFAULT]         Path,  or  oplist points outside the allocated address
117                        space of the process.
118
119       [ELOOP]          A path name lookup involved too many symbolic links.
120
121       [ENAMETOOLONG]   The length of path exceeds {MAXPATHLEN}, or a pathname
122                        component is longer than {MAXNAMELEN}.
123
124       attr_multif will fail if:
125
126       [EINVAL]       A  bit  was  set in the flag argument, or fd refers to a
127                      socket, not a file.
128
129       [EFAULT]       Oplist points outside the allocated address space of the
130                      process.
131
132       [EBADF]        Fd does not refer to a valid descriptor.
133

DIAGNOSTICS

135       On  success,  zero is returned.  On error, -1 is returned, and errno is
136       set appropriately.  Note that the individual operations listed  in  the
137       oplist  array each have their own error return fields.  The errno vari‐
138       able only records the result of the attr_multi call itself, not the re‐
139       sult of any of the sub-operations.
140

SEE ALSO

142       attr(1), attr_get(3), attr_list(3), attr_remove(3), attr_set(3)
143
144
145
146Dec 2001                      Extended Attributes                ATTR_MULTI(3)
Impressum