VOP_GETATTR(9)

NAME
VOP_GETATTR, VOP_SETATTR - get or set vnode attributes

SYNOPSIS
#include <sys/vnode.h>
int
VOP_GETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred, struct proc *p);
int
VOP_SETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred, struct proc *p);

DESCRIPTION
The VOP_GETATTR and VOP_SETATTR routines implement a generic way of representing, retrieving, and setting many vnode attributes such as size, number of references, access mode, and last modified time. All attributes are held in the vattr structure described below.

    struct vattr {
            enum vtype      va_type;        /* vnode type */
            mode_t          va_mode;        /* files access mode and type */
            nlink_t         va_nlink;       /* number of references */
            uid_t           va_uid;         /* owner user id */
            gid_t           va_gid;         /* owner group id */
            long            va_fsid;        /* file system id */
            long            va_fileid;      /* file id */
            u_quad_t        va_size;        /* file size in bytes */
            long            va_blocksize;   /* blocksize preferred for i/o */
            struct timespec va_atime;       /* time of last access */
            struct timespec va_mtime;       /* time of last modification */
            struct timespec va_ctime;       /* time file changed */
            u_long          va_gen;         /* generation number of file */
            u_long          va_flags;       /* flags defined for file */
            dev_t           va_rdev;        /* device the vnode represents */
            u_quad_t        va_bytes;       /* bytes of held disk space */
            u_quad_t        va_filerev;     /* file modification number */
            u_int           va_vaflags;     /* operations flags */
            long            va_spare;       /* remain quad aligned */
    };

IMPLEMENTATION NOTES
Depending on the specific filesystem implementation, some values may not be available for modification and/or retrieval. In these cases, the corresponding fields in the vattr structure should be set to VNOVAL.

Upon return from a VOP_GETATTR() call made on a directory, the va_nlink field should contain the number of entries in the directory, if possible, or 1 otherwise.

RETURN VALUES
The VOP_GETATTR() and VOP_SETATTR() functions return 0 to indicate success and a non-zero error code to indicate failure. See errno(2) for more information.

SEE ALSO
errno(2), vfs(9), vn_stat(9), vnode(9)

AUTHORS
This man page was written by Pedro Martelletto for OpenBSD.