Add a new lfs header file: lfs_accessors.h.
This contains all the accessor functions and macros out of lfs.h. Add an include of lfs_accessors.h after all uses of lfs.h... except for code that wants to define its own struct lfs-alike that the accessors are supposed to play along with. For these, set STRUCT_LFS and include lfs_accessors.h after the necessary structure has been defined, so that lfs_accessors.h can emit functions in terms of it.
This commit is contained in:
parent
158635859e
commit
34f0d74c9e
@ -1,4 +1,4 @@
|
||||
# $NetBSD: mi,v 1.1972 2015/07/26 02:20:30 kamil Exp $
|
||||
# $NetBSD: mi,v 1.1973 2015/07/28 05:09:34 dholland Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
@ -3394,6 +3394,7 @@
|
||||
./usr/include/ufs/ffs/ffs_extern.h comp-c-include
|
||||
./usr/include/ufs/ffs/fs.h comp-c-include
|
||||
./usr/include/ufs/lfs/lfs.h comp-c-include
|
||||
./usr/include/ufs/lfs/lfs_accessors.h comp-c-include
|
||||
./usr/include/ufs/lfs/lfs_extern.h comp-c-include
|
||||
./usr/include/ufs/lfs/lfs_inode.h comp-c-include
|
||||
./usr/include/ufs/mfs/mfs_extern.h comp-c-include
|
||||
|
@ -37,6 +37,9 @@ struct clfs {
|
||||
int clfs_onhold; /* If cleaning this fs is on hold */
|
||||
};
|
||||
|
||||
// XXX temporary
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
|
||||
/* ugh... */
|
||||
#define CLFS_DEF_SB_ACCESSOR(type, field) \
|
||||
static __unused inline type \
|
||||
@ -114,6 +117,12 @@ clfs_sb_getfsmnt(struct clfs *fs)
|
||||
#define lfs_sb_getsboff(fs, n) clfs_sb_getsboff(fs, n)
|
||||
#define lfs_sb_getfsmnt(fs) clfs_sb_getfsmnt(fs)
|
||||
|
||||
/*
|
||||
* This needs to come after the definition of struct clfs. (XXX blah)
|
||||
*/
|
||||
//#define STRUCT_LFS struct clfs
|
||||
//#include <ufs/lfs/lfs_accessors.h>
|
||||
|
||||
/*
|
||||
* Fraction of the could-be-clean segments required to be clean.
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coalesce.c,v 1.26 2015/07/24 06:59:31 dholland Exp $ */
|
||||
/* $NetBSD: coalesce.c,v 1.27 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
|
||||
@ -38,6 +38,7 @@
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dump.h,v 1.51 2013/06/15 01:27:19 christos Exp $ */
|
||||
/* $NetBSD: dump.h,v 1.52 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -34,6 +34,7 @@
|
||||
#include <machine/bswap.h>
|
||||
#ifdef DUMP_LFS
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#endif
|
||||
#include <ufs/ufs/dinode.h>
|
||||
#include <protocols/dumprestore.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.c,v 1.34 2015/07/24 06:56:41 dholland Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.35 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -36,6 +36,7 @@
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
|
||||
#include <err.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: inode.c,v 1.56 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.57 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -66,6 +66,7 @@
|
||||
|
||||
#define vnode uvnode
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
#undef vnode
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs.c,v 1.47 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs.c,v 1.48 2015/07/28 05:09:34 dholland Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -72,6 +72,7 @@
|
||||
|
||||
#define vnode uvnode
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
#undef vnode
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.51 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: main.c,v 1.52 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -32,7 +32,9 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
|
||||
#include <fstab.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass0.c,v 1.36 2015/07/24 06:56:41 dholland Exp $ */
|
||||
/* $NetBSD: pass0.c,v 1.37 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -65,6 +65,7 @@
|
||||
|
||||
#define vnode uvnode
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
#undef vnode
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass1.c,v 1.39 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: pass1.c,v 1.40 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -36,6 +36,7 @@
|
||||
|
||||
#define vnode uvnode
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
#undef vnode
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass4.c,v 1.24 2015/07/24 06:56:41 dholland Exp $ */
|
||||
/* $NetBSD: pass4.c,v 1.25 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -37,6 +37,7 @@
|
||||
#define buf ubuf
|
||||
#define panic call_panic
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
|
||||
#include <err.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass5.c,v 1.31 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: pass5.c,v 1.32 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
|
||||
@ -37,6 +37,7 @@
|
||||
|
||||
#define vnode uvnode
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
#undef vnode
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass6.c,v 1.36 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: pass6.c,v 1.37 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -38,6 +38,7 @@
|
||||
#define VU_DIROP 0x01000000 /* XXX XXX from sys/vnode.h */
|
||||
#define vnode uvnode
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
#undef vnode
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: segwrite.c,v 1.33 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: segwrite.c,v 1.34 2015/07/28 05:09:34 dholland Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -74,6 +74,7 @@
|
||||
#define panic call_panic
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setup.c,v 1.48 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.49 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -73,6 +73,7 @@
|
||||
|
||||
#define vnode uvnode
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
#undef vnode
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: utilities.c,v 1.39 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.40 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -36,6 +36,7 @@
|
||||
#define buf ubuf
|
||||
#define vnode uvnode
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make_lfs.c,v 1.33 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: make_lfs.c,v 1.34 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -62,7 +62,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: make_lfs.c,v 1.33 2015/07/24 06:59:32 dholland Exp $");
|
||||
__RCSID("$NetBSD: make_lfs.c,v 1.34 2015/07/28 05:09:34 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -81,6 +81,7 @@ __RCSID("$NetBSD: make_lfs.c,v 1.33 2015/07/24 06:59:32 dholland Exp $");
|
||||
# define buf ubuf
|
||||
# define panic call_panic
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
|
||||
#include <err.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: resize_lfs.c,v 1.11 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: resize_lfs.c,v 1.12 2015/07/28 05:09:34 dholland Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -40,6 +40,7 @@
|
||||
|
||||
#include <ufs/ufs/dinode.h>
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
|
||||
#include <disktab.h>
|
||||
#include <err.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scan_ffs.c,v 1.27 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: scan_ffs.c,v 1.28 2015/07/28 05:09:35 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005-2007 Juan Romero Pardines
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: scan_ffs.c,v 1.27 2015/07/24 06:59:32 dholland Exp $");
|
||||
__RCSID("$NetBSD: scan_ffs.c,v 1.28 2015/07/28 05:09:35 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -45,6 +45,7 @@ __RCSID("$NetBSD: scan_ffs.c,v 1.27 2015/07/24 06:59:32 dholland Exp $");
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
#include <ufs/ufs/dinode.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs.c,v 1.67 2015/07/24 06:56:42 dholland Exp $ */
|
||||
/* $NetBSD: ufs.c,v 1.68 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -70,8 +70,9 @@
|
||||
#include <sys/queue.h>
|
||||
#include <sys/condvar.h>
|
||||
#include <sys/mount.h> /* XXX for MNAMELEN */
|
||||
#define STRUCT_LFS struct salfs
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#define STRUCT_LFS struct salfs
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#else
|
||||
#include <ufs/ffs/fs.h>
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.2 2013/06/08 02:04:31 dholland Exp $
|
||||
# $NetBSD: Makefile,v 1.3 2015/07/28 05:09:34 dholland Exp $
|
||||
|
||||
INCSDIR= /usr/include/ufs/lfs
|
||||
|
||||
INCS= lfs.h lfs_inode.h lfs_extern.h
|
||||
INCS= lfs.h lfs_accessors.h lfs_inode.h lfs_extern.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs.h,v 1.166 2015/07/28 05:09:34 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 */
|
||||
@ -424,16 +424,6 @@ struct ulfs2_dinode {
|
||||
#define LFS_IFSOCK 0140000 /* UNIX domain socket. */
|
||||
#define LFS_IFWHT 0160000 /* Whiteout. */
|
||||
|
||||
/*
|
||||
* Maximum length of a symlink that can be stored within the inode.
|
||||
*/
|
||||
#define ULFS1_MAXSYMLINKLEN ((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int32_t))
|
||||
#define ULFS2_MAXSYMLINKLEN ((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int64_t))
|
||||
|
||||
#define ULFS_MAXSYMLINKLEN(ip) \
|
||||
((ip)->i_ump->um_fstype == ULFS1) ? \
|
||||
ULFS1_MAXSYMLINKLEN : ULFS2_MAXSYMLINKLEN
|
||||
|
||||
/*
|
||||
* "struct buf" associated definitions
|
||||
*/
|
||||
@ -445,29 +435,6 @@ struct ulfs2_dinode {
|
||||
/* Unused logical block number */
|
||||
#define LFS_UNUSED_LBN -1
|
||||
|
||||
# define LFS_LOCK_BUF(bp) do { \
|
||||
if (((bp)->b_flags & B_LOCKED) == 0 && bp->b_iodone == NULL) { \
|
||||
mutex_enter(&lfs_lock); \
|
||||
++locked_queue_count; \
|
||||
locked_queue_bytes += bp->b_bufsize; \
|
||||
mutex_exit(&lfs_lock); \
|
||||
} \
|
||||
(bp)->b_flags |= B_LOCKED; \
|
||||
} while (0)
|
||||
|
||||
# define LFS_UNLOCK_BUF(bp) do { \
|
||||
if (((bp)->b_flags & B_LOCKED) != 0 && bp->b_iodone == NULL) { \
|
||||
mutex_enter(&lfs_lock); \
|
||||
--locked_queue_count; \
|
||||
locked_queue_bytes -= bp->b_bufsize; \
|
||||
if (locked_queue_count < LFS_WAIT_BUFS && \
|
||||
locked_queue_bytes < LFS_WAIT_BYTES) \
|
||||
cv_broadcast(&locked_queue_cv); \
|
||||
mutex_exit(&lfs_lock); \
|
||||
} \
|
||||
(bp)->b_flags &= ~B_LOCKED; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* "struct inode" associated definitions
|
||||
*/
|
||||
@ -475,33 +442,6 @@ struct ulfs2_dinode {
|
||||
/* For convenience */
|
||||
#define IN_ALLMOD (IN_MODIFIED|IN_ACCESS|IN_CHANGE|IN_UPDATE|IN_MODIFY|IN_ACCESSED|IN_CLEANING)
|
||||
|
||||
#define LFS_SET_UINO(ip, flags) do { \
|
||||
if (((flags) & IN_ACCESSED) && !((ip)->i_flag & IN_ACCESSED)) \
|
||||
lfs_sb_adduinodes((ip)->i_lfs, 1); \
|
||||
if (((flags) & IN_CLEANING) && !((ip)->i_flag & IN_CLEANING)) \
|
||||
lfs_sb_adduinodes((ip)->i_lfs, 1); \
|
||||
if (((flags) & IN_MODIFIED) && !((ip)->i_flag & IN_MODIFIED)) \
|
||||
lfs_sb_adduinodes((ip)->i_lfs, 1); \
|
||||
(ip)->i_flag |= (flags); \
|
||||
} while (0)
|
||||
|
||||
#define LFS_CLR_UINO(ip, flags) do { \
|
||||
if (((flags) & IN_ACCESSED) && ((ip)->i_flag & IN_ACCESSED)) \
|
||||
lfs_sb_subuinodes((ip)->i_lfs, 1); \
|
||||
if (((flags) & IN_CLEANING) && ((ip)->i_flag & IN_CLEANING)) \
|
||||
lfs_sb_subuinodes((ip)->i_lfs, 1); \
|
||||
if (((flags) & IN_MODIFIED) && ((ip)->i_flag & IN_MODIFIED)) \
|
||||
lfs_sb_subuinodes((ip)->i_lfs, 1); \
|
||||
(ip)->i_flag &= ~(flags); \
|
||||
if (lfs_sb_getuinodes((ip)->i_lfs) < 0) { \
|
||||
panic("lfs_uinodes < 0"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LFS_ITIMES(ip, acc, mod, cre) \
|
||||
while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
|
||||
lfs_itimes(ip, acc, mod, cre)
|
||||
|
||||
/*
|
||||
* On-disk and in-memory checkpoint segment usage structure.
|
||||
*/
|
||||
@ -531,50 +471,6 @@ struct segusage_v1 {
|
||||
u_int32_t su_flags; /* 12: segment flags */
|
||||
};
|
||||
|
||||
#define SEGUPB(fs) (lfs_sb_getsepb(fs))
|
||||
#define SEGTABSIZE_SU(fs) \
|
||||
((lfs_sb_getnseg(fs) + SEGUPB(fs) - 1) / lfs_sb_getsepb(fs))
|
||||
|
||||
#ifdef _KERNEL
|
||||
# define SHARE_IFLOCK(F) \
|
||||
do { \
|
||||
rw_enter(&(F)->lfs_iflock, RW_READER); \
|
||||
} while(0)
|
||||
# define UNSHARE_IFLOCK(F) \
|
||||
do { \
|
||||
rw_exit(&(F)->lfs_iflock); \
|
||||
} while(0)
|
||||
#else /* ! _KERNEL */
|
||||
# define SHARE_IFLOCK(F)
|
||||
# define UNSHARE_IFLOCK(F)
|
||||
#endif /* ! _KERNEL */
|
||||
|
||||
/* Read in the block with a specific segment usage entry from the ifile. */
|
||||
#define LFS_SEGENTRY(SP, F, IN, BP) do { \
|
||||
int _e; \
|
||||
SHARE_IFLOCK(F); \
|
||||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if ((_e = bread((F)->lfs_ivnode, \
|
||||
((IN) / lfs_sb_getsepb(F)) + lfs_sb_getcleansz(F), \
|
||||
lfs_sb_getbsize(F), 0, &(BP))) != 0) \
|
||||
panic("lfs: ifile read: %d", _e); \
|
||||
if ((F)->lfs_version == 1) \
|
||||
(SP) = (SEGUSE *)((SEGUSE_V1 *)(BP)->b_data + \
|
||||
((IN) & (lfs_sb_getsepb(F) - 1))); \
|
||||
else \
|
||||
(SP) = (SEGUSE *)(BP)->b_data + ((IN) % lfs_sb_getsepb(F)); \
|
||||
UNSHARE_IFLOCK(F); \
|
||||
} while (0)
|
||||
|
||||
#define LFS_WRITESEGENTRY(SP, F, IN, BP) do { \
|
||||
if ((SP)->su_nbytes == 0) \
|
||||
(SP)->su_flags |= SEGUSE_EMPTY; \
|
||||
else \
|
||||
(SP)->su_flags &= ~SEGUSE_EMPTY; \
|
||||
(F)->lfs_suflags[(F)->lfs_activesb][(IN)] = (SP)->su_flags; \
|
||||
LFS_BWRITE_LOG(BP); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* On-disk file information. One per file with data blocks in the segment.
|
||||
*/
|
||||
@ -613,27 +509,6 @@ struct ifile_v1 {
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* LFSv1 compatibility code is not allowed to touch if_atime, since it
|
||||
* may not be mapped!
|
||||
*/
|
||||
/* Read in the block with a specific inode from the ifile. */
|
||||
#define LFS_IENTRY(IP, F, IN, BP) do { \
|
||||
int _e; \
|
||||
SHARE_IFLOCK(F); \
|
||||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if ((_e = bread((F)->lfs_ivnode, \
|
||||
(IN) / lfs_sb_getifpb(F) + lfs_sb_getcleansz(F) + lfs_sb_getsegtabsz(F), \
|
||||
lfs_sb_getbsize(F), 0, &(BP))) != 0) \
|
||||
panic("lfs: ifile ino %d read %d", (int)(IN), _e); \
|
||||
if ((F)->lfs_version == 1) \
|
||||
(IP) = (IFILE *)((IFILE_V1 *)(BP)->b_data + \
|
||||
(IN) % lfs_sb_getifpb(F)); \
|
||||
else \
|
||||
(IP) = (IFILE *)(BP)->b_data + (IN) % lfs_sb_getifpb(F); \
|
||||
UNSHARE_IFLOCK(F); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Cleaner information structure. This resides in the ifile and is used
|
||||
* to pass information from the kernel to the cleaner.
|
||||
@ -649,82 +524,6 @@ typedef struct _cleanerinfo {
|
||||
u_int32_t flags; /* status word from the kernel */
|
||||
} CLEANERINFO;
|
||||
|
||||
#define CLEANSIZE_SU(fs) \
|
||||
((sizeof(CLEANERINFO) + lfs_sb_getbsize(fs) - 1) >> lfs_sb_getbshift(fs))
|
||||
|
||||
/* Read in the block with the cleaner info from the ifile. */
|
||||
#define LFS_CLEANERINFO(CP, F, BP) do { \
|
||||
SHARE_IFLOCK(F); \
|
||||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if (bread((F)->lfs_ivnode, \
|
||||
(daddr_t)0, lfs_sb_getbsize(F), 0, &(BP))) \
|
||||
panic("lfs: ifile read"); \
|
||||
(CP) = (CLEANERINFO *)(BP)->b_data; \
|
||||
UNSHARE_IFLOCK(F); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Synchronize the Ifile cleaner info with current avail and bfree.
|
||||
*/
|
||||
#define LFS_SYNC_CLEANERINFO(cip, fs, bp, w) do { \
|
||||
mutex_enter(&lfs_lock); \
|
||||
if ((w) || (cip)->bfree != lfs_sb_getbfree(fs) || \
|
||||
(cip)->avail != lfs_sb_getavail(fs) - fs->lfs_ravail - \
|
||||
fs->lfs_favail) { \
|
||||
(cip)->bfree = lfs_sb_getbfree(fs); \
|
||||
(cip)->avail = lfs_sb_getavail(fs) - fs->lfs_ravail - \
|
||||
fs->lfs_favail; \
|
||||
if (((bp)->b_flags & B_GATHERED) == 0) { \
|
||||
fs->lfs_flags |= LFS_IFDIRTY; \
|
||||
} \
|
||||
mutex_exit(&lfs_lock); \
|
||||
(void) LFS_BWRITE_LOG(bp); /* Ifile */ \
|
||||
} else { \
|
||||
mutex_exit(&lfs_lock); \
|
||||
brelse(bp, 0); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Get the head of the inode free list.
|
||||
* Always called with the segment lock held.
|
||||
*/
|
||||
#define LFS_GET_HEADFREE(FS, CIP, BP, FREEP) do { \
|
||||
if ((FS)->lfs_version > 1) { \
|
||||
LFS_CLEANERINFO((CIP), (FS), (BP)); \
|
||||
lfs_sb_setfreehd(FS, (CIP)->free_head); \
|
||||
brelse(BP, 0); \
|
||||
} \
|
||||
*(FREEP) = lfs_sb_getfreehd(FS); \
|
||||
} while (0)
|
||||
|
||||
#define LFS_PUT_HEADFREE(FS, CIP, BP, VAL) do { \
|
||||
lfs_sb_setfreehd(FS, VAL); \
|
||||
if ((FS)->lfs_version > 1) { \
|
||||
LFS_CLEANERINFO((CIP), (FS), (BP)); \
|
||||
(CIP)->free_head = (VAL); \
|
||||
LFS_BWRITE_LOG(BP); \
|
||||
mutex_enter(&lfs_lock); \
|
||||
(FS)->lfs_flags |= LFS_IFDIRTY; \
|
||||
mutex_exit(&lfs_lock); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LFS_GET_TAILFREE(FS, CIP, BP, FREEP) do { \
|
||||
LFS_CLEANERINFO((CIP), (FS), (BP)); \
|
||||
*(FREEP) = (CIP)->free_tail; \
|
||||
brelse(BP, 0); \
|
||||
} while (0)
|
||||
|
||||
#define LFS_PUT_TAILFREE(FS, CIP, BP, VAL) do { \
|
||||
LFS_CLEANERINFO((CIP), (FS), (BP)); \
|
||||
(CIP)->free_tail = (VAL); \
|
||||
LFS_BWRITE_LOG(BP); \
|
||||
mutex_enter(&lfs_lock); \
|
||||
(FS)->lfs_flags |= LFS_IFDIRTY; \
|
||||
mutex_exit(&lfs_lock); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* On-disk segment summary information
|
||||
*/
|
||||
@ -767,8 +566,6 @@ struct segsum {
|
||||
/* FINFO's and inode daddr's... */
|
||||
};
|
||||
|
||||
#define SEGSUM_SIZE(fs) ((fs)->lfs_version == 1 ? sizeof(SEGSUM_V1) : sizeof(SEGSUM))
|
||||
|
||||
|
||||
/*
|
||||
* On-disk super block.
|
||||
@ -969,197 +766,6 @@ struct salfs {
|
||||
struct dlfs lfs_dlfs;
|
||||
};
|
||||
|
||||
/*
|
||||
* Generate accessors for the on-disk superblock fields with cpp.
|
||||
*
|
||||
* STRUCT_LFS is used by the libsa code to get accessors that work
|
||||
* with struct salfs instead of struct lfs.
|
||||
*/
|
||||
|
||||
#ifndef STRUCT_LFS
|
||||
#define STRUCT_LFS struct lfs
|
||||
#endif
|
||||
|
||||
#define LFS_DEF_SB_ACCESSOR(type, field) \
|
||||
static __unused inline type \
|
||||
lfs_sb_get##field(STRUCT_LFS *fs) \
|
||||
{ \
|
||||
return fs->lfs_dlfs.dlfs_##field; \
|
||||
} \
|
||||
static __unused inline void \
|
||||
lfs_sb_set##field(STRUCT_LFS *fs, type val) \
|
||||
{ \
|
||||
fs->lfs_dlfs.dlfs_##field = val; \
|
||||
} \
|
||||
static __unused inline void \
|
||||
lfs_sb_add##field(STRUCT_LFS *fs, type val) \
|
||||
{ \
|
||||
type *p = &fs->lfs_dlfs.dlfs_##field; \
|
||||
*p += val; \
|
||||
} \
|
||||
static __unused inline void \
|
||||
lfs_sb_sub##field(STRUCT_LFS *fs, type val) \
|
||||
{ \
|
||||
type *p = &fs->lfs_dlfs.dlfs_##field; \
|
||||
*p -= val; \
|
||||
}
|
||||
|
||||
#define lfs_magic lfs_dlfs.dlfs_magic
|
||||
#define lfs_version lfs_dlfs.dlfs_version
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, size);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ssize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, dsize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, bsize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, fsize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, frag);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, freehd);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, bfree);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nfiles);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, avail);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, uinodes);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, idaddr);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ifile);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, lastseg);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, nextseg);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, curseg);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, offset);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, lastpseg);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, inopf);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, minfree);
|
||||
LFS_DEF_SB_ACCESSOR(uint64_t, maxfilesize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, fsbpseg);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, inopb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ifpb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, sepb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nindir);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nseg);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nspf);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, cleansz);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, segtabsz);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, segmask);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, segshift);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, bmask);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, bshift);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, ffmask);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ffshift);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, fbmask);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, fbshift);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, blktodb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, fsbtodb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, sushift);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, maxsymlinklen);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, cksum);
|
||||
LFS_DEF_SB_ACCESSOR(u_int16_t, pflags);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nclean);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, dmeta);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, minfreeseg);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, sumsize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, serial);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ibsize);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, s0addr);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, tstamp);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, inodefmt);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, interleave);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ident);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, resvseg);
|
||||
|
||||
/* special-case accessors */
|
||||
|
||||
/*
|
||||
* the v1 otstamp field lives in what's now dlfs_inopf
|
||||
*/
|
||||
#define lfs_sb_getotstamp(fs) lfs_sb_getinopf(fs)
|
||||
#define lfs_sb_setotstamp(fs, val) lfs_sb_setinopf(fs, val)
|
||||
|
||||
/*
|
||||
* lfs_sboffs is an array
|
||||
*/
|
||||
static __unused inline int32_t
|
||||
lfs_sb_getsboff(struct lfs *fs, unsigned n)
|
||||
{
|
||||
#ifdef KASSERT /* ugh */
|
||||
KASSERT(n < LFS_MAXNUMSB);
|
||||
#endif
|
||||
return fs->lfs_dlfs.dlfs_sboffs[n];
|
||||
}
|
||||
static __unused inline void
|
||||
lfs_sb_setsboff(struct lfs *fs, unsigned n, int32_t val)
|
||||
{
|
||||
#ifdef KASSERT /* ugh */
|
||||
KASSERT(n < LFS_MAXNUMSB);
|
||||
#endif
|
||||
fs->lfs_dlfs.dlfs_sboffs[n] = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* lfs_fsmnt is a string
|
||||
*/
|
||||
static __unused inline const char *
|
||||
lfs_sb_getfsmnt(struct lfs *fs)
|
||||
{
|
||||
return fs->lfs_dlfs.dlfs_fsmnt;
|
||||
}
|
||||
|
||||
/* LFS_NINDIR is the number of indirects in a file system block. */
|
||||
#define LFS_NINDIR(fs) (lfs_sb_getnindir(fs))
|
||||
|
||||
/* LFS_INOPB is the number of inodes in a secondary storage block. */
|
||||
#define LFS_INOPB(fs) (lfs_sb_getinopb(fs))
|
||||
/* LFS_INOPF is the number of inodes in a fragment. */
|
||||
#define LFS_INOPF(fs) (lfs_sb_getinopf(fs))
|
||||
|
||||
#define lfs_blksize(fs, ip, lbn) \
|
||||
(((lbn) >= ULFS_NDADDR || (ip)->i_ffs1_size >= ((lbn) + 1) << lfs_sb_getbshift(fs)) \
|
||||
? lfs_sb_getbsize(fs) \
|
||||
: (lfs_fragroundup(fs, lfs_blkoff(fs, (ip)->i_ffs1_size))))
|
||||
#define lfs_blkoff(fs, loc) ((int)((loc) & lfs_sb_getbmask(fs)))
|
||||
#define lfs_fragoff(fs, loc) /* calculates (loc % fs->lfs_fsize) */ \
|
||||
((int)((loc) & lfs_sb_getffmask(fs)))
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#define LFS_FSBTODB(fs, b) ((b) << (lfs_sb_getffshift(fs) - DEV_BSHIFT))
|
||||
#define LFS_DBTOFSB(fs, b) ((b) >> (lfs_sb_getffshift(fs) - DEV_BSHIFT))
|
||||
#else
|
||||
#define LFS_FSBTODB(fs, b) ((b) << lfs_sb_getfsbtodb(fs))
|
||||
#define LFS_DBTOFSB(fs, b) ((b) >> lfs_sb_getfsbtodb(fs))
|
||||
#endif
|
||||
|
||||
#define lfs_lblkno(fs, loc) ((loc) >> lfs_sb_getbshift(fs))
|
||||
#define lfs_lblktosize(fs, blk) ((blk) << lfs_sb_getbshift(fs))
|
||||
|
||||
#define lfs_fsbtob(fs, b) ((b) << lfs_sb_getffshift(fs))
|
||||
#define lfs_btofsb(fs, b) ((b) >> lfs_sb_getffshift(fs))
|
||||
|
||||
#define lfs_numfrags(fs, loc) /* calculates (loc / fs->lfs_fsize) */ \
|
||||
((loc) >> lfs_sb_getffshift(fs))
|
||||
#define lfs_blkroundup(fs, size)/* calculates roundup(size, lfs_sb_getbsize(fs)) */ \
|
||||
((off_t)(((size) + lfs_sb_getbmask(fs)) & (~lfs_sb_getbmask(fs))))
|
||||
#define lfs_fragroundup(fs, size)/* calculates roundup(size, fs->lfs_fsize) */ \
|
||||
((off_t)(((size) + lfs_sb_getffmask(fs)) & (~lfs_sb_getffmask(fs))))
|
||||
#define lfs_fragstoblks(fs, frags)/* calculates (frags / fs->fs_frag) */ \
|
||||
((frags) >> lfs_sb_getfbshift(fs))
|
||||
#define lfs_blkstofrags(fs, blks)/* calculates (blks * fs->fs_frag) */ \
|
||||
((blks) << lfs_sb_getfbshift(fs))
|
||||
#define lfs_fragnum(fs, fsb) /* calculates (fsb % fs->lfs_frag) */ \
|
||||
((fsb) & ((fs)->lfs_frag - 1))
|
||||
#define lfs_blknum(fs, fsb) /* calculates rounddown(fsb, fs->lfs_frag) */ \
|
||||
((fsb) &~ ((fs)->lfs_frag - 1))
|
||||
#define lfs_dblksize(fs, dp, lbn) \
|
||||
(((lbn) >= ULFS_NDADDR || (dp)->di_size >= ((lbn) + 1) << lfs_sb_getbshift(fs)) \
|
||||
? lfs_sb_getbsize(fs) \
|
||||
: (lfs_fragroundup(fs, lfs_blkoff(fs, (dp)->di_size))))
|
||||
|
||||
#define lfs_segsize(fs) ((fs)->lfs_version == 1 ? \
|
||||
lfs_lblktosize((fs), lfs_sb_getssize(fs)) : \
|
||||
lfs_sb_getssize(fs))
|
||||
#define lfs_segtod(fs, seg) (((fs)->lfs_version == 1 ? \
|
||||
lfs_sb_getssize(fs) << lfs_sb_getblktodb(fs) : \
|
||||
lfs_btofsb((fs), lfs_sb_getssize(fs))) * (seg))
|
||||
#define lfs_dtosn(fs, daddr) /* block address to segment number */ \
|
||||
((uint32_t)(((daddr) - lfs_sb_gets0addr(fs)) / lfs_segtod((fs), 1)))
|
||||
#define lfs_sntod(fs, sn) /* segment number to disk address */ \
|
||||
((daddr_t)(lfs_segtod((fs), (sn)) + lfs_sb_gets0addr(fs)))
|
||||
|
||||
/*
|
||||
* Structures used by lfs_bmapv and lfs_markv to communicate information
|
||||
* about inodes and data blocks.
|
||||
@ -1216,60 +822,6 @@ struct segment {
|
||||
int ndupino; /* number of duplicate inodes */
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros for determining free space on the disk, with the variable metadata
|
||||
* of segment summaries and inode blocks taken into account.
|
||||
*/
|
||||
/*
|
||||
* Estimate number of clean blocks not available for writing because
|
||||
* they will contain metadata or overhead. This is calculated as
|
||||
*
|
||||
* E = ((C * M / D) * D + (0) * (T - D)) / T
|
||||
* or more simply
|
||||
* E = (C * M) / T
|
||||
*
|
||||
* where
|
||||
* C is the clean space,
|
||||
* D is the dirty space,
|
||||
* M is the dirty metadata, and
|
||||
* T = C + D is the total space on disk.
|
||||
*
|
||||
* This approximates the old formula of E = C * M / D when D is close to T,
|
||||
* but avoids falsely reporting "disk full" when the sample size (D) is small.
|
||||
*/
|
||||
#define LFS_EST_CMETA(F) (int32_t)(( \
|
||||
(lfs_sb_getdmeta(F) * (int64_t)lfs_sb_getnclean(F)) / \
|
||||
(lfs_sb_getnseg(F))))
|
||||
|
||||
/* Estimate total size of the disk not including metadata */
|
||||
#define LFS_EST_NONMETA(F) (lfs_sb_getdsize(F) - lfs_sb_getdmeta(F) - LFS_EST_CMETA(F))
|
||||
|
||||
/* Estimate number of blocks actually available for writing */
|
||||
#define LFS_EST_BFREE(F) (lfs_sb_getbfree(F) > LFS_EST_CMETA(F) ? \
|
||||
lfs_sb_getbfree(F) - LFS_EST_CMETA(F) : 0)
|
||||
|
||||
/* Amount of non-meta space not available to mortal man */
|
||||
#define LFS_EST_RSVD(F) (int32_t)((LFS_EST_NONMETA(F) * \
|
||||
(u_int64_t)lfs_sb_getminfree(F)) / \
|
||||
100)
|
||||
|
||||
/* Can credential C write BB blocks */
|
||||
#define ISSPACE(F, BB, C) \
|
||||
((((C) == NOCRED || kauth_cred_geteuid(C) == 0) && \
|
||||
LFS_EST_BFREE(F) >= (BB)) || \
|
||||
(kauth_cred_geteuid(C) != 0 && IS_FREESPACE(F, BB)))
|
||||
|
||||
/* Can an ordinary user write BB blocks */
|
||||
#define IS_FREESPACE(F, BB) \
|
||||
(LFS_EST_BFREE(F) >= (BB) + LFS_EST_RSVD(F))
|
||||
|
||||
/*
|
||||
* The minimum number of blocks to create a new inode. This is:
|
||||
* directory direct block (1) + ULFS_NIADDR indirect blocks + inode block (1) +
|
||||
* ifile direct block (1) + ULFS_NIADDR indirect blocks = 3 + 2 * ULFS_NIADDR blocks.
|
||||
*/
|
||||
#define LFS_NRESERVE(F) (lfs_btofsb((F), (2 * ULFS_NIADDR + 3) << lfs_sb_getbshift(F)))
|
||||
|
||||
/* Statistics Counters */
|
||||
struct lfs_stats { /* Must match sysctl list in lfs_vfsops.h ! */
|
||||
u_int segsused;
|
||||
|
627
sys/ufs/lfs/lfs_accessors.h
Normal file
627
sys/ufs/lfs/lfs_accessors.h
Normal file
@ -0,0 +1,627 @@
|
||||
/* $NetBSD: lfs_accessors.h,v 1.1 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/* from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 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 */
|
||||
|
||||
/*-
|
||||
* 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
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed for the FreeBSD Project by Marshall
|
||||
* Kirk McKusick and Network Associates Laboratories, the Security
|
||||
* Research Division of Network Associates, Inc. under DARPA/SPAWAR
|
||||
* contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
|
||||
* research program
|
||||
*
|
||||
* Copyright (c) 1982, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)dinode.h 8.9 (Berkeley) 3/29/95
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)dir.h 8.5 (Berkeley) 4/27/95
|
||||
*/
|
||||
|
||||
#ifndef _UFS_LFS_LFS_ACCESSORS_H_
|
||||
#define _UFS_LFS_LFS_ACCESSORS_H_
|
||||
|
||||
/*
|
||||
* Maximum length of a symlink that can be stored within the inode.
|
||||
*/
|
||||
#define ULFS1_MAXSYMLINKLEN ((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int32_t))
|
||||
#define ULFS2_MAXSYMLINKLEN ((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int64_t))
|
||||
|
||||
#define ULFS_MAXSYMLINKLEN(ip) \
|
||||
((ip)->i_ump->um_fstype == ULFS1) ? \
|
||||
ULFS1_MAXSYMLINKLEN : ULFS2_MAXSYMLINKLEN
|
||||
|
||||
/*
|
||||
* "struct buf" associated definitions
|
||||
*/
|
||||
|
||||
# define LFS_LOCK_BUF(bp) do { \
|
||||
if (((bp)->b_flags & B_LOCKED) == 0 && bp->b_iodone == NULL) { \
|
||||
mutex_enter(&lfs_lock); \
|
||||
++locked_queue_count; \
|
||||
locked_queue_bytes += bp->b_bufsize; \
|
||||
mutex_exit(&lfs_lock); \
|
||||
} \
|
||||
(bp)->b_flags |= B_LOCKED; \
|
||||
} while (0)
|
||||
|
||||
# define LFS_UNLOCK_BUF(bp) do { \
|
||||
if (((bp)->b_flags & B_LOCKED) != 0 && bp->b_iodone == NULL) { \
|
||||
mutex_enter(&lfs_lock); \
|
||||
--locked_queue_count; \
|
||||
locked_queue_bytes -= bp->b_bufsize; \
|
||||
if (locked_queue_count < LFS_WAIT_BUFS && \
|
||||
locked_queue_bytes < LFS_WAIT_BYTES) \
|
||||
cv_broadcast(&locked_queue_cv); \
|
||||
mutex_exit(&lfs_lock); \
|
||||
} \
|
||||
(bp)->b_flags &= ~B_LOCKED; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* "struct inode" associated definitions
|
||||
*/
|
||||
|
||||
#define LFS_SET_UINO(ip, flags) do { \
|
||||
if (((flags) & IN_ACCESSED) && !((ip)->i_flag & IN_ACCESSED)) \
|
||||
lfs_sb_adduinodes((ip)->i_lfs, 1); \
|
||||
if (((flags) & IN_CLEANING) && !((ip)->i_flag & IN_CLEANING)) \
|
||||
lfs_sb_adduinodes((ip)->i_lfs, 1); \
|
||||
if (((flags) & IN_MODIFIED) && !((ip)->i_flag & IN_MODIFIED)) \
|
||||
lfs_sb_adduinodes((ip)->i_lfs, 1); \
|
||||
(ip)->i_flag |= (flags); \
|
||||
} while (0)
|
||||
|
||||
#define LFS_CLR_UINO(ip, flags) do { \
|
||||
if (((flags) & IN_ACCESSED) && ((ip)->i_flag & IN_ACCESSED)) \
|
||||
lfs_sb_subuinodes((ip)->i_lfs, 1); \
|
||||
if (((flags) & IN_CLEANING) && ((ip)->i_flag & IN_CLEANING)) \
|
||||
lfs_sb_subuinodes((ip)->i_lfs, 1); \
|
||||
if (((flags) & IN_MODIFIED) && ((ip)->i_flag & IN_MODIFIED)) \
|
||||
lfs_sb_subuinodes((ip)->i_lfs, 1); \
|
||||
(ip)->i_flag &= ~(flags); \
|
||||
if (lfs_sb_getuinodes((ip)->i_lfs) < 0) { \
|
||||
panic("lfs_uinodes < 0"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LFS_ITIMES(ip, acc, mod, cre) \
|
||||
while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
|
||||
lfs_itimes(ip, acc, mod, cre)
|
||||
|
||||
/*
|
||||
* On-disk and in-memory checkpoint segment usage structure.
|
||||
*/
|
||||
|
||||
#define SEGUPB(fs) (lfs_sb_getsepb(fs))
|
||||
#define SEGTABSIZE_SU(fs) \
|
||||
((lfs_sb_getnseg(fs) + SEGUPB(fs) - 1) / lfs_sb_getsepb(fs))
|
||||
|
||||
#ifdef _KERNEL
|
||||
# define SHARE_IFLOCK(F) \
|
||||
do { \
|
||||
rw_enter(&(F)->lfs_iflock, RW_READER); \
|
||||
} while(0)
|
||||
# define UNSHARE_IFLOCK(F) \
|
||||
do { \
|
||||
rw_exit(&(F)->lfs_iflock); \
|
||||
} while(0)
|
||||
#else /* ! _KERNEL */
|
||||
# define SHARE_IFLOCK(F)
|
||||
# define UNSHARE_IFLOCK(F)
|
||||
#endif /* ! _KERNEL */
|
||||
|
||||
/* Read in the block with a specific segment usage entry from the ifile. */
|
||||
#define LFS_SEGENTRY(SP, F, IN, BP) do { \
|
||||
int _e; \
|
||||
SHARE_IFLOCK(F); \
|
||||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if ((_e = bread((F)->lfs_ivnode, \
|
||||
((IN) / lfs_sb_getsepb(F)) + lfs_sb_getcleansz(F), \
|
||||
lfs_sb_getbsize(F), 0, &(BP))) != 0) \
|
||||
panic("lfs: ifile read: %d", _e); \
|
||||
if ((F)->lfs_version == 1) \
|
||||
(SP) = (SEGUSE *)((SEGUSE_V1 *)(BP)->b_data + \
|
||||
((IN) & (lfs_sb_getsepb(F) - 1))); \
|
||||
else \
|
||||
(SP) = (SEGUSE *)(BP)->b_data + ((IN) % lfs_sb_getsepb(F)); \
|
||||
UNSHARE_IFLOCK(F); \
|
||||
} while (0)
|
||||
|
||||
#define LFS_WRITESEGENTRY(SP, F, IN, BP) do { \
|
||||
if ((SP)->su_nbytes == 0) \
|
||||
(SP)->su_flags |= SEGUSE_EMPTY; \
|
||||
else \
|
||||
(SP)->su_flags &= ~SEGUSE_EMPTY; \
|
||||
(F)->lfs_suflags[(F)->lfs_activesb][(IN)] = (SP)->su_flags; \
|
||||
LFS_BWRITE_LOG(BP); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Index file inode entries.
|
||||
*/
|
||||
|
||||
/*
|
||||
* LFSv1 compatibility code is not allowed to touch if_atime, since it
|
||||
* may not be mapped!
|
||||
*/
|
||||
/* Read in the block with a specific inode from the ifile. */
|
||||
#define LFS_IENTRY(IP, F, IN, BP) do { \
|
||||
int _e; \
|
||||
SHARE_IFLOCK(F); \
|
||||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if ((_e = bread((F)->lfs_ivnode, \
|
||||
(IN) / lfs_sb_getifpb(F) + lfs_sb_getcleansz(F) + lfs_sb_getsegtabsz(F), \
|
||||
lfs_sb_getbsize(F), 0, &(BP))) != 0) \
|
||||
panic("lfs: ifile ino %d read %d", (int)(IN), _e); \
|
||||
if ((F)->lfs_version == 1) \
|
||||
(IP) = (IFILE *)((IFILE_V1 *)(BP)->b_data + \
|
||||
(IN) % lfs_sb_getifpb(F)); \
|
||||
else \
|
||||
(IP) = (IFILE *)(BP)->b_data + (IN) % lfs_sb_getifpb(F); \
|
||||
UNSHARE_IFLOCK(F); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Cleaner information structure. This resides in the ifile and is used
|
||||
* to pass information from the kernel to the cleaner.
|
||||
*/
|
||||
|
||||
#define CLEANSIZE_SU(fs) \
|
||||
((sizeof(CLEANERINFO) + lfs_sb_getbsize(fs) - 1) >> lfs_sb_getbshift(fs))
|
||||
|
||||
/* Read in the block with the cleaner info from the ifile. */
|
||||
#define LFS_CLEANERINFO(CP, F, BP) do { \
|
||||
SHARE_IFLOCK(F); \
|
||||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if (bread((F)->lfs_ivnode, \
|
||||
(daddr_t)0, lfs_sb_getbsize(F), 0, &(BP))) \
|
||||
panic("lfs: ifile read"); \
|
||||
(CP) = (CLEANERINFO *)(BP)->b_data; \
|
||||
UNSHARE_IFLOCK(F); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Synchronize the Ifile cleaner info with current avail and bfree.
|
||||
*/
|
||||
#define LFS_SYNC_CLEANERINFO(cip, fs, bp, w) do { \
|
||||
mutex_enter(&lfs_lock); \
|
||||
if ((w) || (cip)->bfree != lfs_sb_getbfree(fs) || \
|
||||
(cip)->avail != lfs_sb_getavail(fs) - fs->lfs_ravail - \
|
||||
fs->lfs_favail) { \
|
||||
(cip)->bfree = lfs_sb_getbfree(fs); \
|
||||
(cip)->avail = lfs_sb_getavail(fs) - fs->lfs_ravail - \
|
||||
fs->lfs_favail; \
|
||||
if (((bp)->b_flags & B_GATHERED) == 0) { \
|
||||
fs->lfs_flags |= LFS_IFDIRTY; \
|
||||
} \
|
||||
mutex_exit(&lfs_lock); \
|
||||
(void) LFS_BWRITE_LOG(bp); /* Ifile */ \
|
||||
} else { \
|
||||
mutex_exit(&lfs_lock); \
|
||||
brelse(bp, 0); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Get the head of the inode free list.
|
||||
* Always called with the segment lock held.
|
||||
*/
|
||||
#define LFS_GET_HEADFREE(FS, CIP, BP, FREEP) do { \
|
||||
if ((FS)->lfs_version > 1) { \
|
||||
LFS_CLEANERINFO((CIP), (FS), (BP)); \
|
||||
lfs_sb_setfreehd(FS, (CIP)->free_head); \
|
||||
brelse(BP, 0); \
|
||||
} \
|
||||
*(FREEP) = lfs_sb_getfreehd(FS); \
|
||||
} while (0)
|
||||
|
||||
#define LFS_PUT_HEADFREE(FS, CIP, BP, VAL) do { \
|
||||
lfs_sb_setfreehd(FS, VAL); \
|
||||
if ((FS)->lfs_version > 1) { \
|
||||
LFS_CLEANERINFO((CIP), (FS), (BP)); \
|
||||
(CIP)->free_head = (VAL); \
|
||||
LFS_BWRITE_LOG(BP); \
|
||||
mutex_enter(&lfs_lock); \
|
||||
(FS)->lfs_flags |= LFS_IFDIRTY; \
|
||||
mutex_exit(&lfs_lock); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LFS_GET_TAILFREE(FS, CIP, BP, FREEP) do { \
|
||||
LFS_CLEANERINFO((CIP), (FS), (BP)); \
|
||||
*(FREEP) = (CIP)->free_tail; \
|
||||
brelse(BP, 0); \
|
||||
} while (0)
|
||||
|
||||
#define LFS_PUT_TAILFREE(FS, CIP, BP, VAL) do { \
|
||||
LFS_CLEANERINFO((CIP), (FS), (BP)); \
|
||||
(CIP)->free_tail = (VAL); \
|
||||
LFS_BWRITE_LOG(BP); \
|
||||
mutex_enter(&lfs_lock); \
|
||||
(FS)->lfs_flags |= LFS_IFDIRTY; \
|
||||
mutex_exit(&lfs_lock); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* On-disk segment summary information
|
||||
*/
|
||||
|
||||
#define SEGSUM_SIZE(fs) ((fs)->lfs_version == 1 ? sizeof(SEGSUM_V1) : sizeof(SEGSUM))
|
||||
|
||||
/*
|
||||
* Super block.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generate accessors for the on-disk superblock fields with cpp.
|
||||
*
|
||||
* STRUCT_LFS is used by the libsa code to get accessors that work
|
||||
* with struct salfs instead of struct lfs.
|
||||
*/
|
||||
|
||||
#ifndef STRUCT_LFS
|
||||
#define STRUCT_LFS struct lfs
|
||||
#endif
|
||||
|
||||
#define LFS_DEF_SB_ACCESSOR(type, field) \
|
||||
static __unused inline type \
|
||||
lfs_sb_get##field(STRUCT_LFS *fs) \
|
||||
{ \
|
||||
return fs->lfs_dlfs.dlfs_##field; \
|
||||
} \
|
||||
static __unused inline void \
|
||||
lfs_sb_set##field(STRUCT_LFS *fs, type val) \
|
||||
{ \
|
||||
fs->lfs_dlfs.dlfs_##field = val; \
|
||||
} \
|
||||
static __unused inline void \
|
||||
lfs_sb_add##field(STRUCT_LFS *fs, type val) \
|
||||
{ \
|
||||
type *p = &fs->lfs_dlfs.dlfs_##field; \
|
||||
*p += val; \
|
||||
} \
|
||||
static __unused inline void \
|
||||
lfs_sb_sub##field(STRUCT_LFS *fs, type val) \
|
||||
{ \
|
||||
type *p = &fs->lfs_dlfs.dlfs_##field; \
|
||||
*p -= val; \
|
||||
}
|
||||
|
||||
#define lfs_magic lfs_dlfs.dlfs_magic
|
||||
#define lfs_version lfs_dlfs.dlfs_version
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, size);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ssize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, dsize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, bsize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, fsize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, frag);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, freehd);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, bfree);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nfiles);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, avail);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, uinodes);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, idaddr);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ifile);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, lastseg);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, nextseg);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, curseg);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, offset);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, lastpseg);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, inopf);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, minfree);
|
||||
LFS_DEF_SB_ACCESSOR(uint64_t, maxfilesize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, fsbpseg);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, inopb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ifpb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, sepb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nindir);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nseg);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nspf);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, cleansz);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, segtabsz);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, segmask);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, segshift);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, bmask);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, bshift);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, ffmask);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ffshift);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, fbmask);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, fbshift);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, blktodb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, fsbtodb);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, sushift);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, maxsymlinklen);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, cksum);
|
||||
LFS_DEF_SB_ACCESSOR(u_int16_t, pflags);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, nclean);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, dmeta);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, minfreeseg);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, sumsize);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, serial);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ibsize);
|
||||
LFS_DEF_SB_ACCESSOR(int32_t, s0addr);
|
||||
LFS_DEF_SB_ACCESSOR(u_int64_t, tstamp);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, inodefmt);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, interleave);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, ident);
|
||||
LFS_DEF_SB_ACCESSOR(u_int32_t, resvseg);
|
||||
|
||||
/* special-case accessors */
|
||||
|
||||
/*
|
||||
* the v1 otstamp field lives in what's now dlfs_inopf
|
||||
*/
|
||||
#define lfs_sb_getotstamp(fs) lfs_sb_getinopf(fs)
|
||||
#define lfs_sb_setotstamp(fs, val) lfs_sb_setinopf(fs, val)
|
||||
|
||||
/*
|
||||
* lfs_sboffs is an array
|
||||
*/
|
||||
static __unused inline int32_t
|
||||
lfs_sb_getsboff(struct lfs *fs, unsigned n)
|
||||
{
|
||||
#ifdef KASSERT /* ugh */
|
||||
KASSERT(n < LFS_MAXNUMSB);
|
||||
#endif
|
||||
return fs->lfs_dlfs.dlfs_sboffs[n];
|
||||
}
|
||||
static __unused inline void
|
||||
lfs_sb_setsboff(struct lfs *fs, unsigned n, int32_t val)
|
||||
{
|
||||
#ifdef KASSERT /* ugh */
|
||||
KASSERT(n < LFS_MAXNUMSB);
|
||||
#endif
|
||||
fs->lfs_dlfs.dlfs_sboffs[n] = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* lfs_fsmnt is a string
|
||||
*/
|
||||
static __unused inline const char *
|
||||
lfs_sb_getfsmnt(struct lfs *fs)
|
||||
{
|
||||
return fs->lfs_dlfs.dlfs_fsmnt;
|
||||
}
|
||||
|
||||
/* LFS_NINDIR is the number of indirects in a file system block. */
|
||||
#define LFS_NINDIR(fs) (lfs_sb_getnindir(fs))
|
||||
|
||||
/* LFS_INOPB is the number of inodes in a secondary storage block. */
|
||||
#define LFS_INOPB(fs) (lfs_sb_getinopb(fs))
|
||||
/* LFS_INOPF is the number of inodes in a fragment. */
|
||||
#define LFS_INOPF(fs) (lfs_sb_getinopf(fs))
|
||||
|
||||
#define lfs_blksize(fs, ip, lbn) \
|
||||
(((lbn) >= ULFS_NDADDR || (ip)->i_ffs1_size >= ((lbn) + 1) << lfs_sb_getbshift(fs)) \
|
||||
? lfs_sb_getbsize(fs) \
|
||||
: (lfs_fragroundup(fs, lfs_blkoff(fs, (ip)->i_ffs1_size))))
|
||||
#define lfs_blkoff(fs, loc) ((int)((loc) & lfs_sb_getbmask(fs)))
|
||||
#define lfs_fragoff(fs, loc) /* calculates (loc % fs->lfs_fsize) */ \
|
||||
((int)((loc) & lfs_sb_getffmask(fs)))
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#define LFS_FSBTODB(fs, b) ((b) << (lfs_sb_getffshift(fs) - DEV_BSHIFT))
|
||||
#define LFS_DBTOFSB(fs, b) ((b) >> (lfs_sb_getffshift(fs) - DEV_BSHIFT))
|
||||
#else
|
||||
#define LFS_FSBTODB(fs, b) ((b) << lfs_sb_getfsbtodb(fs))
|
||||
#define LFS_DBTOFSB(fs, b) ((b) >> lfs_sb_getfsbtodb(fs))
|
||||
#endif
|
||||
|
||||
#define lfs_lblkno(fs, loc) ((loc) >> lfs_sb_getbshift(fs))
|
||||
#define lfs_lblktosize(fs, blk) ((blk) << lfs_sb_getbshift(fs))
|
||||
|
||||
#define lfs_fsbtob(fs, b) ((b) << lfs_sb_getffshift(fs))
|
||||
#define lfs_btofsb(fs, b) ((b) >> lfs_sb_getffshift(fs))
|
||||
|
||||
#define lfs_numfrags(fs, loc) /* calculates (loc / fs->lfs_fsize) */ \
|
||||
((loc) >> lfs_sb_getffshift(fs))
|
||||
#define lfs_blkroundup(fs, size)/* calculates roundup(size, lfs_sb_getbsize(fs)) */ \
|
||||
((off_t)(((size) + lfs_sb_getbmask(fs)) & (~lfs_sb_getbmask(fs))))
|
||||
#define lfs_fragroundup(fs, size)/* calculates roundup(size, fs->lfs_fsize) */ \
|
||||
((off_t)(((size) + lfs_sb_getffmask(fs)) & (~lfs_sb_getffmask(fs))))
|
||||
#define lfs_fragstoblks(fs, frags)/* calculates (frags / fs->fs_frag) */ \
|
||||
((frags) >> lfs_sb_getfbshift(fs))
|
||||
#define lfs_blkstofrags(fs, blks)/* calculates (blks * fs->fs_frag) */ \
|
||||
((blks) << lfs_sb_getfbshift(fs))
|
||||
#define lfs_fragnum(fs, fsb) /* calculates (fsb % fs->lfs_frag) */ \
|
||||
((fsb) & ((fs)->lfs_frag - 1))
|
||||
#define lfs_blknum(fs, fsb) /* calculates rounddown(fsb, fs->lfs_frag) */ \
|
||||
((fsb) &~ ((fs)->lfs_frag - 1))
|
||||
#define lfs_dblksize(fs, dp, lbn) \
|
||||
(((lbn) >= ULFS_NDADDR || (dp)->di_size >= ((lbn) + 1) << lfs_sb_getbshift(fs)) \
|
||||
? lfs_sb_getbsize(fs) \
|
||||
: (lfs_fragroundup(fs, lfs_blkoff(fs, (dp)->di_size))))
|
||||
|
||||
#define lfs_segsize(fs) ((fs)->lfs_version == 1 ? \
|
||||
lfs_lblktosize((fs), lfs_sb_getssize(fs)) : \
|
||||
lfs_sb_getssize(fs))
|
||||
#define lfs_segtod(fs, seg) (((fs)->lfs_version == 1 ? \
|
||||
lfs_sb_getssize(fs) << lfs_sb_getblktodb(fs) : \
|
||||
lfs_btofsb((fs), lfs_sb_getssize(fs))) * (seg))
|
||||
#define lfs_dtosn(fs, daddr) /* block address to segment number */ \
|
||||
((uint32_t)(((daddr) - lfs_sb_gets0addr(fs)) / lfs_segtod((fs), 1)))
|
||||
#define lfs_sntod(fs, sn) /* segment number to disk address */ \
|
||||
((daddr_t)(lfs_segtod((fs), (sn)) + lfs_sb_gets0addr(fs)))
|
||||
|
||||
/*
|
||||
* Macros for determining free space on the disk, with the variable metadata
|
||||
* of segment summaries and inode blocks taken into account.
|
||||
*/
|
||||
/*
|
||||
* Estimate number of clean blocks not available for writing because
|
||||
* they will contain metadata or overhead. This is calculated as
|
||||
*
|
||||
* E = ((C * M / D) * D + (0) * (T - D)) / T
|
||||
* or more simply
|
||||
* E = (C * M) / T
|
||||
*
|
||||
* where
|
||||
* C is the clean space,
|
||||
* D is the dirty space,
|
||||
* M is the dirty metadata, and
|
||||
* T = C + D is the total space on disk.
|
||||
*
|
||||
* This approximates the old formula of E = C * M / D when D is close to T,
|
||||
* but avoids falsely reporting "disk full" when the sample size (D) is small.
|
||||
*/
|
||||
#define LFS_EST_CMETA(F) (int32_t)(( \
|
||||
(lfs_sb_getdmeta(F) * (int64_t)lfs_sb_getnclean(F)) / \
|
||||
(lfs_sb_getnseg(F))))
|
||||
|
||||
/* Estimate total size of the disk not including metadata */
|
||||
#define LFS_EST_NONMETA(F) (lfs_sb_getdsize(F) - lfs_sb_getdmeta(F) - LFS_EST_CMETA(F))
|
||||
|
||||
/* Estimate number of blocks actually available for writing */
|
||||
#define LFS_EST_BFREE(F) (lfs_sb_getbfree(F) > LFS_EST_CMETA(F) ? \
|
||||
lfs_sb_getbfree(F) - LFS_EST_CMETA(F) : 0)
|
||||
|
||||
/* Amount of non-meta space not available to mortal man */
|
||||
#define LFS_EST_RSVD(F) (int32_t)((LFS_EST_NONMETA(F) * \
|
||||
(u_int64_t)lfs_sb_getminfree(F)) / \
|
||||
100)
|
||||
|
||||
/* Can credential C write BB blocks */
|
||||
#define ISSPACE(F, BB, C) \
|
||||
((((C) == NOCRED || kauth_cred_geteuid(C) == 0) && \
|
||||
LFS_EST_BFREE(F) >= (BB)) || \
|
||||
(kauth_cred_geteuid(C) != 0 && IS_FREESPACE(F, BB)))
|
||||
|
||||
/* Can an ordinary user write BB blocks */
|
||||
#define IS_FREESPACE(F, BB) \
|
||||
(LFS_EST_BFREE(F) >= (BB) + LFS_EST_RSVD(F))
|
||||
|
||||
/*
|
||||
* The minimum number of blocks to create a new inode. This is:
|
||||
* directory direct block (1) + ULFS_NIADDR indirect blocks + inode block (1) +
|
||||
* ifile direct block (1) + ULFS_NIADDR indirect blocks = 3 + 2 * ULFS_NIADDR blocks.
|
||||
*/
|
||||
#define LFS_NRESERVE(F) (lfs_btofsb((F), (2 * ULFS_NIADDR + 3) << lfs_sb_getbshift(F)))
|
||||
|
||||
|
||||
|
||||
#endif /* _UFS_LFS_LFS_ACCESSORS_H_ */
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_alloc.c,v 1.123 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs_alloc.c,v 1.124 2015/07/28 05:09:34 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.123 2015/07/24 06:59:32 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.124 2015/07/28 05:09:34 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.123 2015/07/24 06:59:32 dholland Exp
|
||||
#include <ufs/lfs/ulfs_extern.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_balloc.c,v 1.83 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs_balloc.c,v 1.84 2015/07/28 05:09:34 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.83 2015/07/24 06:59:32 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.84 2015/07/28 05:09:34 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -85,6 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.83 2015/07/24 06:59:32 dholland Exp
|
||||
#include <ufs/lfs/ulfs_extern.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $ */
|
||||
/* $NetBSD: lfs_bio.c,v 1.132 2015/07/28 05:09:34 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.131 2015/07/25 10:40:35 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.132 2015/07/28 05:09:34 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -77,6 +77,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $")
|
||||
#include <ufs/lfs/ulfs_extern.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_debug.c,v 1.45 2015/07/25 13:01:06 hannken Exp $ */
|
||||
/* $NetBSD: lfs_debug.c,v 1.46 2015/07/28 05:09:34 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_debug.c,v 1.45 2015/07/25 13:01:06 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.46 2015/07/28 05:09:34 dholland Exp $");
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
@ -75,6 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.45 2015/07/25 13:01:06 hannken Exp $
|
||||
|
||||
#include <ufs/lfs/ulfs_inode.h>
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
int lfs_lognum;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_inode.c,v 1.139 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs_inode.c,v 1.140 2015/07/28 05:09:34 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.139 2015/07/24 06:59:32 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.140 2015/07/28 05:09:34 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -85,6 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.139 2015/07/24 06:59:32 dholland Exp
|
||||
#include <ufs/lfs/ulfs_extern.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_itimes.c,v 1.15 2013/06/08 02:16:03 dholland Exp $ */
|
||||
/* $NetBSD: lfs_itimes.c,v 1.16 2015/07/28 05:09:34 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -29,7 +29,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_itimes.c,v 1.15 2013/06/08 02:16:03 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_itimes.c,v 1.16 2015/07/28 05:09:34 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_itimes.c,v 1.15 2013/06/08 02:16:03 dholland Exp
|
||||
#endif
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_inode.h>
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $ */
|
||||
/* $NetBSD: lfs_pages.c,v 1.5 2015/07/28 05:09:34 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_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.5 2015/07/28 05:09:34 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -99,6 +99,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $")
|
||||
#include <uvm/uvm_pager.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_rfw.c,v 1.23 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs_rfw.c,v 1.24 2015/07/28 05:09:34 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.23 2015/07/24 06:59:32 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.24 2015/07/28 05:09:34 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.23 2015/07/24 06:59:32 dholland Exp $"
|
||||
#include <uvm/uvm_pdaemon.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_segment.c,v 1.244 2015/07/25 10:40:35 martin Exp $ */
|
||||
/* $NetBSD: lfs_segment.c,v 1.245 2015/07/28 05:09:35 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.244 2015/07/25 10:40:35 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.245 2015/07/28 05:09:35 dholland Exp $");
|
||||
|
||||
#define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */
|
||||
|
||||
@ -102,6 +102,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.244 2015/07/25 10:40:35 martin Exp
|
||||
#include <ufs/lfs/ulfs_extern.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_subr.c,v 1.83 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs_subr.c,v 1.84 2015/07/28 05:09:35 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.83 2015/07/24 06:59:32 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.84 2015/07/28 05:09:35 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.83 2015/07/24 06:59:32 dholland Exp $
|
||||
|
||||
#include <ufs/lfs/ulfs_inode.h>
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.162 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.163 2015/07/28 05:09:35 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.162 2015/07/24 06:59:32 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.163 2015/07/28 05:09:35 dholland Exp $");
|
||||
|
||||
#ifndef LFS
|
||||
# define LFS /* for prototypes in syscallargs.h */
|
||||
@ -82,6 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.162 2015/07/24 06:59:32 dholland
|
||||
#include <ufs/lfs/ulfs_extern.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.328 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.329 2015/07/28 05:09:35 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.328 2015/07/24 06:59:32 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.329 2015/07/28 05:09:35 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_lfs.h"
|
||||
@ -110,6 +110,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.328 2015/07/24 06:59:32 dholland Ex
|
||||
#include <uvm/uvm_pdaemon.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vnops.c,v 1.277 2015/07/26 08:13:23 hannken Exp $ */
|
||||
/* $NetBSD: lfs_vnops.c,v 1.278 2015/07/28 05:09:35 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -125,7 +125,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.277 2015/07/26 08:13:23 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.278 2015/07/28 05:09:35 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -164,6 +164,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.277 2015/07/26 08:13:23 hannken Exp
|
||||
#include <uvm/uvm_pager.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_kernel.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ulfs_quota2.c,v 1.20 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: ulfs_quota2.c,v 1.21 2015/07/28 05:09:35 dholland Exp $ */
|
||||
/* from NetBSD: ufs_quota2.c,v 1.35 2012/09/27 07:47:56 bouyer Exp */
|
||||
/* from NetBSD: ffs_quota2.c,v 1.4 2011/06/12 03:36:00 rmind Exp */
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota2.c,v 1.20 2015/07/24 06:59:32 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota2.c,v 1.21 2015/07/28 05:09:35 dholland Exp $");
|
||||
|
||||
#include <sys/buf.h>
|
||||
#include <sys/param.h>
|
||||
@ -46,6 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_quota2.c,v 1.20 2015/07/24 06:59:32 dholland Ex
|
||||
#include <sys/quota.h>
|
||||
#include <sys/quotactl.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
#include <ufs/lfs/ulfs_quota2.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dumplfs.c,v 1.44 2015/07/24 06:59:32 dholland Exp $ */
|
||||
/* $NetBSD: dumplfs.c,v 1.45 2015/07/28 05:09:35 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dumplfs.c 8.5 (Berkeley) 5/24/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: dumplfs.c,v 1.44 2015/07/24 06:59:32 dholland Exp $");
|
||||
__RCSID("$NetBSD: dumplfs.c,v 1.45 2015/07/28 05:09:35 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -50,6 +50,7 @@ __RCSID("$NetBSD: dumplfs.c,v 1.44 2015/07/24 06:59:32 dholland Exp $");
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ufs/lfs/lfs.h>
|
||||
#include <ufs/lfs/lfs_accessors.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
Loading…
Reference in New Issue
Block a user