Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Aug 2011 00:25:16 +0000 (UTC)
From:      Matthew D Fleming <mdf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r225099 - in projects/ino64/sys/boot: arm/at91/boot2 arm/ixp425/boot2 common i386/boot2 i386/gptboot pc98/boot2 powerpc/boot1.chrp sparc64/boot1
Message-ID:  <201108230025.p7N0PGFd076829@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mdf
Date: Tue Aug 23 00:25:15 2011
New Revision: 225099
URL: http://svn.freebsd.org/changeset/base/225099

Log:
  boot: Use 32 bit ufs_ino_t to keep boot2 small and prevent 64-bit math
  on 32-bit machines.
  
  GSoC r222839.
  Code by Gleb Kurtsou.

Modified:
  projects/ino64/sys/boot/arm/at91/boot2/boot2.c
  projects/ino64/sys/boot/arm/ixp425/boot2/boot2.c
  projects/ino64/sys/boot/common/ufsread.c
  projects/ino64/sys/boot/i386/boot2/boot2.c
  projects/ino64/sys/boot/i386/gptboot/gptboot.c
  projects/ino64/sys/boot/pc98/boot2/boot2.c
  projects/ino64/sys/boot/powerpc/boot1.chrp/boot1.c
  projects/ino64/sys/boot/sparc64/boot1/boot1.c

Modified: projects/ino64/sys/boot/arm/at91/boot2/boot2.c
==============================================================================
--- projects/ino64/sys/boot/arm/at91/boot2/boot2.c	Tue Aug 23 00:12:24 2011	(r225098)
+++ projects/ino64/sys/boot/arm/at91/boot2/boot2.c	Tue Aug 23 00:25:15 2011	(r225099)
@@ -93,7 +93,6 @@ static int dsk_meta;
 
 static void load(void);
 static int parse(void);
-static int xfsread(ino_t, void *, size_t);
 static int dskread(void *, unsigned, unsigned);
 #ifdef FIXUP_BOOT_DRV
 static void fixup_boot_drv(caddr_t, int, int, int);
@@ -109,7 +108,7 @@ static void fixup_boot_drv(caddr_t, int,
 #endif
 
 static inline int
-xfsread(ino_t inode, void *buf, size_t nbyte)
+xfsread(ufs_ino_t inode, void *buf, size_t nbyte)
 {
 	if ((size_t)fsread(inode, buf, nbyte) != nbyte)
 		return -1;
@@ -152,7 +151,7 @@ int
 main(void)
 {
 	int autoboot, c = 0;
-	ino_t ino;
+	ufs_ino_t ino;
 
 	dmadat = (void *)(0x20000000 + (16 << 20));
 	board_init();
@@ -196,7 +195,7 @@ load(void)
 	Elf32_Ehdr eh;
 	static Elf32_Phdr ep[2];
 	caddr_t p;
-	ino_t ino;
+	ufs_ino_t ino;
 	uint32_t addr;
 	int i, j;
 #ifdef FIXUP_BOOT_DRV

Modified: projects/ino64/sys/boot/arm/ixp425/boot2/boot2.c
==============================================================================
--- projects/ino64/sys/boot/arm/ixp425/boot2/boot2.c	Tue Aug 23 00:12:24 2011	(r225098)
+++ projects/ino64/sys/boot/arm/ixp425/boot2/boot2.c	Tue Aug 23 00:25:15 2011	(r225099)
@@ -97,7 +97,6 @@ static int disk_layout;
 
 static void load(void);
 static int parse(void);
-static int xfsread(ino_t, void *, size_t);
 static int dskread(void *, unsigned, unsigned);
 static int drvread(void *, unsigned, unsigned);
 #ifdef FIXUP_BOOT_DRV
@@ -113,7 +112,7 @@ static void fixup_boot_drv(caddr_t, int,
 #endif
 
 static inline int
-xfsread(ino_t inode, void *buf, size_t nbyte)
+xfsread(ufs_ino_t inode, void *buf, size_t nbyte)
 {
 	if ((size_t)fsread(inode, buf, nbyte) != nbyte)
 		return -1;
@@ -157,7 +156,7 @@ main(void)
 {
 	const char *bt;
 	int autoboot, c = 0;
-	ino_t ino;
+	ufs_ino_t ino;
 
 	dmadat = (void *)(0x1c0000);
 	p_memset((char *)dmadat, 0, 32 * 1024);
@@ -205,7 +204,7 @@ load(void)
 	Elf32_Ehdr eh;
 	static Elf32_Phdr ep[2];
 	caddr_t p;
-	ino_t ino;
+	ufs_ino_t ino;
 	uint32_t addr;
 	int i, j;
 #ifdef FIXUP_BOOT_DRV

Modified: projects/ino64/sys/boot/common/ufsread.c
==============================================================================
--- projects/ino64/sys/boot/common/ufsread.c	Tue Aug 23 00:12:24 2011	(r225098)
+++ projects/ino64/sys/boot/common/ufsread.c	Tue Aug 23 00:25:15 2011	(r225099)
@@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$");
 #define cgbase(fs, c)   ((ufs2_daddr_t)((fs)->fs_fpg * (c)))
 #endif
 
+typedef	uint32_t	ufs_ino_t;
+
 /*
  * We use 4k `virtual' blocks for filesystem data, whatever the actual
  * filesystem block size. FFS blocks are always a multiple of 4k.
@@ -85,14 +87,14 @@ struct dmadat {
 };
 static struct dmadat *dmadat;
 
-static ino_t lookup(const char *);
-static ssize_t fsread(ino_t, void *, size_t);
+static ufs_ino_t lookup(const char *);
+static ssize_t fsread(ufs_ino_t, void *, size_t);
 
 static uint8_t ls, dsk_meta;
 static uint32_t fs_off;
 
 static __inline uint8_t
-fsfind(const char *name, ino_t * ino)
+fsfind(const char *name, ufs_ino_t * ino)
 {
 	char buf[DEV_BSIZE];
 	struct direct *d;
@@ -116,12 +118,12 @@ fsfind(const char *name, ino_t * ino)
 	return 0;
 }
 
-static ino_t
+static ufs_ino_t
 lookup(const char *path)
 {
 	char name[MAXNAMLEN + 1];
 	const char *s;
-	ino_t ino;
+	ufs_ino_t ino;
 	ssize_t n;
 	uint8_t dt;
 
@@ -163,7 +165,7 @@ static int sblock_try[] = SBLOCKSEARCH;
 #endif
 
 static ssize_t
-fsread(ino_t inode, void *buf, size_t nbyte)
+fsread(ufs_ino_t inode, void *buf, size_t nbyte)
 {
 #ifndef UFS2_ONLY
 	static struct ufs1_dinode dp1;
@@ -171,7 +173,7 @@ fsread(ino_t inode, void *buf, size_t nb
 #ifndef UFS1_ONLY
 	static struct ufs2_dinode dp2;
 #endif
-	static ino_t inomap;
+	static ufs_ino_t inomap;
 	char *blkbuf;
 	void *indbuf;
 	struct fs fs;

Modified: projects/ino64/sys/boot/i386/boot2/boot2.c
==============================================================================
--- projects/ino64/sys/boot/i386/boot2/boot2.c	Tue Aug 23 00:12:24 2011	(r225098)
+++ projects/ino64/sys/boot/i386/boot2/boot2.c	Tue Aug 23 00:25:15 2011	(r225099)
@@ -140,7 +140,6 @@ static uint8_t ioctrl = IO_KEYBOARD;
 void exit(int);
 static void load(void);
 static int parse(void);
-static int xfsread(ino_t, void *, size_t);
 static int dskread(void *, unsigned, unsigned);
 static void printf(const char *,...);
 static void putchar(int);
@@ -172,7 +171,7 @@ strcmp(const char *s1, const char *s2)
 #include "ufsread.c"
 
 static inline int
-xfsread(ino_t inode, void *buf, size_t nbyte)
+xfsread(ufs_ino_t inode, void *buf, size_t nbyte)
 {
     if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
 	printf("Invalid %s\n", "format");
@@ -224,7 +223,7 @@ int
 main(void)
 {
     uint8_t autoboot;
-    ino_t ino;
+    ufs_ino_t ino;
 
     kname = NULL;
     dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
@@ -306,7 +305,7 @@ load(void)
     static Elf32_Phdr ep[2];
     static Elf32_Shdr es[2];
     caddr_t p;
-    ino_t ino;
+    ufs_ino_t ino;
     uint32_t addr;
     int i, j;
 

Modified: projects/ino64/sys/boot/i386/gptboot/gptboot.c
==============================================================================
--- projects/ino64/sys/boot/i386/gptboot/gptboot.c	Tue Aug 23 00:12:24 2011	(r225098)
+++ projects/ino64/sys/boot/i386/gptboot/gptboot.c	Tue Aug 23 00:25:15 2011	(r225099)
@@ -89,14 +89,13 @@ static struct bootinfo bootinfo;
 void exit(int);
 static void load(void);
 static int parse(char *, int *);
-static int xfsread(ino_t, void *, size_t);
 static int dskread(void *, daddr_t, unsigned);
 static uint32_t memsize(void);
 
 #include "ufsread.c"
 
 static inline int
-xfsread(ino_t inode, void *buf, size_t nbyte)
+xfsread(ufs_ino_t inode, void *buf, size_t nbyte)
 {
 
 	if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
@@ -137,7 +136,7 @@ main(void)
 {
 	char cmd[512], cmdtmp[512];
 	int autoboot, dskupdated;
-	ino_t ino;
+	ufs_ino_t ino;
 
 	dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
 	v86.ctl = V86_FLAGS;
@@ -246,7 +245,7 @@ load(void)
     static Elf32_Phdr ep[2];
     static Elf32_Shdr es[2];
     caddr_t p;
-    ino_t ino;
+    ufs_ino_t ino;
     uint32_t addr, x;
     int fmt, i, j;
 

Modified: projects/ino64/sys/boot/pc98/boot2/boot2.c
==============================================================================
--- projects/ino64/sys/boot/pc98/boot2/boot2.c	Tue Aug 23 00:12:24 2011	(r225098)
+++ projects/ino64/sys/boot/pc98/boot2/boot2.c	Tue Aug 23 00:25:15 2011	(r225099)
@@ -142,7 +142,6 @@ static uint8_t ioctrl = IO_KEYBOARD;
 void exit(int);
 static void load(void);
 static int parse(void);
-static int xfsread(ino_t, void *, size_t);
 static int dskread(void *, unsigned, unsigned);
 static void printf(const char *,...);
 static void putchar(int);
@@ -174,7 +173,7 @@ strcmp(const char *s1, const char *s2)
 #include "ufsread.c"
 
 static inline int
-xfsread(ino_t inode, void *buf, size_t nbyte)
+xfsread(ufs_ino_t inode, void *buf, size_t nbyte)
 {
     if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
 	printf("Invalid %s\n", "format");
@@ -353,7 +352,7 @@ main(void)
     int i;
 #endif
     uint8_t autoboot;
-    ino_t ino;
+    ufs_ino_t ino;
 
     dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
     v86.ctl = V86_FLAGS;
@@ -444,7 +443,7 @@ load(void)
     static Elf32_Phdr ep[2];
     static Elf32_Shdr es[2];
     caddr_t p;
-    ino_t ino;
+    ufs_ino_t ino;
     uint32_t addr;
     int i, j;
 

Modified: projects/ino64/sys/boot/powerpc/boot1.chrp/boot1.c
==============================================================================
--- projects/ino64/sys/boot/powerpc/boot1.chrp/boot1.c	Tue Aug 23 00:12:24 2011	(r225098)
+++ projects/ino64/sys/boot/powerpc/boot1.chrp/boot1.c	Tue Aug 23 00:25:15 2011	(r225099)
@@ -45,7 +45,6 @@ static char bootargs[128];
 static ofwh_t bootdev;
 
 static struct fs fs;
-static ino_t inomap;
 static char blkbuf[BSIZEMAX];
 static unsigned int fsblks;
 
@@ -490,7 +489,7 @@ load(const char *fname)
 	Elf32_Ehdr eh;
 	Elf32_Phdr ph;
 	caddr_t p;
-	ino_t ino;
+	ufs_ino_t ino;
 	int i;
 
 	if ((ino = lookup(fname)) == 0) {

Modified: projects/ino64/sys/boot/sparc64/boot1/boot1.c
==============================================================================
--- projects/ino64/sys/boot/sparc64/boot1/boot1.c	Tue Aug 23 00:12:24 2011	(r225098)
+++ projects/ino64/sys/boot/sparc64/boot1/boot1.c	Tue Aug 23 00:25:15 2011	(r225099)
@@ -385,7 +385,7 @@ load(const char *fname)
 	Elf64_Ehdr eh;
 	Elf64_Phdr ph;
 	caddr_t p;
-	ino_t ino;
+	ufs_ino_t ino;
 	int i;
 
 	if ((ino = lookup(fname)) == 0) {



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