Add lfs_kernel.h for declarations that don't need to be exposed to userland.

lfs currently has the following headers:
   lfs.h - on-disk structures and stuff needed for userlevel tools
   lfs_inode.h - additional restricted materials for userlevel tools
                 that operate the fs (newfs_lfs, fsck_lfs, lfs_cleanerd)
   lfs_kernel.h - stuff needed only in the kernel

and the following legacy headers that are expected to be mopped up and
folded into one of the above:
   lfs_extern.h - function prototypes
   ulfs_bswap.h - endian-independent support
   ulfs_dinode.h - now contains very little
   ulfs_dirhash.h - dirhash support
   ulfs_extattr.h - extattr support
   ulfs_extern.h - more function prototypes
   ulfs_inode.h - assorted kernel-only declarations
   ulfs_quota.h - quota support
   ulfs_quota1.h - more quota support
   ulfs_quota2.h - more quota support
   ulfs_quotacommon.h - more quota support
   ulfsmount.h - legacy copy of ufsmount material
This commit is contained in:
dholland 2013-07-28 01:05:52 +00:00
parent 62ec15fbc5
commit 5bc8cc2b1c
12 changed files with 144 additions and 71 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs.h,v 1.157 2013/06/28 16:14:06 matt Exp $ */
/* $NetBSD: lfs.h,v 1.158 2013/07/28 01:05:52 dholland Exp $ */
/* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */
/* from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp */
@ -1113,28 +1113,6 @@ struct segment {
int ndupino; /* number of duplicate inodes */
};
#ifdef _KERNEL
struct lfs_cluster {
size_t bufsize; /* Size of kept data */
struct buf **bpp; /* Array of kept buffers */
int bufcount; /* Number of kept buffers */
#define LFS_CL_MALLOC 0x00000001
#define LFS_CL_SHIFT 0x00000002
#define LFS_CL_SYNC 0x00000004
u_int32_t flags; /* Flags */
struct lfs *fs; /* LFS that this belongs to */
struct segment *seg; /* Segment structure, for LFS_CL_SYNC */
};
/*
* Splay tree containing block numbers allocated through lfs_balloc.
*/
struct lbnentry {
SPLAY_ENTRY(lbnentry) entry;
daddr_t lbn;
};
#endif /* _KERNEL */
/*
* Macros for determining free space on the disk, with the variable metadata
* of segment summaries and inode blocks taken into account.
@ -1208,9 +1186,6 @@ struct lfs_stats { /* Must match sysctl list in lfs_vfsops.h ! */
u_int clean_vnlocked;
u_int segs_reclaimed;
};
#ifdef _KERNEL
extern struct lfs_stats lfs_stats;
#endif
/* Fcntls to take the place of the lfs syscalls */
struct lfs_fcntl_markv {
@ -1238,31 +1213,6 @@ struct lfs_fhandle {
# define LFS_WRAP_WAITING 0x1
#define LFCNWRAPSTATUS _FCNW_FSPRIV('L', 13, int)
/*
* Compat. Defined for kernel only. Userland always uses
* "the one true version".
*/
#ifdef _KERNEL
#include <compat/sys/time_types.h>
#define LFCNSEGWAITALL_COMPAT _FCNW_FSPRIV('L', 0, struct timeval50)
#define LFCNSEGWAIT_COMPAT _FCNW_FSPRIV('L', 1, struct timeval50)
#define LFCNIFILEFH_COMPAT _FCNW_FSPRIV('L', 5, struct lfs_fhandle)
#define LFCNIFILEFH_COMPAT2 _FCN_FSPRIV(F_FSOUT, 'L', 11, 32)
#define LFCNWRAPSTOP_COMPAT _FCNO_FSPRIV('L', 9)
#define LFCNWRAPGO_COMPAT _FCNO_FSPRIV('L', 10)
#define LFCNSEGWAITALL_COMPAT_50 _FCNR_FSPRIV('L', 0, struct timeval50)
#define LFCNSEGWAIT_COMPAT_50 _FCNR_FSPRIV('L', 1, struct timeval50)
#endif
#ifdef _KERNEL
/* XXX MP */
#define LFS_SEGLOCK_HELD(fs) \
((fs)->lfs_seglock != 0 && \
(fs)->lfs_lockpid == curproc->p_pid && \
(fs)->lfs_locklwp == curlwp->l_lid)
#endif /* _KERNEL */
/* Debug segment lock */
#ifdef notyet
# define ASSERT_SEGLOCK(fs) KASSERT(LFS_SEGLOCK_HELD(fs))

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_alloc.c,v 1.117 2013/06/18 18:18:58 christos Exp $ */
/* $NetBSD: lfs_alloc.c,v 1.118 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.117 2013/06/18 18:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.118 2013/07/28 01:05:52 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -87,6 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.117 2013/06/18 18:18:58 christos Exp
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_extern.h>
#include <ufs/lfs/lfs_kernel.h>
/* Constants for inode free bitmap */
#define BMSHIFT 5 /* 2 ** 5 = 32 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_balloc.c,v 1.77 2013/06/18 18:18:58 christos Exp $ */
/* $NetBSD: lfs_balloc.c,v 1.78 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.77 2013/06/18 18:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.78 2013/07/28 01:05:52 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.77 2013/06/18 18:18:58 christos Exp
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_extern.h>
#include <ufs/lfs/lfs_kernel.h>
#include <uvm/uvm.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_bio.c,v 1.125 2013/06/18 18:18:58 christos Exp $ */
/* $NetBSD: lfs_bio.c,v 1.126 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.125 2013/06/18 18:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.126 2013/07/28 01:05:52 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -78,6 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.125 2013/06/18 18:18:58 christos Exp $
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_extern.h>
#include <ufs/lfs/lfs_kernel.h>
#include <uvm/uvm.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_inode.c,v 1.132 2013/06/18 18:18:58 christos Exp $ */
/* $NetBSD: lfs_inode.c,v 1.133 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.132 2013/06/18 18:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.133 2013/07/28 01:05:52 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.132 2013/06/18 18:18:58 christos Exp
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_extern.h>
#include <ufs/lfs/lfs_kernel.h>
static int lfs_update_seguse(struct lfs *, struct inode *ip, long, size_t);
static int lfs_indirtrunc (struct inode *, daddr_t, daddr_t,

113
sys/ufs/lfs/lfs_kernel.h Normal file
View File

@ -0,0 +1,113 @@
/* $NetBSD: lfs_kernel.h,v 1.1 2013/07/28 01:05:52 dholland Exp $ */
/* from NetBSD: lfs.h,v 1.157 2013/06/28 16:14:06 matt Exp */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Konrad E. Schroder <perseant@hhhh.org>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)lfs.h 8.9 (Berkeley) 5/8/95
*/
#ifndef _UFS_LFS_LFS_KERNEL_H_
#define _UFS_LFS_LFS_KERNEL_H_
#include <ufs/lfs/lfs.h>
extern struct lfs_stats lfs_stats;
/* XXX MP */
#define LFS_SEGLOCK_HELD(fs) \
((fs)->lfs_seglock != 0 && \
(fs)->lfs_lockpid == curproc->p_pid && \
(fs)->lfs_locklwp == curlwp->l_lid)
struct lfs_cluster {
size_t bufsize; /* Size of kept data */
struct buf **bpp; /* Array of kept buffers */
int bufcount; /* Number of kept buffers */
#define LFS_CL_MALLOC 0x00000001
#define LFS_CL_SHIFT 0x00000002
#define LFS_CL_SYNC 0x00000004
u_int32_t flags; /* Flags */
struct lfs *fs; /* LFS that this belongs to */
struct segment *seg; /* Segment structure, for LFS_CL_SYNC */
};
/*
* Splay tree containing block numbers allocated through lfs_balloc.
*/
struct lbnentry {
SPLAY_ENTRY(lbnentry) entry;
daddr_t lbn;
};
/*
* Compat fcntls. Defined for kernel only. Userland always uses
* "the one true version".
*/
#include <compat/sys/time_types.h>
#define LFCNSEGWAITALL_COMPAT _FCNW_FSPRIV('L', 0, struct timeval50)
#define LFCNSEGWAIT_COMPAT _FCNW_FSPRIV('L', 1, struct timeval50)
#define LFCNIFILEFH_COMPAT _FCNW_FSPRIV('L', 5, struct lfs_fhandle)
#define LFCNIFILEFH_COMPAT2 _FCN_FSPRIV(F_FSOUT, 'L', 11, 32)
#define LFCNWRAPSTOP_COMPAT _FCNO_FSPRIV('L', 9)
#define LFCNWRAPGO_COMPAT _FCNO_FSPRIV('L', 10)
#define LFCNSEGWAITALL_COMPAT_50 _FCNR_FSPRIV('L', 0, struct timeval50)
#define LFCNSEGWAIT_COMPAT_50 _FCNR_FSPRIV('L', 1, struct timeval50)
#endif /* _UFS_LFS_LFS_KERNEL_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_rfw.c,v 1.17 2013/06/18 18:18:58 christos Exp $ */
/* $NetBSD: lfs_rfw.c,v 1.18 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.17 2013/06/18 18:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.18 2013/07/28 01:05:52 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.17 2013/06/18 18:18:58 christos Exp $"
#include <uvm/uvm_pdaemon.h>
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_kernel.h>
#include <ufs/lfs/lfs_extern.h>
#include <miscfs/genfs/genfs.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.230 2013/06/18 18:18:58 christos Exp $ */
/* $NetBSD: lfs_segment.c,v 1.231 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.230 2013/06/18 18:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.231 2013/07/28 01:05:52 dholland Exp $");
#ifdef DEBUG
# define vndebug(vp, str) do { \
@ -100,6 +100,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.230 2013/06/18 18:18:58 christos E
#include <ufs/lfs/ulfs_extern.h>
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_kernel.h>
#include <ufs/lfs/lfs_extern.h>
#include <uvm/uvm.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_subr.c,v 1.79 2013/06/18 18:18:58 christos Exp $ */
/* $NetBSD: lfs_subr.c,v 1.80 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.79 2013/06/18 18:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.80 2013/07/28 01:05:52 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.79 2013/06/18 18:18:58 christos Exp $
#include <ufs/lfs/ulfs_inode.h>
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_kernel.h>
#include <ufs/lfs/lfs_extern.h>
#include <uvm/uvm.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_syscalls.c,v 1.147 2013/06/18 18:18:58 christos Exp $ */
/* $NetBSD: lfs_syscalls.c,v 1.148 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.147 2013/06/18 18:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.148 2013/07/28 01:05:52 dholland Exp $");
#ifndef LFS
# define LFS /* for prototypes in syscallargs.h */
@ -82,6 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.147 2013/06/18 18:18:58 christos
#include <ufs/lfs/ulfs_extern.h>
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_kernel.h>
#include <ufs/lfs/lfs_extern.h>
struct buf *lfs_fakebuf(struct lfs *, struct vnode *, int, size_t, void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.308 2013/07/28 00:29:18 dholland Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.309 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.308 2013/07/28 00:29:18 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.309 2013/07/28 01:05:52 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -109,6 +109,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.308 2013/07/28 00:29:18 dholland Ex
#include <uvm/uvm_pdaemon.h>
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_kernel.h>
#include <ufs/lfs/lfs_extern.h>
#include <miscfs/genfs/genfs.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.251 2013/07/21 00:01:22 dholland Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.252 2013/07/28 01:05:52 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.251 2013/07/21 00:01:22 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.252 2013/07/28 01:05:52 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -99,6 +99,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.251 2013/07/21 00:01:22 dholland Exp
#include <uvm/uvm_pager.h>
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_kernel.h>
#include <ufs/lfs/lfs_extern.h>
extern pid_t lfs_writer_daemon;