1997-03-03 18:01:01 +00:00
|
|
|
.\" -*- nroff -*-
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1996 Doug Rabson
|
|
|
|
.\"
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This program is free software.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1997-03-03 18:01:01 +00:00
|
|
|
.\"
|
2020-08-07 23:06:40 +00:00
|
|
|
.Dd August 8, 2020
|
1997-03-03 18:01:01 +00:00
|
|
|
.Dt VOP_ATTRIB 9
|
2010-04-14 19:08:06 +00:00
|
|
|
.Os
|
1997-03-03 18:01:01 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm VOP_GETATTR ,
|
|
|
|
.Nm VOP_SETATTR
|
|
|
|
.Nd get and set attributes on a file or directory
|
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/param.h
|
|
|
|
.In sys/vnode.h
|
1997-03-03 18:01:01 +00:00
|
|
|
.Ft int
|
2008-08-28 15:23:18 +00:00
|
|
|
.Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred"
|
1997-03-03 18:01:01 +00:00
|
|
|
.Ft int
|
2008-08-28 15:23:18 +00:00
|
|
|
.Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred"
|
2020-08-07 23:06:40 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn VOP_STAT "struct vnode *vp" "struct stat *sb" "struct ucred *active_cred" \
|
|
|
|
"struct ucred *file_cred" "struct thread *td"
|
1997-03-03 18:01:01 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
These entry points manipulate various attributes of a file or directory,
|
|
|
|
including file permissions, owner, group, size,
|
|
|
|
access time and modification time.
|
|
|
|
.Pp
|
2020-08-07 23:06:40 +00:00
|
|
|
.Fn VOP_STAT
|
|
|
|
returns data in a format suitable for the
|
|
|
|
.Xr stat 2
|
|
|
|
system call and by default is implemented as a wrapper around
|
|
|
|
.Fn VOP_GETATTR .
|
|
|
|
Filesystems may want to implement their own variant for performance reasons.
|
|
|
|
.Pp
|
|
|
|
For
|
|
|
|
.Fn VOP_GETATTR
|
|
|
|
and
|
|
|
|
.Fn VOP_SETATTR
|
|
|
|
the arguments are:
|
1997-03-03 18:01:01 +00:00
|
|
|
.Bl -tag -width cred
|
2002-05-29 17:37:32 +00:00
|
|
|
.It Fa vp
|
2005-01-28 10:43:05 +00:00
|
|
|
The vnode of the file.
|
2002-05-29 17:37:32 +00:00
|
|
|
.It Fa vap
|
2005-01-28 10:43:05 +00:00
|
|
|
The attributes of the file.
|
2002-05-29 17:37:32 +00:00
|
|
|
.It Fa cred
|
2020-08-07 23:06:40 +00:00
|
|
|
The user credentials of the calling thread.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
For
|
|
|
|
.Fn VOP_STAT
|
|
|
|
the arguments are:
|
|
|
|
.Bl -tag -width active_cred
|
|
|
|
.It Fa vp
|
|
|
|
The vnode of the file.
|
|
|
|
.It Fa sb
|
|
|
|
The attributes of the file.
|
|
|
|
.It Fa active_cred
|
|
|
|
The user credentials of the calling thread.
|
|
|
|
.It Fa file_cred
|
|
|
|
The credentials installed on the file description pointing to the vnode or NOCRED.
|
|
|
|
.It Fa td
|
|
|
|
The calling thread.
|
1997-03-03 18:01:01 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Attributes which are not being modified by
|
2002-12-24 13:41:48 +00:00
|
|
|
.Fn VOP_SETATTR
|
1997-03-03 18:01:01 +00:00
|
|
|
should be set to the value
|
2002-05-03 20:28:38 +00:00
|
|
|
.Dv VNOVAL ;
|
2002-09-14 03:32:57 +00:00
|
|
|
.Fn VATTR_NULL
|
2002-05-03 20:28:38 +00:00
|
|
|
may be used to clear all the values, and should generally be used to reset
|
|
|
|
the contents of
|
2002-05-29 17:37:32 +00:00
|
|
|
.Fa *vap
|
2002-05-03 20:28:38 +00:00
|
|
|
prior to setting specific values.
|
1997-03-03 18:01:01 +00:00
|
|
|
.Sh LOCKS
|
2020-08-07 23:06:40 +00:00
|
|
|
Both
|
2002-12-24 13:41:48 +00:00
|
|
|
.Fn VOP_GETATTR
|
2020-08-07 23:06:40 +00:00
|
|
|
and
|
|
|
|
.Fn VOP_STAT
|
|
|
|
expect the vnode to be locked on entry and will leave the vnode locked on
|
2002-02-10 19:28:34 +00:00
|
|
|
return.
|
2002-05-03 20:28:38 +00:00
|
|
|
The lock type can be either shared or exclusive.
|
1999-09-24 10:42:45 +00:00
|
|
|
.Pp
|
2002-12-24 13:41:48 +00:00
|
|
|
.Fn VOP_SETATTR
|
1999-09-24 10:42:45 +00:00
|
|
|
expects the vnode to be locked on entry and will leave the vnode locked on
|
|
|
|
return.
|
2002-05-03 20:28:38 +00:00
|
|
|
The lock type must be exclusive.
|
1997-03-03 18:01:01 +00:00
|
|
|
.Sh RETURN VALUES
|
2002-12-24 13:41:48 +00:00
|
|
|
.Fn VOP_GETATTR
|
2002-05-03 20:28:38 +00:00
|
|
|
returns 0 if it was able to retrieve the attribute data via
|
|
|
|
.Fa *vap ,
|
|
|
|
otherwise an appropriate error is returned.
|
2002-12-24 13:41:48 +00:00
|
|
|
.Fn VOP_SETATTR
|
1997-03-03 18:01:01 +00:00
|
|
|
returns zero if the attributes were changed successfully, otherwise an
|
|
|
|
appropriate error is returned.
|
2020-08-07 23:06:40 +00:00
|
|
|
.Fn VOP_STAT
|
|
|
|
returns 0 if it was able to retrieve the attribute data
|
|
|
|
.Fa *sb ,
|
|
|
|
otherwise an appropriate error is returned.
|
1997-03-03 18:01:01 +00:00
|
|
|
.Sh ERRORS
|
1997-03-07 03:32:31 +00:00
|
|
|
.Bl -tag -width Er
|
1997-03-03 18:01:01 +00:00
|
|
|
.It Bq Er EPERM
|
2002-09-18 09:34:01 +00:00
|
|
|
The file is immutable.
|
1997-03-03 18:01:01 +00:00
|
|
|
.It Bq Er EACCES
|
2002-09-18 22:12:43 +00:00
|
|
|
The caller does not have permission to modify the file or directory attributes.
|
1997-03-03 18:01:01 +00:00
|
|
|
.It Bq Er EROFS
|
2002-12-12 17:26:04 +00:00
|
|
|
The file system is read-only.
|
1997-03-03 18:01:01 +00:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
2002-05-29 17:37:32 +00:00
|
|
|
.Xr VFS 9 ,
|
1997-03-03 18:01:01 +00:00
|
|
|
.Xr vnode 9 ,
|
2002-05-29 17:37:32 +00:00
|
|
|
.Xr VOP_ACCESS 9
|
1997-03-03 18:01:01 +00:00
|
|
|
.Sh AUTHORS
|
2005-06-28 20:15:19 +00:00
|
|
|
This manual page was written by
|
1998-03-12 07:31:21 +00:00
|
|
|
.An Doug Rabson .
|