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