Move core man pages 1M -> 8
[unleashed.git] / include / sys / fs / namenode.h
blob7a36fe2a46ffd0d1eac8a3d927711640bdd3e363
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
21 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
22 /* All Rights Reserved */
25 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 #ifndef _SYS_FS_NAMENODE_H
30 #define _SYS_FS_NAMENODE_H
32 #if defined(_KERNEL)
33 #include <sys/vnode.h>
34 #include <sys/vfs.h>
35 #endif
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
42 * This structure is used to pass a file descriptor from user
43 * level to the kernel. It is first used by fattach() and then
44 * be NAMEFS.
46 struct namefd {
47 int fd;
50 #if defined(_KERNEL)
52 * Each NAMEFS object is identified by a struct namenode/vnode pair.
54 struct namenode {
55 struct vnode *nm_vnode; /* represents mounted file desc. */
56 int nm_flag; /* flags defined below */
57 struct vattr nm_vattr; /* attributes of mounted file desc. */
58 struct vnode *nm_filevp; /* file desc. prior to mounting */
59 struct file *nm_filep; /* file pointer of nm_filevp */
60 struct vnode *nm_mountpt; /* mount point prior to mounting */
61 struct namenode *nm_nextp; /* next link in the linked list */
62 kmutex_t nm_lock; /* protects nm_vattr */
66 * Valid flags for namenodes.
68 #define NMNMNT 0x01 /* namenode not mounted */
71 * Macros to convert a vnode to a namenode, and vice versa.
73 #define VTONM(vp) ((struct namenode *)((vp)->v_data))
74 #define NMTOV(nm) ((nm)->nm_vnode)
76 #define NM_FILEVP_HASH_SIZE 64
77 #define NM_FILEVP_HASH_MASK (NM_FILEVP_HASH_SIZE - 1)
78 #define NM_FILEVP_HASH_SHIFT 7
79 #define NM_FILEVP_HASH(vp) (&nm_filevp_hash[(((uintptr_t)vp) >> \
80 NM_FILEVP_HASH_SHIFT) & NM_FILEVP_HASH_MASK])
82 extern struct namenode *nm_filevp_hash[NM_FILEVP_HASH_SIZE];
83 extern struct vfs namevfs;
85 extern int nameinit(int, char *);
86 extern int nm_unmountall(struct vnode *, struct cred *);
87 extern void nameinsert(struct namenode *);
88 extern void nameremove(struct namenode *);
89 extern struct namenode *namefind(struct vnode *, struct vnode *);
90 extern uint64_t namenodeno_alloc(void);
91 extern void namenodeno_free(uint64_t);
92 extern const struct vnodeops nm_vnodeops;
93 extern kmutex_t ntable_lock;
95 #endif /* _KERNEL */
97 #ifdef __cplusplus
99 #endif
101 #endif /* _SYS_FS_NAMENODE_H */