summaryrefslogtreecommitdiff
path: root/sbin/disklabel/editor.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2013-09-10 15:17:47 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2013-09-10 15:17:47 +0000
commitbc8c46abc5944c42acd2a54cd5e58e2cdda140b0 (patch)
treef7e6b6e9d79119c69b267945244a1f3470bb9cb7 /sbin/disklabel/editor.c
parent564170b0c493795efbdb567cde3f80935d752594 (diff)
The rule is: daddr_t variables hold counts of 512-byte blocks, a.k.a.
DEV_BSIZE blocks. Counts of possibly other-sized blocks (e.g. disk sector addresses) are u_int64_t. The values stored in disklabels are counts of possibly other-sized blocks and hence should be handled with u_int64_t variables. Start enforcing this rule. No intended functional change. Rule strongly suggested by deraadt@
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r--sbin/disklabel/editor.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index 0a461aa71c3..f74f5244b65 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.271 2013/06/11 16:42:04 deraadt Exp $ */
+/* $OpenBSD: editor.c,v 1.272 2013/09/10 15:17:46 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -62,8 +62,8 @@ struct mountinfo {
/* used when allocating all space according to recommendations */
struct space_allocation {
- daddr_t minsz; /* starts as blocks, xlated to sectors. */
- daddr_t maxsz; /* starts as blocks, xlated to sectors. */
+ u_int64_t minsz; /* starts as blocks, xlated to sectors. */
+ u_int64_t maxsz; /* starts as blocks, xlated to sectors. */
int rate; /* % of extra space to use */
char *mp;
};
@@ -529,7 +529,7 @@ editor_allocspace(struct disklabel *lp_org)
struct space_allocation *ap;
struct partition *pp;
struct diskchunk *chunks;
- daddr_t secs, chunkstart, chunksize, cylsecs, totsecs, xtrasecs;
+ u_int64_t chunkstart, chunksize, cylsecs, secs, totsecs, xtrasecs;
char **partmp;
int i, j, lastalloc, index = 0, fragsize, partno;
int64_t physmem;
@@ -539,7 +539,7 @@ editor_allocspace(struct disklabel *lp_org)
overlap = 0;
for (i = 0; i < MAXPARTITIONS; i++) {
- daddr_t psz, pstart, pend;
+ u_int64_t psz, pstart, pend;
pp = &lp_org->d_partitions[i];
psz = DL_GETPSIZE(pp);
@@ -709,9 +709,9 @@ editor_resize(struct disklabel *lp, char *p)
{
struct disklabel label;
struct partition *pp, *prev;
- daddr_t secs, sz, off;
+ u_int64_t secs, sz, off;
#ifdef SUN_CYLCHECK
- daddr_t cylsecs;
+ u_int64_t cylsecs;
#endif
int partno, i;
@@ -2318,7 +2318,7 @@ max_partition_size(struct disklabel *lp, int partno)
}
void
-psize(daddr_t sz, char unit, struct disklabel *lp)
+psize(u_int64_t sz, char unit, struct disklabel *lp)
{
double d = scale(sz, unit, lp);
if (d < 0)