Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/lfs Move stuff to lfs.h that's needed by userland:
details: https://anonhg.NetBSD.org/src/rev/c7f5f3a285fe
branches: trunk
changeset: 787243:c7f5f3a285fe
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Jun 08 02:13:33 2013 +0000
description:
Move stuff to lfs.h that's needed by userland:
LFS_DT_*
ULFS_ROOTINO
ULFS_WINO
struct lfs_direct
struct lfs_dirtemplate
struct lfs_odirtemplate
struct ulfs_args
Also fix FFS_MAXNAMLEN -> LFS_MAXNAMLEN in several places.
diffstat:
sys/ufs/lfs/lfs.h | 84 +++++++++++++++++++++++++++++++++++++++++++++-
sys/ufs/lfs/ulfs_dinode.h | 18 +---------
sys/ufs/lfs/ulfs_dir.h | 59 +------------------------------
sys/ufs/lfs/ulfs_dirhash.h | 4 +-
sys/ufs/lfs/ulfs_lookup.c | 8 ++--
sys/ufs/lfs/ulfsmount.h | 9 +----
6 files changed, 94 insertions(+), 88 deletions(-)
diffs (truncated from 313 to 300 lines):
diff -r ca15484a80f6 -r c7f5f3a285fe sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Sat Jun 08 02:12:56 2013 +0000
+++ b/sys/ufs/lfs/lfs.h Sat Jun 08 02:13:33 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.h,v 1.144 2013/06/08 02:11:49 dholland Exp $ */
+/* $NetBSD: lfs.h,v 1.145 2013/06/08 02:13:33 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -88,6 +88,23 @@
#define LFS_LOSTFOUNDINO 3 /* 3: lost+found inode number */
#define LFS_FIRST_INUM 4 /* 4: first free inode number */
+/*
+ * The root inode is the root of the file system. Inode 0 can't be used for
+ * normal purposes and historically bad blocks were linked to inode 1, thus
+ * the root inode is 2. (Inode 1 is no longer used for this purpose, however
+ * numerous dump tapes make this assumption, so we are stuck with it).
+ */
+#define ULFS_ROOTINO ((ino_t)2)
+
+/*
+ * The Whiteout inode# is a dummy non-zero inode number which will
+ * never be allocated to a real file. It is used as a place holder
+ * in the directory entry which has been tagged as a LFS_DT_WHT entry.
+ * See the comments about ULFS_ROOTINO above.
+ */
+#define ULFS_WINO ((ino_t)1)
+
+
#define LFS_V1_SUMMARY_SIZE 512 /* V1 fixed summary size */
#define LFS_DFL_SUMMARY_SIZE 512 /* Default summary size */
@@ -193,6 +210,64 @@
#define lfs_doff_t int32_t
#define MAXDIRSIZE (0x7fffffff)
+#define LFS_MAXNAMLEN 255
+
+/*
+ * File types for d_type
+ */
+#define LFS_DT_UNKNOWN 0
+#define LFS_DT_FIFO 1
+#define LFS_DT_CHR 2
+#define LFS_DT_DIR 4
+#define LFS_DT_BLK 6
+#define LFS_DT_REG 8
+#define LFS_DT_LNK 10
+#define LFS_DT_SOCK 12
+#define LFS_DT_WHT 14
+
+/*
+ * (See notes in ulfs_dir.h)
+ */
+#define d_ino d_fileno
+struct lfs_direct {
+ u_int32_t d_fileno; /* inode number of entry */
+ u_int16_t d_reclen; /* length of this record */
+ u_int8_t d_type; /* file type, see below */
+ u_int8_t d_namlen; /* length of string in d_name */
+ char d_name[LFS_MAXNAMLEN + 1];/* name with length <= LFS_MAXNAMLEN */
+};
+
+/*
+ * Template for manipulating directories. Should use struct lfs_direct's,
+ * but the name field is LFS_MAXNAMLEN - 1, and this just won't do.
+ */
+struct lfs_dirtemplate {
+ u_int32_t dot_ino;
+ int16_t dot_reclen;
+ u_int8_t dot_type;
+ u_int8_t dot_namlen;
+ char dot_name[4]; /* must be multiple of 4 */
+ u_int32_t dotdot_ino;
+ int16_t dotdot_reclen;
+ u_int8_t dotdot_type;
+ u_int8_t dotdot_namlen;
+ char dotdot_name[4]; /* ditto */
+};
+
+/*
+ * This is the old format of directories, sans type element.
+ */
+struct lfs_odirtemplate {
+ u_int32_t dot_ino;
+ int16_t dot_reclen;
+ u_int16_t dot_namlen;
+ char dot_name[4]; /* must be multiple of 4 */
+ u_int32_t dotdot_ino;
+ int16_t dotdot_reclen;
+ u_int16_t dotdot_namlen;
+ char dotdot_name[4]; /* ditto */
+};
+
/*
* Inodes
*/
@@ -1288,6 +1363,13 @@
# define ASSERT_MAYBE_SEGLOCK(x)
#endif /* !notyet */
+/*
+ * Arguments to mount LFS filesystems
+ */
+struct ulfs_args {
+ char *fspec; /* block special device to mount */
+};
+
__BEGIN_DECLS
void lfs_itimes(struct inode *, const struct timespec *,
const struct timespec *, const struct timespec *);
diff -r ca15484a80f6 -r c7f5f3a285fe sys/ufs/lfs/ulfs_dinode.h
--- a/sys/ufs/lfs/ulfs_dinode.h Sat Jun 08 02:12:56 2013 +0000
+++ b/sys/ufs/lfs/ulfs_dinode.h Sat Jun 08 02:13:33 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulfs_dinode.h,v 1.8 2013/06/08 02:12:56 dholland Exp $ */
+/* $NetBSD: ulfs_dinode.h,v 1.9 2013/06/08 02:13:33 dholland Exp $ */
/* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */
/*
@@ -56,22 +56,6 @@
#include <ufs/lfs/lfs.h>
/*
- * The root inode is the root of the file system. Inode 0 can't be used for
- * normal purposes and historically bad blocks were linked to inode 1, thus
- * the root inode is 2. (Inode 1 is no longer used for this purpose, however
- * numerous dump tapes make this assumption, so we are stuck with it).
- */
-#define ULFS_ROOTINO ((ino_t)2)
-
-/*
- * The Whiteout inode# is a dummy non-zero inode number which will
- * never be allocated to a real file. It is used as a place holder
- * in the directory entry which has been tagged as a LFS_DT_WHT entry.
- * See the comments about ULFS_ROOTINO above.
- */
-#define ULFS_WINO ((ino_t)1)
-
-/*
* Maximum length of a symlink that can be stored within the inode.
*/
#define ULFS1_MAXSYMLINKLEN ((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int32_t))
diff -r ca15484a80f6 -r c7f5f3a285fe sys/ufs/lfs/ulfs_dir.h
--- a/sys/ufs/lfs/ulfs_dir.h Sat Jun 08 02:12:56 2013 +0000
+++ b/sys/ufs/lfs/ulfs_dir.h Sat Jun 08 02:13:33 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulfs_dir.h,v 1.5 2013/06/08 02:12:56 dholland Exp $ */
+/* $NetBSD: ulfs_dir.h,v 1.6 2013/06/08 02:13:33 dholland Exp $ */
/* from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp */
/*
@@ -51,7 +51,7 @@
* the length of the entry, and the length of the name contained in
* the entry. These are followed by the name padded to a 4 byte boundary.
* All names are guaranteed null terminated.
- * The maximum length of a name in a directory is FFS_MAXNAMLEN.
+ * The maximum length of a name in a directory is LFS_MAXNAMLEN.
*
* The macro DIRSIZ(fmt, dp) gives the amount of space required to represent
* a directory entry. Free space in a directory is represented by
@@ -67,29 +67,6 @@
*/
#undef DIRBLKSIZ
#define DIRBLKSIZ DEV_BSIZE
-#define FFS_MAXNAMLEN 255
-
-#define d_ino d_fileno
-struct lfs_direct {
- u_int32_t d_fileno; /* inode number of entry */
- u_int16_t d_reclen; /* length of this record */
- u_int8_t d_type; /* file type, see below */
- u_int8_t d_namlen; /* length of string in d_name */
- char d_name[FFS_MAXNAMLEN + 1];/* name with length <= FFS_MAXNAMLEN */
-};
-
-/*
- * File types
- */
-#define LFS_DT_UNKNOWN 0
-#define LFS_DT_FIFO 1
-#define LFS_DT_CHR 2
-#define LFS_DT_DIR 4
-#define LFS_DT_BLK 6
-#define LFS_DT_REG 8
-#define LFS_DT_LNK 10
-#define LFS_DT_SOCK 12
-#define LFS_DT_WHT 14
/*
* Convert between stat structure types and directory types.
@@ -104,7 +81,7 @@
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
*/
#define DIRECTSIZ(namlen) \
- ((sizeof(struct lfs_direct) - (FFS_MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3))
+ ((sizeof(struct lfs_direct) - (LFS_MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3))
#if (BYTE_ORDER == LITTLE_ENDIAN)
#define DIRSIZ(oldfmt, dp, needswap) \
@@ -119,34 +96,4 @@
#define OLDDIRFMT 1
#define NEWDIRFMT 0
-/*
- * Template for manipulating directories. Should use struct direct's,
- * but the name field is FFS_MAXNAMLEN - 1, and this just won't do.
- */
-struct lfs_dirtemplate {
- u_int32_t dot_ino;
- int16_t dot_reclen;
- u_int8_t dot_type;
- u_int8_t dot_namlen;
- char dot_name[4]; /* must be multiple of 4 */
- u_int32_t dotdot_ino;
- int16_t dotdot_reclen;
- u_int8_t dotdot_type;
- u_int8_t dotdot_namlen;
- char dotdot_name[4]; /* ditto */
-};
-
-/*
- * This is the old format of directories, sanz type element.
- */
-struct lfs_odirtemplate {
- u_int32_t dot_ino;
- int16_t dot_reclen;
- u_int16_t dot_namlen;
- char dot_name[4]; /* must be multiple of 4 */
- u_int32_t dotdot_ino;
- int16_t dotdot_reclen;
- u_int16_t dotdot_namlen;
- char dotdot_name[4]; /* ditto */
-};
#endif /* !_UFS_LFS_ULFS_DIR_H_ */
diff -r ca15484a80f6 -r c7f5f3a285fe sys/ufs/lfs/ulfs_dirhash.h
--- a/sys/ufs/lfs/ulfs_dirhash.h Sat Jun 08 02:12:56 2013 +0000
+++ b/sys/ufs/lfs/ulfs_dirhash.h Sat Jun 08 02:13:33 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulfs_dirhash.h,v 1.3 2013/06/08 02:12:56 dholland Exp $ */
+/* $NetBSD: ulfs_dirhash.h,v 1.4 2013/06/08 02:13:33 dholland Exp $ */
/* from NetBSD: dirhash.h,v 1.6 2008/06/04 11:33:19 ad Exp */
/*
@@ -48,7 +48,7 @@
#define DIRHASH_DEL (-2) /* deleted entry; may be part of chain */
#define DIRALIGN 4
-#define DH_NFSTATS (DIRECTSIZ(FFS_MAXNAMLEN + 1) / DIRALIGN)
+#define DH_NFSTATS (DIRECTSIZ(LFS_MAXNAMLEN + 1) / DIRALIGN)
/* max DIRALIGN words in a directory entry */
/*
diff -r ca15484a80f6 -r c7f5f3a285fe sys/ufs/lfs/ulfs_lookup.c
--- a/sys/ufs/lfs/ulfs_lookup.c Sat Jun 08 02:12:56 2013 +0000
+++ b/sys/ufs/lfs/ulfs_lookup.c Sat Jun 08 02:13:33 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulfs_lookup.c,v 1.7 2013/06/08 02:12:56 dholland Exp $ */
+/* $NetBSD: ulfs_lookup.c,v 1.8 2013/06/08 02:13:33 dholland Exp $ */
/* from NetBSD: ufs_lookup.c,v 1.122 2013/01/22 09:39:18 dholland Exp */
/*
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.7 2013/06/08 02:12:56 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.8 2013/06/08 02:13:33 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_lfs.h"
@@ -707,7 +707,7 @@
* record length must be multiple of 4
* entry must fit in rest of its DIRBLKSIZ block
* record must be large enough to contain entry
- * name is not longer than FFS_MAXNAMLEN
+ * name is not longer than LFS_MAXNAMLEN
* name must be as long as advertised, and null terminated
*/
int
@@ -735,7 +735,7 @@
dirblksiz - (entryoffsetinblock & (dirblksiz - 1)) ||
ulfs_rw16(ep->d_reclen, needswap) <
DIRSIZ(FSFMT(dp), ep, needswap) ||
- namlen > FFS_MAXNAMLEN) {
+ namlen > LFS_MAXNAMLEN) {
/*return (1); */
printf("First bad, reclen=%#x, DIRSIZ=%lu, namlen=%d, "
"flags=%#x, entryoffsetinblock=%d, dirblksiz = %d\n",
diff -r ca15484a80f6 -r c7f5f3a285fe sys/ufs/lfs/ulfsmount.h
--- a/sys/ufs/lfs/ulfsmount.h Sat Jun 08 02:12:56 2013 +0000
+++ b/sys/ufs/lfs/ulfsmount.h Sat Jun 08 02:13:33 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulfsmount.h,v 1.6 2013/06/06 01:25:25 dholland Exp $ */
+/* $NetBSD: ulfsmount.h,v 1.7 2013/06/08 02:13:33 dholland Exp $ */
/* from NetBSD: ufsmount.h,v 1.39 2012/10/19 17:09:08 drochner Exp */
/*
@@ -37,13 +37,6 @@
Home |
Main Index |
Thread Index |
Old Index