1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 1996-1998, by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All Rights Reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SUBR_H 28*7c478bd9Sstevel@tonic-gate #define _SUBR_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * 34*7c478bd9Sstevel@tonic-gate * subr.h 35*7c478bd9Sstevel@tonic-gate * 36*7c478bd9Sstevel@tonic-gate * Function prototypes for subr.c 37*7c478bd9Sstevel@tonic-gate */ 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate #include <ftw.h> 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate /* size to make a buffer for holding a pathname */ 42*7c478bd9Sstevel@tonic-gate #define CACHEFS_XMAXPATH (PATH_MAX + MAXNAMELEN + 2) 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 45*7c478bd9Sstevel@tonic-gate extern "C" { 46*7c478bd9Sstevel@tonic-gate #endif 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* resource file info */ 49*7c478bd9Sstevel@tonic-gate struct cachefs_rinfo { 50*7c478bd9Sstevel@tonic-gate int r_fsize; /* total file size */ 51*7c478bd9Sstevel@tonic-gate int r_ptroffset; /* offset to pointers area */ 52*7c478bd9Sstevel@tonic-gate int r_ptrsize; /* size of pointers area */ 53*7c478bd9Sstevel@tonic-gate int r_identoffset; /* offset to idents area */ 54*7c478bd9Sstevel@tonic-gate int r_identsize; /* size of idents area */ 55*7c478bd9Sstevel@tonic-gate }; 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate struct cachefs_user_values { 58*7c478bd9Sstevel@tonic-gate int uv_maxblocks; 59*7c478bd9Sstevel@tonic-gate int uv_minblocks; 60*7c478bd9Sstevel@tonic-gate int uv_threshblocks; 61*7c478bd9Sstevel@tonic-gate int uv_maxfiles; 62*7c478bd9Sstevel@tonic-gate int uv_minfiles; 63*7c478bd9Sstevel@tonic-gate int uv_threshfiles; 64*7c478bd9Sstevel@tonic-gate int uv_maxfilesize; 65*7c478bd9Sstevel@tonic-gate int uv_hiblocks; 66*7c478bd9Sstevel@tonic-gate int uv_lowblocks; 67*7c478bd9Sstevel@tonic-gate int uv_hifiles; 68*7c478bd9Sstevel@tonic-gate int uv_lowfiles; 69*7c478bd9Sstevel@tonic-gate }; 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate int cachefs_dir_lock(const char *cachedirp, int shared); 72*7c478bd9Sstevel@tonic-gate int cachefs_dir_unlock(int fd); 73*7c478bd9Sstevel@tonic-gate int cachefs_label_file_get(const char *filep, struct cache_label *clabelp); 74*7c478bd9Sstevel@tonic-gate int cachefs_label_file_put(const char *filep, struct cache_label *clabelp); 75*7c478bd9Sstevel@tonic-gate int cachefs_inuse(const char *cachedirp); 76*7c478bd9Sstevel@tonic-gate int cachefs_label_file_vcheck(char *filep, struct cache_label *clabelp); 77*7c478bd9Sstevel@tonic-gate void cachefs_resource_size(int maxinodes, struct cachefs_rinfo *rinfop); 78*7c478bd9Sstevel@tonic-gate int cachefs_create_cache(char *dirp, struct cachefs_user_values *, 79*7c478bd9Sstevel@tonic-gate struct cache_label *); 80*7c478bd9Sstevel@tonic-gate int cachefs_delete_all_cache(char *dirp); 81*7c478bd9Sstevel@tonic-gate int cachefs_delete_cache(char *dirp, char *namep); 82*7c478bd9Sstevel@tonic-gate int cachefs_delete_file(const char *namep, const struct stat64 *statp, int flg, 83*7c478bd9Sstevel@tonic-gate struct FTW *ftwp); 84*7c478bd9Sstevel@tonic-gate int cachefs_convert_uv2cl(const struct cachefs_user_values *uvp, 85*7c478bd9Sstevel@tonic-gate struct cache_label *clp, const char *dirp); 86*7c478bd9Sstevel@tonic-gate int cachefs_convert_cl2uv(const struct cache_label *clp, 87*7c478bd9Sstevel@tonic-gate struct cachefs_user_values *uvp, const char *dirp); 88*7c478bd9Sstevel@tonic-gate char *cachefs_file_to_dir(const char *); 89*7c478bd9Sstevel@tonic-gate int cachefs_clean_flag_test(const char *cachedirp); 90*7c478bd9Sstevel@tonic-gate void pr_err(char *fmt, ...); 91*7c478bd9Sstevel@tonic-gate time32_t get_boottime(void); 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 94*7c478bd9Sstevel@tonic-gate } 95*7c478bd9Sstevel@tonic-gate #endif 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate #endif /* _SUBR_H */ 98