add some more assert()s
This commit is contained in:
parent
f1447dc5d6
commit
1a478e4092
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs.c,v 1.1 2002/04/19 07:08:51 lukem Exp $ */
|
||||
/* $NetBSD: ffs.c,v 1.2 2002/04/30 14:21:17 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(__lint)
|
||||
__RCSID("$NetBSD: ffs.c,v 1.1 2002/04/19 07:08:51 lukem Exp $");
|
||||
__RCSID("$NetBSD: ffs.c,v 1.2 2002/04/30 14:21:17 lukem Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -70,6 +70,8 @@ ffs_read_disk_block(ib_params *params, uint32_t blkno, int size, char *blk)
|
|||
{
|
||||
int rv;
|
||||
|
||||
assert(params != NULL);
|
||||
assert(blk != NULL);
|
||||
assert(params->filesystem != NULL);
|
||||
assert(params->fsfd != -1);
|
||||
assert(blkno > 0);
|
||||
|
@ -114,6 +116,10 @@ ffs_find_disk_blocks(ib_params *params, uint32_t ino,
|
|||
char diskbuf[MAXBSIZE];
|
||||
} level[LEVELS];
|
||||
|
||||
assert(params != NULL);
|
||||
assert(callback != NULL);
|
||||
assert(state != NULL);
|
||||
|
||||
/* Read the superblock. */
|
||||
if (! ffs_read_disk_block(params, SBLOCK, SBSIZE, sbbuf))
|
||||
return (0);
|
||||
|
@ -244,6 +250,9 @@ ffs_findstage2_ino(ib_params *params, void *_ino,
|
|||
struct direct *de, *ede;
|
||||
uint32_t ino;
|
||||
|
||||
assert(params != NULL);
|
||||
assert(_ino != NULL);
|
||||
|
||||
/* Skip directory holes. */
|
||||
if (blk == 0)
|
||||
return (1);
|
||||
|
@ -284,6 +293,9 @@ ffs_findstage2_blocks(ib_params *params, void *_state,
|
|||
{
|
||||
struct findblks_state *state = _state;
|
||||
|
||||
assert(params != NULL);
|
||||
assert(_state != NULL);
|
||||
|
||||
if (state->nblk == state->maxblk) {
|
||||
warnx("Secondary bootstrap `%s' has too many blocks " \
|
||||
"(max %d)\n", params->stage2, state->maxblk);
|
||||
|
@ -303,6 +315,9 @@ ffs_match(ib_params *params)
|
|||
char sbbuf[SBSIZE];
|
||||
struct fs *fs;
|
||||
|
||||
assert(params != NULL);
|
||||
assert(params->stage2 != NULL);
|
||||
|
||||
/* Read and check the superblock. */
|
||||
if (! ffs_read_disk_block(params, SBLOCK, SBSIZE, sbbuf))
|
||||
return (0);
|
||||
|
@ -321,7 +336,10 @@ ffs_findstage2(ib_params *params, uint32_t *maxblk, ib_block *blocks)
|
|||
uint32_t ino;
|
||||
struct findblks_state state;
|
||||
|
||||
assert (params->stage2 != NULL);
|
||||
assert(params != NULL);
|
||||
assert(params->stage2 != NULL);
|
||||
assert(maxblk != NULL);
|
||||
assert(blocks != NULL);
|
||||
|
||||
/* The secondary bootstrap must be clearly in /. */
|
||||
if (params->stage2[0] == '/')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: installboot.c,v 1.6 2002/04/19 07:08:52 lukem Exp $ */
|
||||
/* $NetBSD: installboot.c,v 1.7 2002/04/30 14:21:17 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(__lint)
|
||||
__RCSID("$NetBSD: installboot.c,v 1.6 2002/04/19 07:08:52 lukem Exp $");
|
||||
__RCSID("$NetBSD: installboot.c,v 1.7 2002/04/30 14:21:17 lukem Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
@ -171,7 +171,7 @@ main(int argc, char *argv[])
|
|||
! params->fstype->match(params))
|
||||
params->fstype++;
|
||||
if (params->fstype->name == NULL)
|
||||
err(1, "File system `%s' is of an unknown type",
|
||||
errx(1, "File system `%s' is of an unknown type",
|
||||
params->filesystem);
|
||||
}
|
||||
|
||||
|
@ -251,6 +251,9 @@ int
|
|||
no_parseopt(ib_params *params, const char *option)
|
||||
{
|
||||
|
||||
assert(params != NULL);
|
||||
assert(option != NULL);
|
||||
|
||||
/* all options are unsupported */
|
||||
warnx("Unsupported -o option `%s'", option);
|
||||
return (0);
|
||||
|
@ -260,6 +263,8 @@ int
|
|||
no_setboot(ib_params *params)
|
||||
{
|
||||
|
||||
assert(params != NULL);
|
||||
|
||||
/* bootstrap installation is not supported */
|
||||
warnx("%s: bootstrap installation is not supported",
|
||||
params->machine->name);
|
||||
|
@ -270,6 +275,8 @@ int
|
|||
no_clearboot(ib_params *params)
|
||||
{
|
||||
|
||||
assert(params != NULL);
|
||||
|
||||
/* bootstrap removal is not supported */
|
||||
warnx("%s: bootstrap removal is not supported",
|
||||
params->machine->name);
|
||||
|
@ -284,6 +291,7 @@ getmachine(ib_params *param, const char *mach, const char *provider)
|
|||
|
||||
assert(param != NULL);
|
||||
assert(mach != NULL);
|
||||
assert(provider != NULL);
|
||||
|
||||
for (i = 0; machines[i].name != NULL; i++) {
|
||||
if (strcmp(machines[i].name, mach) == 0) {
|
||||
|
@ -312,6 +320,7 @@ getfstype(ib_params *param, const char *fstype, const char *provider)
|
|||
|
||||
assert(param != NULL);
|
||||
assert(fstype != NULL);
|
||||
assert(provider != NULL);
|
||||
|
||||
for (i = 0; fstypes[i].name != NULL; i++) {
|
||||
if (strcmp(fstypes[i].name, fstype) == 0) {
|
||||
|
|
Loading…
Reference in New Issue