This commit is contained in:
christos 2012-04-19 17:28:25 +00:00
parent 99b2fa090d
commit b825b96b8e
9 changed files with 37 additions and 41 deletions

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.30 2012/04/19 15:36:06 ttoth Exp $ # $NetBSD: Makefile,v 1.31 2012/04/19 17:28:25 christos Exp $
# #
WARNS?= 3 # XXX -Wsign-compare WARNS?= 5
.include <bsd.own.mk> .include <bsd.own.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660_eltorito.c,v 1.18 2012/04/02 19:01:21 christos Exp $ */ /* $NetBSD: cd9660_eltorito.c,v 1.19 2012/04/19 17:28:25 christos Exp $ */
/* /*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@ -39,7 +39,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint) #if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: cd9660_eltorito.c,v 1.18 2012/04/02 19:01:21 christos Exp $"); __RCSID("$NetBSD: cd9660_eltorito.c,v 1.19 2012/04/19 17:28:25 christos Exp $");
#endif /* !__lint */ #endif /* !__lint */
#ifdef DEBUG #ifdef DEBUG
@ -244,7 +244,7 @@ cd9660_boot_setup_validation_entry(char sys)
boot_catalog_validation_entry *ve; boot_catalog_validation_entry *ve;
int16_t checksum; int16_t checksum;
unsigned char *csptr; unsigned char *csptr;
int i; size_t i;
entry = cd9660_init_boot_catalog_entry(); entry = cd9660_init_boot_catalog_entry();
if (entry == NULL) { if (entry == NULL) {

View File

@ -98,7 +98,6 @@ chfs_parse_opts(const char *option, fsinfo_t *fsopts)
} }
*val++ = '\0'; *val++ = '\0';
/*###101 [cc] error: passing argument 1 of 'set_option' discards qualifiers from pointer target type%%%*/
retval = set_option(chfs_options, var, val); retval = set_option(chfs_options, var, val);
leave_chfs_parse_opts: leave_chfs_parse_opts:
@ -217,8 +216,8 @@ chfs_populate_dir(const char *dir, fsnode *root, fsnode *parent,
if (cur->child == NULL) { if (cur->child == NULL) {
continue; continue;
} }
if (snprintf(path, sizeof(path), "%s/%s", dir, cur->name) if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir,
>= sizeof(path)) { cur->name) >= sizeof(path)) {
errx(EXIT_FAILURE, "Pathname too long"); errx(EXIT_FAILURE, "Pathname too long");
} }
if (!chfs_populate_dir(path, cur->child, cur, fsopts)) { if (!chfs_populate_dir(path, cur->child, cur, fsopts)) {

View File

@ -100,7 +100,8 @@ padword(fsinfo_t *fsopts)
static void static void
pad_block_if_less_than(fsinfo_t *fsopts, int req) pad_block_if_less_than(fsinfo_t *fsopts, int req)
{ {
if ((img_ofs % chfs_opts.eraseblock) + req > chfs_opts.eraseblock) { if ((img_ofs % chfs_opts.eraseblock) + req >
(uint32_t)chfs_opts.eraseblock) {
padblock(fsopts); padblock(fsopts);
write_eb_header(fsopts); write_eb_header(fsopts);
} }
@ -117,7 +118,7 @@ write_eb_header(fsinfo_t *fsopts)
#define MINSIZE MAX(MAX(CHFS_EB_EC_HDR_SIZE, CHFS_EB_HDR_NOR_SIZE), \ #define MINSIZE MAX(MAX(CHFS_EB_EC_HDR_SIZE, CHFS_EB_HDR_NOR_SIZE), \
CHFS_EB_HDR_NAND_SIZE) CHFS_EB_HDR_NAND_SIZE)
if (opts->pagesize < MINSIZE) if ((uint32_t)opts->pagesize < MINSIZE)
errx(EXIT_FAILURE, "pagesize cannot be less than %zu", MINSIZE); errx(EXIT_FAILURE, "pagesize cannot be less than %zu", MINSIZE);
if ((buf = malloc(opts->pagesize)) == NULL) if ((buf = malloc(opts->pagesize)) == NULL)
err(EXIT_FAILURE, "Memory allocation failed"); err(EXIT_FAILURE, "Memory allocation failed");

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs.c,v 1.46 2012/01/28 02:35:46 christos Exp $ */ /* $NetBSD: ffs.c,v 1.47 2012/04/19 17:28:25 christos Exp $ */
/* /*
* Copyright (c) 2001 Wasabi Systems, Inc. * Copyright (c) 2001 Wasabi Systems, Inc.
@ -71,7 +71,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint) #if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: ffs.c,v 1.46 2012/01/28 02:35:46 christos Exp $"); __RCSID("$NetBSD: ffs.c,v 1.47 2012/04/19 17:28:25 christos Exp $");
#endif /* !__lint */ #endif /* !__lint */
#include <sys/param.h> #include <sys/param.h>
@ -536,7 +536,7 @@ ffs_create_image(const char *image, fsinfo_t *fsopts)
(long long)fs->fs_cstotal.cs_ndir); (long long)fs->fs_cstotal.cs_ndir);
} }
if (fs->fs_cstotal.cs_nifree + ROOTINO < fsopts->inodes) { if ((off_t)(fs->fs_cstotal.cs_nifree + ROOTINO) < fsopts->inodes) {
warnx( warnx(
"Image file `%s' has %lld free inodes; %lld are required.", "Image file `%s' has %lld free inodes; %lld are required.",
image, image,
@ -603,7 +603,7 @@ ffs_size_dir(fsnode *root, fsinfo_t *fsopts)
if (node->type == S_IFREG) if (node->type == S_IFREG)
ADDSIZE(node->inode->st.st_size); ADDSIZE(node->inode->st.st_size);
if (node->type == S_IFLNK) { if (node->type == S_IFLNK) {
int slen; size_t slen;
slen = strlen(node->symlink) + 1; slen = strlen(node->symlink) + 1;
if (slen >= (ffs_opts->version == 1 ? if (slen >= (ffs_opts->version == 1 ?
@ -626,7 +626,7 @@ static void *
ffs_build_dinode1(struct ufs1_dinode *dinp, dirbuf_t *dbufp, fsnode *cur, ffs_build_dinode1(struct ufs1_dinode *dinp, dirbuf_t *dbufp, fsnode *cur,
fsnode *root, fsinfo_t *fsopts) fsnode *root, fsinfo_t *fsopts)
{ {
int slen; size_t slen;
void *membuf; void *membuf;
memset(dinp, 0, sizeof(*dinp)); memset(dinp, 0, sizeof(*dinp));
@ -674,7 +674,7 @@ static void *
ffs_build_dinode2(struct ufs2_dinode *dinp, dirbuf_t *dbufp, fsnode *cur, ffs_build_dinode2(struct ufs2_dinode *dinp, dirbuf_t *dbufp, fsnode *cur,
fsnode *root, fsinfo_t *fsopts) fsnode *root, fsinfo_t *fsopts)
{ {
int slen; size_t slen;
void *membuf; void *membuf;
memset(dinp, 0, sizeof(*dinp)); memset(dinp, 0, sizeof(*dinp));
@ -825,8 +825,8 @@ ffs_populate_dir(const char *dir, fsnode *root, fsinfo_t *fsopts)
for (cur = root; cur != NULL; cur = cur->next) { for (cur = root; cur != NULL; cur = cur->next) {
if (cur->child == NULL) if (cur->child == NULL)
continue; continue;
if (snprintf(path, sizeof(path), "%s/%s", dir, cur->name) if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir,
>= sizeof(path)) cur->name) >= sizeof(path))
errx(1, "Pathname too long."); errx(1, "Pathname too long.");
if (! ffs_populate_dir(path, cur->child, fsopts)) if (! ffs_populate_dir(path, cur->child, fsopts))
return (0); return (0);
@ -1047,7 +1047,7 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts)
int cg, cgino, i; int cg, cgino, i;
daddr_t d; daddr_t d;
char sbbuf[FFS_MAXBSIZE]; char sbbuf[FFS_MAXBSIZE];
int32_t initediblk; uint32_t initediblk;
ffs_opt_t *ffs_opts = fsopts->fs_specific; ffs_opt_t *ffs_opts = fsopts->fs_specific;
assert (dp != NULL); assert (dp != NULL);
@ -1098,7 +1098,8 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts)
* Initialize inode blocks on the fly for UFS2. * Initialize inode blocks on the fly for UFS2.
*/ */
initediblk = ufs_rw32(cgp->cg_initediblk, fsopts->needswap); initediblk = ufs_rw32(cgp->cg_initediblk, fsopts->needswap);
if (ffs_opts->version == 2 && cgino + INOPB(fs) > initediblk && if (ffs_opts->version == 2 &&
(uint32_t)(cgino + INOPB(fs)) > initediblk &&
initediblk < ufs_rw32(cgp->cg_niblk, fsopts->needswap)) { initediblk < ufs_rw32(cgp->cg_niblk, fsopts->needswap)) {
memset(buf, 0, fs->fs_bsize); memset(buf, 0, fs->fs_bsize);
dip = (struct ufs2_dinode *)buf; dip = (struct ufs2_dinode *)buf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_alloc.c,v 1.18 2011/03/06 17:08:42 bouyer Exp $ */ /* $NetBSD: ffs_alloc.c,v 1.19 2012/04/19 17:28:26 christos Exp $ */
/* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */ /* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */
/* /*
@ -47,7 +47,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint) #if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: ffs_alloc.c,v 1.18 2011/03/06 17:08:42 bouyer Exp $"); __RCSID("$NetBSD: ffs_alloc.c,v 1.19 2012/04/19 17:28:26 christos Exp $");
#endif /* !__lint */ #endif /* !__lint */
#include <sys/param.h> #include <sys/param.h>
@ -106,7 +106,7 @@ ffs_alloc(struct inode *ip, daddr_t lbn __unused, daddr_t bpref, int size,
int cg; int cg;
*bnp = 0; *bnp = 0;
if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) { if (size > fs->fs_bsize || fragoff(fs, size) != 0) {
errx(1, "ffs_alloc: bad size: bsize %d size %d", errx(1, "ffs_alloc: bad size: bsize %d size %d",
fs->fs_bsize, size); fs->fs_bsize, size);
} }
@ -195,11 +195,7 @@ ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int32_t *bap)
} }
daddr_t daddr_t
ffs_blkpref_ufs2(ip, lbn, indx, bap) ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int64_t *bap)
struct inode *ip;
daddr_t lbn;
int indx;
int64_t *bap;
{ {
struct fs *fs; struct fs *fs;
int cg; int cg;
@ -444,7 +440,7 @@ ffs_blkfree(struct inode *ip, daddr_t bno, long size)
struct fs *fs = ip->i_fs; struct fs *fs = ip->i_fs;
const int needswap = UFS_FSNEEDSWAP(fs); const int needswap = UFS_FSNEEDSWAP(fs);
if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0 || if (size > fs->fs_bsize || fragoff(fs, size) != 0 ||
fragnum(fs, bno) + numfrags(fs, size) > fs->fs_frag) { fragnum(fs, bno) + numfrags(fs, size) > fs->fs_frag) {
errx(1, "blkfree: bad size: bno %lld bsize %d size %ld", errx(1, "blkfree: bad size: bno %lld bsize %d size %ld",
(long long)bno, fs->fs_bsize, size); (long long)bno, fs->fs_bsize, size);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkfs.c,v 1.22 2011/10/09 21:33:43 christos Exp $ */ /* $NetBSD: mkfs.c,v 1.23 2012/04/19 17:28:26 christos Exp $ */
/* /*
* Copyright (c) 2002 Networks Associates Technology, Inc. * Copyright (c) 2002 Networks Associates Technology, Inc.
@ -48,7 +48,7 @@
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
#else #else
#ifdef __RCSID #ifdef __RCSID
__RCSID("$NetBSD: mkfs.c,v 1.22 2011/10/09 21:33:43 christos Exp $"); __RCSID("$NetBSD: mkfs.c,v 1.23 2012/04/19 17:28:26 christos Exp $");
#endif #endif
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -599,7 +599,7 @@ static void
initcg(int cylno, time_t utime, const fsinfo_t *fsopts) initcg(int cylno, time_t utime, const fsinfo_t *fsopts)
{ {
daddr_t cbase, dmax; daddr_t cbase, dmax;
int32_t i, j, d, dlower, dupper, blkno; int i, j, d, dlower, dupper, blkno;
struct ufs1_dinode *dp1; struct ufs1_dinode *dp1;
struct ufs2_dinode *dp2; struct ufs2_dinode *dp2;
int start; int start;
@ -667,8 +667,8 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts)
} }
acg.cg_cs.cs_nifree += sblock.fs_ipg; acg.cg_cs.cs_nifree += sblock.fs_ipg;
if (cylno == 0) if (cylno == 0)
for (i = 0; i < ROOTINO; i++) { for (size_t r = 0; r < ROOTINO; r++) {
setbit(cg_inosused(&acg, 0), i); setbit(cg_inosused(&acg, 0), r);
acg.cg_cs.cs_nifree--; acg.cg_cs.cs_nifree--;
} }
if (cylno > 0) { if (cylno > 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: v7fs_estimate.c,v 1.2 2011/08/10 11:31:49 uch Exp $ */ /* $NetBSD: v7fs_estimate.c,v 1.3 2012/04/19 17:28:26 christos Exp $ */
/*- /*-
* Copyright (c) 2011 The NetBSD Foundation, Inc. * Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint) #if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: v7fs_estimate.c,v 1.2 2011/08/10 11:31:49 uch Exp $"); __RCSID("$NetBSD: v7fs_estimate.c,v 1.3 2012/04/19 17:28:26 christos Exp $");
#endif /* !__lint */ #endif /* !__lint */
#include <stdio.h> #include <stdio.h>
@ -192,9 +192,8 @@ static void
determine_fs_size(fsinfo_t *fsopts, struct v7fs_geometry *geom) determine_fs_size(fsinfo_t *fsopts, struct v7fs_geometry *geom)
{ {
v7fs_daddr_t nblk = geom->ndatablock; v7fs_daddr_t nblk = geom->ndatablock;
v7fs_daddr_t fsblk; v7fs_daddr_t fsblk, n;
int32_t nfiles = geom->ninode; int32_t nfiles = geom->ninode;
int n;
VPRINTF("size=%lld inodes=%lld fd=%d superb=%p onlyspec=%d\n", VPRINTF("size=%lld inodes=%lld fd=%d superb=%p onlyspec=%d\n",
(long long)fsopts->size, (long long)fsopts->inodes, fsopts->fd, (long long)fsopts->size, (long long)fsopts->inodes, fsopts->fd,

View File

@ -1,4 +1,4 @@
/* $NetBSD: walk.c,v 1.25 2012/01/28 02:35:46 christos Exp $ */ /* $NetBSD: walk.c,v 1.26 2012/04/19 17:28:25 christos Exp $ */
/* /*
* Copyright (c) 2001 Wasabi Systems, Inc. * Copyright (c) 2001 Wasabi Systems, Inc.
@ -41,7 +41,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint) #if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: walk.c,v 1.25 2012/01/28 02:35:46 christos Exp $"); __RCSID("$NetBSD: walk.c,v 1.26 2012/04/19 17:28:25 christos Exp $");
#endif /* !__lint */ #endif /* !__lint */
#include <sys/param.h> #include <sys/param.h>
@ -387,7 +387,7 @@ apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly)
if (strcmp(curnode->name, curfsnode->name) == 0) if (strcmp(curnode->name, curfsnode->name) == 0)
break; break;
} }
if (snprintf(path, sizeof(path), "%s/%s", if ((size_t)snprintf(path, sizeof(path), "%s/%s",
dir, curnode->name) >= sizeof(path)) dir, curnode->name) >= sizeof(path))
errx(1, "Pathname too long."); errx(1, "Pathname too long.");
if (curfsnode == NULL) { /* need new entry */ if (curfsnode == NULL) { /* need new entry */