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.
This commit is contained in:
parent
251c50b7b1
commit
e4496714db
|
@ -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 @@ void ipl_main __P((unsigned /*interactive*/,
|
|||
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 @@ load_file(path, loadadr, interactive, part)
|
|||
|
||||
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;
|
||||
|
|
|
@ -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 @@ static int ufs_read_indirect __P((daddr_t blk, int level, caddr_t *buf,
|
|||
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 @@ ufs_read_indirect(blk, level, buf, poff, count)
|
|||
/*
|
||||
* 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 @@ ufs_lookup(dirino, fn)
|
|||
/*
|
||||
* 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 @@ ufs_lookup_path(path)
|
|||
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 @@ ufs_init()
|
|||
#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 @@ main(argc, argv)
|
|||
{
|
||||
void *p;
|
||||
size_t cnt;
|
||||
ino_t ino;
|
||||
ino32_t ino;
|
||||
size_t disize;
|
||||
|
||||
if ((ino = ufs_lookup_path(argv[2])) == 0)
|
||||
|
|
|
@ -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 @@ union ufs_dinode {
|
|||
#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 @@ struct ufs_info {
|
|||
} 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 @@ struct ufs_info {
|
|||
|
||||
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 @@ void RAW_READ __P((void *buf, daddr_t blkpos, size_t bytelen));
|
|||
|
||||
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
|
||||
|
|
|
@ -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 @@ try_ffs()
|
|||
*/
|
||||
int
|
||||
get_ffs_inode(ino, dibuf)
|
||||
ino_t ino;
|
||||
ino32_t ino;
|
||||
union ufs_dinode *dibuf;
|
||||
{
|
||||
struct ufs_info *ufsinfo = &ufs_info;
|
||||
|
|
|
@ -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 @@ try_lfs()
|
|||
*/
|
||||
int
|
||||
get_lfs_inode(ino, dibuf)
|
||||
ino_t ino;
|
||||
ino32_t ino;
|
||||
union ufs_dinode *dibuf;
|
||||
{
|
||||
struct ufs_info *ufsinfo = &ufs_info;
|
||||
|
|
|
@ -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 @@ void print_hex (unsigned int, int);
|
|||
#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 @@ load_file(path, addr, header)
|
|||
|
||||
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;
|
||||
|
|
|
@ -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 @@ static int ufs_read_indirect __P((daddr_t blk, int level, caddr_t *buf,
|
|||
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 @@ ufs_read_indirect(blk, level, buf, poff, count)
|
|||
/*
|
||||
* 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 @@ ufs_lookup(dirino, fn)
|
|||
/*
|
||||
* 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 @@ ufs_lookup_path(path)
|
|||
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 @@ ufs_init()
|
|||
#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 @@ main(argc, argv)
|
|||
{
|
||||
void *p;
|
||||
size_t cnt;
|
||||
ino_t ino;
|
||||
ino32_t ino;
|
||||
size_t disize;
|
||||
|
||||
if ((ino = ufs_lookup_path(argv[2])) == 0)
|
||||
|
|
|
@ -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 @@ union ufs_dinode {
|
|||
#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
|
||||
|
@ -68,7 +71,7 @@ struct ufs_info {
|
|||
UFSTYPE_UFS1, UFSTYPE_UFS2
|
||||
} ufstype;
|
||||
#endif
|
||||
int (*get_inode) __P((ino_t ino, union ufs_dinode *dibuf));
|
||||
int (*get_inode) __P((ino32_t ino, union ufs_dinode *dibuf));
|
||||
|
||||
/* superblock information */
|
||||
u_int32_t bsize; /* fs block size */
|
||||
|
@ -109,9 +112,9 @@ void RAW_READ __P((void *buf, daddr_t blkpos, size_t bytelen));
|
|||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: readufs_ffs.c,v 1.7 2004/03/27 11:46:40 dsl Exp $ */
|
||||
/* $NetBSD: readufs_ffs.c,v 1.8 2005/08/25 14:31:07 he Exp $ */
|
||||
/* from Id: readufs_ffs.c,v 1.6 2003/04/08 09:19:32 itohy Exp */
|
||||
|
||||
/*
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <ufs/ffs/fs.h>
|
||||
|
||||
static int get_ffs_inode __P((ino_t ino, union ufs_dinode *dibuf));
|
||||
static int get_ffs_inode __P((ino32_t ino, union ufs_dinode *dibuf));
|
||||
|
||||
#define fsi (*ufsinfo)
|
||||
#define fsi_ffs fsi.fs_u.u_ffs
|
||||
|
@ -123,7 +123,7 @@ try_ffs()
|
|||
*/
|
||||
static int
|
||||
get_ffs_inode(ino, dibuf)
|
||||
ino_t ino;
|
||||
ino32_t ino;
|
||||
union ufs_dinode *dibuf;
|
||||
{
|
||||
struct ufs_info *ufsinfo = &ufs_info;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: readufs_lfs.c,v 1.6 2003/12/04 13:05:17 keihan Exp $ */
|
||||
/* $NetBSD: readufs_lfs.c,v 1.7 2005/08/25 14:31:07 he Exp $ */
|
||||
/* from Id: readufs_lfs.c,v 1.7 2003/10/15 14:16:58 itohy Exp */
|
||||
|
||||
/*
|
||||
|
@ -20,7 +20,7 @@
|
|||
#error LFS currently requires USE_UFS1
|
||||
#endif
|
||||
|
||||
static int get_lfs_inode __P((ino_t ino, union ufs_dinode *dibuf));
|
||||
static int get_lfs_inode __P((ino32_t ino, union ufs_dinode *dibuf));
|
||||
|
||||
static struct ufs1_dinode ifile_dinode;
|
||||
|
||||
|
@ -156,7 +156,7 @@ try_lfs()
|
|||
*/
|
||||
static int
|
||||
get_lfs_inode(ino, dibuf)
|
||||
ino_t ino;
|
||||
ino32_t ino;
|
||||
union ufs_dinode *dibuf;
|
||||
{
|
||||
struct ufs_info *ufsinfo = &ufs_info;
|
||||
|
|
Loading…
Reference in New Issue