Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Make these first-stage boot loaders use a locally-d...



details:   https://anonhg.NetBSD.org/src/rev/47513a7a67de
branches:  trunk
changeset: 583841:47513a7a67de
user:      he <he%NetBSD.org@localhost>
date:      Thu Aug 25 14:31:07 2005 +0000

description:
Make these first-stage boot loaders use a locally-defined ino32_t
instead of introducing 64-bit operations in these space-constrained
pieces of code with the recent change to ino_t. This is patterned
slightly after recent changes to libsa's ufs.c.

Approved by christos.

diffstat:

 sys/arch/hp700/stand/xxboot/main.c         |   6 +++---
 sys/arch/hp700/stand/xxboot/readufs.c      |  20 ++++++++++----------
 sys/arch/hp700/stand/xxboot/readufs.h      |  17 ++++++++++-------
 sys/arch/hp700/stand/xxboot/readufs_ffs.c  |   4 ++--
 sys/arch/hp700/stand/xxboot/readufs_lfs.c  |   4 ++--
 sys/arch/x68k/stand/boot_ufs/bootmain.c    |   6 +++---
 sys/arch/x68k/stand/boot_ufs/readufs.c     |  20 ++++++++++----------
 sys/arch/x68k/stand/boot_ufs/readufs.h     |  13 ++++++++-----
 sys/arch/x68k/stand/boot_ufs/readufs_ffs.c |   6 +++---
 sys/arch/x68k/stand/boot_ufs/readufs_lfs.c |   6 +++---
 10 files changed, 54 insertions(+), 48 deletions(-)

diffs (truncated from 385 to 300 lines):

diff -r 464b45330bc6 -r 47513a7a67de sys/arch/hp700/stand/xxboot/main.c
--- a/sys/arch/hp700/stand/xxboot/main.c        Thu Aug 25 10:00:01 2005 +0000
+++ b/sys/arch/hp700/stand/xxboot/main.c        Thu Aug 25 14:31:07 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.1 2004/06/15 03:10:30 itohy Exp $   */
+/*     $NetBSD: main.c,v 1.2 2005/08/25 14:31:07 he Exp $      */
 
 /*
  * Copyright (c) 2003 ITOH Yasufumi.
@@ -44,7 +44,7 @@
     unsigned /*sptop*/, unsigned /*psw*/));
 void load_file __P((const char *, unsigned /*loadadr*/,
     unsigned /*interactive*/, int /*part*/));
-void load_file_ino __P((ino_t, const char *, unsigned /*loadadr*/,
+void load_file_ino __P((ino32_t, const char *, unsigned /*loadadr*/,
     unsigned /*interactive*/, int /*part*/));
 
 struct loadinfo {
@@ -315,7 +315,7 @@
 
 void
 load_file_ino(ino, fn, loadadr, interactive, part)
-       ino_t ino;
+       ino32_t ino;
        const char *fn;         /* for message only */
        unsigned loadadr, interactive;
        int part;
diff -r 464b45330bc6 -r 47513a7a67de sys/arch/hp700/stand/xxboot/readufs.c
--- a/sys/arch/hp700/stand/xxboot/readufs.c     Thu Aug 25 10:00:01 2005 +0000
+++ b/sys/arch/hp700/stand/xxboot/readufs.c     Thu Aug 25 14:31:07 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readufs.c,v 1.1 2004/06/15 03:10:30 itohy Exp $        */
+/*     $NetBSD: readufs.c,v 1.2 2005/08/25 14:31:07 he Exp $   */
 /*     from Id: readufs.c,v 1.9 2003/12/16 13:54:11 itohy Exp  */
 
 /*
@@ -20,7 +20,7 @@
                unsigned *poff, size_t count));
 
 #ifdef DEBUG_WITH_STDIO
-void ufs_list_dir __P((ino_t dirino));
+void ufs_list_dir __P((ino32_t dirino));
 int main __P((int argc, char *argv[]));
 #endif
 
@@ -232,9 +232,9 @@
 /*
  * look-up fn in directory dirino
  */
-ino_t
+ino32_t
 ufs_lookup(dirino, fn)
-       ino_t dirino;
+       ino32_t dirino;
        const char *fn;
 {
        union ufs_dinode dirdi;
@@ -263,13 +263,13 @@
 /*
  * look-up a file in absolute pathname from the root directory
  */
-ino_t
+ino32_t
 ufs_lookup_path(path)
        const char *path;
 {
-       char fn[MAXNAMLEN + 1];
+       char fn[FFS_MAXNAMLEN + 1];
        char *p;
-       ino_t ino = ROOTINO;
+       ino32_t ino = ROOTINO;
 
        do {
                while (*path == '/')
@@ -287,7 +287,7 @@
 size_t
 ufs_load_file(buf, dirino, fn)
        void *buf;
-       ino_t dirino;
+       ino32_t dirino;
        const char *fn;
 {
        size_t cnt, disize;
@@ -318,7 +318,7 @@
 #ifdef DEBUG_WITH_STDIO
 void
 ufs_list_dir(dirino)
-       ino_t dirino;
+       ino32_t dirino;
 {
        union ufs_dinode dirdi;
        struct direct *pdir;
@@ -358,7 +358,7 @@
        {
                void *p;
                size_t cnt;
-               ino_t ino;
+               ino32_t ino;
                size_t disize;
 
                if ((ino = ufs_lookup_path(argv[2])) == 0)
diff -r 464b45330bc6 -r 47513a7a67de sys/arch/hp700/stand/xxboot/readufs.h
--- a/sys/arch/hp700/stand/xxboot/readufs.h     Thu Aug 25 10:00:01 2005 +0000
+++ b/sys/arch/hp700/stand/xxboot/readufs.h     Thu Aug 25 14:31:07 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readufs.h,v 1.1 2004/06/15 03:10:30 itohy Exp $        */
+/*     $NetBSD: readufs.h,v 1.2 2005/08/25 14:31:07 he Exp $   */
 /*     from Id: readufs.h,v 1.10 2003/12/16 13:54:11 itohy Exp */
 
 /*
@@ -23,6 +23,9 @@
 #endif
 };
 
+/* For more compact code and independence on 64-bit types and ops */
+typedef uint32_t       ino32_t;
+
 /* short-cut for common fields (di_mode, di_nlink) */
 #ifdef USE_UFS1
 # define di_common     di1
@@ -69,7 +72,7 @@
        } ufstype;
 #endif
 #if 0
-       int (*get_inode) __P((ino_t ino, union ufs_dinode *dibuf));
+       int (*get_inode) __P((ino32_t ino, union ufs_dinode *dibuf));
 #endif
 
        /* superblock information */
@@ -106,8 +109,8 @@
 
 extern struct ufs_info ufs_info;
 
-int get_ffs_inode __P((ino_t ino, union ufs_dinode *dibuf));
-int get_lfs_inode __P((ino_t ino, union ufs_dinode *dibuf));
+int get_ffs_inode __P((ino32_t ino, union ufs_dinode *dibuf));
+int get_lfs_inode __P((ino32_t ino, union ufs_dinode *dibuf));
 #if defined(USE_FFS) && defined(USE_LFS)
 #define ufs_get_inode(ino, di)  ((ufs_info.fstype == UFSTYPE_FFS) ? \
        get_ffs_inode((ino), (di)) : get_lfs_inode((ino), (di)))
@@ -124,9 +127,9 @@
 
 size_t ufs_read __P((union ufs_dinode *di, void *buf, unsigned off,
     size_t count));
-ino_t ufs_lookup __P((ino_t dirino, const char *fn));
-ino_t ufs_lookup_path __P((const char *path));
-size_t ufs_load_file __P((void *buf, ino_t dirino, const char *fn));
+ino32_t ufs_lookup __P((ino32_t dirino, const char *fn));
+ino32_t ufs_lookup_path __P((const char *path));
+size_t ufs_load_file __P((void *buf, ino32_t dirino, const char *fn));
 int ufs_init __P((void));
 
 #ifdef USE_FFS
diff -r 464b45330bc6 -r 47513a7a67de sys/arch/hp700/stand/xxboot/readufs_ffs.c
--- a/sys/arch/hp700/stand/xxboot/readufs_ffs.c Thu Aug 25 10:00:01 2005 +0000
+++ b/sys/arch/hp700/stand/xxboot/readufs_ffs.c Thu Aug 25 14:31:07 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readufs_ffs.c,v 1.1 2004/06/15 03:10:30 itohy Exp $    */
+/*     $NetBSD: readufs_ffs.c,v 1.2 2005/08/25 14:31:07 he Exp $       */
 /*     from Id: readufs_ffs.c,v 1.8 2004/06/12 04:26:39 itohy Exp      */
 
 /*
@@ -122,7 +122,7 @@
  */
 int
 get_ffs_inode(ino, dibuf)
-       ino_t ino;
+       ino32_t ino;
        union ufs_dinode *dibuf;
 {
        struct ufs_info *ufsinfo = &ufs_info;
diff -r 464b45330bc6 -r 47513a7a67de sys/arch/hp700/stand/xxboot/readufs_lfs.c
--- a/sys/arch/hp700/stand/xxboot/readufs_lfs.c Thu Aug 25 10:00:01 2005 +0000
+++ b/sys/arch/hp700/stand/xxboot/readufs_lfs.c Thu Aug 25 14:31:07 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readufs_lfs.c,v 1.1 2004/06/15 03:10:30 itohy Exp $    */
+/*     $NetBSD: readufs_lfs.c,v 1.2 2005/08/25 14:31:07 he Exp $       */
 /*     from Id: readufs_lfs.c,v 1.8 2003/12/16 13:54:11 itohy Exp      */
 
 /*
@@ -152,7 +152,7 @@
  */
 int
 get_lfs_inode(ino, dibuf)
-       ino_t ino;
+       ino32_t ino;
        union ufs_dinode *dibuf;
 {
        struct ufs_info *ufsinfo = &ufs_info;
diff -r 464b45330bc6 -r 47513a7a67de sys/arch/x68k/stand/boot_ufs/bootmain.c
--- a/sys/arch/x68k/stand/boot_ufs/bootmain.c   Thu Aug 25 10:00:01 2005 +0000
+++ b/sys/arch/x68k/stand/boot_ufs/bootmain.c   Thu Aug 25 14:31:07 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootmain.c,v 1.6 2003/10/30 22:27:05 he Exp $  */
+/*     $NetBSD: bootmain.c,v 1.7 2005/08/25 14:31:07 he Exp $  */
 
 /*-
  * Copyright (c) 1993, 1994 Takumi Nakamura.
@@ -69,7 +69,7 @@
 #endif
 
 static int load_file (const char*, unsigned int, struct exec *);
-static int load_file_ino (ino_t, const char*, unsigned int, struct exec *);
+static int load_file_ino (ino32_t, const char*, unsigned int, struct exec *);
 
 void bootufs (void) __attribute__ ((__noreturn__));
 
@@ -210,7 +210,7 @@
 
 static int
 load_file_ino(ino, fn, addr, header)
-       ino_t ino;
+       ino32_t ino;
        const char *fn;         /* for message only */
        unsigned int addr;
        struct exec *header;
diff -r 464b45330bc6 -r 47513a7a67de sys/arch/x68k/stand/boot_ufs/readufs.c
--- a/sys/arch/x68k/stand/boot_ufs/readufs.c    Thu Aug 25 10:00:01 2005 +0000
+++ b/sys/arch/x68k/stand/boot_ufs/readufs.c    Thu Aug 25 14:31:07 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readufs.c,v 1.5 2003/12/04 13:05:17 keihan Exp $       */
+/*     $NetBSD: readufs.c,v 1.6 2005/08/25 14:31:07 he Exp $   */
 /*     from Id: readufs.c,v 1.8 2003/04/08 09:19:32 itohy Exp  */
 
 /*
@@ -20,7 +20,7 @@
                unsigned *poff, size_t count));
 
 #ifdef DEBUG_WITH_STDIO
-void ufs_list_dir __P((ino_t dirino));
+void ufs_list_dir __P((ino32_t dirino));
 int main __P((int argc, char *argv[]));
 #endif
 
@@ -232,9 +232,9 @@
 /*
  * look-up fn in directory dirino
  */
-ino_t
+ino32_t
 ufs_lookup(dirino, fn)
-       ino_t dirino;
+       ino32_t dirino;
        const char *fn;
 {
        union ufs_dinode dirdi;
@@ -267,13 +267,13 @@
 /*
  * look-up a file in absolute pathname from the root directory
  */
-ino_t
+ino32_t
 ufs_lookup_path(path)
        const char *path;
 {
-       char fn[MAXNAMLEN + 1];
+       char fn[FFS_MAXNAMLEN + 1];
        char *p;
-       ino_t ino = ROOTINO;
+       ino32_t ino = ROOTINO;
 
        do {
                while (*path == '/')
@@ -291,7 +291,7 @@
 size_t
 ufs_load_file(buf, dirino, fn)
        void *buf;
-       ino_t dirino;
+       ino32_t dirino;
        const char *fn;
 {
        size_t cnt, disize;
@@ -322,7 +322,7 @@
 #ifdef DEBUG_WITH_STDIO
 void
 ufs_list_dir(dirino)
-       ino_t dirino;
+       ino32_t dirino;
 {
        union ufs_dinode dirdi;
        struct direct *pdir;
@@ -362,7 +362,7 @@
        {
                void *p;
                size_t cnt;
-               ino_t ino;
+               ino32_t ino;
                size_t disize;
 
                if ((ino = ufs_lookup_path(argv[2])) == 0)
diff -r 464b45330bc6 -r 47513a7a67de sys/arch/x68k/stand/boot_ufs/readufs.h
--- a/sys/arch/x68k/stand/boot_ufs/readufs.h    Thu Aug 25 10:00:01 2005 +0000
+++ b/sys/arch/x68k/stand/boot_ufs/readufs.h    Thu Aug 25 14:31:07 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readufs.h,v 1.6 2003/12/04 13:05:17 keihan Exp $       */
+/*     $NetBSD: readufs.h,v 1.7 2005/08/25 14:31:07 he Exp $   */
 /*     from Id: readufs.h,v 1.9 2003/10/15 14:16:58 itohy Exp  */
 
 /*
@@ -23,6 +23,9 @@



Home | Main Index | Thread Index | Old Index