OpenBSD manual page server

Manual Page Search Parameters

VOP_GETATTR(9) Kernel Developer's Manual VOP_GETATTR(9)

VOP_GETATTR, VOP_SETATTRget or set vnode attributes

#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);

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 */
};

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.

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.

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

This man page was written by Pedro Martelletto for OpenBSD.

June 4, 2013 OpenBSD-5.8