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