xref: /illumos-gate/usr/src/uts/common/sys/filep.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
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 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/fs/ufs_fsdir.h>
34 #include <sys/fs/ufs_fs.h>
35 #include <sys/fs/ufs_inode.h>
36 
37 /*
38  *  These structs should be invisible to the caller of
39  *  the user-level routines
40  */
41 typedef struct dev_ident {	/* device identifier block */
42 	char		*di_desc;
43 	int		di_dcookie;
44 	char		di_taken;
45 	union {
46 		struct	fs	di_fs;
47 		char	dummy[SBSIZE];
48 	}		un_fs;
49 } devid_t;
50 
51 /*
52  * Borrowed bits from i_flag
53  */
54 #define	FI_CACHED		0x100000
55 #define	FI_PARTIAL_CACHE	0x200000
56 #define	FI_NOCACHE		0x400000
57 
58 #define	FI_COMPRESSED		0x8		/* File compressed in ramdisk */
59 #define	DECOMP_BUFSIZE		(512 * 1024)	/* size of decompress buffer */
60 
61 typedef struct file_ident {	/* file identifier block */
62 	uint_t		fi_filedes;
63 	char		*fi_path;
64 	daddr_t		fi_blocknum;
65 	uint_t		fi_count;
66 	off_t		fi_offset;
67 	caddr_t		fi_memp;
68 	char		fi_taken;
69 	char		fi_flags;
70 	devid_t		*fi_devp;
71 	char		fi_buf[MAXBSIZE];
72 	int		(*fi_getblock)(struct file_ident *);
73 	struct	inode	*fi_inode;
74 	struct file_ident *fi_forw;
75 	struct file_ident *fi_back;
76 	off_t		fi_cfoff;		/* compressed file offset */
77 	caddr_t		fi_dcscrbuf;		/* decomp scratch buffer */
78 	size_t		fi_dcscrused;		/* used bytes in scratch buf */
79 	struct z_stream_s *fi_dcstream;		/* decompression stream */
80 }  fileid_t;
81 
82 extern int diskread(fileid_t *);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif	/* _SYS_FILEP_H */
89