xref: /illumos-gate/usr/src/uts/common/sys/filep.h (revision 132157d7fb25c120ae1deca2a65fa7c78e8fcfd0)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_FILEP_H
27 #define	_SYS_FILEP_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #include <sys/fs/ufs_fsdir.h>
36 #include <sys/fs/ufs_fs.h>
37 #include <sys/fs/ufs_inode.h>
38 
39 /*
40  *  These structs should be invisible to the caller of
41  *  the user-level routines
42  */
43 typedef struct dev_ident {	/* device identifier block */
44 	char		*di_desc;
45 	int		di_dcookie;
46 	char		di_taken;
47 	union {
48 		struct	fs	di_fs;
49 		char	dummy[SBSIZE];
50 	}		un_fs;
51 } devid_t;
52 
53 /*
54  * Borrowed bits from i_flag
55  */
56 #define	FI_CACHED		0x100000
57 #define	FI_PARTIAL_CACHE	0x200000
58 #define	FI_NOCACHE		0x400000
59 
60 #define	FI_COMPRESSED		0x8		/* File compressed in ramdisk */
61 #define	DECOMP_BUFSIZE		(512 * 1024)	/* size of decompress buffer */
62 
63 typedef struct file_ident {	/* file identifier block */
64 	uint_t		fi_filedes;
65 	char		*fi_path;
66 	daddr_t		fi_blocknum;
67 	uint_t		fi_count;
68 	off_t		fi_offset;
69 	caddr_t		fi_memp;
70 	char		fi_taken;
71 	char		fi_flags;
72 	devid_t		*fi_devp;
73 	char		fi_buf[MAXBSIZE];
74 	int		(*fi_getblock)(struct file_ident *);
75 	struct	inode	*fi_inode;
76 	struct file_ident *fi_forw;
77 	struct file_ident *fi_back;
78 	off_t		fi_cfoff;		/* compressed file offset */
79 	caddr_t		fi_dcscrbuf;		/* decomp scratch buffer */
80 	size_t		fi_dcscrused;		/* used bytes in scratch buf */
81 	struct z_stream_s *fi_dcstream;		/* decompression stream */
82 }  fileid_t;
83 
84 extern int diskread(fileid_t *);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif	/* _SYS_FILEP_H */
91