xref: /illumos-gate/usr/src/uts/common/sys/fs/ufs_filio.h (revision ba3594ba)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5986fd29aSsetje  * Common Development and Distribution License (the "License").
6986fd29aSsetje  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23*ba3594baSGarrett D'Amore  *
24986fd29aSsetje  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef _SYS_FS_UFS_FILIO_H
297c478bd9Sstevel@tonic-gate #define	_SYS_FS_UFS_FILIO_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * _FIOIO
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  * struct for _FIOIO ioctl():
397c478bd9Sstevel@tonic-gate  *	Input:
407c478bd9Sstevel@tonic-gate  *		fio_ino	- inode number
417c478bd9Sstevel@tonic-gate  *		fio_gen	- generation number
427c478bd9Sstevel@tonic-gate  *	Output:
437c478bd9Sstevel@tonic-gate  *		fio_fd	- readonly file descriptor
447c478bd9Sstevel@tonic-gate  *
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate struct fioio {
487c478bd9Sstevel@tonic-gate 	ino_t	fio_ino;	/* input : inode number */
497c478bd9Sstevel@tonic-gate 	int	fio_gen;	/* input : generation number */
507c478bd9Sstevel@tonic-gate 	int	fio_fd;		/* output: readonly file descriptor */
517c478bd9Sstevel@tonic-gate };
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate struct fioio32 {
567c478bd9Sstevel@tonic-gate 	ino32_t	fio_ino;	/* input : inode number */
577c478bd9Sstevel@tonic-gate 	int32_t	fio_gen;	/* input : generation number */
587c478bd9Sstevel@tonic-gate 	int32_t	fio_fd;		/* output: readonly file descriptor */
597c478bd9Sstevel@tonic-gate };
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * _FIOTUNE
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate struct fiotune {
677c478bd9Sstevel@tonic-gate 	int	maxcontig;	/* cluster and directio size */
687c478bd9Sstevel@tonic-gate 	int	rotdelay;	/* skip blocks between contig allocations */
697c478bd9Sstevel@tonic-gate 	int	maxbpg;		/* currently defaults to 2048 */
707c478bd9Sstevel@tonic-gate 	int	minfree;	/* %age to reserve for root */
717c478bd9Sstevel@tonic-gate 	int	optim;		/* space or time */
727c478bd9Sstevel@tonic-gate };
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * UFS Logging
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate typedef struct fiolog {
787c478bd9Sstevel@tonic-gate 	uint_t	nbytes_requested;
797c478bd9Sstevel@tonic-gate 	uint_t	nbytes_actual;
807c478bd9Sstevel@tonic-gate 	int	error;
817c478bd9Sstevel@tonic-gate } fiolog_t;
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #define	FIOLOG_ENONE	0
847c478bd9Sstevel@tonic-gate #define	FIOLOG_ETRANS	1
857c478bd9Sstevel@tonic-gate #define	FIOLOG_EROFS	2
867c478bd9Sstevel@tonic-gate #define	FIOLOG_EULOCK	3
877c478bd9Sstevel@tonic-gate #define	FIOLOG_EWLOCK	4
887c478bd9Sstevel@tonic-gate #define	FIOLOG_ECLEAN	5
897c478bd9Sstevel@tonic-gate #define	FIOLOG_ENOULOCK	6
907c478bd9Sstevel@tonic-gate 
91*ba3594baSGarrett D'Amore #if defined(_KERNEL)
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate extern	int	ufs_fiosatime(struct vnode *, struct timeval *, int,
947c478bd9Sstevel@tonic-gate 		struct cred *);
957c478bd9Sstevel@tonic-gate extern	int	ufs_fiosdio(struct vnode *, uint_t *, int flag, struct cred *);
967c478bd9Sstevel@tonic-gate extern	int	ufs_fiogdio(struct vnode *, uint_t *, int flag, struct cred *);
977c478bd9Sstevel@tonic-gate extern	int	ufs_fioio(struct vnode *, struct fioio *, int, struct cred *);
987c478bd9Sstevel@tonic-gate extern	int	ufs_fioisbusy(struct vnode *, int *, struct cred *);
997c478bd9Sstevel@tonic-gate extern	int	ufs_fiodirectio(struct vnode *, int, struct cred *);
1007c478bd9Sstevel@tonic-gate extern	int	ufs_fiotune(struct vnode *, struct fiotune *, struct cred *);
1017c478bd9Sstevel@tonic-gate extern	int	ufs_fiologenable(vnode_t *, fiolog_t *, cred_t *, int);
1027c478bd9Sstevel@tonic-gate extern	int	ufs_fiologdisable(vnode_t *, fiolog_t *, cred_t *, int);
1037c478bd9Sstevel@tonic-gate extern	int	ufs_fioislog(vnode_t *, uint32_t *, cred_t *, int);
1047c478bd9Sstevel@tonic-gate extern	int	ufs_fio_holey(vnode_t *, int, offset_t *);
105986fd29aSsetje extern	int	ufs_mark_compressed(struct vnode *vp);
1067c478bd9Sstevel@tonic-gate 
107*ba3594baSGarrett D'Amore #endif	/* defined(_KERNEL) */
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1107c478bd9Sstevel@tonic-gate }
1117c478bd9Sstevel@tonic-gate #endif
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #endif	/* _SYS_FS_UFS_FILIO_H */
114