Date: Fri, 25 May 2012 09:36:39 +0000 (UTC) From: Gleb Kurtsou <gleb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r235988 - in head/sys/boot: arm/at91/boot2 arm/ixp425/boot2 common i386/boot2 i386/gptboot pc98/boot2 powerpc/boot1.chrp sparc64/boot1 Message-ID: <201205250936.q4P9adck093814@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gleb Date: Fri May 25 09:36:39 2012 New Revision: 235988 URL: http://svn.freebsd.org/changeset/base/235988 Log: 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 Modified: head/sys/boot/arm/at91/boot2/boot2.c head/sys/boot/arm/ixp425/boot2/boot2.c head/sys/boot/common/ufsread.c head/sys/boot/i386/boot2/boot2.c head/sys/boot/i386/gptboot/gptboot.c head/sys/boot/pc98/boot2/boot2.c head/sys/boot/powerpc/boot1.chrp/boot1.c head/sys/boot/sparc64/boot1/boot1.c Modified: head/sys/boot/arm/at91/boot2/boot2.c ============================================================================== --- head/sys/boot/arm/at91/boot2/boot2.c Fri May 25 09:30:16 2012 (r235987) +++ head/sys/boot/arm/at91/boot2/boot2.c Fri May 25 09:36:39 2012 (r235988) @@ -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, #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 Modified: head/sys/boot/arm/ixp425/boot2/boot2.c ============================================================================== --- head/sys/boot/arm/ixp425/boot2/boot2.c Fri May 25 09:30:16 2012 (r235987) +++ head/sys/boot/arm/ixp425/boot2/boot2.c Fri May 25 09:36:39 2012 (r235988) @@ -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, #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 Modified: head/sys/boot/common/ufsread.c ============================================================================== --- head/sys/boot/common/ufsread.c Fri May 25 09:30:16 2012 (r235987) +++ head/sys/boot/common/ufsread.c Fri May 25 09:36:39 2012 (r235988) @@ -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 nb 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; Modified: head/sys/boot/i386/boot2/boot2.c ============================================================================== --- head/sys/boot/i386/boot2/boot2.c Fri May 25 09:30:16 2012 (r235987) +++ head/sys/boot/i386/boot2/boot2.c Fri May 25 09:36:39 2012 (r235988) @@ -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; Modified: head/sys/boot/i386/gptboot/gptboot.c ============================================================================== --- head/sys/boot/i386/gptboot/gptboot.c Fri May 25 09:30:16 2012 (r235987) +++ head/sys/boot/i386/gptboot/gptboot.c Fri May 25 09:36:39 2012 (r235988) @@ -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; Modified: head/sys/boot/pc98/boot2/boot2.c ============================================================================== --- head/sys/boot/pc98/boot2/boot2.c Fri May 25 09:30:16 2012 (r235987) +++ head/sys/boot/pc98/boot2/boot2.c Fri May 25 09:36:39 2012 (r235988) @@ -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; Modified: head/sys/boot/powerpc/boot1.chrp/boot1.c ============================================================================== --- head/sys/boot/powerpc/boot1.chrp/boot1.c Fri May 25 09:30:16 2012 (r235987) +++ head/sys/boot/powerpc/boot1.chrp/boot1.c Fri May 25 09:36:39 2012 (r235988) @@ -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) { Modified: head/sys/boot/sparc64/boot1/boot1.c ============================================================================== --- head/sys/boot/sparc64/boot1/boot1.c Fri May 25 09:30:16 2012 (r235987) +++ head/sys/boot/sparc64/boot1/boot1.c Fri May 25 09:36:39 2012 (r235988) @@ -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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205250936.q4P9adck093814>