summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorgleb <gleb@FreeBSD.org>2012-05-25 09:36:39 +0000
committergleb <gleb@FreeBSD.org>2012-05-25 09:36:39 +0000
commit2dc26af4447ddf75f00ee32933b59022bffa31a6 (patch)
treeb96ac54d1a86e70ab6e3af1f4c959eee6dc450ac /sys/boot
parent02feec4a4507f678cfd5036cbb906dcc9908b6ba (diff)
downloadFreeBSD-src-2dc26af4447ddf75f00ee32933b59022bffa31a6.zip
FreeBSD-src-2dc26af4447ddf75f00ee32933b59022bffa31a6.tar.gz
Use 32-bit ufs_ino_t instead of ino_t to keep boot2 small and prevent
unnecessary 64-bit math on 32-bit machines. Sponsored by: Google Summer of Code 2011
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/arm/at91/boot2/boot2.c7
-rw-r--r--sys/boot/arm/ixp425/boot2/boot2.c7
-rw-r--r--sys/boot/common/ufsread.c16
-rw-r--r--sys/boot/i386/boot2/boot2.c7
-rw-r--r--sys/boot/i386/gptboot/gptboot.c7
-rw-r--r--sys/boot/pc98/boot2/boot2.c7
-rw-r--r--sys/boot/powerpc/boot1.chrp/boot1.c3
-rw-r--r--sys/boot/sparc64/boot1/boot1.c3
8 files changed, 26 insertions, 31 deletions
diff --git a/sys/boot/arm/at91/boot2/boot2.c b/sys/boot/arm/at91/boot2/boot2.c
index f84ac30..c3629a5 100644
--- a/sys/boot/arm/at91/boot2/boot2.c
+++ b/sys/boot/arm/at91/boot2/boot2.c
@@ -95,7 +95,6 @@ static uint8_t 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);
@@ -111,7 +110,7 @@ static void fixup_boot_drv(caddr_t, int, int, 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;
@@ -154,7 +153,7 @@ int
main(void)
{
int autoboot, c = 0;
- ino_t ino;
+ ufs_ino_t ino;
dmadat = (void *)(0x20000000 + (16 << 20));
board_init();
@@ -199,7 +198,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
diff --git a/sys/boot/arm/ixp425/boot2/boot2.c b/sys/boot/arm/ixp425/boot2/boot2.c
index 3d356f0..e5f4982 100644
--- a/sys/boot/arm/ixp425/boot2/boot2.c
+++ b/sys/boot/arm/ixp425/boot2/boot2.c
@@ -98,7 +98,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
@@ -114,7 +113,7 @@ static void fixup_boot_drv(caddr_t, int, int, 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;
@@ -158,7 +157,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);
@@ -207,7 +206,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
diff --git a/sys/boot/common/ufsread.c b/sys/boot/common/ufsread.c
index 1825957..c02010f 100644
--- a/sys/boot/common/ufsread.c
+++ b/sys/boot/common/ufsread.c
@@ -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)
{
static 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)
{
static 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;
@@ -173,7 +175,7 @@ fsread(ino_t inode, void *buf, size_t nbyte)
static struct ufs2_dinode dp2;
#endif
static struct fs fs;
- static ino_t inomap;
+ static ufs_ino_t inomap;
char *blkbuf;
void *indbuf;
char *s;
diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c
index d5ac39e..a0779e0 100644
--- a/sys/boot/i386/boot2/boot2.c
+++ b/sys/boot/i386/boot2/boot2.c
@@ -138,7 +138,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);
@@ -170,7 +169,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");
@@ -222,7 +221,7 @@ int
main(void)
{
uint8_t autoboot;
- ino_t ino;
+ ufs_ino_t ino;
size_t nbyte;
dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
@@ -307,7 +306,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;
diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c
index 8cb4136..b976378 100644
--- a/sys/boot/i386/gptboot/gptboot.c
+++ b/sys/boot/i386/gptboot/gptboot.c
@@ -90,14 +90,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) {
@@ -138,7 +137,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;
@@ -247,7 +246,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;
diff --git a/sys/boot/pc98/boot2/boot2.c b/sys/boot/pc98/boot2/boot2.c
index 393a460..95384bd 100644
--- a/sys/boot/pc98/boot2/boot2.c
+++ b/sys/boot/pc98/boot2/boot2.c
@@ -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");
@@ -351,7 +350,7 @@ main(void)
int i;
#endif
uint8_t autoboot;
- ino_t ino;
+ ufs_ino_t ino;
size_t nbyte;
dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
@@ -446,7 +445,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;
diff --git a/sys/boot/powerpc/boot1.chrp/boot1.c b/sys/boot/powerpc/boot1.chrp/boot1.c
index 5ad405b..ff99ce6 100644
--- a/sys/boot/powerpc/boot1.chrp/boot1.c
+++ b/sys/boot/powerpc/boot1.chrp/boot1.c
@@ -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;
@@ -492,7 +491,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) {
diff --git a/sys/boot/sparc64/boot1/boot1.c b/sys/boot/sparc64/boot1/boot1.c
index 685d414..4bafe06 100644
--- a/sys/boot/sparc64/boot1/boot1.c
+++ b/sys/boot/sparc64/boot1/boot1.c
@@ -415,7 +415,6 @@ loadzfs(void)
Elf64_Ehdr eh;
Elf64_Phdr ph;
caddr_t p;
- ino_t ino;
int i;
if (zbread((char *)&eh, 0, sizeof(eh)) != sizeof(eh)) {
@@ -459,7 +458,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) {
OpenPOWER on IntegriCloud