xref: /netbsd-src/sys/ufs/lfs/lfs_kernel.h (revision 8859f77e663d06356968e72abf9ef48bdbd2ca09)
1*8859f77eSdholland /*	$NetBSD: lfs_kernel.h,v 1.3 2016/06/20 03:29:52 dholland Exp $	*/
25bc8cc2bSdholland 
35bc8cc2bSdholland /*  from NetBSD: lfs.h,v 1.157 2013/06/28 16:14:06 matt Exp  */
45bc8cc2bSdholland 
55bc8cc2bSdholland /*-
65bc8cc2bSdholland  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
75bc8cc2bSdholland  * All rights reserved.
85bc8cc2bSdholland  *
95bc8cc2bSdholland  * This code is derived from software contributed to The NetBSD Foundation
105bc8cc2bSdholland  * by Konrad E. Schroder <perseant@hhhh.org>.
115bc8cc2bSdholland  *
125bc8cc2bSdholland  * Redistribution and use in source and binary forms, with or without
135bc8cc2bSdholland  * modification, are permitted provided that the following conditions
145bc8cc2bSdholland  * are met:
155bc8cc2bSdholland  * 1. Redistributions of source code must retain the above copyright
165bc8cc2bSdholland  *    notice, this list of conditions and the following disclaimer.
175bc8cc2bSdholland  * 2. Redistributions in binary form must reproduce the above copyright
185bc8cc2bSdholland  *    notice, this list of conditions and the following disclaimer in the
195bc8cc2bSdholland  *    documentation and/or other materials provided with the distribution.
205bc8cc2bSdholland  *
215bc8cc2bSdholland  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
225bc8cc2bSdholland  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
235bc8cc2bSdholland  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
245bc8cc2bSdholland  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
255bc8cc2bSdholland  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
265bc8cc2bSdholland  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
275bc8cc2bSdholland  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
285bc8cc2bSdholland  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
295bc8cc2bSdholland  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
305bc8cc2bSdholland  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
315bc8cc2bSdholland  * POSSIBILITY OF SUCH DAMAGE.
325bc8cc2bSdholland  */
335bc8cc2bSdholland /*-
345bc8cc2bSdholland  * Copyright (c) 1991, 1993
355bc8cc2bSdholland  *	The Regents of the University of California.  All rights reserved.
365bc8cc2bSdholland  *
375bc8cc2bSdholland  * Redistribution and use in source and binary forms, with or without
385bc8cc2bSdholland  * modification, are permitted provided that the following conditions
395bc8cc2bSdholland  * are met:
405bc8cc2bSdholland  * 1. Redistributions of source code must retain the above copyright
415bc8cc2bSdholland  *    notice, this list of conditions and the following disclaimer.
425bc8cc2bSdholland  * 2. Redistributions in binary form must reproduce the above copyright
435bc8cc2bSdholland  *    notice, this list of conditions and the following disclaimer in the
445bc8cc2bSdholland  *    documentation and/or other materials provided with the distribution.
455bc8cc2bSdholland  * 3. Neither the name of the University nor the names of its contributors
465bc8cc2bSdholland  *    may be used to endorse or promote products derived from this software
475bc8cc2bSdholland  *    without specific prior written permission.
485bc8cc2bSdholland  *
495bc8cc2bSdholland  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
505bc8cc2bSdholland  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
515bc8cc2bSdholland  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
525bc8cc2bSdholland  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
535bc8cc2bSdholland  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
545bc8cc2bSdholland  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
555bc8cc2bSdholland  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
565bc8cc2bSdholland  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
575bc8cc2bSdholland  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
585bc8cc2bSdholland  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
595bc8cc2bSdholland  * SUCH DAMAGE.
605bc8cc2bSdholland  *
615bc8cc2bSdholland  *	@(#)lfs.h	8.9 (Berkeley) 5/8/95
625bc8cc2bSdholland  */
635bc8cc2bSdholland 
645bc8cc2bSdholland #ifndef _UFS_LFS_LFS_KERNEL_H_
655bc8cc2bSdholland #define _UFS_LFS_LFS_KERNEL_H_
665bc8cc2bSdholland 
675bc8cc2bSdholland #include <ufs/lfs/lfs.h>
685bc8cc2bSdholland 
695bc8cc2bSdholland extern struct lfs_stats lfs_stats;
705bc8cc2bSdholland 
715bc8cc2bSdholland /* XXX MP */
725bc8cc2bSdholland #define	LFS_SEGLOCK_HELD(fs) \
735bc8cc2bSdholland 	((fs)->lfs_seglock != 0 &&					\
745bc8cc2bSdholland 	 (fs)->lfs_lockpid == curproc->p_pid &&				\
755bc8cc2bSdholland 	 (fs)->lfs_locklwp == curlwp->l_lid)
765bc8cc2bSdholland 
775bc8cc2bSdholland struct lfs_cluster {
785bc8cc2bSdholland 	size_t bufsize;	       /* Size of kept data */
795bc8cc2bSdholland 	struct buf **bpp;      /* Array of kept buffers */
805bc8cc2bSdholland 	int bufcount;	       /* Number of kept buffers */
815bc8cc2bSdholland #define LFS_CL_MALLOC	0x00000001
825bc8cc2bSdholland #define LFS_CL_SHIFT	0x00000002
835bc8cc2bSdholland #define LFS_CL_SYNC	0x00000004
84*8859f77eSdholland 	uint32_t flags;        /* Flags */
855bc8cc2bSdholland 	struct lfs *fs;	       /* LFS that this belongs to */
865bc8cc2bSdholland 	struct segment *seg;   /* Segment structure, for LFS_CL_SYNC */
875bc8cc2bSdholland };
885bc8cc2bSdholland 
895bc8cc2bSdholland /*
905bc8cc2bSdholland  * Splay tree containing block numbers allocated through lfs_balloc.
915bc8cc2bSdholland  */
925bc8cc2bSdholland struct lbnentry {
935bc8cc2bSdholland 	SPLAY_ENTRY(lbnentry) entry;
945bc8cc2bSdholland 	daddr_t lbn;
955bc8cc2bSdholland };
965bc8cc2bSdholland 
975bc8cc2bSdholland /*
985bc8cc2bSdholland  * Compat fcntls.  Defined for kernel only.  Userland always uses
995bc8cc2bSdholland  * "the one true version".
1005bc8cc2bSdholland  */
1015bc8cc2bSdholland #include <compat/sys/time_types.h>
1025bc8cc2bSdholland 
103aaf6e0acSdholland struct lfs_fcntl_markv_70 {
104aaf6e0acSdholland 	BLOCK_INFO_70 *blkiov;	/* blocks to relocate */
105aaf6e0acSdholland 	int blkcnt;		/* number of blocks (limited to 65536) */
106aaf6e0acSdholland };
107aaf6e0acSdholland 
1085bc8cc2bSdholland #define LFCNSEGWAITALL_COMPAT	 _FCNW_FSPRIV('L', 0, struct timeval50)
1095bc8cc2bSdholland #define LFCNSEGWAIT_COMPAT	 _FCNW_FSPRIV('L', 1, struct timeval50)
1105bc8cc2bSdholland #define LFCNIFILEFH_COMPAT	 _FCNW_FSPRIV('L', 5, struct lfs_fhandle)
1115bc8cc2bSdholland #define LFCNIFILEFH_COMPAT2	 _FCN_FSPRIV(F_FSOUT, 'L', 11, 32)
1125bc8cc2bSdholland #define LFCNWRAPSTOP_COMPAT	 _FCNO_FSPRIV('L', 9)
1135bc8cc2bSdholland #define LFCNWRAPGO_COMPAT	 _FCNO_FSPRIV('L', 10)
1145bc8cc2bSdholland #define LFCNSEGWAITALL_COMPAT_50 _FCNR_FSPRIV('L', 0, struct timeval50)
1155bc8cc2bSdholland #define LFCNSEGWAIT_COMPAT_50	 _FCNR_FSPRIV('L', 1, struct timeval50)
116aaf6e0acSdholland #define LFCNBMAPV_COMPAT_70	_FCNRW_FSPRIV('L', 2, struct lfs_fcntl_markv_70)
117aaf6e0acSdholland #define LFCNMARKV_COMPAT_70	_FCNRW_FSPRIV('L', 3, struct lfs_fcntl_markv_70)
1185bc8cc2bSdholland 
1195bc8cc2bSdholland 
1205bc8cc2bSdholland #endif /* _UFS_LFS_LFS_KERNEL_H_ */
121