Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)

- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
2014-07-28 17:05:06 +02:00
parent ff10274392
commit 84d9c625bf
4655 changed files with 379308 additions and 151050 deletions
+6 -1
View File
@@ -1,4 +1,4 @@
/* $NetBSD: libkern.h,v 1.104 2011/11/28 08:05:06 tls Exp $ */
/* $NetBSD: libkern.h,v 1.108 2013/08/28 16:20:38 riastradh Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -190,6 +190,8 @@ tolower(int ch)
#endif
#define CTASSERT(x) __CTASSERT(x)
#define CTASSERT_SIGNED(x) __CTASSERT(((typeof(x))-1) < 0)
#define CTASSERT_UNSIGNED(x) __CTASSERT(((typeof(x))-1) >= 0)
#ifndef DIAGNOSTIC
#define _DIAGASSERT(a) (void)0
@@ -343,4 +345,7 @@ unsigned int popcountl(unsigned long) __constfunc;
unsigned int popcountll(unsigned long long) __constfunc;
unsigned int popcount32(uint32_t) __constfunc;
unsigned int popcount64(uint64_t) __constfunc;
void *explicit_memset(void *, int, size_t);
int consttime_memequal(const void *, const void *, size_t);
#endif /* !_LIB_LIBKERN_LIBKERN_H_ */
@@ -1,4 +1,4 @@
/* $NetBSD: xlat_mbr_fstype.c,v 1.8 2012/01/16 18:47:57 christos Exp $ */
/* $NetBSD: xlat_mbr_fstype.c,v 1.9 2013/03/02 22:04:06 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0,"$NetBSD: xlat_mbr_fstype.c,v 1.8 2012/01/16 18:47:57 christos Exp $");
__KERNEL_RCSID(0,"$NetBSD: xlat_mbr_fstype.c,v 1.9 2013/03/02 22:04:06 christos Exp $");
#include <sys/disklabel.h>
@@ -56,6 +56,7 @@ xlat_mbr_fstype(int mbr_type)
{ MBR_PTYPE_NETBSD, FS_BSDFFS },
{ MBR_PTYPE_NTFS, FS_NTFS },
{ MBR_PTYPE_MINIX_14B, FS_MINIXFS3 },
{ MBR_PTYPE_OPENBSD, FS_BSDFFS },
{ 0, FS_OTHER }
};
const struct ptn_types *pt;
+9 -14
View File
@@ -1,8 +1,7 @@
# $NetBSD: Makefile,v 1.78 2012/08/10 16:05:27 joerg Exp $
# $NetBSD: Makefile,v 1.79 2013/08/21 08:30:50 matt Exp $
LIB= sa
NOPIC= # defined
NOPROFILE=# defined
LIBISPRIVATE?= yes
SA_USE_CREAD?= no # Read compressed kernels
SA_INCLUDE_NET?= yes # Netboot via TFTP, NFS
@@ -37,10 +36,9 @@ SRCS+= exec.c
.if ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "x86_64"
SRCS+= memcmp.c memcpy.c memmove.c memset.c strchr.c
.endif
.ifndef __MINIX
.if !defined(__MINIX)
SRCS+= bcopy.c bzero.c # Remove me eventually.
.endif
.endif # !defined(__MINIX)
# io routines
SRCS+= closeall.c dev.c disklabel.c dkcksum.c ioctl.c nullfs.c stat.c fstat.c
@@ -54,7 +52,7 @@ SRCS+= ls.c
.endif
.if (${SA_USE_LOADFILE} == "yes")
.ifndef __MINIX
.if !defined(__MINIX)
SRCS+= loadfile.c loadfile_ecoff.c loadfile_elf32.c lookup_elf32.c \
loadfile_elf64.c lookup_elf64.c
.if (${MACHINE_CPU} != "mips")
@@ -62,7 +60,7 @@ SRCS+= loadfile_aout.c
.endif
.else
SRCS+= loadfile.c loadfile_elf32.c loadfile_elf64.c
.endif
.endif # !defined(__MINIX)
.endif
.if (${SA_INCLUDE_NET} == "yes")
@@ -90,16 +88,13 @@ SRCS+= ufs.c
.if defined(__MINIX)
# NetBSD has it in libkern, MINIX lacks it
SRCS+= xlat_mbr_fstype.c
.PATH.c: ${NETBSDSRCDIR}/sys/lib/libkern
# NetBSD has it in libkern, MINIX has it in libc but not libminc...
SRCS+= md5c.c
.PATH.c: ${.PARSEDIR}/../../../common/lib/libc/md
.endif
.PATH.c: ${NETBSDSRCDIR}/common/lib/libc/md
.endif # defined(__MINIX)
# only needed during build
libinstall::
.undef DESTDIR
.include <bsd.lib.mk>
lib${LIB}.o:: ${OBJS}
+2 -2
View File
@@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.20 2011/05/26 12:56:31 joerg Exp $
# $NetBSD: Makefile.inc,v 1.21 2012/12/12 15:12:11 matt Exp $
#
# Configuration variables (default values are below):
#
@@ -37,7 +37,7 @@ SAMISCCPPFLAGS+=-I${ZLIBSRCDIR}
SAMAKE= \
cd ${SADST} && ${MAKE} -f ${SADIR:Q}/Makefile \
SADIR=${SADIR:Q} \
CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
CC=${CC:Q} CFLAGS=${CFLAGS:Q} CPUFLAGS= \
AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
LORDER=${LORDER:Q} \
TSORT=${TSORT:Q} \
+7 -9
View File
@@ -1,4 +1,4 @@
/* $NetBSD: cread.c,v 1.23 2009/03/25 18:41:06 tls Exp $ */
/* $NetBSD: cread.c,v 1.26 2013/10/13 20:09:02 joerg Exp $ */
/*
* Copyright (c) 1996
@@ -284,6 +284,7 @@ open(const char *fname, int mode)
errout:
if (s != 0)
dealloc(s, sizeof(struct sd));
ss[fd] = NULL;
oclose(fd);
return -1;
}
@@ -291,7 +292,6 @@ errout:
int
close(int fd)
{
struct open_file *f;
struct sd *s;
#if !defined(LIBSA_NO_FD_CHECKING)
@@ -300,17 +300,15 @@ close(int fd)
return -1;
}
#endif
f = &files[fd];
if ((f->f_flags & F_READ) == 0)
return oclose(fd);
s = ss[fd];
inflateEnd(&(s->stream));
if (s != NULL) {
inflateEnd(&(s->stream));
dealloc(s->inbuf, Z_BUFSIZE);
dealloc(s, sizeof(struct sd));
dealloc(s->inbuf, Z_BUFSIZE);
dealloc(s, sizeof(struct sd));
}
return oclose(fd);
}
+2 -2
View File
@@ -1,4 +1,4 @@
/* $NetBSD: dosfs.c,v 1.18 2011/12/25 06:09:08 tsutsui Exp $ */
/* $NetBSD: dosfs.c,v 1.19 2013/10/20 17:15:42 christos Exp $ */
/*
* Copyright (c) 1996, 1998 Robert Nordier
@@ -571,7 +571,7 @@ lookup(DOS_FS *fs, u_int clus, const char *name, const struct direntry **dep)
for (x = 0, i = 0;
i < 11; i++)
x = ((((x & 1) << 7) | (x >> 1)) +
dir[ent].de.deName[i]) & 0xff;
msdos_dirchar(&dir[ent].de,i)) & 0xff;
ok = chk == x &&
!strcasecmp(name, (const char *)lfn);
}
+31 -30
View File
@@ -1,4 +1,4 @@
/* $NetBSD: ext2fs.c,v 1.13 2012/05/21 21:34:16 dsl Exp $ */
/* $NetBSD: ext2fs.c,v 1.19 2013/10/20 17:17:30 christos Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -115,7 +115,7 @@
#endif
typedef uint32_t ino32_t;
#ifndef FSBTODB
#define FSBTODB(fs, indp) fsbtodb(fs, indp)
#define FSBTODB(fs, indp) EXT2_FSBTODB(fs, indp)
#endif
/*
@@ -240,37 +240,37 @@ block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
/*
* Index structure of an inode:
*
* e2di_blocks[0..NDADDR-1]
* hold block numbers for blocks
* 0..NDADDR-1
* e2di_blocks[0..EXT2FS_NDADDR-1]
* hold block numbers for blocks
* 0..EXT2FS_NDADDR-1
*
* e2di_blocks[NDADDR+0]
* block NDADDR+0 is the single indirect block
* holds block numbers for blocks
* NDADDR .. NDADDR + NINDIR(fs)-1
* e2di_blocks[EXT2FS_NDADDR+0]
* block EXT2FS_NDADDR+0 is the single indirect block
* holds block numbers for blocks
* EXT2FS_NDADDR .. EXT2FS_NDADDR + EXT2_NINDIR(fs)-1
*
* e2di_blocks[NDADDR+1]
* block NDADDR+1 is the double indirect block
* holds block numbers for INDEX blocks for blocks
* NDADDR + NINDIR(fs) ..
* NDADDR + NINDIR(fs) + NINDIR(fs)**2 - 1
* e2di_blocks[EXT2FS_NDADDR+1]
* block EXT2FS_NDADDR+1 is the double indirect block
* holds block numbers for INDEX blocks for blocks
* EXT2FS_NDADDR + EXT2_NINDIR(fs) ..
* EXT2FS_NDADDR + EXT2_NINDIR(fs) + EXT2_NINDIR(fs)**2 - 1
*
* e2di_blocks[NDADDR+2]
* block NDADDR+2 is the triple indirect block
* holds block numbers for double-indirect
* blocks for blocks
* NDADDR + NINDIR(fs) + NINDIR(fs)**2 ..
* NDADDR + NINDIR(fs) + NINDIR(fs)**2
* + NINDIR(fs)**3 - 1
* e2di_blocks[EXT2FS_NDADDR+2]
* block EXT2FS_NDADDR+2 is the triple indirect block
* holds block numbers for double-indirect
* blocks for blocks
* EXT2FS_NDADDR + EXT2_NINDIR(fs) + EXT2_NINDIR(fs)**2 ..
* EXT2FS_NDADDR + EXT2_NINDIR(fs) + EXT2_NINDIR(fs)**2
* + EXT2_NINDIR(fs)**3 - 1
*/
if (file_block < NDADDR) {
if (file_block < EXT2FS_NDADDR) {
/* Direct block. */
*disk_block_p = fs2h32(fp->f_di.e2di_blocks[file_block]);
return 0;
}
file_block -= NDADDR;
file_block -= EXT2FS_NDADDR;
ind_cache = file_block >> LN2_IND_CACHE_SZ;
if (ind_cache == fp->f_ind_cache_block) {
@@ -283,14 +283,15 @@ block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
level += fp->f_nishift;
if (file_block < (indp_t)1 << level)
break;
if (level > NIADDR * fp->f_nishift)
if (level > EXT2FS_NIADDR * fp->f_nishift)
/* Block number too high */
return EFBIG;
file_block -= (indp_t)1 << level;
}
ind_block_num =
fs2h32(fp->f_di.e2di_blocks[NDADDR + (level / fp->f_nishift - 1)]);
fs2h32(fp->f_di.e2di_blocks[EXT2FS_NDADDR +
(level / fp->f_nishift - 1)]);
for (;;) {
level -= fp->f_nishift;
@@ -340,12 +341,12 @@ buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
struct m_ext2fs *fs = fp->f_fs;
long off;
indp_t file_block;
indp_t disk_block;
indp_t disk_block = 0; /* XXX: gcc */
size_t block_size;
int rc;
off = blkoff(fs, fp->f_seekp);
file_block = lblkno(fs, fp->f_seekp);
off = ext2_blkoff(fs, fp->f_seekp);
file_block = ext2_lblkno(fs, fp->f_seekp);
block_size = fs->e2fs_bsize; /* no fragment */
if (file_block != fp->f_buf_blkno) {
@@ -569,7 +570,7 @@ ext2fs_open(const char *path, struct open_file *f)
* of divide and remainder and avoinds pulling in the
* 64bit division routine into the boot code.
*/
mult = NINDIR(fs);
mult = EXT2_NINDIR(fs);
#ifdef DEBUG
if (!powerof2(mult)) {
/* Hummm was't a power of 2 */
@@ -1003,7 +1004,7 @@ void e2fs_i_bswap(struct ext2fs_dinode *old, struct ext2fs_dinode *new)
new->e2di_dacl = bswap32(old->e2di_dacl);
new->e2di_faddr = bswap32(old->e2di_faddr);
memcpy(&new->e2di_blocks[0], &old->e2di_blocks[0],
(NDADDR + NIADDR) * sizeof(uint32_t));
(EXT2FS_NDADDR + EXT2FS_NIADDR) * sizeof(uint32_t));
}
#endif
+9 -2
View File
@@ -1,4 +1,4 @@
/* $NetBSD: lfsv1.c,v 1.5 2012/05/21 21:34:16 dsl Exp $ */
/* $NetBSD: lfsv1.c,v 1.9 2013/06/23 07:28:36 dholland Exp $ */
#define LIBSA_LFS
#define REQUIRED_LFS_VERSION 1
@@ -13,11 +13,18 @@
#define ufs_ls lfsv1_ls
#endif
#define ufs_dinode ulfs1_dinode
#define fs_bsize lfs_ibsize
#define IFILE_Vx IFILE_V1
#define INOPBx(fs) LFS_INOPB(fs)
#define UFS_NINDIR LFS_NINDIR
#define ufs_blkoff(a, b) lfs_blkoff((a), (b))
#define ufs_lblkno(a, b) lfs_lblkno((a), (b))
#define dblksize(a, b, c) lfs_dblksize((a), (b), (c))
#define FSBTODB(fs, daddr) (daddr) /* LFSv1 uses sectors for addresses */
#define INOPBx(fs) INOPB(fs)
#define FSMOD "lfs"
#define FSMOD2 "ffs"
+12 -3
View File
@@ -1,4 +1,4 @@
/* $NetBSD: lfsv2.c,v 1.5 2012/05/21 21:34:16 dsl Exp $ */
/* $NetBSD: lfsv2.c,v 1.9 2013/06/23 07:28:36 dholland Exp $ */
#define LIBSA_LFS
#define REQUIRED_LFS_VERSION 2
@@ -13,15 +13,24 @@
#define ufs_ls lfsv2_ls
#endif
/* XXX wrong! but for now it won't build with ulfs2_dinode */
#define ufs_dinode ulfs1_dinode
#define fs_bsize lfs_bsize
#define IFILE_Vx IFILE
#ifdef LFS_IFILE_FRAG_ADDRESSING /* XXX see sys/ufs/lfs/ -- not tested */
#define INOPBx(fs) INOPF(fs)
#define INOPBx(fs) LFS_INOPF(fs)
#else
#define INOPBx(fs) INOPB(fs)
#define INOPBx(fs) LFS_INOPB(fs)
#endif
#define UFS_NINDIR LFS_NINDIR
#define ufs_blkoff(a, b) lfs_blkoff((a), (b))
#define ufs_lblkno(a, b) lfs_lblkno((a), (b))
#define dblksize(a, b, c) lfs_dblksize((a), (b), (c))
#define FSBTODB(a, b) LFS_FSBTODB((a), (b))
#define FSMOD "lfs"
#define FSMOD2 "ffs"
+4 -2
View File
@@ -1,4 +1,4 @@
/* $NetBSD: loadfile_elf32.c,v 1.29 2011/02/17 21:15:31 christos Exp $ */
/* $NetBSD: loadfile_elf32.c,v 1.30 2013/11/27 17:33:03 jakllsch Exp $ */
/*-
* Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -273,6 +273,7 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
uint8_t desc[ELF_NOTE_NETBSD_DESCSZ];
} note;
char *shstr = NULL;
size_t shstrsz = 0;
int boot_load_ctf = 1;
/* some ports dont use the offset */
@@ -432,6 +433,7 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
}
shstr = ALLOC(shp[elf->e_shstrndx].sh_size);
shstrsz = shp[elf->e_shstrndx].sh_size;
if (lseek(fd, shp[elf->e_shstrndx].sh_offset,
SEEK_SET) == -1) {
WARN(("lseek symbols"));
@@ -556,7 +558,7 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
}
if (shstr) {
DEALLOC(shstr, shp[elf->e_shstrndx].sh_size);
DEALLOC(shstr, shstrsz);
}
/*
+2 -2
View File
@@ -1,4 +1,4 @@
/* $NetBSD: ls.c,v 1.3 2011/12/25 06:09:08 tsutsui Exp $ */
/* $NetBSD: ls.c,v 1.4 2012/03/02 12:08:44 tsutsui Exp $ */
/*-
* Copyright (c) 2011
@@ -93,7 +93,7 @@ ls(const char *path, void (*funcp)(char* arg))
{
int fd;
struct stat sb;
size_t size;
size_t size = -1;
const char *fname = 0;
char *p = NULL;
struct open_file *f;
+9 -9
View File
@@ -1,4 +1,4 @@
/* $NetBSD: minixfs3.c,v 1.1 2012/01/16 18:44:13 christos Exp $ */
/* $NetBSD: minixfs3.c,v 1.6 2013/11/03 00:44:34 christos Exp $ */
/*-
* Copyright (c) 2012
@@ -138,7 +138,7 @@
typedef uint32_t ino32_t;
#ifndef FSBTODB
#define FSBTODB(fs, indp) fsbtodb(fs, indp)
#define FSBTODB(fs, indp) MFS_FSBTODB(fs, indp)
#endif
/*
@@ -258,13 +258,13 @@ block_map(struct open_file *f, block_t file_block, block_t *disk_block_p)
* mdi_blocks[NR_DZONES+0]
* block NDADDR+0 is the single indirect block
* holds zone numbers for zones
* NR_DZONES .. NR_DZONES + NINDIR(fs)-1
* NR_DZONES .. NR_DZONES + MFS_NINDIR(fs)-1
*
* mdi_blocks[NR_DZONES+1]
* block NDADDR+1 is the double indirect block
* holds zone numbers for INDEX blocks for zones
* NR_DZONES + NINDIR(fs) ..
* NR_TZONES + NINDIR(fs) + NINDIR(fs)**2 - 1
* NR_DZONES + MFS_NINDIR(fs) ..
* NR_TZONES + MFS_NINDIR(fs) + MFS_NINDIR(fs)**2 - 1
*/
zone = file_block >> scale;
@@ -354,12 +354,12 @@ buf_read_file(struct open_file *f, void *v, size_t *size_p)
struct mfs_sblock *fs = fp->f_fs;
long off;
block_t file_block;
block_t disk_block;
block_t disk_block = 0; /* XXX: gcc */
size_t block_size;
int rc;
off = blkoff(fs, fp->f_seekp);
file_block = lblkno(fs, fp->f_seekp);
off = mfs_blkoff(fs, fp->f_seekp);
file_block = mfs_lblkno(fs, fp->f_seekp);
block_size = fs->mfs_block_size;
if (file_block != fp->f_buf_blkno) {
@@ -587,7 +587,7 @@ minixfs3_open(const char *path, struct open_file *f)
* of divide and remainder and avoinds pulling in the
* 64bit division routine into the boot code.
*/
mult = NINDIR(fs);
mult = MFS_NINDIR(fs);
#ifdef DEBUG
if (!powerof2(mult)) {
/* Hummm was't a power of 2 */
+7 -7
View File
@@ -1,4 +1,4 @@
/* $NetBSD: minixfs3.h,v 1.1 2012/01/16 18:44:13 christos Exp $ */
/* $NetBSD: minixfs3.h,v 1.5 2013/06/23 07:28:36 dholland Exp $ */
/*-
* Copyright (c) 2012
@@ -33,11 +33,11 @@
FS_DEF(minixfs3);
#ifndef __minix
#if !defined(__minix)
typedef uint32_t zone_t;
typedef uint16_t zone1_t;
typedef uint32_t block_t;
#endif
#endif /* !defined(__minix) */
#define NR_DZONES 7 /* # direct zone numbers in an inode */
#define NR_TZONES 10 /* total # zone numbers in an inode */
@@ -113,13 +113,13 @@ struct mfs_sblock {
#define ZONE_NUM_SIZE sizeof(zone_t) /* # bytes in zone */
#define INODE_SIZE sizeof(struct mfs_dinode) /* bytes in dsk ino */
/* # zones/indir block */
#define NINDIR(fs) ((fs)->mfs_block_size/ZONE_NUM_SIZE)
#define MFS_NINDIR(fs) ((fs)->mfs_block_size/ZONE_NUM_SIZE)
#define NO_ZONE ((zone_t) 0) /* absence of a zone number */
#define NO_BLOCK ((block_t) 0) /* absence of a block number */
/* Turn file system block numbers into disk block addresses */
#define fsbtodb(fs, b) ((b) << (fs)->mfs_fsbtodb)
#define MFS_FSBTODB(fs, b) ((b) << (fs)->mfs_fsbtodb)
#define ino_to_fsba(fs, x) \
(((x) - 1) / (fs)->mfs_inodes_per_block + \
@@ -151,9 +151,9 @@ void minixfs3_i_bswap(struct mfs_dinode *, struct mfs_dinode *);
* quantities by using shifts and masks in place of divisions
* modulos and multiplications.
*/
#define blkoff(fs, loc) /* calculates (loc % fs->mfs_bsize) */ \
#define mfs_blkoff(fs, loc) /* calculates (loc % fs->mfs_bsize) */ \
((loc) & (fs)->mfs_qbmask)
#define lblkno(fs, loc) /* calculates (loc / fs->mfs_bsize) */ \
#define mfs_lblkno(fs, loc) /* calculates (loc / fs->mfs_bsize) */ \
((loc) >> (fs)->mfs_bshift)
/* Flag bits for i_mode in the inode. */
+2 -3
View File
@@ -1,4 +1,4 @@
/* $NetBSD: netif.c,v 1.24 2009/01/17 14:00:36 tsutsui Exp $ */
/* $NetBSD: netif.c,v 1.25 2013/10/20 17:16:57 christos Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@@ -92,7 +92,7 @@ netif_match(struct netif *nif, void *machdep_hint)
struct netif *
netif_select(void *machdep_hint)
{
int d, u, unit_done, s;
int d, u, s;
struct netif_driver *drv;
struct netif cur_if;
static struct netif best_if;
@@ -113,7 +113,6 @@ netif_select(void *machdep_hint)
for (u = 0; u < drv->netif_nifs; u++) {
cur_if.nif_unit = u;
unit_done = 0;
#ifdef NETIF_DEBUG
if (netif_debug)
-4
View File
@@ -33,10 +33,6 @@
#include <sys/errno.h>
#ifndef ELAST
#define ELAST 256 /* XXX temporary hack... need revisiting! */
#endif
extern int errno;
/* special stand error codes */
+33
View File
@@ -71,6 +71,11 @@ const char hexdigits[16] = "0123456789abcdef";
#ifdef LIBSA_PRINTF_LONGLONG_SUPPORT
#define LLONG 0x02
#endif
#if defined(__minix)
#define HEXCAP 0x100
#endif /* defined(__minix) */
#ifdef LIBSA_PRINTF_WIDTH_SUPPORT
#define ALT 0x04
#define SPACE 0x08
@@ -139,6 +144,10 @@ vprintf(const char *fmt, va_list ap)
{
kdoprnt(putchar, fmt, ap);
#if defined(__minix) && defined(LIBSA_PRINTF_WIDTH_SUPPORT)
/* BJG: our libminc kputc() relies on a 0 to flush the diag buffer. */
putchar(0);
#endif /* defined(__minix) && defined(LIBSA_PRINTF_WIDTH_SUPPORT) */
}
int
@@ -177,6 +186,16 @@ kdoprnt(void (*put)(int), const char *fmt, va_list ap)
reswitch:
switch (ch = *fmt++) {
#ifdef LIBSA_PRINTF_WIDTH_SUPPORT
#if defined(__minix)
/* LSC: FIXME: this is a simple hack which ignores the thing for now. */
case '.':
/* eat up digits */
while( ((('1' >= *fmt) && ( *fmt <= '9'))
|| (*fmt == '*')) )
fmt++;
fmt++;
goto reswitch;
#endif /* defined(__minix) */
case '#':
lflag |= ALT;
goto reswitch;
@@ -275,6 +294,12 @@ reswitch:
case 'x':
KPRINT(16);
break;
#if defined(__minix)
case 'X':
lflag |= HEXCAP;
KPRINT(16);
break;
#endif /* defined(__minix) */
default:
if (ch == '\0')
return;
@@ -300,6 +325,14 @@ kprintn(void (*put)(int), UINTMAX_T ul, int base)
p = buf;
do {
*p++ = hexdigits[ul % base];
#if defined(__minix)
#ifdef LIBSA_PRINTF_WIDTH_SUPPORT
/* LSC: Quick hack to support capital hex printout. */
if ((lflag & HEXCAP) && (*(p-1) >= 'a') && (*(p-1) <= 'z')) {
*(p-1) -= 32;
}
#endif
#endif /* defined(__minix) */
} while (ul /= base);
#ifdef LIBSA_PRINTF_WIDTH_SUPPORT
q = p;
+34 -24
View File
@@ -1,4 +1,4 @@
/* $NetBSD: ufs.c,v 1.58 2012/05/21 21:34:16 dsl Exp $ */
/* $NetBSD: ufs.c,v 1.64 2013/10/20 17:17:30 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -136,8 +136,18 @@ struct fs {
#define indp_t int32_t
#endif
typedef uint32_t ino32_t;
#ifndef FSBTODB
#define FSBTODB(fs, indp) fsbtodb(fs, indp)
#define FSBTODB(fs, indp) FFS_FSBTODB(fs, indp)
#endif
#ifndef UFS_NINDIR
#define UFS_NINDIR FFS_NINDIR
#endif
#ifndef ufs_blkoff
#define ufs_blkoff ffs_blkoff
#endif
#ifndef ufs_lblkno
#define ufs_lblkno ffs_lblkno
#endif
/*
@@ -257,7 +267,7 @@ read_inode(ino32_t inumber, struct open_file *f)
char *buf;
size_t rsize;
int rc;
daddr_t inode_sector;
daddr_t inode_sector = 0; /* XXX: gcc */
#ifdef LIBSA_LFS
struct ufs_dinode *dip;
int cnt;
@@ -324,33 +334,33 @@ block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
/*
* Index structure of an inode:
*
* di_db[0..NDADDR-1] hold block numbers for blocks
* 0..NDADDR-1
* di_db[0..UFS_NDADDR-1] hold block numbers for blocks
* 0..UFS_NDADDR-1
*
* di_ib[0] index block 0 is the single indirect block
* holds block numbers for blocks
* NDADDR .. NDADDR + NINDIR(fs)-1
* UFS_NDADDR .. UFS_NDADDR + UFS_NINDIR(fs)-1
*
* di_ib[1] index block 1 is the double indirect block
* holds block numbers for INDEX blocks for blocks
* NDADDR + NINDIR(fs) ..
* NDADDR + NINDIR(fs) + NINDIR(fs)**2 - 1
* UFS_NDADDR + UFS_NINDIR(fs) ..
* UFS_NDADDR + UFS_NINDIR(fs) + UFS_NINDIR(fs)**2 - 1
*
* di_ib[2] index block 2 is the triple indirect block
* holds block numbers for double-indirect
* blocks for blocks
* NDADDR + NINDIR(fs) + NINDIR(fs)**2 ..
* NDADDR + NINDIR(fs) + NINDIR(fs)**2
* + NINDIR(fs)**3 - 1
* UFS_NDADDR + UFS_NINDIR(fs) + UFS_NINDIR(fs)**2 ..
* UFS_NDADDR + UFS_NINDIR(fs) + UFS_NINDIR(fs)**2
* + UFS_NINDIR(fs)**3 - 1
*/
if (file_block < NDADDR) {
if (file_block < UFS_NDADDR) {
/* Direct block. */
*disk_block_p = fp->f_di.di_db[file_block];
return 0;
}
file_block -= NDADDR;
file_block -= UFS_NDADDR;
ind_cache = file_block >> LN2_IND_CACHE_SZ;
if (ind_cache == fp->f_ind_cache_block) {
@@ -362,7 +372,7 @@ block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
level += fp->f_nishift;
if (file_block < (indp_t)1 << level)
break;
if (level > NIADDR * fp->f_nishift)
if (level > UFS_NIADDR * fp->f_nishift)
/* Block number too high */
return EFBIG;
file_block -= (indp_t)1 << level;
@@ -418,19 +428,19 @@ buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
struct fs *fs = fp->f_fs;
long off;
indp_t file_block;
indp_t disk_block;
size_t block_size;
int rc;
off = blkoff(fs, fp->f_seekp);
file_block = lblkno(fs, fp->f_seekp);
off = ufs_blkoff(fs, fp->f_seekp);
file_block = ufs_lblkno(fs, fp->f_seekp);
#ifdef LIBSA_LFS
block_size = dblksize(fs, &fp->f_di, file_block);
#else
block_size = sblksize(fs, (int64_t)fp->f_di.di_size, file_block);
block_size = ffs_sblksize(fs, (int64_t)fp->f_di.di_size, file_block);
#endif
if (file_block != fp->f_buf_blkno) {
indp_t disk_block = 0; /* XXX: gcc */
rc = block_map(f, file_block, &disk_block);
if (rc)
return rc;
@@ -625,7 +635,7 @@ ufs_open(const char *path, struct open_file *f)
* of divide and remainder and avoinds pulling in the
* 64bit division routine into the boot code.
*/
mult = NINDIR(fs);
mult = UFS_NINDIR(fs);
#ifdef DEBUG
if (mult & (mult - 1)) {
/* Hummm was't a power of 2 */
@@ -641,7 +651,7 @@ ufs_open(const char *path, struct open_file *f)
/* alloc a block sized buffer used for all fs transfers */
fp->f_buf = alloc(fs->fs_bsize);
inumber = ROOTINO;
inumber = UFS_ROOTINO;
if ((rc = read_inode(inumber, f)) != 0)
goto out;
@@ -740,7 +750,7 @@ ufs_open(const char *path, struct open_file *f)
if (*cp != '/')
inumber = parent_inumber;
else
inumber = (ino32_t)ROOTINO;
inumber = (ino32_t)UFS_ROOTINO;
if ((rc = read_inode(inumber, f)) != 0)
goto out;
@@ -770,8 +780,8 @@ ufs_open(const char *path, struct open_file *f)
out:
if (rc)
ufs_close(f);
else {
#ifdef FSMOD
else { //LSC: FIXME: Do we still need fsmod2??
#ifdef FSMOD /* Only defined for lfs */
fsmod = FSMOD;
#endif
#ifdef FSMOD2
@@ -900,7 +910,7 @@ ufs_ls(struct open_file *f, const char *pattern,
if (rc)
goto out;
/* some firmware might use block size larger than DEV_BSIZE */
if (buf_size < DIRBLKSIZ)
if (buf_size < UFS_DIRBLKSIZ)
goto out;
dp = (struct direct *)buf;
+2 -2
View File
@@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.13 2005/12/11 12:24:46 christos Exp $
# $NetBSD: Makefile.inc,v 1.14 2012/12/12 15:12:11 matt Exp $
#
# Configuration variables (default values are below):
#
@@ -33,7 +33,7 @@ ZLIB_PROF= ${ZDST}/libz_p.a
ZMAKE= \
cd ${ZDST} && ${MAKE} -f ${ZDIR:Q}/Makefile \
ZDIR=${ZDIR:Q} \
CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
CC=${CC:Q} CFLAGS=${CFLAGS:Q} CPUFLAGS= \
AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
LORDER=${LORDER:Q} \
TSORT=${TSORT:Q} \