4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
25 */
26
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30 /*
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
34 *
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
38 */
39
40 #ifndef _SYS_VNODE_H
41 #define _SYS_VNODE_H
42
43 #include <sys/types.h>
44 #include <sys/t_lock.h>
726
727 /*
728 * Vnode Events - Used by VOP_VNEVENT
729 * The VE_PRE_RENAME_* events fire before the rename operation and are
730 * primarily used for specialized applications, such as NFSv4 delegation, which
731 * need to know about rename before it occurs.
732 */
733 typedef enum vnevent {
734 VE_SUPPORT = 0, /* Query */
735 VE_RENAME_SRC = 1, /* Rename, with vnode as source */
736 VE_RENAME_DEST = 2, /* Rename, with vnode as target/destination */
737 VE_REMOVE = 3, /* Remove of vnode's name */
738 VE_RMDIR = 4, /* Remove of directory vnode's name */
739 VE_CREATE = 5, /* Create with vnode's name which exists */
740 VE_LINK = 6, /* Link with vnode's name as source */
741 VE_RENAME_DEST_DIR = 7, /* Rename with vnode as target dir */
742 VE_MOUNTEDOVER = 8, /* File or Filesystem got mounted over vnode */
743 VE_TRUNCATE = 9, /* Truncate */
744 VE_PRE_RENAME_SRC = 10, /* Pre-rename, with vnode as source */
745 VE_PRE_RENAME_DEST = 11, /* Pre-rename, with vnode as target/dest. */
746 VE_PRE_RENAME_DEST_DIR = 12 /* Pre-rename with vnode as target dir */
747 } vnevent_t;
748
749 /*
750 * Values for checking vnode open and map counts
751 */
752 enum v_mode { V_READ, V_WRITE, V_RDORWR, V_RDANDWR };
753
754 typedef enum v_mode v_mode_t;
755
756 #define V_TRUE 1
757 #define V_FALSE 0
758
759 /*
760 * Structure used on VOP_GETSECATTR and VOP_SETSECATTR operations
761 */
762
763 typedef struct vsecattr {
764 uint_t vsa_mask; /* See below */
765 int vsa_aclcnt; /* ACL entry count */
766 void *vsa_aclentp; /* pointer to ACL entries */
1281 int vn_vfswlock_held(struct vnode *vp);
1282 vnode_t *specvp(struct vnode *vp, dev_t dev, vtype_t type, struct cred *cr);
1283 vnode_t *makespecvp(dev_t dev, vtype_t type);
1284 vn_vfslocks_entry_t *vn_vfslocks_getlock(void *);
1285 void vn_vfslocks_rele(vn_vfslocks_entry_t *);
1286 boolean_t vn_is_reparse(vnode_t *, cred_t *, caller_context_t *);
1287
1288 void vn_copypath(struct vnode *src, struct vnode *dst);
1289 void vn_setpath_str(struct vnode *vp, const char *str, size_t len);
1290 void vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp,
1291 const char *path, size_t plen);
1292 void vn_renamepath(vnode_t *dvp, vnode_t *vp, const char *nm, size_t len);
1293
1294 /* Vnode event notification */
1295 void vnevent_rename_src(vnode_t *, vnode_t *, char *, caller_context_t *);
1296 void vnevent_rename_dest(vnode_t *, vnode_t *, char *, caller_context_t *);
1297 void vnevent_remove(vnode_t *, vnode_t *, char *, caller_context_t *);
1298 void vnevent_rmdir(vnode_t *, vnode_t *, char *, caller_context_t *);
1299 void vnevent_create(vnode_t *, caller_context_t *);
1300 void vnevent_link(vnode_t *, caller_context_t *);
1301 void vnevent_rename_dest_dir(vnode_t *, caller_context_t *ct);
1302 void vnevent_mountedover(vnode_t *, caller_context_t *);
1303 void vnevent_truncate(vnode_t *, caller_context_t *);
1304 int vnevent_support(vnode_t *, caller_context_t *);
1305 void vnevent_pre_rename_src(vnode_t *, vnode_t *, char *,
1306 caller_context_t *);
1307 void vnevent_pre_rename_dest(vnode_t *, vnode_t *, char *,
1308 caller_context_t *);
1309 void vnevent_pre_rename_dest_dir(vnode_t *, vnode_t *, char *,
1310 caller_context_t *);
1311
1312 /* Vnode specific data */
1313 void vsd_create(uint_t *, void (*)(void *));
1314 void vsd_destroy(uint_t *);
1315 void *vsd_get(vnode_t *, uint_t);
1316 int vsd_set(vnode_t *, uint_t, void *);
1317 void vsd_free(vnode_t *);
1318
1319 /*
1320 * Extensible vnode attribute (xva) routines:
1321 * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR)
1322 * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t
1323 */
1324 void xva_init(xvattr_t *);
1325 xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */
1326
1327 void xattr_init(void); /* Initialize vnodeops for xattrs */
1328
1329 /* GFS tunnel for xattrs */
1330 int xattr_dir_lookup(vnode_t *, vnode_t **, int, cred_t *);
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2014, Joyent, Inc. All rights reserved.
25 */
26
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30 /*
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
34 *
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
38 */
39
40 #ifndef _SYS_VNODE_H
41 #define _SYS_VNODE_H
42
43 #include <sys/types.h>
44 #include <sys/t_lock.h>
726
727 /*
728 * Vnode Events - Used by VOP_VNEVENT
729 * The VE_PRE_RENAME_* events fire before the rename operation and are
730 * primarily used for specialized applications, such as NFSv4 delegation, which
731 * need to know about rename before it occurs.
732 */
733 typedef enum vnevent {
734 VE_SUPPORT = 0, /* Query */
735 VE_RENAME_SRC = 1, /* Rename, with vnode as source */
736 VE_RENAME_DEST = 2, /* Rename, with vnode as target/destination */
737 VE_REMOVE = 3, /* Remove of vnode's name */
738 VE_RMDIR = 4, /* Remove of directory vnode's name */
739 VE_CREATE = 5, /* Create with vnode's name which exists */
740 VE_LINK = 6, /* Link with vnode's name as source */
741 VE_RENAME_DEST_DIR = 7, /* Rename with vnode as target dir */
742 VE_MOUNTEDOVER = 8, /* File or Filesystem got mounted over vnode */
743 VE_TRUNCATE = 9, /* Truncate */
744 VE_PRE_RENAME_SRC = 10, /* Pre-rename, with vnode as source */
745 VE_PRE_RENAME_DEST = 11, /* Pre-rename, with vnode as target/dest. */
746 VE_PRE_RENAME_DEST_DIR = 12, /* Pre-rename with vnode as target dir */
747 VE_RENAME_SRC_DIR = 13, /* Rename with vnode as source dir */
748 VE_RESIZE = 14 /* Resize/truncate to non-zero offset */
749 } vnevent_t;
750
751 /*
752 * Values for checking vnode open and map counts
753 */
754 enum v_mode { V_READ, V_WRITE, V_RDORWR, V_RDANDWR };
755
756 typedef enum v_mode v_mode_t;
757
758 #define V_TRUE 1
759 #define V_FALSE 0
760
761 /*
762 * Structure used on VOP_GETSECATTR and VOP_SETSECATTR operations
763 */
764
765 typedef struct vsecattr {
766 uint_t vsa_mask; /* See below */
767 int vsa_aclcnt; /* ACL entry count */
768 void *vsa_aclentp; /* pointer to ACL entries */
1283 int vn_vfswlock_held(struct vnode *vp);
1284 vnode_t *specvp(struct vnode *vp, dev_t dev, vtype_t type, struct cred *cr);
1285 vnode_t *makespecvp(dev_t dev, vtype_t type);
1286 vn_vfslocks_entry_t *vn_vfslocks_getlock(void *);
1287 void vn_vfslocks_rele(vn_vfslocks_entry_t *);
1288 boolean_t vn_is_reparse(vnode_t *, cred_t *, caller_context_t *);
1289
1290 void vn_copypath(struct vnode *src, struct vnode *dst);
1291 void vn_setpath_str(struct vnode *vp, const char *str, size_t len);
1292 void vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp,
1293 const char *path, size_t plen);
1294 void vn_renamepath(vnode_t *dvp, vnode_t *vp, const char *nm, size_t len);
1295
1296 /* Vnode event notification */
1297 void vnevent_rename_src(vnode_t *, vnode_t *, char *, caller_context_t *);
1298 void vnevent_rename_dest(vnode_t *, vnode_t *, char *, caller_context_t *);
1299 void vnevent_remove(vnode_t *, vnode_t *, char *, caller_context_t *);
1300 void vnevent_rmdir(vnode_t *, vnode_t *, char *, caller_context_t *);
1301 void vnevent_create(vnode_t *, caller_context_t *);
1302 void vnevent_link(vnode_t *, caller_context_t *);
1303 void vnevent_rename_dest_dir(vnode_t *, vnode_t *, char *,
1304 caller_context_t *ct);
1305 void vnevent_mountedover(vnode_t *, caller_context_t *);
1306 void vnevent_truncate(vnode_t *, caller_context_t *);
1307 int vnevent_support(vnode_t *, caller_context_t *);
1308 void vnevent_pre_rename_src(vnode_t *, vnode_t *, char *,
1309 caller_context_t *);
1310 void vnevent_pre_rename_dest(vnode_t *, vnode_t *, char *,
1311 caller_context_t *);
1312 void vnevent_pre_rename_dest_dir(vnode_t *, vnode_t *, char *,
1313 caller_context_t *);
1314 void vnevent_resize(vnode_t *, caller_context_t *);
1315
1316 /* Vnode specific data */
1317 void vsd_create(uint_t *, void (*)(void *));
1318 void vsd_destroy(uint_t *);
1319 void *vsd_get(vnode_t *, uint_t);
1320 int vsd_set(vnode_t *, uint_t, void *);
1321 void vsd_free(vnode_t *);
1322
1323 /*
1324 * Extensible vnode attribute (xva) routines:
1325 * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR)
1326 * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t
1327 */
1328 void xva_init(xvattr_t *);
1329 xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */
1330
1331 void xattr_init(void); /* Initialize vnodeops for xattrs */
1332
1333 /* GFS tunnel for xattrs */
1334 int xattr_dir_lookup(vnode_t *, vnode_t **, int, cred_t *);
|