diff options
-rw-r--r-- | sys/arch/arm64/dev/apm.c | 4 | ||||
-rw-r--r-- | sys/conf/swapgeneric.c | 8 | ||||
-rw-r--r-- | sys/dev/acpi/acpi_apm.c | 6 | ||||
-rw-r--r-- | sys/kern/subr_disk.c | 36 | ||||
-rw-r--r-- | sys/kern/subr_hibernate.c | 6 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 16 | ||||
-rw-r--r-- | sys/sys/conf.h | 18 | ||||
-rw-r--r-- | sys/uvm/uvm_swap.c | 8 | ||||
-rw-r--r-- | usr.sbin/config/mkswap.c | 8 |
9 files changed, 48 insertions, 62 deletions
diff --git a/sys/arch/arm64/dev/apm.c b/sys/arch/arm64/dev/apm.c index 49d4e1a6610..feb9447f972 100644 --- a/sys/arch/arm64/dev/apm.c +++ b/sys/arch/arm64/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.25 2024/05/28 09:40:40 kettenis Exp $ */ +/* $OpenBSD: apm.c,v 1.26 2024/10/30 06:16:27 jsg Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -380,7 +380,7 @@ request_sleep(int sleepmode) break; #ifdef HIBERNATE case SLEEP_HIBERNATE: - if (get_hibernate_io_function(swdevt[0].sw_dev) == NULL) + if (get_hibernate_io_function(swdevt[0]) == NULL) return EOPNOTSUPP; task_add(sleep_taskq, &hibernate_task); break; diff --git a/sys/conf/swapgeneric.c b/sys/conf/swapgeneric.c index a47c541db0a..116e061e05c 100644 --- a/sys/conf/swapgeneric.c +++ b/sys/conf/swapgeneric.c @@ -1,4 +1,4 @@ -/* $OpenBSD: swapgeneric.c,v 1.4 2013/04/19 15:02:41 florian Exp $ */ +/* $OpenBSD: swapgeneric.c,v 1.5 2024/10/30 06:16:27 jsg Exp $ */ /* $NetBSD: swapgeneric.c,v 1.12 1996/05/03 19:42:28 christos Exp $ */ /*- @@ -47,7 +47,7 @@ int (*mountroot)(void) = NULL; /* tells autoconf.c that we are "generic" */ dev_t rootdev = NODEV; dev_t dumpdev = NODEV; -struct swdevt swdevt[] = { - { NODEV, 0 }, /* to be filled in */ - { NODEV, 0 } +dev_t swdevt[] = { + NODEV, /* to be filled in */ + NODEV }; diff --git a/sys/dev/acpi/acpi_apm.c b/sys/dev/acpi/acpi_apm.c index c10e9d8607f..34588d35083 100644 --- a/sys/dev/acpi/acpi_apm.c +++ b/sys/dev/acpi/acpi_apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_apm.c,v 1.3 2023/08/06 14:30:08 tobhe Exp $ */ +/* $OpenBSD: acpi_apm.c,v 1.4 2024/10/30 06:16:27 jsg Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -138,7 +138,7 @@ acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) error = EBADF; break; } - if (get_hibernate_io_function(swdevt[0].sw_dev) == NULL) { + if (get_hibernate_io_function(swdevt[0]) == NULL) { error = EOPNOTSUPP; break; } @@ -225,7 +225,7 @@ request_sleep(int sleepmode) #ifdef HIBERNATE if (sleepmode == SLEEP_HIBERNATE) { - if (get_hibernate_io_function(swdevt[0].sw_dev) == NULL) + if (get_hibernate_io_function(swdevt[0]) == NULL) return EOPNOTSUPP; } #endif 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)); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 1bb790f3328..b4e241a12d1 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.131 2024/05/12 09:09:39 jsg Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.132 2024/10/30 06:16:27 jsg Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -255,7 +255,7 @@ struct nfs_diskless nfs_diskless; * - Call nfs_boot_init() to fill in the nfs_diskless struct * (using RARP, bootparam RPC, mountd RPC) * - hand craft the swap nfs vnode hanging off a fake mount point - * if swdevt[0].sw_dev == NODEV + * if swdevt[0] == NODEV * - build the rootfs mount point and call mountnfs() to do the rest. */ int @@ -315,17 +315,17 @@ nfs_mountroot(void) * "Mount" the swap device. * * On a "dataless" configuration (swap on disk) we will have: - * (swdevt[0].sw_dev != NODEV) identifying the swap device. + * (swdevt[0] != NODEV) identifying the swap device. */ - if (swdevt[0].sw_dev != NODEV) { + if (swdevt[0] != NODEV) { if (bdevvp(swapdev, &swapdev_vp)) panic("nfs_mountroot: can't setup swap vp"); - printf("swap on device 0x%x\n", swdevt[0].sw_dev); + printf("swap on device 0x%x\n", swdevt[0]); return (0); } /* - * If swapping to an nfs node: (swdevt[0].sw_dev == NODEV) + * If swapping to an nfs node: (swdevt[0] == NODEV) * Create a fake mount point just for the swap vnode so that the * swap file can be on a different server from the rootfs. * @@ -348,7 +348,7 @@ nfs_mountroot(void) * Next line is a hack to make swapmount() work on NFS * swap files. */ - swdevt[0].sw_dev = NETDEV; + swdevt[0] = NETDEV; /* end hack */ nfs_diskless.sw_vp = vp; @@ -368,7 +368,7 @@ nfs_mountroot(void) } printf("WARNING: no swap\n"); - swdevt[0].sw_dev = NODEV; + swdevt[0] = NODEV; return (0); } diff --git a/sys/sys/conf.h b/sys/sys/conf.h index c53d11c5317..057444949e1 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.165 2024/10/26 05:39:03 jsg Exp $ */ +/* $OpenBSD: conf.h,v 1.166 2024/10/30 06:16:27 jsg Exp $ */ /* $NetBSD: conf.h,v 1.33 1996/05/03 20:03:32 christos Exp $ */ /*- @@ -515,21 +515,7 @@ struct linesw { #ifdef _KERNEL extern struct linesw linesw[]; -#endif - -/* - * Swap device table - */ -struct swdevt { - dev_t sw_dev; - int sw_flags; -}; -#define SW_FREED 0x01 -#define SW_SEQUENTIAL 0x02 -#define sw_freed sw_flags /* XXX compat */ - -#ifdef _KERNEL -extern struct swdevt swdevt[]; +extern dev_t swdevt[]; /* Swap device table */ extern const int chrtoblktbl[]; extern const int nchrtoblktbl; diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c index b2df93b7edf..25a2e8c8e98 100644 --- a/sys/uvm/uvm_swap.c +++ b/sys/uvm/uvm_swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap.c,v 1.171 2024/09/04 07:54:53 mglocker Exp $ */ +/* $OpenBSD: uvm_swap.c,v 1.172 2024/10/30 06:16:27 jsg Exp $ */ /* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */ /* @@ -1007,7 +1007,7 @@ swap_on(struct proc *p, struct swapdev *sdp) * Lock down the last region of primary disk swap, in case * hibernate needs to place a signature there. */ - if (dev == swdevt[0].sw_dev && vp->v_type == VBLK && size > 3 ) { + if (dev == swdevt[0] && vp->v_type == VBLK && size > 3 ) { if (blist_fill(sdp->swd_blist, npages - 1, 1) != 1) panic("hibernate reserve"); } @@ -1964,7 +1964,7 @@ swapmount(void) struct swapdev *sdp; struct swappri *spp; struct vnode *vp; - dev_t swap_dev = swdevt[0].sw_dev; + dev_t swap_dev = swdevt[0]; char *nam; char path[MNAMELEN + 1]; @@ -2037,7 +2037,7 @@ uvm_hibswap(dev_t dev, u_long *sp, u_long *ep) struct swappri *spp; /* no swap devices configured yet? */ - if (uvmexp.nswapdev < 1 || dev != swdevt[0].sw_dev) + if (uvmexp.nswapdev < 1 || dev != swdevt[0]) return (1); LIST_FOREACH(spp, &swap_priority, spi_swappri) { diff --git a/usr.sbin/config/mkswap.c b/usr.sbin/config/mkswap.c index f4a726fbb5d..7c649aed538 100644 --- a/usr.sbin/config/mkswap.c +++ b/usr.sbin/config/mkswap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkswap.c,v 1.19 2021/11/28 19:26:03 deraadt Exp $ */ +/* $OpenBSD: mkswap.c,v 1.20 2024/10/30 06:16:27 jsg Exp $ */ /* $NetBSD: mkswap.c,v 1.5 1996/08/31 20:58:27 mycroft Exp $ */ /* @@ -108,13 +108,13 @@ mkoneswap(struct config *cf) if (fprintf(fp, "dev_t\tdumpdev = %s;\t/* %s */\n", mkdevstr(nv->nv_int), nv->nv_str) < 0) goto wrerror; - if (fputs("\nstruct\tswdevt swdevt[] = {\n", fp) == EOF) + if (fputs("\ndev_t\tswdevt[] = {\n", fp) == EOF) goto wrerror; for (nv = cf->cf_swap; nv != NULL; nv = nv->nv_next) - if (fprintf(fp, "\t{ %s,\t0 },\t/* %s */\n", + if (fprintf(fp, "\t%s,\t/* %s */\n", mkdevstr(nv->nv_int), nv->nv_str) < 0) goto wrerror; - if (fputs("\t{ NODEV, 0 }\n};\n\n", fp) == EOF) + if (fputs("\tNODEV\n};\n\n", fp) == EOF) goto wrerror; mountroot = cf->cf_root->nv_str == s_nfs ? "nfs_mountroot" : "dk_mountroot"; |