Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Oct 2002 03:53:45 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Takahashi Yoshihiro <nyan@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/boot/pc98/boot2 Makefile boot.c boot.h     dinode.h disk.c fs.h inode.h quota.h
Message-ID:  <20021004034612.L4976-100000@gamplex.bde.org>
In-Reply-To: <200210031620.g93GKFgD004296@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 3 Oct 2002, Takahashi Yoshihiro wrote:

> nyan        2002/10/03 09:20:15 PDT
>
>   Modified files:
>     sys/boot/pc98/boot2  Makefile boot.c boot.h disk.c
>   Added files:
>     sys/boot/pc98/boot2  dinode.h fs.h inode.h quota.h
>   Log:
>   Added some header files from -stable and fixed the boot[12] programs.
>
>   Revision  Changes    Path
>   1.11      +14 -2     src/sys/boot/pc98/boot2/Makefile
>   1.9       +1 -2      src/sys/boot/pc98/boot2/boot.c
>   1.5       +7 -4      src/sys/boot/pc98/boot2/boot.h
>   1.1       +130 -0    src/sys/boot/pc98/boot2/dinode.h (new)
>   1.6       +1 -0      src/sys/boot/pc98/boot2/disk.c
>   1.1       +555 -0    src/sys/boot/pc98/boot2/fs.h (new)
>   1.1       +165 -0    src/sys/boot/pc98/boot2/inode.h (new)
>   1.1       +205 -0    src/sys/boot/pc98/boot2/quota.h (new)

I used a few lines of hacks to "fix" this problem in biosboot (I don't
like the new boot programs and don't use them).  This doesn't provide
ufs2 support.

The following patches may be slightly incomplete or change too much.
(They are missing at least -DBOOTBLOCKS in the Makefile, and I think
the last 2 hunks in the patch for sys.c are redundant.)

%%%
Index: sys.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/boot/biosboot/Attic/sys.c,v
retrieving revision 1.22
diff -u -2 -r1.22 sys.c
--- sys.c	28 Aug 1999 00:43:14 -0000	1.22
+++ sys.c	2 Sep 2002 14:31:38 -0000
@@ -29,12 +29,46 @@

 #include "boot.h"
+#include <sys/disklabel.h>
+#include <sys/diskslice.h>
 #include <sys/dirent.h>
 #include <sys/reboot.h>

+/* XXX use some ufs1 macros since the ufs1+ufs2 macros are too large. */
+#undef cgstart
+#define	cgstart(fs, c)							\
+       (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))
+#undef ino_to_fsba
+#define	ino_to_fsba(fs, x)						\
+	((ufs1_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) +			\
+	    (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))
+
+/*
+ * XXX^2 use some ufs1 macros since initializing the ufs1+ufs2 fields would be
+ * too large.
+ */
+#define	i_atime		i_din.di_atime
+#define	i_atimensec	i_din.di_atimensec
+#define	i_blocks	i_din.di_blocks
+#define	i_ctime		i_din.di_ctime
+#define	i_ctimensec	i_din.di_ctimensec
+#define	i_db		i_din.di_db
+#define	i_flags		i_din.di_flags
+#define	i_gen		i_din.di_gen
+#define	i_gid		i_din.di_gid
+#define	i_ib		i_din.di_ib
+#define	i_mode		i_din.di_mode
+#define	i_mtime		i_din.di_mtime
+#define	i_mtimensec	i_din.di_mtimensec
+#define	i_nlink		i_din.di_nlink
+#define	i_rdev		i_din.di_rdev
+#define	i_shortlink	i_din.di_shortlink
+#define	i_size		i_din.di_size
+#define	i_uid		i_din.di_uid
+
 #if 0
 /* #define BUFSIZE 4096 */
 #define BUFSIZE MAXBSIZE

-static char buf[BUFSIZE], fsbuf[SBSIZE], iobuf[MAXBSIZE];
+static char buf[BUFSIZE], fsbuf[SBLOCKSIZE], iobuf[MAXBSIZE];
 #endif

@@ -145,7 +179,7 @@
 loop:
 	devread(iobuf, fsbtodb(fs, ino_to_fsba(fs, ino)) + boff, fs->fs_bsize);
-	bcopy((void *)&((struct dinode *)iobuf)[ino % fs->fs_inopb],
+	bcopy((void *)&((struct ufs1_dinode *)iobuf)[ino % fs->fs_inopb],
 	      (void *)&inode.i_din,
-	      sizeof (struct dinode));
+	      sizeof(struct ufs1_dinode));
 	if (!*path)
 		return 1;
@@ -187,6 +221,6 @@
 	int bnum;
 	if (file_block < NDADDR)
-		return(inode.i_db[file_block]);
-	if ((bnum=fsbtodb(fs, inode.i_ib[0])+boff) != mapblock) {
+		return(inode.i_din.di_db[file_block]);
+	if ((bnum=fsbtodb(fs, inode.i_din.di_ib[0])+boff) != mapblock) {
 		devread(mapbuf, bnum, fs->fs_bsize);
 		mapblock = bnum;
Index: inode.h
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ufs/inode.h,v
retrieving revision 1.40
diff -u -2 -r1.40 inode.h
--- inode.h	27 Sep 2002 20:03:05 -0000	1.40
+++ inode.h	28 Sep 2002 11:15:14 -0000
@@ -108,8 +107,12 @@
 	 * The real copy of the on-disk inode.
 	 */
+#ifdef BOOTBLOCKS
+	struct ufs1_dinode i_din;
+#else
 	union {
 		struct ufs1_dinode *din1;	/* UFS1 on-disk dinode. */
 		struct ufs2_dinode *din2;	/* UFS2 on-disk dinode. */
 	} dinode_u;
+#endif
 };
 /*
%%%

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021004034612.L4976-100000>