xref: /freebsd/share/man/man9/VOP_SETEXTATTR.9 (revision e5b786625f7f82a1fa91e41823332459ea5550f9)
1.\"-
2.\" Copyright (c) 1999, 2000, 2001 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_SETEXTATTR 9
28.Os
29.Sh NAME
30.Nm VOP_SETEXTATTR
31.Nd set named extended attribute for a vnode
32.Sh SYNOPSIS
33.In sys/param.h
34.In sys/vnode.h
35.In sys/extattr.h
36.Ft int
37.Fn VOP_SETEXTATTR "struct vnode *vp" "int attrnamespace" "const char *name" "struct uio *uio" "struct ucred *cred" "struct thread *td"
38.Sh DESCRIPTION
39This vnode call may be used to set specific named extended attribute for a
40file or directory.
41.Pp
42Its arguments are:
43.Bl -tag -width type
44.It Fa vp
45The vnode of the file or directory.
46.It Fa attrnamespace
47Integer constant indicating which extended attribute namespace the attribute
48name is present in.
49.It Fa name
50Pointer to a null-terminated character string containing the attribute name.
51.It Fa uio
52The location of the data to be read or written.
53.It Fa cred
54The user credentials to use in authorizing the request.
55.It Fa td
56The thread setting the extended attribute.
57.El
58.Pp
59The uio structure is used in a manner similar to the argument of the same
60name in
61.Xr VOP_WRITE 9 .
62However, as extended attributes provide a strict "name=value" semantic,
63non-zero offsets will be rejected.
64.Pp
65The
66.Fa uio
67pointer may be
68.Dv NULL
69to indicate that the specified extended attribute should be deleted.
70.Pp
71The
72.Fa cred
73pointer may be
74.Dv NULL
75to indicate that access control checks are not to be performed, if possible.
76This
77.Fa cred
78setting might be used to allow the kernel to authorize extended attribute
79changes that the active process might not be permitted to make.
80.Pp
81Extended attribute semantics may vary by file system implementing the call.
82More information on extended attributes may be found in
83.Xr extattr 9 .
84.Sh LOCKS
85The vnode will be locked on entry and should remain locked on return.
86.Sh RETURN VALUES
87If the extended attribute is successfully set, then zero is returned.
88Otherwise, an appropriate error code is returned.
89.Sh ERRORS
90.Bl -tag -width Er
91.It Bq Er EACCES
92The caller does not have the appropriate privilege.
93.It Bq Er ENXIO
94The request was not valid in this file system for the specified vnode and
95attribute name.
96.It Bq Er ENOMEM
97Insufficient memory available to fulfill the request.
98.It Bq Er EFAULT
99The uio structure refers to an invalid userspace address.
100.It Bq Er EINVAL
101The name, namespace, or uio argument is invalid.
102.It Bq Er EOPNOTSUPP
103The file system does not support
104.Fn VOP_SETEXTATTR .
105.It Bq Er ENOSPC
106The file system is out of space.
107.It Bq Er EROFS
108The file system is read-only.
109.El
110.Sh SEE ALSO
111.Xr extattr 9 ,
112.Xr vnode 9 ,
113.Xr VOP_GETEXTATTR 9 ,
114.Xr VOP_LISTEXTATTR 9
115.Sh AUTHORS
116This manual page was written by
117.An Robert Watson .
118