summaryrefslogtreecommitdiffstats
path: root/sbin/growfs/debug.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /sbin/growfs/debug.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz
wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'sbin/growfs/debug.c')
-rw-r--r--sbin/growfs/debug.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/growfs/debug.c b/sbin/growfs/debug.c
index 03181fbfb97..7b999528eae 100644
--- a/sbin/growfs/debug.c
+++ b/sbin/growfs/debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: debug.c,v 1.10 2014/05/24 17:56:17 krw Exp $ */
+/* $OpenBSD: debug.c,v 1.11 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
@@ -42,7 +42,6 @@
*/
/* ********************************************************** INCLUDES ***** */
-#include <sys/param.h>
#include <limits.h>
#include <stdio.h>
@@ -51,6 +50,9 @@
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#include "debug.h"
#ifdef FS_DEBUG
@@ -721,7 +723,7 @@ dbg_dump_ino(struct fs *sb, const char *comment, struct ufs1_dinode *ino)
ino->di_ctimensec);
remaining_blocks = howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */
- for (ictr = 0; ictr < MIN(NDADDR, remaining_blocks); ictr++) {
+ for (ictr = 0; ictr < MINIMUM(NDADDR, remaining_blocks); ictr++) {
fprintf(dbg_log, "db int32_t[%x] 0x%08x\n", ictr,
ino->di_db[ictr]);
}
@@ -799,7 +801,7 @@ dbg_dump_ufs2_ino(struct fs *sb, const char *comment, struct ufs2_dinode *ino)
/* XXX: What do we do with di_extb[NXADDR]? */
remaining_blocks = howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */
- for (ictr = 0; ictr < MIN(NDADDR, remaining_blocks); ictr++) {
+ for (ictr = 0; ictr < MINIMUM(NDADDR, remaining_blocks); ictr++) {
fprintf(dbg_log, "db daddr_t[%x] 0x%16jx\n", ictr,
ino->di_db[ictr]);
}
@@ -851,7 +853,7 @@ dbg_dump_iblk(struct fs *sb, const char *comment, char *block, size_t length)
size = sizeof(int64_t);
mem = (unsigned int *)block;
- for (i = 0; (size_t)i < MIN(howmany(sb->fs_bsize, size), length); i += 8) {
+ for (i = 0; (size_t)i < MINIMUM(howmany(sb->fs_bsize, size), length); i += 8) {
fprintf(dbg_log, "%04x: ", i);
for (j = 0; j < 8; j++) {
if ((size_t)(i + j) < length) {