1*0a6a1f1dSLionel Sambuc /* $NetBSD: lfs_kernel.h,v 1.2 2015/08/12 18:24:14 dholland Exp $ */ 284d9c625SLionel Sambuc 384d9c625SLionel Sambuc /* from NetBSD: lfs.h,v 1.157 2013/06/28 16:14:06 matt Exp */ 484d9c625SLionel Sambuc 584d9c625SLionel Sambuc /*- 684d9c625SLionel Sambuc * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. 784d9c625SLionel Sambuc * All rights reserved. 884d9c625SLionel Sambuc * 984d9c625SLionel Sambuc * This code is derived from software contributed to The NetBSD Foundation 1084d9c625SLionel Sambuc * by Konrad E. Schroder <perseant@hhhh.org>. 1184d9c625SLionel Sambuc * 1284d9c625SLionel Sambuc * Redistribution and use in source and binary forms, with or without 1384d9c625SLionel Sambuc * modification, are permitted provided that the following conditions 1484d9c625SLionel Sambuc * are met: 1584d9c625SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 1684d9c625SLionel Sambuc * notice, this list of conditions and the following disclaimer. 1784d9c625SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 1884d9c625SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 1984d9c625SLionel Sambuc * documentation and/or other materials provided with the distribution. 2084d9c625SLionel Sambuc * 2184d9c625SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2284d9c625SLionel Sambuc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2384d9c625SLionel Sambuc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2484d9c625SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2584d9c625SLionel Sambuc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2684d9c625SLionel Sambuc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2784d9c625SLionel Sambuc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2884d9c625SLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2984d9c625SLionel Sambuc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3084d9c625SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3184d9c625SLionel Sambuc * POSSIBILITY OF SUCH DAMAGE. 3284d9c625SLionel Sambuc */ 3384d9c625SLionel Sambuc /*- 3484d9c625SLionel Sambuc * Copyright (c) 1991, 1993 3584d9c625SLionel Sambuc * The Regents of the University of California. All rights reserved. 3684d9c625SLionel Sambuc * 3784d9c625SLionel Sambuc * Redistribution and use in source and binary forms, with or without 3884d9c625SLionel Sambuc * modification, are permitted provided that the following conditions 3984d9c625SLionel Sambuc * are met: 4084d9c625SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 4184d9c625SLionel Sambuc * notice, this list of conditions and the following disclaimer. 4284d9c625SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 4384d9c625SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 4484d9c625SLionel Sambuc * documentation and/or other materials provided with the distribution. 4584d9c625SLionel Sambuc * 3. Neither the name of the University nor the names of its contributors 4684d9c625SLionel Sambuc * may be used to endorse or promote products derived from this software 4784d9c625SLionel Sambuc * without specific prior written permission. 4884d9c625SLionel Sambuc * 4984d9c625SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 5084d9c625SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 5184d9c625SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 5284d9c625SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 5384d9c625SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 5484d9c625SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 5584d9c625SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 5684d9c625SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 5784d9c625SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5884d9c625SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5984d9c625SLionel Sambuc * SUCH DAMAGE. 6084d9c625SLionel Sambuc * 6184d9c625SLionel Sambuc * @(#)lfs.h 8.9 (Berkeley) 5/8/95 6284d9c625SLionel Sambuc */ 6384d9c625SLionel Sambuc 6484d9c625SLionel Sambuc #ifndef _UFS_LFS_LFS_KERNEL_H_ 6584d9c625SLionel Sambuc #define _UFS_LFS_LFS_KERNEL_H_ 6684d9c625SLionel Sambuc 6784d9c625SLionel Sambuc #include <ufs/lfs/lfs.h> 6884d9c625SLionel Sambuc 6984d9c625SLionel Sambuc extern struct lfs_stats lfs_stats; 7084d9c625SLionel Sambuc 7184d9c625SLionel Sambuc /* XXX MP */ 7284d9c625SLionel Sambuc #define LFS_SEGLOCK_HELD(fs) \ 7384d9c625SLionel Sambuc ((fs)->lfs_seglock != 0 && \ 7484d9c625SLionel Sambuc (fs)->lfs_lockpid == curproc->p_pid && \ 7584d9c625SLionel Sambuc (fs)->lfs_locklwp == curlwp->l_lid) 7684d9c625SLionel Sambuc 7784d9c625SLionel Sambuc struct lfs_cluster { 7884d9c625SLionel Sambuc size_t bufsize; /* Size of kept data */ 7984d9c625SLionel Sambuc struct buf **bpp; /* Array of kept buffers */ 8084d9c625SLionel Sambuc int bufcount; /* Number of kept buffers */ 8184d9c625SLionel Sambuc #define LFS_CL_MALLOC 0x00000001 8284d9c625SLionel Sambuc #define LFS_CL_SHIFT 0x00000002 8384d9c625SLionel Sambuc #define LFS_CL_SYNC 0x00000004 8484d9c625SLionel Sambuc u_int32_t flags; /* Flags */ 8584d9c625SLionel Sambuc struct lfs *fs; /* LFS that this belongs to */ 8684d9c625SLionel Sambuc struct segment *seg; /* Segment structure, for LFS_CL_SYNC */ 8784d9c625SLionel Sambuc }; 8884d9c625SLionel Sambuc 8984d9c625SLionel Sambuc /* 9084d9c625SLionel Sambuc * Splay tree containing block numbers allocated through lfs_balloc. 9184d9c625SLionel Sambuc */ 9284d9c625SLionel Sambuc struct lbnentry { 9384d9c625SLionel Sambuc SPLAY_ENTRY(lbnentry) entry; 9484d9c625SLionel Sambuc daddr_t lbn; 9584d9c625SLionel Sambuc }; 9684d9c625SLionel Sambuc 9784d9c625SLionel Sambuc /* 9884d9c625SLionel Sambuc * Compat fcntls. Defined for kernel only. Userland always uses 9984d9c625SLionel Sambuc * "the one true version". 10084d9c625SLionel Sambuc */ 10184d9c625SLionel Sambuc #include <compat/sys/time_types.h> 10284d9c625SLionel Sambuc 103*0a6a1f1dSLionel Sambuc struct lfs_fcntl_markv_70 { 104*0a6a1f1dSLionel Sambuc BLOCK_INFO_70 *blkiov; /* blocks to relocate */ 105*0a6a1f1dSLionel Sambuc int blkcnt; /* number of blocks (limited to 65536) */ 106*0a6a1f1dSLionel Sambuc }; 107*0a6a1f1dSLionel Sambuc 10884d9c625SLionel Sambuc #define LFCNSEGWAITALL_COMPAT _FCNW_FSPRIV('L', 0, struct timeval50) 10984d9c625SLionel Sambuc #define LFCNSEGWAIT_COMPAT _FCNW_FSPRIV('L', 1, struct timeval50) 11084d9c625SLionel Sambuc #define LFCNIFILEFH_COMPAT _FCNW_FSPRIV('L', 5, struct lfs_fhandle) 11184d9c625SLionel Sambuc #define LFCNIFILEFH_COMPAT2 _FCN_FSPRIV(F_FSOUT, 'L', 11, 32) 11284d9c625SLionel Sambuc #define LFCNWRAPSTOP_COMPAT _FCNO_FSPRIV('L', 9) 11384d9c625SLionel Sambuc #define LFCNWRAPGO_COMPAT _FCNO_FSPRIV('L', 10) 11484d9c625SLionel Sambuc #define LFCNSEGWAITALL_COMPAT_50 _FCNR_FSPRIV('L', 0, struct timeval50) 11584d9c625SLionel Sambuc #define LFCNSEGWAIT_COMPAT_50 _FCNR_FSPRIV('L', 1, struct timeval50) 116*0a6a1f1dSLionel Sambuc #define LFCNBMAPV_COMPAT_70 _FCNRW_FSPRIV('L', 2, struct lfs_fcntl_markv_70) 117*0a6a1f1dSLionel Sambuc #define LFCNMARKV_COMPAT_70 _FCNRW_FSPRIV('L', 3, struct lfs_fcntl_markv_70) 11884d9c625SLionel Sambuc 11984d9c625SLionel Sambuc 12084d9c625SLionel Sambuc #endif /* _UFS_LFS_LFS_KERNEL_H_ */ 121