diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-10-30 06:16:28 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-10-30 06:16:28 +0000 |
commit | c2253d34d826569efaa2eab0e591eac342ccb040 (patch) | |
tree | 060a6e1a652fff72c717f69538db9e595ca66ee6 /sys/kern | |
parent | 65aad79f6235d72bdcdc365eb8ee3af77e3cd653 (diff) |
directly use dev_t for swdevt[], remove struct swdevt
ok mpi@ miod@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_disk.c | 36 | ||||
-rw-r--r-- | sys/kern/subr_hibernate.c | 6 |
2 files changed, 21 insertions, 21 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index bf169beff2e..6eb96f24559 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.272 2023/11/15 20:23:19 kn Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.273 2024/10/30 06:16:27 jsg Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -1423,7 +1423,7 @@ void setroot(struct device *bootdv, int part, int exitflags) { int majdev, unit, len, s, slept = 0; - struct swdevt *swp; + dev_t *swp; struct device *dv; dev_t nrootdev, nswapdev = NODEV, temp = NODEV; struct ifnet *ifp = NULL; @@ -1564,8 +1564,8 @@ setroot(struct device *bootdv, int part, int exitflags) gotswap: rootdev = nrootdev; dumpdev = nswapdev; - swdevt[0].sw_dev = nswapdev; - swdevt[1].sw_dev = NODEV; + swdevt[0] = nswapdev; + swdevt[1] = NODEV; #if defined(NFSCLIENT) } else if (mountroot == nfs_mountroot) { rootdv = bootdv; @@ -1605,8 +1605,8 @@ gotswap: nswapdev = NODEV; } dumpdev = nswapdev; - swdevt[0].sw_dev = nswapdev; - /* swdevt[1].sw_dev = NODEV; */ + swdevt[0] = nswapdev; + /* swdevt[1] = NODEV; */ } else { /* Completely pre-configured, but we want rootdv .. */ majdev = major(rootdev); @@ -1653,27 +1653,27 @@ gotswap: /* * Make the swap partition on the root drive the primary swap. */ - for (swp = swdevt; swp->sw_dev != NODEV; swp++) { - if (major(rootdev) == major(swp->sw_dev) && - DISKUNIT(rootdev) == DISKUNIT(swp->sw_dev)) { - temp = swdevt[0].sw_dev; - swdevt[0].sw_dev = swp->sw_dev; - swp->sw_dev = temp; + for (swp = swdevt; *swp != NODEV; swp++) { + if (major(rootdev) == major(*swp) && + DISKUNIT(rootdev) == DISKUNIT(*swp)) { + temp = swdevt[0]; + swdevt[0] = *swp; + *swp = temp; break; } } - if (swp->sw_dev != NODEV) { + if (*swp != NODEV) { /* * If dumpdev was the same as the old primary swap device, * move it to the new primary swap device. */ if (temp == dumpdev) - dumpdev = swdevt[0].sw_dev; + dumpdev = swdevt[0]; } - if (swdevt[0].sw_dev != NODEV) - printf(" swap on %s%d%c", findblkname(major(swdevt[0].sw_dev)), - DISKUNIT(swdevt[0].sw_dev), - 'a' + DISKPART(swdevt[0].sw_dev)); + if (swdevt[0] != NODEV) + printf(" swap on %s%d%c", findblkname(major(swdevt[0])), + DISKUNIT(swdevt[0]), + 'a' + DISKPART(swdevt[0])); if (dumpdev != NODEV) printf(" dump on %s%d%c", findblkname(major(dumpdev)), DISKUNIT(dumpdev), 'a' + DISKPART(dumpdev)); diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c index 464bc48bab0..f4fae1f313c 100644 --- a/sys/kern/subr_hibernate.c +++ b/sys/kern/subr_hibernate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_hibernate.c,v 1.142 2024/08/18 08:01:03 mpi Exp $ */ +/* $OpenBSD: subr_hibernate.c,v 1.143 2024/10/30 06:16:27 jsg Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -573,12 +573,12 @@ get_hibernate_info(union hibernate_info *hib, int suspend) #endif /* ! NO_PROPOLICE */ /* Determine I/O function to use */ - hib->io_func = get_hibernate_io_function(swdevt[0].sw_dev); + hib->io_func = get_hibernate_io_function(swdevt[0]); if (hib->io_func == NULL) return (1); /* Calculate hibernate device */ - hib->dev = swdevt[0].sw_dev; + hib->dev = swdevt[0]; /* Read disklabel (used to calculate signature and image offsets) */ dl_ret = disk_readlabel(&dl, hib->dev, err_string, sizeof(err_string)); |