Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa Rearrange the structures in the lfs bootbolloc...
details: https://anonhg.NetBSD.org/src/rev/9db04d04ca61
branches: trunk
changeset: 339476:9db04d04ca61
user: dholland <dholland%NetBSD.org@localhost>
date: Fri Jul 24 06:53:24 2015 +0000
description:
Rearrange the structures in the lfs bootbollocks slightly.
This generates the same output (at least on amd64) but will be more
robust until we're ready to deploy lfs64 bootblocks too.
XXX: I don't think these actually work right now, and the logic for
picking between v1 and v2 lfs formats (which is not related to ffsv1
vs. ffsv2) is definitely broken. But I haven't made it any worse.
diffstat:
sys/lib/libsa/lfsv1.c | 6 ++--
sys/lib/libsa/lfsv2.c | 6 ++--
sys/lib/libsa/ufs.c | 61 +++++++++++++++++++++++++++++++++++---------------
3 files changed, 48 insertions(+), 25 deletions(-)
diffs (204 lines):
diff -r 99a6aa9f343b -r 9db04d04ca61 sys/lib/libsa/lfsv1.c
--- a/sys/lib/libsa/lfsv1.c Fri Jul 24 06:51:46 2015 +0000
+++ b/sys/lib/libsa/lfsv1.c Fri Jul 24 06:53:24 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfsv1.c,v 1.9 2013/06/23 07:28:36 dholland Exp $ */
+/* $NetBSD: lfsv1.c,v 1.10 2015/07/24 06:53:24 dholland Exp $ */
#define LIBSA_LFS
#define REQUIRED_LFS_VERSION 1
@@ -15,12 +15,12 @@
#define ufs_dinode ulfs1_dinode
-#define fs_bsize lfs_ibsize
+#define fs_bsize dlfs_ibsize
#define IFILE_Vx IFILE_V1
#define INOPBx(fs) LFS_INOPB(fs)
-#define UFS_NINDIR LFS_NINDIR
+#define UFS_NINDIR(fs) ((fs)->dlfs_nindir)
#define ufs_blkoff(a, b) lfs_blkoff((a), (b))
#define ufs_lblkno(a, b) lfs_lblkno((a), (b))
#define dblksize(a, b, c) lfs_dblksize((a), (b), (c))
diff -r 99a6aa9f343b -r 9db04d04ca61 sys/lib/libsa/lfsv2.c
--- a/sys/lib/libsa/lfsv2.c Fri Jul 24 06:51:46 2015 +0000
+++ b/sys/lib/libsa/lfsv2.c Fri Jul 24 06:53:24 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfsv2.c,v 1.9 2013/06/23 07:28:36 dholland Exp $ */
+/* $NetBSD: lfsv2.c,v 1.10 2015/07/24 06:53:24 dholland Exp $ */
#define LIBSA_LFS
#define REQUIRED_LFS_VERSION 2
@@ -16,7 +16,7 @@
/* XXX wrong! but for now it won't build with ulfs2_dinode */
#define ufs_dinode ulfs1_dinode
-#define fs_bsize lfs_bsize
+#define fs_bsize dlfs_bsize
#define IFILE_Vx IFILE
#ifdef LFS_IFILE_FRAG_ADDRESSING /* XXX see sys/ufs/lfs/ -- not tested */
@@ -25,7 +25,7 @@
#define INOPBx(fs) LFS_INOPB(fs)
#endif
-#define UFS_NINDIR LFS_NINDIR
+#define UFS_NINDIR(fs) ((fs)->dlfs_nindir)
#define ufs_blkoff(a, b) lfs_blkoff((a), (b))
#define ufs_lblkno(a, b) lfs_lblkno((a), (b))
#define dblksize(a, b, c) lfs_dblksize((a), (b), (c))
diff -r 99a6aa9f343b -r 9db04d04ca61 sys/lib/libsa/ufs.c
--- a/sys/lib/libsa/ufs.c Fri Jul 24 06:51:46 2015 +0000
+++ b/sys/lib/libsa/ufs.c Fri Jul 24 06:53:24 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs.c,v 1.65 2014/03/20 03:13:18 christos Exp $ */
+/* $NetBSD: ufs.c,v 1.66 2015/07/24 06:53:24 dholland Exp $ */
/*-
* Copyright (c) 1993
@@ -101,19 +101,42 @@
#ifdef LIBSA_LFS
/*
- * In-core LFS superblock. This exists only to placate the macros in lfs.h,
+ * In-core LFS superblock - just the on-disk one.
*/
-struct fs {
- struct dlfs lfs_dlfs;
-};
-#define fs_magic lfs_magic
-#define fs_maxsymlinklen lfs_maxsymlinklen
+typedef struct dlfs FS;
+#define fs_magic dlfs_magic
+#define fs_maxsymlinklen dlfs_maxsymlinklen
+
+/* XXX these will go away in the near future */
+#undef lfs_bmask
+#define lfs_bmask dlfs_bmask
+#undef lfs_ifile
+#define lfs_ifile dlfs_ifile
+#undef lfs_ifpb
+#define lfs_ifpb dlfs_ifpb
+#undef lfs_cleansz
+#define lfs_cleansz dlfs_cleansz
+#undef lfs_segtabsz
+#define lfs_segtabsz dlfs_segtabsz
+#undef lfs_idaddr
+#define lfs_idaddr dlfs_idaddr
+#undef lfs_inopb
+#define lfs_inopb dlfs_inopb
+#undef lfs_bshift
+#define lfs_bshift dlfs_bshift
+#undef lfs_bsize
+#define lfs_bsize dlfs_bsize
+#undef lfs_ffmask
+#define lfs_ffmask dlfs_ffmask
+#undef lfs_fsbtodb
+#define lfs_fsbtodb dlfs_fsbtodb
#define FS_MAGIC LFS_MAGIC
#define SBLOCKSIZE LFS_SBPAD
#define SBLOCKOFFSET LFS_LABELPAD
#else
-/* NB ufs2 doesn't use the common suberblock code... */
+/* NB ufs2 doesn't use the common superblock code... */
+typedef struct fs FS;
#define FS_MAGIC FS_UFS1_MAGIC
#define SBLOCKOFFSET SBLOCK_UFS1
#endif
@@ -167,7 +190,7 @@
*/
struct file {
off_t f_seekp; /* seek pointer */
- struct fs *f_fs; /* pointer to super-block */
+ FS *f_fs; /* pointer to super-block */
struct ufs_dinode f_di; /* copy of on-disk inode */
uint f_nishift; /* for blocks in indirect block */
indp_t f_ind_cache_block;
@@ -183,10 +206,10 @@
static int buf_read_file(struct open_file *, char **, size_t *);
static int search_directory(const char *, int, struct open_file *, ino32_t *);
#ifdef LIBSA_FFSv1
-static void ffs_oldfscompat(struct fs *);
+static void ffs_oldfscompat(FS *);
#endif
#ifdef LIBSA_FFSv2
-static int ffs_find_superblock(struct open_file *, struct fs *);
+static int ffs_find_superblock(struct open_file *, FS *);
#endif
@@ -198,7 +221,7 @@
find_inode_sector(ino32_t inumber, struct open_file *f, daddr_t *isp)
{
struct file *fp = (struct file *)f->f_fsdata;
- struct fs *fs = fp->f_fs;
+ FS *fs = fp->f_fs;
daddr_t ifileent_blkno;
char *ent_in_buf;
size_t buf_after_ent;
@@ -233,7 +256,7 @@
read_inode(ino32_t inumber, struct open_file *f)
{
struct file *fp = (struct file *)f->f_fsdata;
- struct fs *fs = fp->f_fs;
+ FS *fs = fp->f_fs;
char *buf;
size_t rsize;
int rc;
@@ -293,7 +316,7 @@
block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
{
struct file *fp = (struct file *)f->f_fsdata;
- struct fs *fs = fp->f_fs;
+ FS *fs = fp->f_fs;
uint level;
indp_t ind_cache;
indp_t ind_block_num;
@@ -395,7 +418,7 @@
buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
{
struct file *fp = (struct file *)f->f_fsdata;
- struct fs *fs = fp->f_fs;
+ FS *fs = fp->f_fs;
long off;
indp_t file_block;
size_t block_size;
@@ -499,7 +522,7 @@
daddr_t sblock_try[] = SBLOCKSEARCH;
static int
-ffs_find_superblock(struct open_file *f, struct fs *fs)
+ffs_find_superblock(struct open_file *f, FS *fs)
{
int i, rc;
size_t buf_size;
@@ -533,7 +556,7 @@
#endif
ino32_t inumber;
struct file *fp;
- struct fs *fs;
+ FS *fs;
int rc;
#ifndef LIBSA_NO_FS_SYMLINK
ino32_t parent_inumber;
@@ -587,7 +610,7 @@
#endif
if (fs->fs_bsize > MAXBSIZE ||
- (size_t)fs->fs_bsize < sizeof(struct fs)) {
+ (size_t)fs->fs_bsize < sizeof(FS)) {
rc = EINVAL;
goto out;
}
@@ -940,7 +963,7 @@
* Stripped of stuff libsa doesn't need.....
*/
static void
-ffs_oldfscompat(struct fs *fs)
+ffs_oldfscompat(FS *fs)
{
#ifdef COMPAT_UFS
Home |
Main Index |
Thread Index |
Old Index