Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs Add lfs_kernel.h for declarations that don't nee...



details:   https://anonhg.NetBSD.org/src/rev/b02fdb28f3f4
branches:  trunk
changeset: 788897:b02fdb28f3f4
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jul 28 01:05:52 2013 +0000

description:
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

diffstat:

 sys/ufs/lfs/lfs.h          |   52 +--------------------
 sys/ufs/lfs/lfs_alloc.c    |    5 +-
 sys/ufs/lfs/lfs_balloc.c   |    5 +-
 sys/ufs/lfs/lfs_bio.c      |    5 +-
 sys/ufs/lfs/lfs_inode.c    |    5 +-
 sys/ufs/lfs/lfs_kernel.h   |  113 +++++++++++++++++++++++++++++++++++++++++++++
 sys/ufs/lfs/lfs_rfw.c      |    5 +-
 sys/ufs/lfs/lfs_segment.c  |    5 +-
 sys/ufs/lfs/lfs_subr.c     |    5 +-
 sys/ufs/lfs/lfs_syscalls.c |    5 +-
 sys/ufs/lfs/lfs_vfsops.c   |    5 +-
 sys/ufs/lfs/lfs_vnops.c    |    5 +-
 12 files changed, 144 insertions(+), 71 deletions(-)

diffs (truncated from 457 to 300 lines):

diff -r f3cc8dd004a9 -r b02fdb28f3f4 sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Sun Jul 28 00:37:07 2013 +0000
+++ b/sys/ufs/lfs/lfs.h Sun Jul 28 01:05:52 2013 +0000
@@ -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 @@
        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 @@
        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 @@
 # 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))
diff -r f3cc8dd004a9 -r b02fdb28f3f4 sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c   Sun Jul 28 00:37:07 2013 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c   Sun Jul 28 01:05:52 2013 +0000
@@ -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 @@
 
 #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 */
diff -r f3cc8dd004a9 -r b02fdb28f3f4 sys/ufs/lfs/lfs_balloc.c
--- a/sys/ufs/lfs/lfs_balloc.c  Sun Jul 28 00:37:07 2013 +0000
+++ b/sys/ufs/lfs/lfs_balloc.c  Sun Jul 28 01:05:52 2013 +0000
@@ -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 @@
 
 #include <ufs/lfs/lfs.h>
 #include <ufs/lfs/lfs_extern.h>
+#include <ufs/lfs/lfs_kernel.h>
 
 #include <uvm/uvm.h>
 
diff -r f3cc8dd004a9 -r b02fdb28f3f4 sys/ufs/lfs/lfs_bio.c
--- a/sys/ufs/lfs/lfs_bio.c     Sun Jul 28 00:37:07 2013 +0000
+++ b/sys/ufs/lfs/lfs_bio.c     Sun Jul 28 01:05:52 2013 +0000
@@ -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 @@
 
 #include <ufs/lfs/lfs.h>
 #include <ufs/lfs/lfs_extern.h>
+#include <ufs/lfs/lfs_kernel.h>
 
 #include <uvm/uvm.h>
 
diff -r f3cc8dd004a9 -r b02fdb28f3f4 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Sun Jul 28 00:37:07 2013 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Sun Jul 28 01:05:52 2013 +0000
@@ -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 @@
 
 #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,
diff -r f3cc8dd004a9 -r b02fdb28f3f4 sys/ufs/lfs/lfs_kernel.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/ufs/lfs/lfs_kernel.h  Sun Jul 28 01:05:52 2013 +0000
@@ -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@localhost>.
+ *
+ * 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)
+
+



Home | Main Index | Thread Index | Old Index