3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SYS_FS_CACHEFS_FS_H
28 #define _SYS_FS_CACHEFS_FS_H
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 #include <sys/vnode.h>
33 #include <sys/vfs.h>
34 #include <sys/types.h>
35 #include <sys/types32.h>
36 #include <sys/t_lock.h>
37 #include <sys/thread.h>
38 #include <sys/kmem.h>
39 #include <sys/inttypes.h>
40 #include <sys/time_impl.h>
41 #include <sys/systm.h>
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 #ifdef CFSDEBUG
48 #define CFSDEBUG_ALL 0xffffffff
49 #define CFSDEBUG_NONE 0x0
50 #define CFSDEBUG_GENERAL 0x1
51 #define CFSDEBUG_SUBR 0x2
1090 int cdb_int; /* arbitrary int */
1091 void *cdb_pointer; /* arbitrary pointer */
1092 uint_t cdb_count; /* how many times called */
1093
1094 cachefscache_t *cdb_cachep; /* relevant cachep (maybe undefined) */
1095 struct fscache *cdb_fscp; /* relevant fscache */
1096 struct cnode *cdb_cnode; /* relevant cnode */
1097 vnode_t *cdb_frontvp; /* relevant front vnode */
1098 vnode_t *cdb_backvp; /* relevant back vnode */
1099
1100 kthread_id_t cdb_thread; /* thread who called */
1101 hrtime_t cdb_timestamp; /* when */
1102 int cdb_depth; /* depth of saved stack */
1103 pc_t cdb_stack[CACHEFS_DEBUG_DEPTH]; /* stack trace */
1104 struct cachefs_debug_info *cdb_next; /* pointer to next */
1105 } cachefs_debug_info_t;
1106
1107 /*
1108 * cachefs function prototypes
1109 */
1110 #if defined(_KERNEL) && defined(__STDC__)
1111 extern int cachefs_getcookie(vnode_t *, struct fid *, struct vattr *,
1112 cred_t *, uint32_t);
1113 cachefscache_t *cachefs_cache_create(void);
1114 void cachefs_cache_destroy(cachefscache_t *cachep);
1115 int cachefs_cache_activate_ro(cachefscache_t *cachep, vnode_t *cdvp);
1116 void cachefs_cache_activate_rw(cachefscache_t *cachep);
1117 void cachefs_cache_dirty(struct cachefscache *cachep, int lockit);
1118 int cachefs_cache_rssync(struct cachefscache *cachep);
1119 void cachefs_cache_sync(struct cachefscache *cachep);
1120 uint_t cachefs_cache_unique(cachefscache_t *cachep);
1121 void cachefs_do_req(struct cachefs_req *);
1122
1123 /* cachefs_cnode.c */
1124 void cachefs_cnode_idle(struct vnode *vp, cred_t *cr);
1125 void cachefs_cnode_idleclean(fscache_t *fscp, int unmount);
1126 int cachefs_cnode_inactive(register struct vnode *vp, cred_t *cr);
1127 void cachefs_cnode_listadd(struct cnode *cp);
1128 void cachefs_cnode_listrem(struct cnode *cp);
1129 void cachefs_cnode_free(struct cnode *cp);
1130 void cachefs_cnode_cleanfreelist();
1288 void cachefs_purgeacl(cnode_t *);
1289 int cachefs_vtype_aclok(vnode_t *);
1290
1291 /* cachefs_vfsops.c */
1292 int cachefs_init_vfsops(int);
1293 int cachefs_init_vnops(char *);
1294 void cachefs_kstat_mount(struct fscache *, char *, char *, char *, char *);
1295 void cachefs_kstat_umount(int);
1296 int cachefs_kstat_key_update(kstat_t *, int);
1297 int cachefs_kstat_key_snapshot(kstat_t *, void *, int);
1298
1299 extern void cachefs_workq_init(struct cachefs_workq *);
1300 extern void cachefs_addqueue(struct cachefs_req *, struct cachefs_workq *);
1301
1302
1303 extern void *cachefs_kmem_alloc(size_t, int);
1304 extern void *cachefs_kmem_zalloc(size_t, int);
1305 extern void cachefs_kmem_free(void *, size_t);
1306 extern char *cachefs_strdup(char *);
1307
1308 #endif /* defined (_KERNEL) && defined (__STDC__) */
1309
1310
1311
1312 #define C_RL_MAXENTS 0x4000 /* Whatever */
1313
1314 /*
1315 * ioctls.
1316 */
1317 #include <sys/ioccom.h>
1318 #define _FIOCOD _IO('f', 78) /* consistency on demand */
1319 #define _FIOSTOPCACHE _IO('f', 86) /* stop using cache */
1320
1321 #define CACHEFSIO_PACK _IO('f', 81)
1322 #define CACHEFSIO_UNPACK _IO('f', 82)
1323 #define CACHEFSIO_UNPACKALL _IO('f', 83)
1324 #define CACHEFSIO_PACKINFO _IO('f', 84)
1325 #define CACHEFSIO_DCMD _IO('f', 85)
1326
1327 #ifdef __cplusplus
1328 }
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 *
25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 */
28
29 #ifndef _SYS_FS_CACHEFS_FS_H
30 #define _SYS_FS_CACHEFS_FS_H
31
32 #include <sys/vnode.h>
33 #include <sys/vfs.h>
34 #include <sys/types.h>
35 #include <sys/types32.h>
36 #include <sys/t_lock.h>
37 #include <sys/thread.h>
38 #include <sys/kmem.h>
39 #include <sys/inttypes.h>
40 #include <sys/time_impl.h>
41 #include <sys/systm.h>
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 #ifdef CFSDEBUG
48 #define CFSDEBUG_ALL 0xffffffff
49 #define CFSDEBUG_NONE 0x0
50 #define CFSDEBUG_GENERAL 0x1
51 #define CFSDEBUG_SUBR 0x2
1090 int cdb_int; /* arbitrary int */
1091 void *cdb_pointer; /* arbitrary pointer */
1092 uint_t cdb_count; /* how many times called */
1093
1094 cachefscache_t *cdb_cachep; /* relevant cachep (maybe undefined) */
1095 struct fscache *cdb_fscp; /* relevant fscache */
1096 struct cnode *cdb_cnode; /* relevant cnode */
1097 vnode_t *cdb_frontvp; /* relevant front vnode */
1098 vnode_t *cdb_backvp; /* relevant back vnode */
1099
1100 kthread_id_t cdb_thread; /* thread who called */
1101 hrtime_t cdb_timestamp; /* when */
1102 int cdb_depth; /* depth of saved stack */
1103 pc_t cdb_stack[CACHEFS_DEBUG_DEPTH]; /* stack trace */
1104 struct cachefs_debug_info *cdb_next; /* pointer to next */
1105 } cachefs_debug_info_t;
1106
1107 /*
1108 * cachefs function prototypes
1109 */
1110 #if defined(_KERNEL)
1111 extern int cachefs_getcookie(vnode_t *, struct fid *, struct vattr *,
1112 cred_t *, uint32_t);
1113 cachefscache_t *cachefs_cache_create(void);
1114 void cachefs_cache_destroy(cachefscache_t *cachep);
1115 int cachefs_cache_activate_ro(cachefscache_t *cachep, vnode_t *cdvp);
1116 void cachefs_cache_activate_rw(cachefscache_t *cachep);
1117 void cachefs_cache_dirty(struct cachefscache *cachep, int lockit);
1118 int cachefs_cache_rssync(struct cachefscache *cachep);
1119 void cachefs_cache_sync(struct cachefscache *cachep);
1120 uint_t cachefs_cache_unique(cachefscache_t *cachep);
1121 void cachefs_do_req(struct cachefs_req *);
1122
1123 /* cachefs_cnode.c */
1124 void cachefs_cnode_idle(struct vnode *vp, cred_t *cr);
1125 void cachefs_cnode_idleclean(fscache_t *fscp, int unmount);
1126 int cachefs_cnode_inactive(register struct vnode *vp, cred_t *cr);
1127 void cachefs_cnode_listadd(struct cnode *cp);
1128 void cachefs_cnode_listrem(struct cnode *cp);
1129 void cachefs_cnode_free(struct cnode *cp);
1130 void cachefs_cnode_cleanfreelist();
1288 void cachefs_purgeacl(cnode_t *);
1289 int cachefs_vtype_aclok(vnode_t *);
1290
1291 /* cachefs_vfsops.c */
1292 int cachefs_init_vfsops(int);
1293 int cachefs_init_vnops(char *);
1294 void cachefs_kstat_mount(struct fscache *, char *, char *, char *, char *);
1295 void cachefs_kstat_umount(int);
1296 int cachefs_kstat_key_update(kstat_t *, int);
1297 int cachefs_kstat_key_snapshot(kstat_t *, void *, int);
1298
1299 extern void cachefs_workq_init(struct cachefs_workq *);
1300 extern void cachefs_addqueue(struct cachefs_req *, struct cachefs_workq *);
1301
1302
1303 extern void *cachefs_kmem_alloc(size_t, int);
1304 extern void *cachefs_kmem_zalloc(size_t, int);
1305 extern void cachefs_kmem_free(void *, size_t);
1306 extern char *cachefs_strdup(char *);
1307
1308 #endif /* defined (_KERNEL) */
1309
1310
1311
1312 #define C_RL_MAXENTS 0x4000 /* Whatever */
1313
1314 /*
1315 * ioctls.
1316 */
1317 #include <sys/ioccom.h>
1318 #define _FIOCOD _IO('f', 78) /* consistency on demand */
1319 #define _FIOSTOPCACHE _IO('f', 86) /* stop using cache */
1320
1321 #define CACHEFSIO_PACK _IO('f', 81)
1322 #define CACHEFSIO_UNPACK _IO('f', 82)
1323 #define CACHEFSIO_UNPACKALL _IO('f', 83)
1324 #define CACHEFSIO_PACKINFO _IO('f', 84)
1325 #define CACHEFSIO_DCMD _IO('f', 85)
1326
1327 #ifdef __cplusplus
1328 }
|