xref: /freebsd/share/man/man9/VOP_GETEXTATTR.9 (revision c1c03d4944f7cecd02d9a96a41d4e0c3c6c26b3d)
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.\" $FreeBSD$
27.\"
28.Dd December 23, 1999
29.Os
30.Dt VOP_GETEXTATTR 9
31.Sh NAME
32.Nm VOP_GETEXTATTR
33.Nd retrieve named extended attribute from a vnode
34.Sh SYNOPSIS
35.In sys/param.h
36.In sys/vnode.h
37.In sys/extattr.h
38.Ft int
39.Fo VOP_GETEXTATTR
40.Fa "struct vnode *vp"
41.Fa "int attrnamespace"
42.Fa "const char *name"
43.Fa "struct uio *uio"
44.Fa "size_t *size"
45.Fa "struct ucred *cred"
46.Fa "struct thread *td"
47.Fc
48.Sh DESCRIPTION
49This vnode call may be used to retrieve a specific named extended attribute
50from a file or directory.
51.Pp
52Its arguments are:
53.Bl -tag -width ".Fa attrnamespace"
54.It Fa vp
55the vnode of the file or directory
56.It Fa attrnamespace
57integer constant indicating which extended attribute namespace the attribute
58name is present in
59.It Fa name
60pointer to a null-terminated character string containing the attribute name
61.It Fa uio
62the location of the data to be read
63.It Fa size
64if not
65.Dv NULL ,
66on return it will contain the number of bytes required to read all of the
67attribute data.
68In most cases
69.Fa uio
70will be
71.Dv NULL
72when
73.Fa size
74is not, and vise versa.
75.It Fa cred
76the user credentials to use in authorizing the request
77.It Fa td
78the thread requesting the extended attribute
79.El
80.Pp
81The
82.Fa cred
83pointer may be
84.Dv NULL
85to indicate that access control checks are not to be performed, if possible.
86This
87.Fa cred
88setting might be used to allow the kernel to authorize extended attribute
89retrieval that the active process might not be permitted to do.
90.Pp
91Extended attribute semantics may vary by file system implementing the call.
92More information on extended attributes may be found in
93.Xr extattr 9 .
94.Sh LOCKS
95The vnode will be locked on entry and should remain locked on return.
96.Sh RETURN VALUES
97On success, zero will be returned, and the uio structure will be updated to
98reflect data read.
99Otherwise, an appropriate error code is returned.
100.Sh ERRORS
101.Bl -tag -width Er
102.It Bq Er ENOATTR
103The requested attribute was not defined for this vnode.
104.It Bq Er EACCES
105The the caller does not have the appropriate privilege.
106.It Bq Er ENXIO
107The request was not valid in this file system for the specified vnode and
108attribute name.
109.It Bq Er ENOMEM
110Sufficient memory is not available to fulfill the request.
111.It Bq Er EFAULT
112The uio structure refers to an invalid userspace address.
113.It Bq Er EINVAL
114The
115.Fa name ,
116.Fa namespace,
117or
118.Fa uio
119argument is invalid.
120.It Bq Er EOPNOTSUPP
121The file system does not support
122.Fn VOP_GETEXTATTR .
123.El
124.Sh SEE ALSO
125.Xr extattr 9 ,
126.Xr vnode 9 ,
127.Xr VOP_LISTEXTATTR 9 ,
128.Xr VOP_SETEXTATTR 9
129.Sh BUGS
130By passing in the empty string as the attribute name, some file systems
131will return a list of defined names on the target vnode for the
132requested namespace.
133This is a bad API, and will be replaced by an explicit VOP.
134