xref: /titanic_44/usr/src/cmd/fs.d/cachefs/common/subr.h (revision 49b225e1cfa7bbf7738d4df0a03f18e3283426eb)
1 /*
2  * CDDL HEADER START
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 (c) 1996-1998, by Sun Microsystems, Inc.
24  * All Rights Reserved.
25  */
26 
27 #ifndef	_SUBR_H
28 #define	_SUBR_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  *
34  *			subr.h
35  *
36  * Function prototypes for subr.c
37  */
38 
39 #include <ftw.h>
40 
41 /* size to make a buffer for holding a pathname */
42 #define	CACHEFS_XMAXPATH (PATH_MAX + MAXNAMELEN + 2)
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /* resource file info */
49 struct cachefs_rinfo {
50 	int	r_fsize;	/* total file size */
51 	int	r_ptroffset;	/* offset to pointers area */
52 	int	r_ptrsize;	/* size of pointers area */
53 	int	r_identoffset;	/* offset to idents area */
54 	int	r_identsize;	/* size of idents area */
55 };
56 
57 struct cachefs_user_values {
58 	int uv_maxblocks;
59 	int uv_minblocks;
60 	int uv_threshblocks;
61 	int uv_maxfiles;
62 	int uv_minfiles;
63 	int uv_threshfiles;
64 	int uv_maxfilesize;
65 	int uv_hiblocks;
66 	int uv_lowblocks;
67 	int uv_hifiles;
68 	int uv_lowfiles;
69 };
70 
71 int cachefs_dir_lock(const char *cachedirp, int shared);
72 int cachefs_dir_unlock(int fd);
73 int cachefs_label_file_get(const char *filep, struct cache_label *clabelp);
74 int cachefs_label_file_put(const char *filep, struct cache_label *clabelp);
75 int cachefs_inuse(const char *cachedirp);
76 int cachefs_label_file_vcheck(char *filep, struct cache_label *clabelp);
77 void cachefs_resource_size(int maxinodes, struct cachefs_rinfo *rinfop);
78 int cachefs_create_cache(char *dirp, struct cachefs_user_values *,
79     struct cache_label *);
80 int cachefs_delete_all_cache(char *dirp);
81 int cachefs_delete_cache(char *dirp, char *namep);
82 int cachefs_delete_file(const char *namep, const struct stat64 *statp, int flg,
83     struct FTW *ftwp);
84 int cachefs_convert_uv2cl(const struct cachefs_user_values *uvp,
85     struct cache_label *clp, const char *dirp);
86 int cachefs_convert_cl2uv(const struct cache_label *clp,
87     struct cachefs_user_values *uvp, const char *dirp);
88 char *cachefs_file_to_dir(const char *);
89 int cachefs_clean_flag_test(const char *cachedirp);
90 void pr_err(char *fmt, ...);
91 time32_t get_boottime(void);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* _SUBR_H */
98