summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/fsck_ffs/setup.c8
-rw-r--r--sbin/newfs/newfs.c4
-rw-r--r--sbin/newfs_msdos/newfs_msdos.c8
-rw-r--r--sys/arch/amd64/stand/libsa/diskprobe.c12
-rw-r--r--sys/arch/armish/stand/boot/wd.c10
-rw-r--r--sys/arch/i386/stand/libsa/diskprobe.c12
-rw-r--r--sys/arch/luna88k/stand/boot/ufs_disksubr.c12
-rw-r--r--sys/arch/mvme68k/stand/libsa/bugdev.c6
-rw-r--r--sys/arch/mvme88k/stand/libsa/bugdev.c6
-rw-r--r--sys/arch/socppc/stand/boot/wd.c10
-rw-r--r--sys/arch/sparc64/stand/ofwboot/ofdev.c12
-rw-r--r--sys/kern/subr_hibernate.c12
12 files changed, 54 insertions, 58 deletions
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 5e097964d74..342d3e3d2e7 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.49 2013/06/11 16:42:04 deraadt Exp $ */
+/* $OpenBSD: setup.c,v 1.50 2013/11/05 00:51:58 krw Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
@@ -611,8 +611,8 @@ calcsb(char *dev, int devfd, struct fs *fs)
fs->fs_bsize = fs->fs_fsize * fs->fs_frag;
fs->fs_cpg = pp->p_cpg;
fs->fs_nspf = fs->fs_fsize / lp->d_secsize;
- /* unit for fs->fs_size is fragments, for pp->p_size it is sectors */
- fs->fs_size = pp->p_size / fs->fs_nspf;
+ /* unit for fs->fs_size is fragments, for DL_GETPSIZE() it is sectors */
+ fs->fs_size = DL_GETPSIZE(pp) / fs->fs_nspf;
fs->fs_ntrak = lp->d_ntracks;
fs->fs_nsect = lp->d_nsectors;
fs->fs_spc = lp->d_secpercyl;
@@ -629,7 +629,7 @@ again:
fs->fs_cgoffset = roundup(
howmany(fs->fs_nsect, NSPF(fs)), fs->fs_frag);
fs->fs_fpg = (fs->fs_cpg * fs->fs_spc) / NSPF(fs);
- fs->fs_ncg = howmany(pp->p_size / fs->fs_spc, fs->fs_cpg);
+ fs->fs_ncg = howmany(DL_GETPSIZE(pp) / fs->fs_spc, fs->fs_cpg);
for (fs->fs_fsbtodb = 0, i = NSPF(fs); i > 1; i >>= 1)
fs->fs_fsbtodb++;
/*
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index f6cdf776d4b..d0cb25b6481 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs.c,v 1.93 2013/10/07 10:05:24 krw Exp $ */
+/* $OpenBSD: newfs.c,v 1.94 2013/11/05 00:51:58 krw Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
@@ -342,7 +342,7 @@ main(int argc, char *argv[])
mfsfakelabel.d_ntracks = 16;
mfsfakelabel.d_ncylinders = 16;
mfsfakelabel.d_secpercyl = 1024;
- mfsfakelabel.d_secperunit = 16384;
+ DL_SETDSIZE(&mfsfakelabel, 16384);
mfsfakelabel.d_npartitions = 1;
mfsfakelabel.d_version = 1;
DL_SETPSIZE(&mfsfakelabel.d_partitions[0], 16384);
diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index c8a4731c76c..a876ec7835a 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs_msdos.c,v 1.20 2010/05/18 04:41:14 dlg Exp $ */
+/* $OpenBSD: newfs_msdos.c,v 1.21 2013/11/05 00:51:58 krw Exp $ */
/*
* Copyright (c) 1998 Robert Nordier
@@ -740,12 +740,12 @@ getdiskinfo(int fd, const char *fname, const char *dtype, int oflag,
if (part == -1)
part = RAW_PART;
if (part >= lp->d_npartitions ||
- !lp->d_partitions[part].p_size)
+ !DL_GETPSIZE(&lp->d_partitions[part]))
errx(1, "%s: partition is unavailable", fname);
if (!oflag && part != -1)
- bpb->hid += lp->d_partitions[part].p_offset;
+ bpb->hid += DL_GETPOFFSET(&lp->d_partitions[part]);
if (!bpb->bsec)
- bpb->bsec = lp->d_partitions[part].p_size;
+ bpb->bsec = DL_GETPSIZE(&lp->d_partitions[part]);
if (!bpb->bps)
bpb->bps = ckgeom(fname, lp->d_secsize, "bytes/sector");
if (!bpb->spt)
diff --git a/sys/arch/amd64/stand/libsa/diskprobe.c b/sys/arch/amd64/stand/libsa/diskprobe.c
index 581bcac749c..50062579d5d 100644
--- a/sys/arch/amd64/stand/libsa/diskprobe.c
+++ b/sys/arch/amd64/stand/libsa/diskprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diskprobe.c,v 1.12 2012/10/30 14:06:29 jsing Exp $ */
+/* $OpenBSD: diskprobe.c,v 1.13 2013/11/05 00:51:58 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -266,19 +266,19 @@ cdprobe(void)
strncpy(dip->disklabel.d_packname, "fictitious",
sizeof(dip->disklabel.d_packname));
- dip->disklabel.d_secperunit = 100;
+ DL_SETDSIZE(&dip->disklabel, 100);
dip->disklabel.d_bbsize = 2048;
dip->disklabel.d_sbsize = 2048;
/* 'a' partition covering the "whole" disk */
- dip->disklabel.d_partitions[0].p_offset = 0;
- dip->disklabel.d_partitions[0].p_size = 100;
+ DL_SETPOFFSET(&dip->disklabel.d_partitions[0], 0);
+ DL_SETPSIZE(&dip->disklabel.d_partitions[0], 100);
dip->disklabel.d_partitions[0].p_fstype = FS_UNUSED;
/* The raw partition is special */
- dip->disklabel.d_partitions[RAW_PART].p_offset = 0;
- dip->disklabel.d_partitions[RAW_PART].p_size = 100;
+ DL_SETPOFFSET(&dip->disklabel.d_partitions[RAW_PART], 0);
+ DL_SETPSIZE(&dip->disklabel.d_partitions[RAW_PART], 100);
dip->disklabel.d_partitions[RAW_PART].p_fstype = FS_UNUSED;
dip->disklabel.d_npartitions = MAXPARTITIONS;
diff --git a/sys/arch/armish/stand/boot/wd.c b/sys/arch/armish/stand/boot/wd.c
index 6e1aa847192..a54f3ec5d06 100644
--- a/sys/arch/armish/stand/boot/wd.c
+++ b/sys/arch/armish/stand/boot/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.10 2013/03/24 19:20:34 deraadt Exp $ */
+/* $OpenBSD: wd.c,v 1.11 2013/11/05 00:51:58 krw Exp $ */
/* $NetBSD: wd.c,v 1.5 2005/12/11 12:17:06 christos Exp $ */
/*-
@@ -126,13 +126,13 @@ wdgetdefaultlabel(wd, lp)
strncpy(lp->d_typename, wd->sc_params.atap_model, 16);
strncpy(lp->d_packname, "fictitious", 16);
if (wd->sc_capacity > UINT32_MAX)
- lp->d_secperunit = UINT32_MAX;
+ DL_SETDSIZE(lp, UINT32_MAX);
else
- lp->d_secperunit = wd->sc_capacity;
+ DL_SETDSIZE(lp, wd->sc_capacity);
lp->d_flags = 0;
- lp->d_partitions[RAW_PART].p_offset = 0;
- lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
+ DL_SETPOFFSET(&lp->d_partitions[RAW_PART], 0);
+ DL_SETPSIZE(&lp->d_partitions[RAW_PART], DL_GETDSIZE(lp));
lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
lp->d_npartitions = MAXPARTITIONS;
diff --git a/sys/arch/i386/stand/libsa/diskprobe.c b/sys/arch/i386/stand/libsa/diskprobe.c
index 1d466e7cc45..81ead6b8900 100644
--- a/sys/arch/i386/stand/libsa/diskprobe.c
+++ b/sys/arch/i386/stand/libsa/diskprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diskprobe.c,v 1.34 2012/11/01 00:55:38 jsing Exp $ */
+/* $OpenBSD: diskprobe.c,v 1.35 2013/11/05 00:51:58 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -266,19 +266,19 @@ cdprobe(void)
strncpy(dip->disklabel.d_packname, "fictitious",
sizeof(dip->disklabel.d_packname));
- dip->disklabel.d_secperunit = 100;
+ DL_SETDSIZE(&dip->disklabel, 100);
dip->disklabel.d_bbsize = 2048;
dip->disklabel.d_sbsize = 2048;
/* 'a' partition covering the "whole" disk */
- dip->disklabel.d_partitions[0].p_offset = 0;
- dip->disklabel.d_partitions[0].p_size = 100;
+ DL_SETPSOFFSET(&dip->disklabel.d_partitions[0], 0);
+ DL_SETDSIZE(&dip->disklabel.d_partitions[0], 100);
dip->disklabel.d_partitions[0].p_fstype = FS_UNUSED;
/* The raw partition is special */
- dip->disklabel.d_partitions[RAW_PART].p_offset = 0;
- dip->disklabel.d_partitions[RAW_PART].p_size = 100;
+ DL_SETPSOFFSET(&dip->disklabel.d_partitions[RAW_PART], 0);
+ DL_SETDSIZE(&dip->disklabel.d_partitions[RAW_PART], 100);
dip->disklabel.d_partitions[RAW_PART].p_fstype = FS_UNUSED;
dip->disklabel.d_npartitions = MAXPARTITIONS;
diff --git a/sys/arch/luna88k/stand/boot/ufs_disksubr.c b/sys/arch/luna88k/stand/boot/ufs_disksubr.c
index b98536da79f..9b29f64ce07 100644
--- a/sys/arch/luna88k/stand/boot/ufs_disksubr.c
+++ b/sys/arch/luna88k/stand/boot/ufs_disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_disksubr.c,v 1.3 2013/11/02 00:08:17 krw Exp $ */
+/* $OpenBSD: ufs_disksubr.c,v 1.4 2013/11/05 00:51:58 krw Exp $ */
/* $NetBSD: ufs_disksubr.c,v 1.2 2013/01/14 01:37:57 tsutsui Exp $ */
/*
@@ -126,12 +126,12 @@ readdisklabel(struct scsi_softc *sc, uint tgt, struct disklabel *lp)
{ CMD_READ, 0, 0, 0, 1, 0 }
};
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
+ if (DL_GETDSIZE(lp) == 0)
+ DL_SETDSIZE(lp, 0x1fffffff);
lp->d_npartitions = 1;
- if (lp->d_partitions[0].p_size == 0)
- lp->d_partitions[0].p_size = 0x1fffffff;
- lp->d_partitions[0].p_offset = 0;
+ if (DL_GETPSIZE(&lp->d_partitions[0]) == 0)
+ DL_SETPSIZE(&lp->d_partitions[0], 0x1fffffff);
+ DL_SETPSIZE(&lp->d_partitions[0], 0);
if (scsi_immed_command(sc, tgt, 0, &cdb, bp, DEV_BSIZE) != 0)
return "I/O error";
diff --git a/sys/arch/mvme68k/stand/libsa/bugdev.c b/sys/arch/mvme68k/stand/libsa/bugdev.c
index 2ff54801db1..fc9bb95fc11 100644
--- a/sys/arch/mvme68k/stand/libsa/bugdev.c
+++ b/sys/arch/mvme68k/stand/libsa/bugdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bugdev.c,v 1.8 2012/12/31 21:35:32 miod Exp $ */
+/* $OpenBSD: bugdev.c,v 1.9 2013/11/05 00:51:58 krw Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -176,9 +176,7 @@ cputobsdlabel(struct disklabel *lp, struct mvmedisklabel *clp)
lp->d_ntracks = clp->cfg_hds;
lp->d_secpercyl = clp->secpercyl;
- lp->d_secperunit = clp->secperunit;
- lp->d_secpercyl = clp->secpercyl;
- lp->d_secperunit = clp->secperunit;
+ DL_SETDSIZE(lp, clp->secperunit);
lp->d_acylinders = clp->acylinders;
lp->d_flags = clp->flags;
for (i = 0; i < NDDATA; i++)
diff --git a/sys/arch/mvme88k/stand/libsa/bugdev.c b/sys/arch/mvme88k/stand/libsa/bugdev.c
index f0d5513543e..adb9751794b 100644
--- a/sys/arch/mvme88k/stand/libsa/bugdev.c
+++ b/sys/arch/mvme88k/stand/libsa/bugdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bugdev.c,v 1.8 2013/01/16 20:45:09 miod Exp $ */
+/* $OpenBSD: bugdev.c,v 1.9 2013/11/05 00:51:58 krw Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -188,9 +188,7 @@ cputobsdlabel(lp, clp)
lp->d_ntracks = clp->cfg_hds;
lp->d_secpercyl = clp->secpercyl;
- lp->d_secperunit = clp->secperunit;
- lp->d_secpercyl = clp->secpercyl;
- lp->d_secperunit = clp->secperunit;
+ DL_SETDSIZE(lp, clp->secperunit);
lp->d_acylinders = clp->acylinders;
lp->d_flags = clp->flags;
for (i = 0; i < NDDATA; i++)
diff --git a/sys/arch/socppc/stand/boot/wd.c b/sys/arch/socppc/stand/boot/wd.c
index d381508abc2..848ee1093c1 100644
--- a/sys/arch/socppc/stand/boot/wd.c
+++ b/sys/arch/socppc/stand/boot/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.6 2013/03/24 18:43:47 deraadt Exp $ */
+/* $OpenBSD: wd.c,v 1.7 2013/11/05 00:51:58 krw Exp $ */
/* $NetBSD: wd.c,v 1.5 2005/12/11 12:17:06 christos Exp $ */
/*-
@@ -143,13 +143,13 @@ wdgetdefaultlabel(wd, lp)
strncpy(lp->d_typename, wd->sc_params.atap_model, 16);
strncpy(lp->d_packname, "fictitious", 16);
if (wd->sc_capacity > UINT32_MAX)
- lp->d_secperunit = UINT32_MAX;
+ DL_SETDSIZE(lp, UINT32_MAX);
else
- lp->d_secperunit = wd->sc_capacity;
+ DL_SETDSIZE(lp, wd->sc_capacity);
lp->d_flags = 0;
- lp->d_partitions[RAW_PART].p_offset = 0;
- lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
+ DL_SETPOFFSET(&lp->d_partitions[RAW_PART], 0);
+ DL_SETPSIZE(&lp->d_partitions[RAW_PART], DL_GETDSIZE(lp));
lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
lp->d_npartitions = MAXPARTITIONS;
diff --git a/sys/arch/sparc64/stand/ofwboot/ofdev.c b/sys/arch/sparc64/stand/ofwboot/ofdev.c
index f02a718c972..877be513793 100644
--- a/sys/arch/sparc64/stand/ofwboot/ofdev.c
+++ b/sys/arch/sparc64/stand/ofwboot/ofdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofdev.c,v 1.19 2013/10/20 10:11:17 krw Exp $ */
+/* $OpenBSD: ofdev.c,v 1.20 2013/11/05 00:51:58 krw Exp $ */
/* $NetBSD: ofdev.c,v 1.1 2000/08/20 14:58:41 mrg Exp $ */
/*
@@ -416,12 +416,12 @@ search_label(struct of_dev *devp, u_long off, char *buf, struct disklabel *lp,
int error;
/* minimal requirements for archetypal disk label */
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
+ if (DL_GETDSIZE(lp) == 0)
+ DL_SETDSIZE(lp, 0x1fffffff);
lp->d_npartitions = MAXPARTITIONS;
- if (lp->d_partitions[0].p_size == 0)
- lp->d_partitions[0].p_size = 0x1fffffff;
- lp->d_partitions[0].p_offset = 0;
+ if (DL_GETPSIZE(&lp->d_partitions[0]) == 0)
+ DL_SETPSIZE(&lp->d_partitions[0], 0x1fffffff);
+ DL_SETPOFFSET(&lp->d_partitions[0], 0);
if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read)
|| read != DEV_BSIZE)
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c
index dfbfedf4ff8..bab98e515f5 100644
--- a/sys/kern/subr_hibernate.c
+++ b/sys/kern/subr_hibernate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_hibernate.c,v 1.66 2013/10/20 17:16:47 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.67 2013/11/05 00:51:58 krw Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -663,7 +663,7 @@ get_hibernate_info(union hibernate_info *hiber_info, int suspend)
/* Make sure we have a swap partition. */
if (dl.d_partitions[1].p_fstype != FS_SWAP ||
- dl.d_partitions[1].p_size == 0)
+ DL_GETPSIZE(&dl.d_partitions[1]) == 0)
return (1);
hiber_info->secsize = dl.d_secsize;
@@ -679,8 +679,8 @@ get_hibernate_info(union hibernate_info *hiber_info, int suspend)
hiber_info->swap_offset = dl.d_partitions[1].p_offset;
/* Calculate signature block location */
- hiber_info->sig_offset = dl.d_partitions[1].p_offset +
- dl.d_partitions[1].p_size -
+ hiber_info->sig_offset = DL_GETPOFFSET(&dl.d_partitions[1]) +
+ DL_GETPSIZE(&dl.d_partitions[1]) -
sizeof(union hibernate_info)/hiber_info->secsize;
chunktable_size = HIBERNATE_CHUNK_TABLE_SIZE / hiber_info->secsize;
@@ -729,8 +729,8 @@ get_hibernate_info(union hibernate_info *hiber_info, int suspend)
goto fail;
/* Calculate memory image location in swap */
- hiber_info->image_offset = dl.d_partitions[1].p_offset +
- dl.d_partitions[1].p_size -
+ hiber_info->image_offset = DL_GETPOFFSET(&dl.d_partitions[1]) +
+ DL_GETPSIZE(&dl.d_partitions[1]) -
(hiber_info->image_size / hiber_info->secsize) -
sizeof(union hibernate_info)/hiber_info->secsize -
chunktable_size;