6198 Let's EOL cachefs
[illumos-gate.git] / usr / src / uts / common / sys / objfs_impl.h
blob687db9edec0103a51ea3f895420d91a02b2c7565
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
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _OBJFS_IMPL_H
27 #define _OBJFS_IMPL_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <sys/modctl.h>
32 #include <sys/vfs.h>
33 #include <sys/vnode.h>
34 #include <sys/gfs.h>
35 #include <sys/objfs.h>
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
42 * VFS data object
44 typedef struct objfs_vfs {
45 vnode_t *objfs_vfs_root;
46 } objfs_vfs_t;
49 * Common vop_ entry points
51 extern int objfs_dir_open(vnode_t **, int, cred_t *, caller_context_t *);
52 extern int objfs_dir_access(vnode_t *, int, int, cred_t *,
53 caller_context_t *);
54 extern int objfs_common_close(vnode_t *, int, int, offset_t, cred_t *,
55 caller_context_t *);
58 * Common vop_ support functions
60 extern int objfs_common_getattr(vnode_t *, vattr_t *);
63 * Miscellaneous support functions
65 extern int objfs_nobjs(void);
67 #define OBJFS_NAME_MAX MAXNAMELEN
70 * The root vnode has an inode number of 0xffffffff. All other vnodes have an
71 * inode that is an OR of the module id with the type of vnode.
73 * ----------------------------------------
74 * | type | mod_id |
75 * ----------------------------------------
76 * 63 31 0
78 * This way, module directories will have an inode value equal to their module
79 * id.
82 #define OBJFS_INO(modid, type) \
83 (((uint64_t)(type) << 32) | (modid))
86 * Root directory
88 typedef gfs_dir_t objfs_rootnode_t;
90 #define OBJFS_INO_ROOT 0xffffffff
92 extern const fs_operation_def_t objfs_tops_root[];
93 extern vnodeops_t *objfs_ops_root;
95 extern vnode_t *objfs_create_root(vfs_t *);
98 * Object directory
101 typedef struct objfs_odirnode {
102 gfs_dir_t objfs_odir_dir; /* gfs dir */
103 struct modctl *objfs_odir_modctl; /* modctl pointer */
104 } objfs_odirnode_t;
106 #define OBJFS_INO_ODIR(modid) OBJFS_INO(modid, 0)
108 extern const fs_operation_def_t objfs_tops_odir[];
109 extern vnodeops_t *objfs_ops_odir;
111 extern vnode_t *objfs_create_odirnode(vnode_t *, struct modctl *);
114 * Data file
116 typedef struct objfs_datanode {
117 gfs_file_t objfs_data_file; /* gfs file */
118 objfs_info_t objfs_data_info;
119 int objfs_data_gencount; /* gen when opened */
120 } objfs_datanode_t;
122 #define OBJFS_INO_DATA(modid) OBJFS_INO(modid, 1)
124 extern const fs_operation_def_t objfs_tops_data[];
125 extern vnodeops_t *objfs_ops_data;
127 extern void objfs_data_init(void);
128 extern vnode_t *objfs_create_data(vnode_t *);
130 #ifdef __cplusplus
132 #endif
134 #endif /* _OBJFS_IMPL_H */