1*84d9c625SLionel Sambuc /* $NetBSD: lfs_kernel.h,v 1.1 2013/07/28 01:05:52 dholland Exp $ */ 2*84d9c625SLionel Sambuc 3*84d9c625SLionel Sambuc /* from NetBSD: lfs.h,v 1.157 2013/06/28 16:14:06 matt Exp */ 4*84d9c625SLionel Sambuc 5*84d9c625SLionel Sambuc /*- 6*84d9c625SLionel Sambuc * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. 7*84d9c625SLionel Sambuc * All rights reserved. 8*84d9c625SLionel Sambuc * 9*84d9c625SLionel Sambuc * This code is derived from software contributed to The NetBSD Foundation 10*84d9c625SLionel Sambuc * by Konrad E. Schroder <perseant@hhhh.org>. 11*84d9c625SLionel Sambuc * 12*84d9c625SLionel Sambuc * Redistribution and use in source and binary forms, with or without 13*84d9c625SLionel Sambuc * modification, are permitted provided that the following conditions 14*84d9c625SLionel Sambuc * are met: 15*84d9c625SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 16*84d9c625SLionel Sambuc * notice, this list of conditions and the following disclaimer. 17*84d9c625SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 18*84d9c625SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 19*84d9c625SLionel Sambuc * documentation and/or other materials provided with the distribution. 20*84d9c625SLionel Sambuc * 21*84d9c625SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 22*84d9c625SLionel Sambuc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 23*84d9c625SLionel Sambuc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24*84d9c625SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 25*84d9c625SLionel Sambuc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26*84d9c625SLionel Sambuc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27*84d9c625SLionel Sambuc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28*84d9c625SLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29*84d9c625SLionel Sambuc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30*84d9c625SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31*84d9c625SLionel Sambuc * POSSIBILITY OF SUCH DAMAGE. 32*84d9c625SLionel Sambuc */ 33*84d9c625SLionel Sambuc /*- 34*84d9c625SLionel Sambuc * Copyright (c) 1991, 1993 35*84d9c625SLionel Sambuc * The Regents of the University of California. All rights reserved. 36*84d9c625SLionel Sambuc * 37*84d9c625SLionel Sambuc * Redistribution and use in source and binary forms, with or without 38*84d9c625SLionel Sambuc * modification, are permitted provided that the following conditions 39*84d9c625SLionel Sambuc * are met: 40*84d9c625SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 41*84d9c625SLionel Sambuc * notice, this list of conditions and the following disclaimer. 42*84d9c625SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 43*84d9c625SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 44*84d9c625SLionel Sambuc * documentation and/or other materials provided with the distribution. 45*84d9c625SLionel Sambuc * 3. Neither the name of the University nor the names of its contributors 46*84d9c625SLionel Sambuc * may be used to endorse or promote products derived from this software 47*84d9c625SLionel Sambuc * without specific prior written permission. 48*84d9c625SLionel Sambuc * 49*84d9c625SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 50*84d9c625SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 51*84d9c625SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 52*84d9c625SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 53*84d9c625SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54*84d9c625SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55*84d9c625SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56*84d9c625SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57*84d9c625SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58*84d9c625SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59*84d9c625SLionel Sambuc * SUCH DAMAGE. 60*84d9c625SLionel Sambuc * 61*84d9c625SLionel Sambuc * @(#)lfs.h 8.9 (Berkeley) 5/8/95 62*84d9c625SLionel Sambuc */ 63*84d9c625SLionel Sambuc 64*84d9c625SLionel Sambuc #ifndef _UFS_LFS_LFS_KERNEL_H_ 65*84d9c625SLionel Sambuc #define _UFS_LFS_LFS_KERNEL_H_ 66*84d9c625SLionel Sambuc 67*84d9c625SLionel Sambuc #include <ufs/lfs/lfs.h> 68*84d9c625SLionel Sambuc 69*84d9c625SLionel Sambuc extern struct lfs_stats lfs_stats; 70*84d9c625SLionel Sambuc 71*84d9c625SLionel Sambuc /* XXX MP */ 72*84d9c625SLionel Sambuc #define LFS_SEGLOCK_HELD(fs) \ 73*84d9c625SLionel Sambuc ((fs)->lfs_seglock != 0 && \ 74*84d9c625SLionel Sambuc (fs)->lfs_lockpid == curproc->p_pid && \ 75*84d9c625SLionel Sambuc (fs)->lfs_locklwp == curlwp->l_lid) 76*84d9c625SLionel Sambuc 77*84d9c625SLionel Sambuc struct lfs_cluster { 78*84d9c625SLionel Sambuc size_t bufsize; /* Size of kept data */ 79*84d9c625SLionel Sambuc struct buf **bpp; /* Array of kept buffers */ 80*84d9c625SLionel Sambuc int bufcount; /* Number of kept buffers */ 81*84d9c625SLionel Sambuc #define LFS_CL_MALLOC 0x00000001 82*84d9c625SLionel Sambuc #define LFS_CL_SHIFT 0x00000002 83*84d9c625SLionel Sambuc #define LFS_CL_SYNC 0x00000004 84*84d9c625SLionel Sambuc u_int32_t flags; /* Flags */ 85*84d9c625SLionel Sambuc struct lfs *fs; /* LFS that this belongs to */ 86*84d9c625SLionel Sambuc struct segment *seg; /* Segment structure, for LFS_CL_SYNC */ 87*84d9c625SLionel Sambuc }; 88*84d9c625SLionel Sambuc 89*84d9c625SLionel Sambuc /* 90*84d9c625SLionel Sambuc * Splay tree containing block numbers allocated through lfs_balloc. 91*84d9c625SLionel Sambuc */ 92*84d9c625SLionel Sambuc struct lbnentry { 93*84d9c625SLionel Sambuc SPLAY_ENTRY(lbnentry) entry; 94*84d9c625SLionel Sambuc daddr_t lbn; 95*84d9c625SLionel Sambuc }; 96*84d9c625SLionel Sambuc 97*84d9c625SLionel Sambuc /* 98*84d9c625SLionel Sambuc * Compat fcntls. Defined for kernel only. Userland always uses 99*84d9c625SLionel Sambuc * "the one true version". 100*84d9c625SLionel Sambuc */ 101*84d9c625SLionel Sambuc #include <compat/sys/time_types.h> 102*84d9c625SLionel Sambuc 103*84d9c625SLionel Sambuc #define LFCNSEGWAITALL_COMPAT _FCNW_FSPRIV('L', 0, struct timeval50) 104*84d9c625SLionel Sambuc #define LFCNSEGWAIT_COMPAT _FCNW_FSPRIV('L', 1, struct timeval50) 105*84d9c625SLionel Sambuc #define LFCNIFILEFH_COMPAT _FCNW_FSPRIV('L', 5, struct lfs_fhandle) 106*84d9c625SLionel Sambuc #define LFCNIFILEFH_COMPAT2 _FCN_FSPRIV(F_FSOUT, 'L', 11, 32) 107*84d9c625SLionel Sambuc #define LFCNWRAPSTOP_COMPAT _FCNO_FSPRIV('L', 9) 108*84d9c625SLionel Sambuc #define LFCNWRAPGO_COMPAT _FCNO_FSPRIV('L', 10) 109*84d9c625SLionel Sambuc #define LFCNSEGWAITALL_COMPAT_50 _FCNR_FSPRIV('L', 0, struct timeval50) 110*84d9c625SLionel Sambuc #define LFCNSEGWAIT_COMPAT_50 _FCNR_FSPRIV('L', 1, struct timeval50) 111*84d9c625SLionel Sambuc 112*84d9c625SLionel Sambuc 113*84d9c625SLionel Sambuc #endif /* _UFS_LFS_LFS_KERNEL_H_ */ 114