xref: /illumos-gate/usr/src/uts/common/sys/fs/ufs_filio.h (revision 3db86aab)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_FS_UFS_FILIO_H
28 #define	_SYS_FS_UFS_FILIO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * _FIOIO
38  *
39  * struct for _FIOIO ioctl():
40  *	Input:
41  *		fio_ino	- inode number
42  *		fio_gen	- generation number
43  *	Output:
44  *		fio_fd	- readonly file descriptor
45  *
46  */
47 
48 struct fioio {
49 	ino_t	fio_ino;	/* input : inode number */
50 	int	fio_gen;	/* input : generation number */
51 	int	fio_fd;		/* output: readonly file descriptor */
52 };
53 
54 #if defined(_SYSCALL32)
55 
56 struct fioio32 {
57 	ino32_t	fio_ino;	/* input : inode number */
58 	int32_t	fio_gen;	/* input : generation number */
59 	int32_t	fio_fd;		/* output: readonly file descriptor */
60 };
61 
62 #endif	/* _SYSCALL32 */
63 
64 /*
65  * _FIOTUNE
66  */
67 struct fiotune {
68 	int	maxcontig;	/* cluster and directio size */
69 	int	rotdelay;	/* skip blocks between contig allocations */
70 	int	maxbpg;		/* currently defaults to 2048 */
71 	int	minfree;	/* %age to reserve for root */
72 	int	optim;		/* space or time */
73 };
74 
75 /*
76  * UFS Logging
77  */
78 typedef struct fiolog {
79 	uint_t	nbytes_requested;
80 	uint_t	nbytes_actual;
81 	int	error;
82 } fiolog_t;
83 
84 #define	FIOLOG_ENONE	0
85 #define	FIOLOG_ETRANS	1
86 #define	FIOLOG_EROFS	2
87 #define	FIOLOG_EULOCK	3
88 #define	FIOLOG_EWLOCK	4
89 #define	FIOLOG_ECLEAN	5
90 #define	FIOLOG_ENOULOCK	6
91 
92 #if defined(_KERNEL) && defined(__STDC__)
93 
94 extern	int	ufs_fiosatime(struct vnode *, struct timeval *, int,
95 		struct cred *);
96 extern	int	ufs_fiosdio(struct vnode *, uint_t *, int flag, struct cred *);
97 extern	int	ufs_fiogdio(struct vnode *, uint_t *, int flag, struct cred *);
98 extern	int	ufs_fioio(struct vnode *, struct fioio *, int, struct cred *);
99 extern	int	ufs_fioisbusy(struct vnode *, int *, struct cred *);
100 extern	int	ufs_fiodirectio(struct vnode *, int, struct cred *);
101 extern	int	ufs_fiotune(struct vnode *, struct fiotune *, struct cred *);
102 extern	int	ufs_fiologenable(vnode_t *, fiolog_t *, cred_t *, int);
103 extern	int	ufs_fiologdisable(vnode_t *, fiolog_t *, cred_t *, int);
104 extern	int	ufs_fioislog(vnode_t *, uint32_t *, cred_t *, int);
105 extern	int	ufs_fio_holey(vnode_t *, int, offset_t *);
106 
107 #endif	/* defined(_KERNEL) && defined(__STDC__) */
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif	/* _SYS_FS_UFS_FILIO_H */
114