xref: /freebsd/share/man/man9/VOP_GETEXTATTR.9 (revision edf8578117e8844e02c0121147f45e4609b30680)
1.\"-
2.\" Copyright (c) 1999, 2000, 2001, 2003 Robert N. M. Watson
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd December 23, 1999
27.Dt VOP_GETEXTATTR 9
28.Os
29.Sh NAME
30.Nm VOP_GETEXTATTR
31.Nd retrieve named extended attribute from a vnode
32.Sh SYNOPSIS
33.In sys/param.h
34.In sys/vnode.h
35.In sys/extattr.h
36.Ft int
37.Fo VOP_GETEXTATTR
38.Fa "struct vnode *vp"
39.Fa "int attrnamespace"
40.Fa "const char *name"
41.Fa "struct uio *uio"
42.Fa "size_t *size"
43.Fa "struct ucred *cred"
44.Fa "struct thread *td"
45.Fc
46.Sh DESCRIPTION
47This vnode call may be used to retrieve a specific named extended attribute
48from a file or directory.
49.Pp
50Its arguments are:
51.Bl -tag -width ".Fa attrnamespace"
52.It Fa vp
53The vnode of the file or directory.
54.It Fa attrnamespace
55Integer constant indicating which extended attribute namespace the attribute
56name is present in.
57.It Fa name
58Pointer to a null-terminated character string containing the attribute name.
59.It Fa uio
60The location of the data to be read.
61.It Fa size
62If not
63.Dv NULL ,
64on return it will contain the number of bytes required to read all of the
65attribute data.
66In most cases
67.Fa uio
68will be
69.Dv NULL
70when
71.Fa size
72is not, and vice versa.
73.It Fa cred
74The user credentials to use in authorizing the request.
75.It Fa td
76The thread requesting the extended attribute.
77.El
78.Pp
79The
80.Fa cred
81pointer may be
82.Dv NULL
83to indicate that access control checks are not to be performed, if possible.
84This
85.Fa cred
86setting might be used to allow the kernel to authorize extended attribute
87retrieval that the active process might not be permitted to do.
88.Pp
89Extended attribute semantics may vary by file system implementing the call.
90More information on extended attributes may be found in
91.Xr extattr 9 .
92.Sh LOCKS
93The vnode will be locked on entry and should remain locked on return.
94.Sh RETURN VALUES
95On success, zero will be returned, and the uio structure will be updated to
96reflect data read.
97Otherwise, an appropriate error code is returned.
98.Sh ERRORS
99.Bl -tag -width Er
100.It Bq Er ENOATTR
101The requested attribute was not defined for this vnode.
102.It Bq Er EACCES
103The caller does not have the appropriate privilege.
104.It Bq Er ENXIO
105The request was not valid in this file system for the specified vnode and
106attribute name.
107.It Bq Er ENOMEM
108Sufficient memory is not available to fulfill the request.
109.It Bq Er EFAULT
110The uio structure refers to an invalid userspace address.
111.It Bq Er EINVAL
112The
113.Fa name ,
114.Fa namespace ,
115or
116.Fa uio
117argument is invalid.
118.It Bq Er EOPNOTSUPP
119The file system does not support
120.Fn VOP_GETEXTATTR .
121.El
122.Sh SEE ALSO
123.Xr extattr 9 ,
124.Xr vnode 9 ,
125.Xr VOP_LISTEXTATTR 9 ,
126.Xr VOP_SETEXTATTR 9
127.Sh BUGS
128By passing in the empty string as the attribute name, some file systems
129will return a list of defined names on the target vnode for the
130requested namespace.
131This is a bad API, and will be replaced by an explicit VOP.
132