b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * CDDL HEADER START
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The contents of this file are subject to the terms of the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Common Development and Distribution License (the "License").
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * You may not use this file except in compliance with the License.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * or http://www.opensolaris.org/os/licensing.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * See the License for the specific language governing permissions
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * and limitations under the License.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * When distributing Covered Code, include this CDDL HEADER in each
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * If applicable, add the following below this CDDL HEADER, with the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * fields enclosed by brackets "[]" replaced with your own identifying
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * information: Portions Copyright [yyyy] [name of copyright owner]
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * CDDL HEADER END
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Copyright (c) 2013, Joyent, Inc. All rights reserved.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* All Rights Reserved */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * University Copyright- Copyright (c) 1982, 1986, 1988
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The Regents of the University of California
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * All Rights Reserved
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * University Acknowledgment- Portions of this document are derived from
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * software developed by the University of California, Berkeley, and its
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * contributors.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#ifndef _SYS_VNODE_H
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define _SYS_VNODE_H
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/types.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/t_lock.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/time_impl.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/cred.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/uio.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/resource.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <vm/seg_enum.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/kstat.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/kmem.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/list.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/avl.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#ifdef _KERNEL
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/rwstlock.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/buf.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif /* _KERNEL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#ifdef __cplusplus
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern "C" {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Statistics for all vnode operations.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * All operations record number of ops (since boot/mount/zero'ed).
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Certain I/O operations (read, write, readdir) also record number
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * of bytes transferred.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * This appears in two places in the system: one is embedded in each
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * vfs_t. There is also an array of vopstats_t structures allocated
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * on a per-fstype basis.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPSTATS_STR "vopstats_" /* Initial string for vopstat kstats */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct vopstats {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nopen; /* VOP_OPEN */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nclose; /* VOP_CLOSE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nread; /* VOP_READ */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t read_bytes;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nwrite; /* VOP_WRITE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t write_bytes;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nioctl; /* VOP_IOCTL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nsetfl; /* VOP_SETFL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ngetattr; /* VOP_GETATTR */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nsetattr; /* VOP_SETATTR */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t naccess; /* VOP_ACCESS */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nlookup; /* VOP_LOOKUP */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ncreate; /* VOP_CREATE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nremove; /* VOP_REMOVE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nlink; /* VOP_LINK */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nrename; /* VOP_RENAME */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nmkdir; /* VOP_MKDIR */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nrmdir; /* VOP_RMDIR */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nreaddir; /* VOP_READDIR */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t readdir_bytes;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nsymlink; /* VOP_SYMLINK */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nreadlink; /* VOP_READLINK */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nfsync; /* VOP_FSYNC */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ninactive; /* VOP_INACTIVE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nfid; /* VOP_FID */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nrwlock; /* VOP_RWLOCK */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nrwunlock; /* VOP_RWUNLOCK */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nseek; /* VOP_SEEK */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ncmp; /* VOP_CMP */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nfrlock; /* VOP_FRLOCK */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nspace; /* VOP_SPACE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nrealvp; /* VOP_REALVP */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ngetpage; /* VOP_GETPAGE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nputpage; /* VOP_PUTPAGE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nmap; /* VOP_MAP */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t naddmap; /* VOP_ADDMAP */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ndelmap; /* VOP_DELMAP */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t npoll; /* VOP_POLL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ndump; /* VOP_DUMP */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t npathconf; /* VOP_PATHCONF */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t npageio; /* VOP_PAGEIO */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ndumpctl; /* VOP_DUMPCTL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ndispose; /* VOP_DISPOSE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nsetsecattr; /* VOP_SETSECATTR */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t ngetsecattr; /* VOP_GETSECATTR */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nshrlock; /* VOP_SHRLOCK */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nvnevent; /* VOP_VNEVENT */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nreqzcbuf; /* VOP_REQZCBUF */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kstat_named_t nretzcbuf; /* VOP_RETZCBUF */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vopstats_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The vnode is the focus of all file activity in UNIX.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * A vnode is allocated for each active file, each current
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * directory, each mounted-on file, and the root.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Each vnode is usually associated with a file-system-specific node (for
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * UFS, this is the in-memory inode). Generally, a vnode and an fs-node
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * should be created and destroyed together as a pair.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * If a vnode is reused for a new file, it should be reinitialized by calling
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * either vn_reinit() or vn_recycle().
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * vn_reinit() resets the entire vnode as if it was returned by vn_alloc().
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The caller is responsible for setting up the entire vnode after calling
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * vn_reinit(). This is important when using kmem caching where the vnode is
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * allocated by a constructor, for instance.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * vn_recycle() is used when the file system keeps some state around in both
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * the vnode and the associated FS-node. In UFS, for example, the inode of
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * a deleted file can be reused immediately. The v_data, v_vfsp, v_op, etc.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * remains the same but certain fields related to the previous instance need
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * to be reset. In particular:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_femhead
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_path
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_rdcnt, v_wrcnt
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_mmap_read, v_mmap_write
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * vnode types. VNON means no type. These values are unrelated to
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * values in on-disk inodes.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef enum vtype {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VNON = 0,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VREG = 1,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VDIR = 2,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VBLK = 3,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VCHR = 4,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VLNK = 5,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VFIFO = 6,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VDOOR = 7,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VPROC = 8,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VSOCK = 9,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VPORT = 10,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VBAD = 11
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vtype_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * VSD - Vnode Specific Data
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Used to associate additional private data with a vnode.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct vsd_node {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross list_node_t vs_nodes; /* list of all VSD nodes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t vs_nkeys; /* entries in value array */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross void **vs_value; /* array of value/key */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross};
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Many of the fields in the vnode are read-only once they are initialized
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * at vnode creation time. Other fields are protected by locks.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * IMPORTANT: vnodes should be created ONLY by calls to vn_alloc(). They
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * may not be embedded into the file-system specific node (inode). The
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * size of vnodes may change.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The v_lock protects:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_flag
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_stream
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_count
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_shrlocks
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_path
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_vsd
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_xattrdir
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * A special lock (implemented by vn_vfswlock in vnode.c) protects:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_vfsmountedhere
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The global flock_lock mutex (in flock.c) protects:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_filocks
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * IMPORTANT NOTE:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The following vnode fields are considered public and may safely be
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * accessed by file systems or other consumers:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_lock
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_flag
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_count
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_data
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_vfsp
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_stream
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_type
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * v_rdev
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * ALL OTHER FIELDS SHOULD BE ACCESSED ONLY BY THE OWNER OF THAT FIELD.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * In particular, file systems should not access other fields; they may
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * change or even be removed. The functionality which was once provided
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * by these fields is available through vn_* functions.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct fem_head; /* from fem.h */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct vnode {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross kmutex_t v_lock; /* protects vnode fields */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t v_flag; /* vnode flags (see below) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t v_count; /* reference count */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross void *v_data; /* private data for fs */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct vfs *v_vfsp; /* ptr to containing VFS */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct stdata *v_stream; /* associated stream */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross enum vtype v_type; /* vnode type */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross dev_t v_rdev; /* device (VCHR, VBLK) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross /* PRIVATE FIELDS BELOW - DO NOT USE */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross krwlock_t v_nbllock; /* sync for NBMAND locks */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross char *v_path; /* cached path */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t v_rdcnt; /* open for read count (VREG only) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t v_wrcnt; /* open for write count (VREG only) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct vnode *v_xattrdir; /* unnamed extended attr dir (GFS) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross /* Private to the fake vnode impl. */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int v_fd;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross dev_t v_st_dev;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ino_t v_st_ino;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross avl_node_t v_avl_node;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vnode_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define IS_DEVVP(vp) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((vp)->v_type == VCHR || (vp)->v_type == VBLK || (vp)->v_type == VFIFO)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VNODE_ALIGN 64
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* Count of low-order 0 bits in a vnode *, based on size and alignment. */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if defined(_LP64)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VNODE_ALIGN_LOG2 8
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#else
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VNODE_ALIGN_LOG2 7
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * vnode flags.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VROOT 0x01 /* root of its file system */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VNOCACHE 0x02 /* don't keep cache pages on vnode */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VNOMAP 0x04 /* file cannot be mapped/faulted */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VDUP 0x08 /* file should be dup'ed rather then opened */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VNOSWAP 0x10 /* file cannot be used as virtual swap device */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VNOMOUNT 0x20 /* file cannot be covered by mount */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VISSWAP 0x40 /* vnode is being used for swap */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSWAPLIKE 0x80 /* vnode acts like swap (but may not be) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define IS_SWAPVP(vp) (((vp)->v_flag & (VISSWAP | VSWAPLIKE)) != 0)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if defined(_KERNEL)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct vn_vfslocks_entry {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross rwstlock_t ve_lock;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross void *ve_vpvfs;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct vn_vfslocks_entry *ve_next;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t ve_refcnt;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross char pad[64 - sizeof (rwstlock_t) - 2 * sizeof (void *) - \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross sizeof (uint32_t)];
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vn_vfslocks_entry_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif /* _KERNEL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The following two flags are used to lock the v_vfsmountedhere field
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VVFSLOCK 0x100
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VVFSWAIT 0x200
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Used to serialize VM operations on a vnode
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VVMLOCK 0x400
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Tell vn_open() not to fail a directory open for writing but
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * to go ahead and call VOP_OPEN() to let the filesystem check.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VDIROPEN 0x800
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flag to let the VM system know that this file is most likely a binary
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * or shared library since it has been mmap()ed EXEC at some time.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VVMEXEC 0x1000
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VPXFS 0x2000 /* clustering: global fs proxy vnode */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define IS_PXFSVP(vp) ((vp)->v_flag & VPXFS)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_XATTRDIR 0x4000 /* attribute unnamed directory */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define IS_XATTRDIR(vp) ((vp)->v_flag & V_XATTRDIR)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_LOCALITY 0x8000 /* whether locality aware */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flag that indicates the VM should maintain the v_pages list with all modified
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * pages on one end and unmodified pages at the other. This makes finding dirty
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * pages to write back to disk much faster at the expense of taking a minor
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * fault on the first store instruction which touches a writable page.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VMODSORT (0x10000)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define IS_VMODSORT(vp) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (pvn_vmodsort_supported != 0 && ((vp)->v_flag & VMODSORT) != 0)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VISSWAPFS 0x20000 /* vnode is being used for swapfs */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The mdb memstat command assumes that IS_SWAPFSVP only uses the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * vnode's v_flag field. If this changes, cache the additional
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * fields in mdb; see vn_get in mdb/common/modules/genunix/memory.c
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define IS_SWAPFSVP(vp) (((vp)->v_flag & VISSWAPFS) != 0)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_SYSATTR 0x40000 /* vnode is a GFS system attribute */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Vnode attributes. A bit-mask is supplied as part of the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * structure to indicate the attributes the caller wants to
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * set (setattr) or extract (getattr).
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Note that va_nodeid and va_nblocks are 64bit data type.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * We support large files over NFSV3. With Solaris client and
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Server that generates 64bit ino's and sizes these fields
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * will overflow if they are 32 bit sizes.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct vattr {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t va_mask; /* bit-mask of attributes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vtype_t va_type; /* vnode type (for create) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross mode_t va_mode; /* file access mode */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uid_t va_uid; /* owner user id */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross gid_t va_gid; /* owner group id */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross dev_t va_fsid; /* file system id (dev for now) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_longlong_t va_nodeid; /* node id */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross nlink_t va_nlink; /* number of references to file */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_offset_t va_size; /* file size in bytes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross timestruc_t va_atime; /* time of last access */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross timestruc_t va_mtime; /* time of last modification */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross timestruc_t va_ctime; /* time of last status change */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross dev_t va_rdev; /* device the file represents */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t va_blksize; /* fundamental block size */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_longlong_t va_nblocks; /* # of blocks allocated */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t va_seq; /* sequence number */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vattr_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Structure of all optional attributes.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct xoptattr {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross timestruc_t xoa_createtime; /* Create time of file */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_archive;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_system;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_readonly;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_hidden;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_nounlink;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_immutable;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_appendonly;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_nodump;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_opaque;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_av_quarantined;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_av_modified;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_av_scanstamp[AV_SCANSTAMP_SZ];
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_reparse;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint64_t xoa_generation;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_offline;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint8_t xoa_sparse;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} xoptattr_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The xvattr structure is really a variable length structure that
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * is made up of:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * - The classic vattr_t (xva_vattr)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * - a 32 bit quantity (xva_mapsize) that specifies the size of the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * attribute bitmaps in 32 bit words.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * - A pointer to the returned attribute bitmap (needed because the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * previous element, the requested attribute bitmap) is variable lenth.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * - The requested attribute bitmap, which is an array of 32 bit words.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Callers use the XVA_SET_REQ() macro to set the bits corresponding to
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * the attributes that are being requested.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * - The returned attribute bitmap, which is an array of 32 bit words.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * File systems that support optional attributes use the XVA_SET_RTN()
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * macro to set the bits corresponding to the attributes that are being
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * returned.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * - The xoptattr_t structure which contains the attribute values
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_mapsize determines how many words in the attribute bitmaps.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Immediately following the attribute bitmaps is the xoptattr_t.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_getxoptattr() is used to get the pointer to the xoptattr_t
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * section.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_MAPSIZE 3 /* Size of attr bitmaps */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_MAGIC 0x78766174 /* Magic # for verification */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The xvattr structure is an extensible structure which permits optional
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * attributes to be requested/returned. File systems may or may not support
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * optional attributes. They do so at their own discretion but if they do
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * support optional attributes, they must register the VFSFT_XVATTR feature
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * so that the optional attributes can be set/retrived.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The fields of the xvattr structure are:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_vattr - The first element of an xvattr is a legacy vattr structure
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * which includes the common attributes. If AT_XVATTR is set in the va_mask
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * then the entire structure is treated as an xvattr. If AT_XVATTR is not
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * set, then only the xva_vattr structure can be used.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_magic - 0x78766174 (hex for "xvat"). Magic number for verification.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_mapsize - Size of requested and returned attribute bitmaps.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_rtnattrmapp - Pointer to xva_rtnattrmap[]. We need this since the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * size of the array before it, xva_reqattrmap[], could change which means
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * the location of xva_rtnattrmap[] could change. This will allow unbundled
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * file systems to find the location of xva_rtnattrmap[] when the sizes change.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_reqattrmap[] - Array of requested attributes. Attributes are
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * represented by a specific bit in a specific element of the attribute
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * map array. Callers set the bits corresponding to the attributes
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * that the caller wants to get/set.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_rtnattrmap[] - Array of attributes that the file system was able to
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * process. Not all file systems support all optional attributes. This map
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * informs the caller which attributes the underlying file system was able
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * to set/get. (Same structure as the requested attributes array in terms
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * of each attribute corresponding to specific bits and array elements.)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_xoptattrs - Structure containing values of optional attributes.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * These values are only valid if the corresponding bits in xva_reqattrmap
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * are set and the underlying file system supports those attributes.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct xvattr {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vattr_t xva_vattr; /* Embedded vattr structure */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t xva_magic; /* Magic Number */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross xoptattr_t xva_xoptattrs; /* Optional attributes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} xvattr_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#ifdef _SYSCALL32
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * For bigtypes time_t changed to 64 bit on the 64-bit kernel.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Define an old version for user/kernel interface
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#pragma pack(4)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct vattr32 {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t va_mask; /* bit-mask of attributes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vtype_t va_type; /* vnode type (for create) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross mode32_t va_mode; /* file access mode */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uid32_t va_uid; /* owner user id */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross gid32_t va_gid; /* owner group id */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross dev32_t va_fsid; /* file system id (dev for now) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_longlong_t va_nodeid; /* node id */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross nlink_t va_nlink; /* number of references to file */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_offset_t va_size; /* file size in bytes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross timestruc32_t va_atime; /* time of last access */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross timestruc32_t va_mtime; /* time of last modification */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross timestruc32_t va_ctime; /* time of last status change */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross dev32_t va_rdev; /* device the file represents */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t va_blksize; /* fundamental block size */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_longlong_t va_nblocks; /* # of blocks allocated */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint32_t va_seq; /* sequence number */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vattr32_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#pragma pack()
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#else /* not _SYSCALL32 */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define vattr32 vattr
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef vattr_t vattr32_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif /* _SYSCALL32 */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Attributes of interest to the caller of setattr or getattr.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_TYPE 0x00001
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_MODE 0x00002
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_UID 0x00004
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_GID 0x00008
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_FSID 0x00010
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_NODEID 0x00020
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_NLINK 0x00040
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_SIZE 0x00080
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_ATIME 0x00100
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_MTIME 0x00200
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_CTIME 0x00400
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_RDEV 0x00800
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_BLKSIZE 0x01000
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_NBLOCKS 0x02000
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* 0x04000 */ /* unused */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_SEQ 0x08000
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * If AT_XVATTR is set then there are additional bits to process in
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * the xvattr_t's attribute bitmap. If this is not set then the bitmap
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * MUST be ignored. Note that this bit must be set/cleared explicitly.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * That is, setting AT_ALL will NOT set AT_XVATTR.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_XVATTR 0x10000
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_SEQ)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_STAT (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|AT_TYPE)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross AT_BLKSIZE|AT_NBLOCKS|AT_SEQ)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Attribute bits used in the extensible attribute's (xva's) attribute
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * bitmaps. Note that the bitmaps are made up of a variable length number
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * of 32-bit words. The convention is to use XAT{n}_{attrname} where "n"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * is the element in the bitmap (starting at 1). This convention is for
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * the convenience of the maintainer to keep track of which element each
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * attribute belongs to.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * NOTE THAT CONSUMERS MUST *NOT* USE THE XATn_* DEFINES DIRECTLY. CONSUMERS
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * MUST USE THE XAT_* DEFINES.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_INDEX 0LL /* Index into bitmap for XAT0 attrs */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_CREATETIME 0x00000001 /* Create time of file */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_ARCHIVE 0x00000002 /* Archive */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_SYSTEM 0x00000004 /* System */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_READONLY 0x00000008 /* Readonly */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_HIDDEN 0x00000010 /* Hidden */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_NOUNLINK 0x00000020 /* Nounlink */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_IMMUTABLE 0x00000040 /* immutable */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_APPENDONLY 0x00000080 /* appendonly */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_NODUMP 0x00000100 /* nodump */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_OPAQUE 0x00000200 /* opaque */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_AV_QUARANTINED 0x00000400 /* anti-virus quarantine */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_AV_MODIFIED 0x00000800 /* anti-virus modified */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_AV_SCANSTAMP 0x00001000 /* anti-virus scanstamp */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_REPARSE 0x00002000 /* FS reparse point */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_GEN 0x00004000 /* object generation number */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_OFFLINE 0x00008000 /* offline */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_SPARSE 0x00010000 /* sparse */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT0_ALL_ATTRS (XAT0_CREATETIME|XAT0_ARCHIVE|XAT0_SYSTEM| \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross XAT0_READONLY|XAT0_HIDDEN|XAT0_NOUNLINK|XAT0_IMMUTABLE|XAT0_APPENDONLY| \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross XAT0_NODUMP|XAT0_OPAQUE|XAT0_AV_QUARANTINED| XAT0_AV_MODIFIED| \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross XAT0_AV_SCANSTAMP|XAT0_REPARSE|XATO_GEN|XAT0_OFFLINE|XAT0_SPARSE)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* Support for XAT_* optional attributes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_MASK 0xffffffff /* Used to mask off 32 bits */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_SHFT 32 /* Used to shift index */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Used to pry out the index and attribute bits from the XAT_* attributes
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * defined below. Note that we're masking things down to 32 bits then
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * casting to uint32_t.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_INDEX(attr) ((uint32_t)(((attr) >> XVA_SHFT) & XVA_MASK))
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_ATTRBIT(attr) ((uint32_t)((attr) & XVA_MASK))
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The following defines present a "flat namespace" so that consumers don't
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * need to keep track of which element belongs to which bitmap entry.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * NOTE THAT THESE MUST NEVER BE OR-ed TOGETHER
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_CREATETIME ((XAT0_INDEX << XVA_SHFT) | XAT0_CREATETIME)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_ARCHIVE ((XAT0_INDEX << XVA_SHFT) | XAT0_ARCHIVE)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_SYSTEM ((XAT0_INDEX << XVA_SHFT) | XAT0_SYSTEM)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_READONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_READONLY)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_HIDDEN ((XAT0_INDEX << XVA_SHFT) | XAT0_HIDDEN)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_NOUNLINK ((XAT0_INDEX << XVA_SHFT) | XAT0_NOUNLINK)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_IMMUTABLE ((XAT0_INDEX << XVA_SHFT) | XAT0_IMMUTABLE)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_APPENDONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_APPENDONLY)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_NODUMP ((XAT0_INDEX << XVA_SHFT) | XAT0_NODUMP)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_OPAQUE ((XAT0_INDEX << XVA_SHFT) | XAT0_OPAQUE)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_AV_QUARANTINED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_QUARANTINED)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_AV_MODIFIED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_MODIFIED)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_AV_SCANSTAMP ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_SCANSTAMP)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_REPARSE ((XAT0_INDEX << XVA_SHFT) | XAT0_REPARSE)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_GEN ((XAT0_INDEX << XVA_SHFT) | XAT0_GEN)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_OFFLINE ((XAT0_INDEX << XVA_SHFT) | XAT0_OFFLINE)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XAT_SPARSE ((XAT0_INDEX << XVA_SHFT) | XAT0_SPARSE)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The returned attribute map array (xva_rtnattrmap[]) is located past the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * requested attribute map array (xva_reqattrmap[]). Its location changes
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * when the array sizes change. We use a separate pointer in a known location
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * (xva_rtnattrmapp) to hold the location of xva_rtnattrmap[]. This is
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * set in xva_init()
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_RTNATTRMAP(xvap) ((xvap)->xva_rtnattrmapp)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * XVA_SET_REQ() sets an attribute bit in the proper element in the bitmap
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * of requested attributes (xva_reqattrmap[]).
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_SET_REQ(xvap, attr) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ASSERT((xvap)->xva_magic == XVA_MAGIC); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (xvap)->xva_reqattrmap[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * XVA_CLR_REQ() clears an attribute bit in the proper element in the bitmap
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * of requested attributes (xva_reqattrmap[]).
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_CLR_REQ(xvap, attr) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ASSERT((xvap)->xva_magic == XVA_MAGIC); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (xvap)->xva_reqattrmap[XVA_INDEX(attr)] &= ~XVA_ATTRBIT(attr)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * XVA_SET_RTN() sets an attribute bit in the proper element in the bitmap
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * of returned attributes (xva_rtnattrmap[]).
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_SET_RTN(xvap, attr) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ASSERT((xvap)->xva_magic == XVA_MAGIC); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * XVA_ISSET_REQ() checks the requested attribute bitmap (xva_reqattrmap[])
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * to see of the corresponding attribute bit is set. If so, returns non-zero.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_ISSET_REQ(xvap, attr) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((xvap)->xva_magic == XVA_MAGIC) && \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((xvap)->xva_reqattrmap[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * XVA_ISSET_RTN() checks the returned attribute bitmap (xva_rtnattrmap[])
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * to see of the corresponding attribute bit is set. If so, returns non-zero.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define XVA_ISSET_RTN(xvap, attr) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((xvap)->xva_magic == XVA_MAGIC) && \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Modes. Some values same as S_xxx entries from stat.h for convenience.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSUID 04000 /* set user id on execution */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSGID 02000 /* set group id on execution */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSVTX 01000 /* save swapped text even after use */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Permissions.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VREAD 00400
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VWRITE 00200
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VEXEC 00100
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define MODEMASK 07777 /* mode bits plus permission bits */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define PERMMASK 00777 /* permission bits */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * VOP_ACCESS flags
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_ACE_MASK 0x1 /* mask represents NFSv4 ACE permissions */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_APPEND 0x2 /* want to do append only check */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Check whether mandatory file locking is enabled.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define MANDMODE(mode) (((mode) & (VSGID|(VEXEC>>3))) == VSGID)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define MANDLOCK(vp, mode) ((vp)->v_type == VREG && MANDMODE(mode))
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flags for vnode operations.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossenum rm { RMFILE, RMDIRECTORY }; /* rm or rmdir (remove) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossenum symfollow { NO_FOLLOW, FOLLOW }; /* follow symlinks (or not) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossenum vcexcl { NONEXCL, EXCL }; /* (non)excl create */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossenum create { CRCREAT, CRMKNOD, CRMKDIR }; /* reason for create */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef enum rm rm_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef enum symfollow symfollow_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef enum vcexcl vcexcl_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef enum create create_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* Vnode Events - Used by VOP_VNEVENT */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef enum vnevent {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_SUPPORT = 0, /* Query */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_RENAME_SRC = 1, /* Rename, with vnode as source */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_RENAME_DEST = 2, /* Rename, with vnode as target/destination */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_REMOVE = 3, /* Remove of vnode's name */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_RMDIR = 4, /* Remove of directory vnode's name */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_CREATE = 5, /* Create with vnode's name which exists */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_LINK = 6, /* Link with vnode's name as source */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_RENAME_DEST_DIR = 7, /* Rename with vnode as target dir */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_MOUNTEDOVER = 8, /* File or Filesystem got mounted over vnode */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VE_TRUNCATE = 9 /* Truncate */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vnevent_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Values for checking vnode open and map counts
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossenum v_mode { V_READ, V_WRITE, V_RDORWR, V_RDANDWR };
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef enum v_mode v_mode_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_TRUE 1
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_FALSE 0
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Structure used on VOP_GETSECATTR and VOP_SETSECATTR operations
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct vsecattr {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t vsa_mask; /* See below */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int vsa_aclcnt; /* ACL entry count */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross void *vsa_aclentp; /* pointer to ACL entries */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int vsa_dfaclcnt; /* default ACL entry count */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross void *vsa_dfaclentp; /* pointer to default ACL entries */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t vsa_aclflags; /* ACE ACL flags */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vsecattr_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* vsa_mask values */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSA_ACL 0x0001
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSA_ACLCNT 0x0002
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSA_DFACL 0x0004
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSA_DFACLCNT 0x0008
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSA_ACE 0x0010
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSA_ACECNT 0x0020
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSA_ACE_ALLTYPES 0x0040
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VSA_ACE_ACLFLAGS 0x0080 /* get/set ACE ACL flags */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Structure used by various vnode operations to determine
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * the context (pid, host, identity) of a caller.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The cc_caller_id is used to identify one or more callers who invoke
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * operations, possibly on behalf of others. For example, the NFS
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * server could have it's own cc_caller_id which can be detected by
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * vnode/vfs operations or (FEM) monitors on those operations. New
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * caller IDs are generated by fs_new_caller_id().
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct caller_context {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross pid_t cc_pid; /* Process ID of the caller */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int cc_sysid; /* System ID, used for remote calls */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_longlong_t cc_caller_id; /* Identifier for (set of) caller(s) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ulong_t cc_flags;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} caller_context_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flags for caller context. The caller sets CC_DONTBLOCK if it does not
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * want to block inside of a FEM monitor. The monitor will set CC_WOULDBLOCK
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * and return EAGAIN if the operation would have blocked.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define CC_WOULDBLOCK 0x01
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define CC_DONTBLOCK 0x02
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Structure tags for function prototypes, defined elsewhere.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct pathname;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct fid;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct flock64;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct flk_callback;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct shrlock;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct page;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct seg;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct as;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct pollhead;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct taskq;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if defined(_KERNEL) || defined(_FAKE_KERNEL)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * VNODE_OPS defines all the vnode operations. It is used to define
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * the vnodeops structure (below) and the fs_func_p union (vfs_opreg.h).
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VNODE_OPS \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_open)(vnode_t **, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_close)(vnode_t *, int, int, offset_t, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_read)(vnode_t *, uio_t *, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_write)(vnode_t *, uio_t *, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_ioctl)(vnode_t *, int, intptr_t, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_setfl)(vnode_t *, int, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_getattr)(vnode_t *, vattr_t *, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_setattr)(vnode_t *, vattr_t *, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_access)(vnode_t *, int, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_lookup)(vnode_t *, char *, vnode_t **, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct pathname *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, vnode_t *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct pathname *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_create)(vnode_t *, char *, vattr_t *, vcexcl_t, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, vnode_t **, cred_t *, int, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, vsecattr_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_remove)(vnode_t *, char *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_link)(vnode_t *, vnode_t *, char *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_rename)(vnode_t *, char *, vnode_t *, char *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross cred_t *, caller_context_t *, int); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_mkdir)(vnode_t *, char *, vattr_t *, vnode_t **, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross cred_t *, caller_context_t *, int, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vsecattr_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_rmdir)(vnode_t *, char *, vnode_t *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_readdir)(vnode_t *, uio_t *, cred_t *, int *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_symlink)(vnode_t *, char *, vattr_t *, char *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross cred_t *, caller_context_t *, int); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_readlink)(vnode_t *, uio_t *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_fsync)(vnode_t *, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross void (*vop_inactive)(vnode_t *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_fid)(vnode_t *, struct fid *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_rwlock)(vnode_t *, int, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross void (*vop_rwunlock)(vnode_t *, int, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_seek)(vnode_t *, offset_t, offset_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_cmp)(vnode_t *, vnode_t *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_frlock)(vnode_t *, int, struct flock64 *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, offset_t, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct flk_callback *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_space)(vnode_t *, int, struct flock64 *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, offset_t, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross cred_t *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_realvp)(vnode_t *, vnode_t **, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_getpage)(vnode_t *, offset_t, size_t, uint_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct page **, size_t, struct seg *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caddr_t, enum seg_rw, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_putpage)(vnode_t *, offset_t, size_t, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, cred_t *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_map)(vnode_t *, offset_t, struct as *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caddr_t *, size_t, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uchar_t, uchar_t, uint_t, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_addmap)(vnode_t *, offset_t, struct as *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caddr_t, size_t, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uchar_t, uchar_t, uint_t, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_delmap)(vnode_t *, offset_t, struct as *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caddr_t, size_t, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t, uint_t, uint_t, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_poll)(vnode_t *, short, int, short *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct pollhead **, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_dump)(vnode_t *, caddr_t, offset_t, offset_t, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_pathconf)(vnode_t *, int, ulong_t *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_pageio)(vnode_t *, struct page *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_offset_t, size_t, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_dumpctl)(vnode_t *, int, offset_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross void (*vop_dispose)(vnode_t *, struct page *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, int, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_setsecattr)(vnode_t *, vsecattr_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, cred_t *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_getsecattr)(vnode_t *, vsecattr_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, cred_t *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_shrlock)(vnode_t *, int, struct shrlock *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, cred_t *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_vnevent)(vnode_t *, vnevent_t, vnode_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross char *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_reqzcbuf)(vnode_t *, enum uio_rw, xuio_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross cred_t *, caller_context_t *); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int (*vop_retzcbuf)(vnode_t *, xuio_t *, cred_t *, \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross /* NB: No ";" */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Operations on vnodes. Note: File systems must never operate directly
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * on a 'vnodeops' structure -- it WILL change in future releases! They
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * must use vn_make_ops() to create the structure.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef struct vnodeops {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross const char *vnop_name;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VNODE_OPS; /* Signatures of all vnode operations (vops) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} vnodeops_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef int (*fs_generic_func_p) (); /* Generic vop/vfsop/femop/fsemop ptr */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_open(vnode_t **, int, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_close(vnode_t *, int, int, offset_t, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_read(vnode_t *, uio_t *, int, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_write(vnode_t *, uio_t *, int, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_ioctl(vnode_t *, int, intptr_t, int, cred_t *, int *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_setfl(vnode_t *, int, int, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_getattr(vnode_t *, vattr_t *, int, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_setattr(vnode_t *, vattr_t *, int, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_access(vnode_t *, int, int, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_lookup(vnode_t *, char *, vnode_t **, struct pathname *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int, vnode_t *, cred_t *, caller_context_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int *, struct pathname *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_create(vnode_t *, char *, vattr_t *, vcexcl_t, int,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vnode_t **, cred_t *, int, caller_context_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vsecattr_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_remove(vnode_t *vp, char *, cred_t *, caller_context_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_link(vnode_t *, vnode_t *, char *, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_rename(vnode_t *, char *, vnode_t *, char *, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_mkdir(vnode_t *, char *, vattr_t *, vnode_t **, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int, vsecattr_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_rmdir(vnode_t *, char *, vnode_t *, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_readdir(vnode_t *, uio_t *, cred_t *, int *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_symlink(vnode_t *, char *, vattr_t *, char *, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *, int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_readlink(vnode_t *, uio_t *, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_fsync(vnode_t *, int, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern void fop_inactive(vnode_t *, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_fid(vnode_t *, struct fid *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_rwlock(vnode_t *, int, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern void fop_rwunlock(vnode_t *, int, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_seek(vnode_t *, offset_t, offset_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_cmp(vnode_t *, vnode_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_frlock(vnode_t *, int, struct flock64 *, int, offset_t,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct flk_callback *, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_space(vnode_t *, int, struct flock64 *, int, offset_t,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_realvp(vnode_t *, vnode_t **, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_getpage(vnode_t *, offset_t, size_t, uint_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct page **, size_t, struct seg *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caddr_t, enum seg_rw, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_putpage(vnode_t *, offset_t, size_t, int, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_map(vnode_t *, offset_t, struct as *, caddr_t *, size_t,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uchar_t, uchar_t, uint_t, cred_t *cr,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_addmap(vnode_t *, offset_t, struct as *, caddr_t, size_t,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uchar_t, uchar_t, uint_t, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_delmap(vnode_t *, offset_t, struct as *, caddr_t, size_t,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t, uint_t, uint_t, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_poll(vnode_t *, short, int, short *, struct pollhead **,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_dump(vnode_t *, caddr_t, offset_t, offset_t,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_pathconf(vnode_t *, int, ulong_t *, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_pageio(vnode_t *, struct page *, u_offset_t, size_t, int,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_dumpctl(vnode_t *, int, offset_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern void fop_dispose(vnode_t *, struct page *, int, int, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_setsecattr(vnode_t *, vsecattr_t *, int, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_getsecattr(vnode_t *, vsecattr_t *, int, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_shrlock(vnode_t *, int, struct shrlock *, int, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_vnevent(vnode_t *, vnevent_t, vnode_t *, char *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_reqzcbuf(vnode_t *, enum uio_rw, xuio_t *, cred_t *,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern int fop_retzcbuf(vnode_t *, xuio_t *, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif /* _KERNEL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_OPEN(vpp, mode, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_open(vpp, mode, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_CLOSE(vp, f, c, o, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_close(vp, f, c, o, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_READ(vp, uiop, iof, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_read(vp, uiop, iof, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_WRITE(vp, uiop, iof, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_write(vp, uiop, iof, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_IOCTL(vp, cmd, a, f, cr, rvp, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_ioctl(vp, cmd, a, f, cr, rvp, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_SETFL(vp, f, a, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_setfl(vp, f, a, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_GETATTR(vp, vap, f, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_getattr(vp, vap, f, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_SETATTR(vp, vap, f, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_setattr(vp, vap, f, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_ACCESS(vp, mode, f, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_access(vp, mode, f, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_LOOKUP(vp, cp, vpp, pnp, f, rdir, cr, ct, defp, rpnp) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_lookup(vp, cp, vpp, pnp, f, rdir, cr, ct, defp, rpnp)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_CREATE(dvp, p, vap, ex, mode, vpp, cr, flag, ct, vsap) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_create(dvp, p, vap, ex, mode, vpp, cr, flag, ct, vsap)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_REMOVE(dvp, p, cr, ct, f) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_remove(dvp, p, cr, ct, f)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_LINK(tdvp, fvp, p, cr, ct, f) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_link(tdvp, fvp, p, cr, ct, f)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_RENAME(fvp, fnm, tdvp, tnm, cr, ct, f) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_rename(fvp, fnm, tdvp, tnm, cr, ct, f)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_MKDIR(dp, p, vap, vpp, cr, ct, f, vsap) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_mkdir(dp, p, vap, vpp, cr, ct, f, vsap)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_RMDIR(dp, p, cdir, cr, ct, f) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_rmdir(dp, p, cdir, cr, ct, f)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_READDIR(vp, uiop, cr, eofp, ct, f) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_readdir(vp, uiop, cr, eofp, ct, f)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_SYMLINK(dvp, lnm, vap, tnm, cr, ct, f) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_symlink(dvp, lnm, vap, tnm, cr, ct, f)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_READLINK(vp, uiop, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_readlink(vp, uiop, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_FSYNC(vp, syncflag, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_fsync(vp, syncflag, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_INACTIVE(vp, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_inactive(vp, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_FID(vp, fidp, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_fid(vp, fidp, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_RWLOCK(vp, w, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_rwlock(vp, w, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_RWUNLOCK(vp, w, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_rwunlock(vp, w, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_SEEK(vp, ooff, noffp, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_seek(vp, ooff, noffp, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_CMP(vp1, vp2, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_cmp(vp1, vp2, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_FRLOCK(vp, cmd, a, f, o, cb, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_frlock(vp, cmd, a, f, o, cb, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_SPACE(vp, cmd, a, f, o, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_space(vp, cmd, a, f, o, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_REALVP(vp1, vp2, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_realvp(vp1, vp2, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_GETPAGE(vp, of, sz, pr, pl, ps, sg, a, rw, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_getpage(vp, of, sz, pr, pl, ps, sg, a, rw, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_putpage(vp, of, sz, fl, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_MAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_map(vp, of, as, a, sz, p, mp, fl, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_ADDMAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_addmap(vp, of, as, a, sz, p, mp, fl, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_DELMAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_delmap(vp, of, as, a, sz, p, mp, fl, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_POLL(vp, events, anyyet, reventsp, phpp, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_poll(vp, events, anyyet, reventsp, phpp, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_DUMP(vp, addr, bn, count, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_dump(vp, addr, bn, count, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_PATHCONF(vp, cmd, valp, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_pathconf(vp, cmd, valp, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_PAGEIO(vp, pp, io_off, io_len, flags, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_pageio(vp, pp, io_off, io_len, flags, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_DUMPCTL(vp, action, blkp, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_dumpctl(vp, action, blkp, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_DISPOSE(vp, pp, flag, dn, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_dispose(vp, pp, flag, dn, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_GETSECATTR(vp, vsap, f, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_getsecattr(vp, vsap, f, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_SETSECATTR(vp, vsap, f, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_setsecattr(vp, vsap, f, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_SHRLOCK(vp, cmd, shr, f, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_shrlock(vp, cmd, shr, f, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_VNEVENT(vp, vnevent, dvp, fnm, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_vnevent(vp, vnevent, dvp, fnm, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_REQZCBUF(vp, rwflag, xuiop, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_reqzcbuf(vp, rwflag, xuiop, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOP_RETZCBUF(vp, xuiop, cr, ct) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross fop_retzcbuf(vp, xuiop, cr, ct)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_OPEN "open"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_CLOSE "close"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_READ "read"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_WRITE "write"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_IOCTL "ioctl"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_SETFL "setfl"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_GETATTR "getattr"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_SETATTR "setattr"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_ACCESS "access"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_LOOKUP "lookup"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_CREATE "create"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_REMOVE "remove"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_LINK "link"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_RENAME "rename"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_MKDIR "mkdir"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_RMDIR "rmdir"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_READDIR "readdir"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_SYMLINK "symlink"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_READLINK "readlink"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_FSYNC "fsync"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_INACTIVE "inactive"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_FID "fid"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_RWLOCK "rwlock"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_RWUNLOCK "rwunlock"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_SEEK "seek"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_CMP "cmp"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_FRLOCK "frlock"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_SPACE "space"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_REALVP "realvp"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_GETPAGE "getpage"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_PUTPAGE "putpage"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_MAP "map"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_ADDMAP "addmap"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_DELMAP "delmap"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_POLL "poll"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_DUMP "dump"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_PATHCONF "pathconf"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_PAGEIO "pageio"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_DUMPCTL "dumpctl"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_DISPOSE "dispose"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_GETSECATTR "getsecattr"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_SETSECATTR "setsecattr"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_SHRLOCK "shrlock"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_VNEVENT "vnevent"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_REQZCBUF "reqzcbuf"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VOPNAME_RETZCBUF "retzcbuf"
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flags for VOP_LOOKUP
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Defined in file.h, but also possible, FIGNORECASE and FSEARCH
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define LOOKUP_DIR 0x01 /* want parent dir vp */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define LOOKUP_XATTR 0x02 /* lookup up extended attr dir */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define CREATE_XATTR_DIR 0x04 /* Create extended attr dir */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define LOOKUP_HAVE_SYSATTR_DIR 0x08 /* Already created virtual GFS dir */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flags for VOP_READDIR
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_RDDIR_ACCFILTER 0x02 /* filter out inaccessible dirents */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flags for VOP_RWLOCK/VOP_RWUNLOCK
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * VOP_RWLOCK will return the flag that was actually set, or -1 if none.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_WRITELOCK_TRUE (1) /* Request write-lock on the vnode */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define V_WRITELOCK_FALSE (0) /* Request read-lock on the vnode */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flags for VOP_DUMPCTL
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define DUMP_ALLOC 0
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define DUMP_FREE 1
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define DUMP_SCAN 2
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Public vnode manipulation functions.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if defined(_KERNEL) || defined(_FAKE_KERNEL)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvnode_t *vn_alloc(int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_reinit(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_recycle(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_free(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_is_readonly(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_is_opened(vnode_t *, v_mode_t);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_is_mapped(vnode_t *, v_mode_t);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_has_other_opens(vnode_t *, v_mode_t);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_open_upgrade(vnode_t *, int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_open_downgrade(vnode_t *, int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_can_change_zones(vnode_t *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_has_flocks(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_has_mandatory_locks(vnode_t *, int);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_has_cached_data(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_setops(vnode_t *, vnodeops_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvnodeops_t *vn_getops(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_matchops(vnode_t *, vnodeops_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_matchopval(vnode_t *, char *, fs_generic_func_p);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_ismntpt(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct vfs *vn_mountedvfs(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_in_dnlc(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_create_cache(void);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_destroy_cache(void);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_freevnodeops(vnodeops_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_open(char *pnamep, enum uio_seg seg, int filemode, int createmode,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct vnode **vpp, enum create crwhy, mode_t umask);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_openat(char *pnamep, enum uio_seg seg, int filemode, int createmode,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct vnode **vpp, enum create crwhy,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross mode_t umask, struct vnode *startvp, int fd);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_create(char *pnamep, enum uio_seg seg, struct vattr *vap,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross enum vcexcl excl, int mode, struct vnode **vpp,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross enum create why, int flag, mode_t umask);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_createat(char *pnamep, enum uio_seg seg, struct vattr *vap,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross enum vcexcl excl, int mode, struct vnode **vpp,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross enum create why, int flag, mode_t umask, struct vnode *startvp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_rdwr(enum uio_rw rw, struct vnode *vp, caddr_t base, ssize_t len,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross offset_t offset, enum uio_seg seg, int ioflag, rlim64_t ulimit,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross cred_t *cr, ssize_t *residp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_hold(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_rele(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_rele_async(struct vnode *vp, struct taskq *taskq);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_rele_dnlc(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_rele_stream(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_link(char *from, char *to, enum uio_seg seg);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_linkat(vnode_t *fstartvp, char *from, enum symfollow follow,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vnode_t *tstartvp, char *to, enum uio_seg seg);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_rename(char *from, char *to, enum uio_seg seg);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_renameat(vnode_t *fdvp, char *fname, vnode_t *tdvp, char *tname,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross enum uio_seg seg);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_remove(char *fnamep, enum uio_seg seg, enum rm dirflag);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_removeat(vnode_t *startvp, char *fnamep, enum uio_seg seg,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross enum rm dirflag);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_compare(vnode_t *vp1, vnode_t *vp2);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_vfswlock(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_vfswlock_wait(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_vfsrlock(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_vfsrlock_wait(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_vfsunlock(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_vfswlock_held(struct vnode *vp);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvnode_t *specvp(struct vnode *vp, dev_t dev, vtype_t type, struct cred *cr);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvnode_t *makespecvp(dev_t dev, vtype_t type);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if defined(_KERNEL)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvn_vfslocks_entry_t *vn_vfslocks_getlock(void *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_vfslocks_rele(vn_vfslocks_entry_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossboolean_t vn_is_reparse(vnode_t *, cred_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_copypath(struct vnode *src, struct vnode *dst);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_setpath_str(struct vnode *vp, const char *str, size_t len);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp,
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross const char *path, size_t plen);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vn_renamepath(vnode_t *dvp, vnode_t *vp, const char *nm, size_t len);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* Vnode event notification */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_rename_src(vnode_t *, vnode_t *, char *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_rename_dest(vnode_t *, vnode_t *, char *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_remove(vnode_t *, vnode_t *, char *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_rmdir(vnode_t *, vnode_t *, char *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_create(vnode_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_link(vnode_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_rename_dest_dir(vnode_t *, caller_context_t *ct);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_mountedover(vnode_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vnevent_truncate(vnode_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vnevent_support(vnode_t *, caller_context_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* Vnode specific data */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vsd_create(uint_t *, void (*)(void *));
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vsd_destroy(uint_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid *vsd_get(vnode_t *, uint_t);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vsd_set(vnode_t *, uint_t, void *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid vsd_free(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Extensible vnode attribute (xva) routines:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid xva_init(xvattr_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossxoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid xattr_init(void); /* Initialize vnodeops for xattrs */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* GFS tunnel for xattrs */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint xattr_dir_lookup(vnode_t *, vnode_t **, int, cred_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* Reparse Point */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossvoid reparse_point_init(void);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* Context identification */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossu_longlong_t fs_new_caller_id();
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossint vn_vmpss_usepageio(vnode_t *);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Needed for use of IS_VMODSORT() in kernel.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern uint_t pvn_vmodsort_supported;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VN_HOLD(vp) { \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vn_hold(vp); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross}
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VN_RELE(vp) { \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vn_rele(vp); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross}
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VN_RELE_ASYNC(vp, taskq) { \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross vn_rele_async(vp, taskq); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross}
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VN_SET_VFS_TYPE_DEV(vp, vfsp, type, dev) { \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (vp)->v_vfsp = (vfsp); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (vp)->v_type = (type); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (vp)->v_rdev = (dev); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross}
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Compare two vnodes for equality. In general this macro should be used
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * in preference to calling VOP_CMP directly.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if defined(_FAKE_KERNEL)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VN_CMP(VP1, VP2) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (((VP1) == (VP2)) ? 1 : VOP_CMP(VP1, VP2, NULL))
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#else
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VN_CMP(VP1, VP2) ((VP1) == (VP2) ? 1 : \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ((VP1) && (VP2) && (vn_getops(VP1) == vn_getops(VP2)) ? \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VOP_CMP(VP1, VP2, NULL) : 0))
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Some well-known global vnodes used by the VM system to name pages.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossextern struct vnode kvps[];
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rosstypedef enum {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross KV_KVP, /* vnode for all segkmem pages */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross KV_ZVP, /* vnode for all ZFS pages */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if defined(__sparc)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross KV_MPVP, /* vnode for all page_t meta-pages */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross KV_PROMVP, /* vnode for all PROM pages */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif /* __sparc */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross KV_MAX /* total number of vnodes in kvps[] */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross} kvps_index_t;
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VN_ISKAS(vp) ((vp) >= &kvps[0] && (vp) < &kvps[KV_MAX])
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif /* _KERNEL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Flags to VOP_SETATTR/VOP_GETATTR.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define ATTR_UTIME 0x01 /* non-default utime(2) request */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define ATTR_EXEC 0x02 /* invocation from exec(2) */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define ATTR_COMM 0x04 /* yield common vp attributes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define ATTR_HINT 0x08 /* information returned will be `hint' */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define ATTR_REAL 0x10 /* yield attributes of the real vp */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define ATTR_NOACLCHECK 0x20 /* Don't check ACL when checking permissions */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define ATTR_TRIGGER 0x40 /* Mount first if vnode is a trigger mount */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Generally useful macros.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VBSIZE(vp) ((vp)->v_vfsp->vfs_bsize)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VTOZONE(vp) ((vp)->v_vfsp->vfs_zone)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define NULLVP ((struct vnode *)0)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define NULLVPP ((struct vnode **)0)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#ifdef _KERNEL
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Structure used while handling asynchronous VOP_PUTPAGE operations.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Rossstruct async_reqs {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct async_reqs *a_next; /* pointer to next arg struct */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct vnode *a_vp; /* vnode pointer */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross u_offset_t a_off; /* offset in file */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross uint_t a_len; /* size of i/o request */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross int a_flags; /* flags to indicate operation type */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross struct cred *a_cred; /* cred pointer */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross ushort_t a_prealloced; /* set if struct is pre-allocated */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross};
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/*
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * VN_DISPOSE() -- given a page pointer, safely invoke VOP_DISPOSE().
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Note that there is no guarantee that the page passed in will be
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * freed. If that is required, then a check after calling VN_DISPOSE would
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * be necessary to ensure the page was freed.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#define VN_DISPOSE(pp, flag, dn, cr) { \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross if ((pp)->p_vnode != NULL && !VN_ISKAS((pp)->p_vnode)) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross VOP_DISPOSE((pp)->p_vnode, (pp), (flag), (dn), (cr), NULL); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross else if ((flag) == B_FREE) \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross page_free((pp), (dn)); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross else \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross page_destroy((pp), (dn)); \
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross }
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif /* _KERNEL */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#ifdef __cplusplus
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross}
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#endif /* _SYS_VNODE_H */