Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

vattr(9) [netbsd man page]

VATTR(9)						   BSD Kernel Developer's Manual						  VATTR(9)

vattr, vattr_null -- vnode attributes SYNOPSIS
#include <sys/param.h> #include <sys/vnode.h> void vattr_null(struct vattr *vap); DESCRIPTION
Vnode attributes describe attributes of a file or directory including file permissions, owner, group, size, access time and modification time. A vnode attribute has the following structure: struct vattr { enum vtype va_type; /* vnode type (for create) */ mode_t va_mode; /* files access mode and type */ nlink_t va_nlink; /* number of references to file */ uid_t va_uid; /* owner user id */ gid_t va_gid; /* owner group id */ dev_t va_fsid; /* file system id (dev for now) */ ino_t 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 */ struct timespec va_birthtime; /* time file created */ u_long va_gen; /* generation number of file */ u_long va_flags; /* flags defined for file */ dev_t va_rdev; /* device the special file represents */ u_quad_t va_bytes; /* bytes of disk space held by file */ u_quad_t va_filerev; /* file modification number */ u_int va_vaflags; /* operations flags, see below */ long va_spare; /* remain quad aligned */ }; A field value of VNOVAL represents a field whose value is unavailable or which is not to be changed. Valid flag values for va_flags are: VA_UTIMES_NULL utimes argument was NULL VA_EXCLUSIVE exclusive create request Vnode attributes for a file are set by the vnode operation VOP_SETATTR(9). Vnode attributes for a file are retrieved by the vnode operation VOP_GETATTR(9). For more information on vnode operations see vnodeops(9). FUNCTIONS
vattr_null(vap) Set vnode attributes in vap to VNOVAL. CODE REFERENCES
vattr_null() is implemented in sys/kern/vfs_subr.c. SEE ALSO
intro(9), vfs(9), vnode(9), vnodeops(9) BSD
January 8, 2010 BSD

Check Out this Related Man Page

VNSUBR(9)						   BSD Kernel Developer's Manual						 VNSUBR(9)

vnsubr, vn_bwrite, vn_close, vn_default_error, vn_isunder, vn_lock, vn_markexec, vn_marktext, vn_rdwr, vn_open, vn_stat, vn_writechk -- high- level convenience functions for vnode operations SYNOPSIS
#include <sys/param.h> #include <sys/lock.h> #include <sys/vnode.h> int vn_bwrite(void *ap); int vn_close(struct vnode *vp, int flags, kauth_cred_t cred); int vn_default_error(void *v); int vn_isunder(struct vnode *dvp, struct vnode *rvp, struct lwp *l); int vn_lock(struct vnode *vp, int flags); void vn_markexec(struct vnode *vp); void vn_marktext(struct vnode *vp); int vn_open(struct nameidata *ndp, int fmode, int cmode); int vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset, enum uio_seg segflg, int ioflg, kauth_cred_t cred, size_t *aresid, struct lwp *l); int vn_readdir(file_t *fp, char *buf, int segflg, u_int count, int *done, struct lwp *l, off_t **cookies, int *ncookies); int vn_stat(struct vnode *vp, struct stat *sb); int vn_writechk(struct vnode *vp); DESCRIPTION
The high-level functions described in this page are convenience functions for simplified access to the vnode operations described in vnodeops(9). FUNCTIONS
vn_bwrite(ap) Common code for block write operations. vn_close(vp, flags, cred) Common code for a vnode close. The argument vp is the unlocked vnode of the vnode to close. vn_close() simply locks the vnode, invokes the vnode operation VOP_CLOSE(9) and calls vput() to return the vnode to the freelist or holdlist. Note that vn_close() expects an unlocked, referenced vnode and will dereference the vnode prior to returning. If the operation is successful zero is returned, otherwise an appropriate error is returned. vn_default_error(v) A generic "default" routine that just returns error. It is used by a file system to specify unsupported operations in the vnode operations vector. vn_isunder(dvp, rvp, l) Common code to check if one directory specified by the vnode rvp can be found inside the directory specified by the vnode dvp. The argument l is the calling process. vn_isunder() is intended to be used in chroot(2), chdir(2), fchdir(2), etc., to ensure that chroot(2) actually means something. If the operation is successful zero is returned, otherwise 1 is returned. vn_lock(vp, flags) Common code to acquire the lock for vnode vp. The argument flags specifies the flags used to lock the vnode. There are the follow- ing flags: LK_SHARED shared lock LK_EXCLUSIVE exclusive lock LK_NOWAIT do not sleep to await lock LK_RETRY retry lock operation until locked If the operation is successful zero is returned, otherwise an appropriate error code is returned. The vnode interlock v_interlock is released on return. vn_lock() must not be called when the vnode's reference count is zero. Instead, vget(9) should be used. vn_markexec(vp) Common code to mark the vnode vp as containing executable code of a running process. vn_marktext(vp) Common code to mark the vnode vp as being the text of a running process. vn_open(ndp, fmode, cmode) Common code for vnode open operations. The pathname is described in the nameidata pointer (see namei(9)). The arguments fmode and cmode specify the open(2) file mode and the access permissions for creation. vn_open() checks permissions and invokes the VOP_OPEN(9) or VOP_CREATE(9) vnode operations. If the operation is successful zero is returned and the vnode is locked, otherwise an appropriate error code is returned. vn_rdwr(rw, vp, base, len, offset, segflg, ioflg, cred, aresid, l) Common code to package up an I/O request on a vnode into a uio and then perform the I/O. The argument rw specifies whether the I/O is a read (UIO_READ) or write (UIO_WRITE) operation. The vnode is specified by vp. The arguments l and cred are the calling lwp and its credentials. If ioflg contains IO_NODELOCKED, it is expected that the vnode is locked. ioflg will be passed to VOP_READ()/VOP_WRITE(). The remaining arguments specify the uio parameters. For further information on these parameters see uiomove(9). vn_readdir(fp, buf, segflg, count, done, l, cookies, ncookies) Common code for reading the contents of a directory. The argument fp is the file structure, buf is the buffer for placing the struct dirent structures. The arguments cookies and ncookies specify the addresses for the list and number of directory seek cook- ies generated for NFS. Both cookies and ncookies should be NULL if they aren't required to be returned by vn_readdir(). If the operation is successful zero is returned, otherwise an appropriate error code is returned. vn_stat(vp, sb) Common code for a vnode stat operation. The vnode is specified by the argument vp, and sb is the buffer to return the stat informa- tion. vn_stat() basically calls the vnode operation VOP_GETATTR(9) and transfers the contents of a vattr structure into a struct stat. If the operation is successful zero is returned, otherwise an appropriate error code is returned. vn_writechk(vp) Common code to check for write permission on the vnode vp. A vnode is read-only if it is in use as a process's text image. If the vnode is read-only ETEXTBSY is returned, otherwise zero is returned to indicate that the vnode can be written to. ERRORS
[EBUSY] The LK_NOWAIT flag was set and vn_lock() would have slept. [ENOENT] The vnode has been reclaimed and is dead. This error is only returned if the LK_RETRY flag is not passed to vn_lock(). [ETXTBSY] Cannot write to a vnode since is a process's text image. CODE REFERENCES
The high-level convenience functions are implemented within the files sys/kern/vfs_vnops.c and sys/sys/vnode.h. SEE ALSO
file(9), intro(9), lock(9), namei(9), vattr(9), vfs(9), vnode(9), vnodeops(9) BSD
January 30, 2010 BSD
Man Page