CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:32:30 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Assert about dk_openmask under the lock. This serves two purposes: 1. Pacifies data race sanitizers. 2. Ensures that we don't spuriously trip over the assertion if dkclose happens concurrently with dkopen due to a revoke call. To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.122 src/sys/dev/dkwedge/dk.c:1.123 --- src/sys/dev/dkwedge/dk.c:1.122 Mon Aug 22 00:31:57 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:32:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.122 2022/08/22 00:31:57 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.123 2022/08/22 00:32:30 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.122 2022/08/22 00:31:57 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.123 2022/08/22 00:32:30 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1250,11 +1250,11 @@ dkclose(dev_t dev, int flags, int fmt, s if (sc->sc_state != DKW_STATE_RUNNING) return ENXIO; - KASSERT(sc->sc_dk.dk_openmask != 0); - mutex_enter(>sc_dk.dk_openlock); mutex_enter(>sc_parent->dk_rawlock); + KASSERT(sc->sc_dk.dk_openmask != 0); + if (fmt == S_IFCHR) sc->sc_dk.dk_copenmask &= ~1; else
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:32:30 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Assert about dk_openmask under the lock. This serves two purposes: 1. Pacifies data race sanitizers. 2. Ensures that we don't spuriously trip over the assertion if dkclose happens concurrently with dkopen due to a revoke call. To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:31:57 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Revert "dk(4): Narrow scope of dk_rawlock on close to dklastclose." dkfirstopen relies on reading from dk_openmask of _other_ wedges, writes to dk_openmask must be serialized by dk_rawlock in addition to dk_openlock. (However, reads from dk_openlock only require one or the other). To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.121 src/sys/dev/dkwedge/dk.c:1.122 --- src/sys/dev/dkwedge/dk.c:1.121 Mon Aug 22 00:20:36 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:31:57 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.121 2022/08/22 00:20:36 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.122 2022/08/22 00:31:57 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.121 2022/08/22 00:20:36 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.122 2022/08/22 00:31:57 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1253,6 +1253,7 @@ dkclose(dev_t dev, int flags, int fmt, s KASSERT(sc->sc_dk.dk_openmask != 0); mutex_enter(>sc_dk.dk_openlock); + mutex_enter(>sc_parent->dk_rawlock); if (fmt == S_IFCHR) sc->sc_dk.dk_copenmask &= ~1; @@ -1262,11 +1263,10 @@ dkclose(dev_t dev, int flags, int fmt, s sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask; if (sc->sc_dk.dk_openmask == 0) { - mutex_enter(>sc_parent->dk_rawlock); dklastclose(sc); - mutex_exit(>sc_parent->dk_rawlock); } + mutex_exit(>sc_parent->dk_rawlock); mutex_exit(>sc_dk.dk_openlock); return 0;
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:31:57 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Revert "dk(4): Narrow scope of dk_rawlock on close to dklastclose." dkfirstopen relies on reading from dk_openmask of _other_ wedges, writes to dk_openmask must be serialized by dk_rawlock in addition to dk_openlock. (However, reads from dk_openlock only require one or the other). To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:56 UTC 2022 Modified Files: src/sys/dev: cons.c Log Message: cons(4): Don't barge ahead if cdevvp has failed -- return error now. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/dev/cons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/cons.c diff -u src/sys/dev/cons.c:1.78 src/sys/dev/cons.c:1.79 --- src/sys/dev/cons.c:1.78 Mon Aug 22 00:20:45 2022 +++ src/sys/dev/cons.c Mon Aug 22 00:20:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $ */ +/* $NetBSD: cons.c,v 1.79 2022/08/22 00:20:56 riastradh Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.79 2022/08/22 00:20:56 riastradh Exp $"); #include #include @@ -131,8 +131,10 @@ cnopen(dev_t dev, int flag, int mode, st } if (cn_devvp[unit] != NULLVP) return 0; - if ((error = cdevvp(cndev, _devvp[unit])) != 0) + if ((error = cdevvp(cndev, _devvp[unit])) != 0) { printf("cnopen: unable to get vnode reference\n"); + return error; + } vn_lock(cn_devvp[unit], LK_EXCLUSIVE | LK_RETRY); error = VOP_OPEN(cn_devvp[unit], flag, kauth_cred_get()); VOP_UNLOCK(cn_devvp[unit]);
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:56 UTC 2022 Modified Files: src/sys/dev: cons.c Log Message: cons(4): Don't barge ahead if cdevvp has failed -- return error now. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/dev/cons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:45 UTC 2022 Modified Files: src/sys/dev: cons.c Log Message: cons(4): Ignore error from vn_lock(vp, LK_EXCUSIVE|LK_RETRY). This never fails, as is asserted in vn_lock whenever LK_RETRY is set and LK_NOWAIT is not. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/cons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/cons.c diff -u src/sys/dev/cons.c:1.77 src/sys/dev/cons.c:1.78 --- src/sys/dev/cons.c:1.77 Fri Dec 6 04:15:38 2019 +++ src/sys/dev/cons.c Mon Aug 22 00:20:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cons.c,v 1.77 2019/12/06 04:15:38 riastradh Exp $ */ +/* $NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.77 2019/12/06 04:15:38 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $"); #include #include @@ -133,11 +133,9 @@ cnopen(dev_t dev, int flag, int mode, st return 0; if ((error = cdevvp(cndev, _devvp[unit])) != 0) printf("cnopen: unable to get vnode reference\n"); - error = vn_lock(cn_devvp[unit], LK_EXCLUSIVE | LK_RETRY); - if (error == 0) { - error = VOP_OPEN(cn_devvp[unit], flag, kauth_cred_get()); - VOP_UNLOCK(cn_devvp[unit]); - } + vn_lock(cn_devvp[unit], LK_EXCLUSIVE | LK_RETRY); + error = VOP_OPEN(cn_devvp[unit], flag, kauth_cred_get()); + VOP_UNLOCK(cn_devvp[unit]); return error; } @@ -154,12 +152,10 @@ cnclose(dev_t dev, int flag, int mode, s vp = cn_devvp[unit]; cn_devvp[unit] = NULL; - error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (error == 0) { - error = VOP_CLOSE(vp, flag, kauth_cred_get()); - VOP_UNLOCK(vp); - vrele(vp); - } + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + error = VOP_CLOSE(vp, flag, kauth_cred_get()); + VOP_UNLOCK(vp); + vrele(vp); return error; }
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:45 UTC 2022 Modified Files: src/sys/dev: cons.c Log Message: cons(4): Ignore error from vn_lock(vp, LK_EXCUSIVE|LK_RETRY). This never fails, as is asserted in vn_lock whenever LK_RETRY is set and LK_NOWAIT is not. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/cons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:36 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): dklastclose never fails. Make it return void. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.120 src/sys/dev/dkwedge/dk.c:1.121 --- src/sys/dev/dkwedge/dk.c:1.120 Mon Aug 22 00:20:27 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:20:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.120 2022/08/22 00:20:27 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.121 2022/08/22 00:20:36 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.120 2022/08/22 00:20:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.121 2022/08/22 00:20:36 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -98,7 +98,7 @@ static void dkrestart(void *); static void dkminphys(struct buf *); static int dkfirstopen(struct dkwedge_softc *, int); -static int dklastclose(struct dkwedge_softc *); +static void dklastclose(struct dkwedge_softc *); static int dkwedge_cleanup_parent(struct dkwedge_softc *, int); static int dkwedge_detach(device_t, int); static void dkwedge_delall1(struct disk *, bool); @@ -588,7 +588,7 @@ dkwedge_cleanup_parent(struct dkwedge_so rc = EBUSY; } else { mutex_enter(>sc_parent->dk_rawlock); - rc = dklastclose(sc); + dklastclose(sc); mutex_exit(>sc_parent->dk_rawlock); } mutex_exit(>sc_dk.dk_openlock); @@ -1215,7 +1215,7 @@ dkfirstopen(struct dkwedge_softc *sc, in return 0; } -static int +static void dklastclose(struct dkwedge_softc *sc) { @@ -1233,8 +1233,6 @@ dklastclose(struct dkwedge_softc *sc) dk_close_parent(vp, mode); } - - return 0; } /* @@ -1246,12 +1244,11 @@ static int dkclose(dev_t dev, int flags, int fmt, struct lwp *l) { struct dkwedge_softc *sc = dkwedge_lookup(dev); - int error = 0; if (sc == NULL) - return (ENODEV); + return ENODEV; if (sc->sc_state != DKW_STATE_RUNNING) - return (ENXIO); + return ENXIO; KASSERT(sc->sc_dk.dk_openmask != 0); @@ -1266,13 +1263,13 @@ dkclose(dev_t dev, int flags, int fmt, s if (sc->sc_dk.dk_openmask == 0) { mutex_enter(>sc_parent->dk_rawlock); - error = dklastclose(sc); + dklastclose(sc); mutex_exit(>sc_parent->dk_rawlock); } mutex_exit(>sc_dk.dk_openlock); - return (error); + return 0; } /*
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:36 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): dklastclose never fails. Make it return void. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:27 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Simplify dklastclose. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.119 src/sys/dev/dkwedge/dk.c:1.120 --- src/sys/dev/dkwedge/dk.c:1.119 Mon Aug 22 00:20:18 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:20:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.119 2022/08/22 00:20:18 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.120 2022/08/22 00:20:27 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.119 2022/08/22 00:20:18 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.120 2022/08/22 00:20:27 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1218,30 +1218,23 @@ dkfirstopen(struct dkwedge_softc *sc, in static int dklastclose(struct dkwedge_softc *sc) { - struct vnode *vp; - int error = 0, mode; KASSERT(mutex_owned(>sc_dk.dk_openlock)); KASSERT(mutex_owned(>sc_parent->dk_rawlock)); KASSERT(sc->sc_parent->dk_rawopens > 0); + KASSERT(sc->sc_parent->dk_rawvp != NULL); - mode = sc->sc_mode; + if (--sc->sc_parent->dk_rawopens == 0) { + struct vnode *const vp = sc->sc_parent->dk_rawvp; + const int mode = sc->sc_mode; - vp = NULL; - if (sc->sc_parent->dk_rawopens > 0) { - if (--sc->sc_parent->dk_rawopens == 0) { - KASSERT(sc->sc_parent->dk_rawvp != NULL); - vp = sc->sc_parent->dk_rawvp; - sc->sc_parent->dk_rawvp = NULL; - sc->sc_mode = 0; - } - } + sc->sc_parent->dk_rawvp = NULL; + sc->sc_mode = 0; - if (vp) { dk_close_parent(vp, mode); } - return error; + return 0; } /*
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:27 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Simplify dklastclose. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:18 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Assert parent is open in dklastclose. It is not possible for us to be closing a wedge whose parent is not open by at least this wedge. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.118 src/sys/dev/dkwedge/dk.c:1.119 --- src/sys/dev/dkwedge/dk.c:1.118 Mon Aug 22 00:20:03 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:20:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.118 2022/08/22 00:20:03 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.119 2022/08/22 00:20:18 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.118 2022/08/22 00:20:03 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.119 2022/08/22 00:20:18 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1223,6 +1223,7 @@ dklastclose(struct dkwedge_softc *sc) KASSERT(mutex_owned(>sc_dk.dk_openlock)); KASSERT(mutex_owned(>sc_parent->dk_rawlock)); + KASSERT(sc->sc_parent->dk_rawopens > 0); mode = sc->sc_mode;
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:18 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Assert parent is open in dklastclose. It is not possible for us to be closing a wedge whose parent is not open by at least this wedge. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:03 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Move first-open logic to new dkfirstopen function. Makes the logic more clearly pair with dklastclose. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.117 src/sys/dev/dkwedge/dk.c:1.118 --- src/sys/dev/dkwedge/dk.c:1.117 Mon Aug 22 00:19:53 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:20:03 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.117 2022/08/22 00:19:53 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.118 2022/08/22 00:20:03 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.117 2022/08/22 00:19:53 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.118 2022/08/22 00:20:03 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -97,6 +97,7 @@ static void dkiodone(struct buf *); static void dkrestart(void *); static void dkminphys(struct buf *); +static int dkfirstopen(struct dkwedge_softc *, int); static int dklastclose(struct dkwedge_softc *); static int dkwedge_cleanup_parent(struct dkwedge_softc *, int); static int dkwedge_detach(device_t, int); @@ -1132,10 +1133,7 @@ static int dkopen(dev_t dev, int flags, int fmt, struct lwp *l) { struct dkwedge_softc *sc = dkwedge_lookup(dev); - struct dkwedge_softc *nsc; - struct vnode *vp; int error = 0; - int mode; if (sc == NULL) return (ENODEV); @@ -1151,35 +1149,9 @@ dkopen(dev_t dev, int flags, int fmt, st mutex_enter(>sc_dk.dk_openlock); mutex_enter(>sc_parent->dk_rawlock); if (sc->sc_dk.dk_openmask == 0) { - if (sc->sc_parent->dk_rawopens == 0) { - KASSERT(sc->sc_parent->dk_rawvp == NULL); - /* - * Try open read-write. If this fails for EROFS - * and wedge is read-only, retry to open read-only. - */ - mode = FREAD | FWRITE; - error = dk_open_parent(sc->sc_pdev, mode, ); - if (error == EROFS && (flags & FWRITE) == 0) { -mode &= ~FWRITE; -error = dk_open_parent(sc->sc_pdev, mode, ); - } - if (error) -goto popen_fail; - sc->sc_parent->dk_rawvp = vp; - } else { - /* - * Retrieve mode from an already opened wedge. - */ - mode = 0; - LIST_FOREACH(nsc, >sc_parent->dk_wedges, sc_plink) { -if (nsc == sc || nsc->sc_dk.dk_openmask == 0) - continue; -mode = nsc->sc_mode; -break; - } - } - sc->sc_mode = mode; - sc->sc_parent->dk_rawopens++; + error = dkfirstopen(sc, flags); + if (error) + goto popen_fail; } KASSERT(sc->sc_mode != 0); if (flags & ~sc->sc_mode & FWRITE) { @@ -1200,6 +1172,50 @@ dkopen(dev_t dev, int flags, int fmt, st } static int +dkfirstopen(struct dkwedge_softc *sc, int flags) +{ + struct dkwedge_softc *nsc; + struct vnode *vp; + int mode; + int error; + + KASSERT(mutex_owned(>sc_dk.dk_openlock)); + KASSERT(mutex_owned(>sc_parent->dk_rawlock)); + + if (sc->sc_parent->dk_rawopens == 0) { + KASSERT(sc->sc_parent->dk_rawvp == NULL); + /* + * Try open read-write. If this fails for EROFS + * and wedge is read-only, retry to open read-only. + */ + mode = FREAD | FWRITE; + error = dk_open_parent(sc->sc_pdev, mode, ); + if (error == EROFS && (flags & FWRITE) == 0) { + mode &= ~FWRITE; + error = dk_open_parent(sc->sc_pdev, mode, ); + } + if (error) + return error; + sc->sc_parent->dk_rawvp = vp; + } else { + /* + * Retrieve mode from an already opened wedge. + */ + mode = 0; + LIST_FOREACH(nsc, >sc_parent->dk_wedges, sc_plink) { + if (nsc == sc || nsc->sc_dk.dk_openmask == 0) +continue; + mode = nsc->sc_mode; + break; + } + } + sc->sc_mode = mode; + sc->sc_parent->dk_rawopens++; + + return 0; +} + +static int dklastclose(struct dkwedge_softc *sc) { struct vnode *vp;
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:20:03 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Move first-open logic to new dkfirstopen function. Makes the logic more clearly pair with dklastclose. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:53 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Turn locking contract comment into assertions in dklastclose. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.116 src/sys/dev/dkwedge/dk.c:1.117 --- src/sys/dev/dkwedge/dk.c:1.116 Mon Aug 22 00:19:43 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:19:53 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.116 2022/08/22 00:19:43 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.117 2022/08/22 00:19:53 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.116 2022/08/22 00:19:43 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.117 2022/08/22 00:19:53 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1199,15 +1199,15 @@ dkopen(dev_t dev, int flags, int fmt, st return (error); } -/* - * Caller must hold sc->sc_dk.dk_openlock and sc->sc_parent->dk_rawlock. - */ static int dklastclose(struct dkwedge_softc *sc) { struct vnode *vp; int error = 0, mode; + KASSERT(mutex_owned(>sc_dk.dk_openlock)); + KASSERT(mutex_owned(>sc_parent->dk_rawlock)); + mode = sc->sc_mode; vp = NULL;
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:53 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Turn locking contract comment into assertions in dklastclose. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:43 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Narrow scope of dk_rawlock on close to dklastclose. No need to take it if we're not actually going to close the parent. No functional change intended; dk_rawlock is only supposed to serialize dk_rawopens access and open/close of the parent, after all. To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.115 src/sys/dev/dkwedge/dk.c:1.116 --- src/sys/dev/dkwedge/dk.c:1.115 Mon Aug 22 00:19:33 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:19:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.115 2022/08/22 00:19:33 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.116 2022/08/22 00:19:43 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.115 2022/08/22 00:19:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.116 2022/08/22 00:19:43 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1246,7 +1246,6 @@ dkclose(dev_t dev, int flags, int fmt, s KASSERT(sc->sc_dk.dk_openmask != 0); mutex_enter(>sc_dk.dk_openlock); - mutex_enter(>sc_parent->dk_rawlock); if (fmt == S_IFCHR) sc->sc_dk.dk_copenmask &= ~1; @@ -1256,10 +1255,11 @@ dkclose(dev_t dev, int flags, int fmt, s sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask; if (sc->sc_dk.dk_openmask == 0) { + mutex_enter(>sc_parent->dk_rawlock); error = dklastclose(sc); + mutex_exit(>sc_parent->dk_rawlock); } - mutex_exit(>sc_parent->dk_rawlock); mutex_exit(>sc_dk.dk_openlock); return (error);
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:43 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Narrow scope of dk_rawlock on close to dklastclose. No need to take it if we're not actually going to close the parent. No functional change intended; dk_rawlock is only supposed to serialize dk_rawopens access and open/close of the parent, after all. To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:33 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Factor common mutex_exit out of branches to keep it balanced. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.114 src/sys/dev/dkwedge/dk.c:1.115 --- src/sys/dev/dkwedge/dk.c:1.114 Mon Aug 22 00:19:22 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:19:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.114 2022/08/22 00:19:22 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.115 2022/08/22 00:19:33 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.114 2022/08/22 00:19:22 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.115 2022/08/22 00:19:33 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -581,18 +581,16 @@ dkwedge_cleanup_parent(struct dkwedge_so rc = 0; mutex_enter(>dk_openlock); - if (dk->dk_openmask == 0) + if (dk->dk_openmask == 0) { /* nothing to do */ - mutex_exit(>dk_openlock); - else if ((flags & DETACH_FORCE) == 0) { + } else if ((flags & DETACH_FORCE) == 0) { rc = EBUSY; - mutex_exit(>dk_openlock); } else { mutex_enter(>sc_parent->dk_rawlock); rc = dklastclose(sc); mutex_exit(>sc_parent->dk_rawlock); - mutex_exit(>sc_dk.dk_openlock); } + mutex_exit(>sc_dk.dk_openlock); return rc; } @@ -1259,13 +1257,11 @@ dkclose(dev_t dev, int flags, int fmt, s if (sc->sc_dk.dk_openmask == 0) { error = dklastclose(sc); - mutex_exit(>sc_parent->dk_rawlock); - mutex_exit(>sc_dk.dk_openlock); - } else { - mutex_exit(>sc_parent->dk_rawlock); - mutex_exit(>sc_dk.dk_openlock); } + mutex_exit(>sc_parent->dk_rawlock); + mutex_exit(>sc_dk.dk_openlock); + return (error); }
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:33 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Factor common mutex_exit out of branches to keep it balanced. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:22 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Move lock release out of dklastclose into caller. No longer necessary to have this unbalanced logic now that dk_close_parent correctly happens under the lock in order to serialize with dk_open_parent. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.113 src/sys/dev/dkwedge/dk.c:1.114 --- src/sys/dev/dkwedge/dk.c:1.113 Mon Aug 22 00:19:12 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:19:22 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.113 2022/08/22 00:19:12 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.114 2022/08/22 00:19:22 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.113 2022/08/22 00:19:12 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.114 2022/08/22 00:19:22 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -589,7 +589,9 @@ dkwedge_cleanup_parent(struct dkwedge_so mutex_exit(>dk_openlock); } else { mutex_enter(>sc_parent->dk_rawlock); - rc = dklastclose(sc); /* releases locks */ + rc = dklastclose(sc); + mutex_exit(>sc_parent->dk_rawlock); + mutex_exit(>sc_dk.dk_openlock); } return rc; @@ -1224,9 +1226,6 @@ dklastclose(struct dkwedge_softc *sc) dk_close_parent(vp, mode); } - mutex_exit(>sc_parent->dk_rawlock); - mutex_exit(>sc_dk.dk_openlock); - return error; } @@ -1259,7 +1258,9 @@ dkclose(dev_t dev, int flags, int fmt, s sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask; if (sc->sc_dk.dk_openmask == 0) { - error = dklastclose(sc); /* releases locks */ + error = dklastclose(sc); + mutex_exit(>sc_parent->dk_rawlock); + mutex_exit(>sc_dk.dk_openlock); } else { mutex_exit(>sc_parent->dk_rawlock); mutex_exit(>sc_dk.dk_openlock);
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:22 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Move lock release out of dklastclose into caller. No longer necessary to have this unbalanced logic now that dk_close_parent correctly happens under the lock in order to serialize with dk_open_parent. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:13 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Serialize closing parent's dk_rawvp with opening it. Otherwise, the following events might happen: - process 123 had /dev/rdkN open, starts close, enters dk_close_parent - process 456 opens /dev/rdkM (same parent, different wedge), calls dk_open_parent At this point, the block device hasn't yet closed, so dk_open_parent will fail with EBUSY. This is incorrect -- the chardev is never supposed to fail with EBUSY, and dkopen/dkclose carefully manage state to avoid opening the block device while it's still open. The problem is that dkopen in process 456 didn't wait for vn_close in process 123 to finish before calling VOP_OPEN. (Note: If it were the _same_ chardev /dev/rdkN in both processes, then spec_open/close would prevent this. But since it's a _different_ chardev, spec_open/close assume that concurrency is OK, and it's the driver's responsibility to serialize access to the parent disk which, unbeknownst to spec_open/close, is shared between dkN and dkM.) It appears that the vn_close call was previously moved outside dk_rawlock in 2010 to work around an unrelated bug in raidframe that had already been fixed in HEAD: Crash pointing to dk_rawlock and raidclose: https://mail-index.netbsd.org/tech-kern/2010/07/27/msg008612.html Change working around that crash: https://mail-index.netbsd.org/source-changes/2010/08/04/msg012270.html Change removing raidclose -> mutex_destroy(_rawlock) path: https://mail-index.netbsd.org/source-changes/2009/07/23/msg223381.html To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.112 src/sys/dev/dkwedge/dk.c:1.113 --- src/sys/dev/dkwedge/dk.c:1.112 Sat Jun 11 18:17:00 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:19:12 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.112 2022/06/11 18:17:00 martin Exp $ */ +/* $NetBSD: dk.c,v 1.113 2022/08/22 00:19:12 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.112 2022/06/11 18:17:00 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.113 2022/08/22 00:19:12 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1220,13 +1220,13 @@ dklastclose(struct dkwedge_softc *sc) } } - mutex_exit(>sc_parent->dk_rawlock); - mutex_exit(>sc_dk.dk_openlock); - if (vp) { dk_close_parent(vp, mode); } + mutex_exit(>sc_parent->dk_rawlock); + mutex_exit(>sc_dk.dk_openlock); + return error; }
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: riastradh Date: Mon Aug 22 00:19:13 UTC 2022 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: dk(4): Serialize closing parent's dk_rawvp with opening it. Otherwise, the following events might happen: - process 123 had /dev/rdkN open, starts close, enters dk_close_parent - process 456 opens /dev/rdkM (same parent, different wedge), calls dk_open_parent At this point, the block device hasn't yet closed, so dk_open_parent will fail with EBUSY. This is incorrect -- the chardev is never supposed to fail with EBUSY, and dkopen/dkclose carefully manage state to avoid opening the block device while it's still open. The problem is that dkopen in process 456 didn't wait for vn_close in process 123 to finish before calling VOP_OPEN. (Note: If it were the _same_ chardev /dev/rdkN in both processes, then spec_open/close would prevent this. But since it's a _different_ chardev, spec_open/close assume that concurrency is OK, and it's the driver's responsibility to serialize access to the parent disk which, unbeknownst to spec_open/close, is shared between dkN and dkM.) It appears that the vn_close call was previously moved outside dk_rawlock in 2010 to work around an unrelated bug in raidframe that had already been fixed in HEAD: Crash pointing to dk_rawlock and raidclose: https://mail-index.netbsd.org/tech-kern/2010/07/27/msg008612.html Change working around that crash: https://mail-index.netbsd.org/source-changes/2010/08/04/msg012270.html Change removing raidclose -> mutex_destroy(_rawlock) path: https://mail-index.netbsd.org/source-changes/2009/07/23/msg223381.html To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/rump/librump/rumpkern/arch/generic
Module Name:src Committed By: riastradh Date: Sun Aug 21 22:28:26 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c Log Message: rump: Define pmap_resident_count, pmap_wired_count conditionally. These definitions will not be used by anything yet because on every architecture except x86 as of yeterday, pmap_resident_count and pmap_wired_count are defined as macros anyway. But if more struct pmaps are made private these definitions will get used. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c diff -u src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.6 src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.7 --- src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.6 Sun Aug 21 16:55:14 2022 +++ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c Sun Aug 21 22:28:26 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_generic_pmap.c,v 1.6 2022/08/21 16:55:14 mlelstv Exp $ */ +/* $NetBSD: rump_generic_pmap.c,v 1.7 2022/08/21 22:28:26 riastradh Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.6 2022/08/21 16:55:14 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.7 2022/08/21 22:28:26 riastradh Exp $"); #include @@ -89,16 +89,20 @@ pmap_clear_modify(struct vm_page *pg) return false; } +#ifndef pmap_resident_count long pmap_resident_count(struct pmap *pmap) { return 0; } +#endif +#ifndef pmap_wired_count long pmap_wired_count(struct pmap *pmap) { return 0; } +#endif
CVS commit: src/sys/rump/librump/rumpkern/arch/generic
Module Name:src Committed By: riastradh Date: Sun Aug 21 22:28:26 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c Log Message: rump: Define pmap_resident_count, pmap_wired_count conditionally. These definitions will not be used by anything yet because on every architecture except x86 as of yeterday, pmap_resident_count and pmap_wired_count are defined as macros anyway. But if more struct pmaps are made private these definitions will get used. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sh
Module Name:src Committed By: nia Date: Sun Aug 21 21:35:36 UTC 2022 Modified Files: src/bin/sh: histedit.c Log Message: sh(1): revert previous because it interferes with custom user bindings To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/bin/sh/histedit.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/sh/histedit.c diff -u src/bin/sh/histedit.c:1.63 src/bin/sh/histedit.c:1.64 --- src/bin/sh/histedit.c:1.63 Thu Aug 18 14:10:05 2022 +++ src/bin/sh/histedit.c Sun Aug 21 21:35:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: histedit.c,v 1.63 2022/08/18 14:10:05 nia Exp $ */ +/* $NetBSD: histedit.c,v 1.64 2022/08/21 21:35:36 nia Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: histedit.c,v 1.63 2022/08/18 14:10:05 nia Exp $"); +__RCSID("$NetBSD: histedit.c,v 1.64 2022/08/21 21:35:36 nia Exp $"); #endif #endif /* not lint */ @@ -176,11 +176,11 @@ bad: } if (el) { INTOFF; - el_source(el, lookupvar("EDITRC")); if (Vflag) el_set(el, EL_EDITOR, "vi"); else if (Eflag) el_set(el, EL_EDITOR, "emacs"); + el_source(el, lookupvar("EDITRC")); el_set(el, EL_BIND, "^I", tabcomplete ? "rl-complete" : "ed-insert", NULL); INTON;
CVS commit: src/bin/sh
Module Name:src Committed By: nia Date: Sun Aug 21 21:35:36 UTC 2022 Modified Files: src/bin/sh: histedit.c Log Message: sh(1): revert previous because it interferes with custom user bindings To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/bin/sh/histedit.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/ksh
Module Name:src Committed By: uwe Date: Sun Aug 21 20:12:37 UTC 2022 Modified Files: src/bin/ksh: ksh.Man Log Message: ksh(1): fix pasto in the description of the -l option. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/bin/ksh/ksh.Man Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ksh/ksh.Man diff -u src/bin/ksh/ksh.Man:1.28 src/bin/ksh/ksh.Man:1.29 --- src/bin/ksh/ksh.Man:1.28 Sun Aug 7 11:06:18 2022 +++ src/bin/ksh/ksh.Man Sun Aug 21 20:12:37 2022 @@ -1,5 +1,5 @@ '\" t -.\" $NetBSD: ksh.Man,v 1.28 2022/08/07 11:06:18 andvar Exp $ +.\" $NetBSD: ksh.Man,v 1.29 2022/08/21 20:12:37 uwe Exp $ .\"{{{}}} .\"{{{ Notes about man page .\" - use the pseudo-macros .sh( and .sh) to begin and end sh-specific @@ -66,7 +66,6 @@ the shell executes the command(s) contai interactive mode \(em see below .IP \fB\-l\fP login shell \(em see below -interactive mode \(em see below .IP \fB\-s\fP the shell reads commands from standard input; all non-option arguments are positional parameters
CVS commit: src/bin/ksh
Module Name:src Committed By: uwe Date: Sun Aug 21 20:12:37 UTC 2022 Modified Files: src/bin/ksh: ksh.Man Log Message: ksh(1): fix pasto in the description of the -l option. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/bin/ksh/ksh.Man Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/cddl/osnet/dev/dtrace/i386
Module Name:src Committed By: riastradh Date: Sun Aug 21 18:58:45 UTC 2022 Modified Files: src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c Log Message: dtrace/i386: Need machine/cpufunc.h for x86_read_flags and rcr2. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c diff -u src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.13 src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.14 --- src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.13 Tue Apr 6 12:48:59 2021 +++ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c Sun Aug 21 18:58:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dtrace_subr.c,v 1.13 2021/04/06 12:48:59 simonb Exp $ */ +/* $NetBSD: dtrace_subr.c,v 1.14 2022/08/21 18:58:45 riastradh Exp $ */ /* * CDDL HEADER START @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include
CVS commit: src/external/cddl/osnet/dev/dtrace/i386
Module Name:src Committed By: riastradh Date: Sun Aug 21 18:58:45 UTC 2022 Modified Files: src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c Log Message: dtrace/i386: Need machine/cpufunc.h for x86_read_flags and rcr2. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/rump/librump/rumpkern/arch/generic
Module Name:src Committed By: mlelstv Date: Sun Aug 21 16:55:14 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c Log Message: Add stubs for pmap_resident_count, pmap_wired_count. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c diff -u src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.5 src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.6 --- src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.5 Tue Jan 26 23:12:18 2016 +++ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c Sun Aug 21 16:55:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_generic_pmap.c,v 1.5 2016/01/26 23:12:18 pooka Exp $ */ +/* $NetBSD: rump_generic_pmap.c,v 1.6 2022/08/21 16:55:14 mlelstv Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.5 2016/01/26 23:12:18 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.6 2022/08/21 16:55:14 mlelstv Exp $"); #include @@ -88,3 +88,17 @@ pmap_clear_modify(struct vm_page *pg) return false; } + +long +pmap_resident_count(struct pmap *pmap) + +{ + return 0; +} + +long +pmap_wired_count(struct pmap *pmap) +{ + + return 0; +}
CVS commit: src/sys/rump/librump/rumpkern/arch/generic
Module Name:src Committed By: mlelstv Date: Sun Aug 21 16:55:14 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c Log Message: Add stubs for pmap_resident_count, pmap_wired_count. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: brook Date: Sun Aug 21 15:01:08 UTC 2022 Modified Files: src: BUILDING src/etc/etc.evbarm: Makefile.inc src/share/man/man7: release.7 Log Message: Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. Release builds for arm platforms create compressed images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot blocks must be manually installed in the images, which is an extra barrier for testing systems or adopting NetBSD. This has prompted creation of external repositories, e.g., armbsd.org, to host a collection of bootable images. However, this does not ease the burden on developers compiling their own systems; for them, manual installation of boot blocks is still required. For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands used to create system images. Because installboot(8) can write boot blocks directly to system images, a loop through possible boards can create a series of bootable images during the normal build process. In the case of many arm platforms, installboot(8) uses U-Boot boot blocks, which are not part of the NetBSD source code. Developers can, however, install as many U-Boot boot blocks as desired, either in the default location of /usr/pkg/share/u-boot or in a set of directories pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS environment variable. For each board with an available boot block, a board-specific bootable image will be created in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is not available, which is the typical situation currently, no additional image will be created. This facility creates opportunities to build bootable images for any number of boards within the scope of a standard release build. However, that is not required and will not occur without the intervention of installing U-Boot boot blocks prior to the build. To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.144 src/BUILDING cvs rdiff -u -r1.126 -r1.127 src/etc/etc.evbarm/Makefile.inc cvs rdiff -u -r1.39 -r1.40 src/share/man/man7/release.7 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: brook Date: Sun Aug 21 15:01:08 UTC 2022 Modified Files: src: BUILDING src/etc/etc.evbarm: Makefile.inc src/share/man/man7: release.7 Log Message: Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. Release builds for arm platforms create compressed images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot blocks must be manually installed in the images, which is an extra barrier for testing systems or adopting NetBSD. This has prompted creation of external repositories, e.g., armbsd.org, to host a collection of bootable images. However, this does not ease the burden on developers compiling their own systems; for them, manual installation of boot blocks is still required. For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands used to create system images. Because installboot(8) can write boot blocks directly to system images, a loop through possible boards can create a series of bootable images during the normal build process. In the case of many arm platforms, installboot(8) uses U-Boot boot blocks, which are not part of the NetBSD source code. Developers can, however, install as many U-Boot boot blocks as desired, either in the default location of /usr/pkg/share/u-boot or in a set of directories pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS environment variable. For each board with an available boot block, a board-specific bootable image will be created in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is not available, which is the typical situation currently, no additional image will be created. This facility creates opportunities to build bootable images for any number of boards within the scope of a standard release build. However, that is not required and will not occur without the intervention of installing U-Boot boot blocks prior to the build. To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.144 src/BUILDING cvs rdiff -u -r1.126 -r1.127 src/etc/etc.evbarm/Makefile.inc cvs rdiff -u -r1.39 -r1.40 src/share/man/man7/release.7 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/BUILDING diff -u src/BUILDING:1.143 src/BUILDING:1.144 --- src/BUILDING:1.143 Sun Aug 21 07:12:54 2022 +++ src/BUILDING Sun Aug 21 15:01:08 2022 @@ -153,6 +153,13 @@ CONFIGURATION cannot usefully be set inside a Makefile, including mk.conf or ${MAKECONF}. + INSTALLBOOT_UBOOT_PATHS + A colon-separated list of search paths used by + installboot to find U-Boot packages; see + installboot(8). If appropriate U-Boot packages + are installed, bootable images are created as + part of a release. + "make" variables Several variables control the behavior of NetBSD builds. Unless otherwise specified, these variables may be set in either the process Index: src/etc/etc.evbarm/Makefile.inc diff -u src/etc/etc.evbarm/Makefile.inc:1.126 src/etc/etc.evbarm/Makefile.inc:1.127 --- src/etc/etc.evbarm/Makefile.inc:1.126 Fri May 20 16:12:34 2022 +++ src/etc/etc.evbarm/Makefile.inc Sun Aug 21 15:01:08 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.126 2022/05/20 16:12:34 rin Exp $ +# $NetBSD: Makefile.inc,v 1.127 2022/08/21 15:01:08 brook Exp $ # # etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets # @@ -92,6 +92,15 @@ IMAGE.dir= ${IMAGE.rel}/binary/gzimg IMAGE.kern= ${IMAGE.rel}/binary/kernel IMAGE.instk= ${IMAGE.rel}/installation/instkernel +# list of boards supported by installboot(8); a bootable image will be +# created for each (if the corresponding U-Boot package is installed +# in one of the directories listed in the environment variable +# INSTALLBOOT_UBOOT_PATHS) +# +INSTALLBOOT_BOARDS!= \ + ${TOOL_INSTALLBOOT} -m ${MACHINE} 2>&1 \ + | ${TOOL_AWK} 'BEGIN { FS=" " } { if (BOARDS) print $$1 } /^Known boards/{ BOARDS=1 }' + __mkimage: .USE TOOL_MAKE=${MAKE} \ TOOL_MAKEFS=${TOOL_MAKEFS} \ @@ -110,6 +119,17 @@ __mkimage: .USE ${HOST_SH} ${MKIMAGE} -x -h ${.TARGET:S/smp_//} -D ${DESTDIR} \ -S ${NETBSDSRCDIR} -B ${IMAGEENDIAN} ${MKI_OPTS.${.TARGET}} \ ${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz + ${TOOL_GZIP} -cd ${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz \ + > ${IMAGE.dir}/${.TARGET:S/smp_//}.img +.for f in ${INSTALLBOOT_BOARDS} + @echo "===> Making bootable image ${IMAGE.dir:T}/${.TARGET:S/smp_//}-${f}.img.gz" + @cp ${IMAGE.dir}/${.TARGET:S/smp_//}.img ${IMAGE.dir}/${.TARGET:S/smp_//}-${f}.img + @${TOOL_INSTALLBOOT} -m ${MACHINE} -o board=${f} \ + ${IMAGE.dir}/${.TARGET:S/smp_//}-${f}.img \ + && ${TOOL_GZIP} -f ${IMAGE.dir}/${.TARGET:S/smp_//}-${f}.img \ + || rm
CVS commit: src/sys/dev/pci
Module Name:src Committed By: thorpej Date: Sun Aug 21 14:42:24 UTC 2022 Modified Files: src/sys/dev/pci: if_jme.c Log Message: jme_ifstart(): Replace "IFQ_DEQUEUE() -> IF_PREPEND() on failure" with "IFQ_POLL() -> IFQ_DEQUEUE() on success (and fatal-to-packet errors)". To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/if_jme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_jme.c diff -u src/sys/dev/pci/if_jme.c:1.53 src/sys/dev/pci/if_jme.c:1.54 --- src/sys/dev/pci/if_jme.c:1.53 Sun Aug 21 14:36:15 2022 +++ src/sys/dev/pci/if_jme.c Sun Aug 21 14:42:24 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_jme.c,v 1.53 2022/08/21 14:36:15 thorpej Exp $ */ +/* $NetBSD: if_jme.c,v 1.54 2022/08/21 14:42:24 thorpej Exp $ */ /* * Copyright (c) 2008 Manuel Bouyer. All rights reserved. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.53 2022/08/21 14:36:15 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.54 2022/08/21 14:42:24 thorpej Exp $"); #include @@ -1636,7 +1636,7 @@ jme_ifstart(struct ifnet *ifp) for (enq = 0;; enq++) { nexttx: /* Grab a paquet for output */ - IFQ_DEQUEUE(>if_snd, mb_head); + IFQ_POLL(>if_snd, mb_head); if (mb_head == NULL) { #ifdef JMEDEBUG_TX printf("%s: nothing to send\n", __func__); @@ -1647,15 +1647,17 @@ nexttx: if ((error = jme_encap(sc, mb_head)) != 0) { if (error == EFBIG) { /* This error is fatal to the packet. */ +IFQ_DEQUEUE(>if_snd, mb_head); m_freem(mb_head); if_statinc(ifp, if_oerrors); goto nexttx; } /* resource shortage, try again later */ - IF_PREPEND(>if_snd, mb_head); ifp->if_flags |= IFF_OACTIVE; break; } + IFQ_DEQUEUE(>if_snd, mb_head); + /* Pass packet to bpf if there is a listener */ bpf_mtap(ifp, mb_head, BPF_D_OUT); }
CVS commit: src/sys/dev/pci
Module Name:src Committed By: thorpej Date: Sun Aug 21 14:42:24 UTC 2022 Modified Files: src/sys/dev/pci: if_jme.c Log Message: jme_ifstart(): Replace "IFQ_DEQUEUE() -> IF_PREPEND() on failure" with "IFQ_POLL() -> IFQ_DEQUEUE() on success (and fatal-to-packet errors)". To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/if_jme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: thorpej Date: Sun Aug 21 14:36:15 UTC 2022 Modified Files: src/sys/dev/pci: if_jme.c Log Message: Don't allow jme_encap() to modify the head-of-mbuf-chain pointer. Instead, act on fatal packet errors in jme_ifstart(). To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/if_jme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_jme.c diff -u src/sys/dev/pci/if_jme.c:1.52 src/sys/dev/pci/if_jme.c:1.53 --- src/sys/dev/pci/if_jme.c:1.52 Sun Aug 21 14:12:59 2022 +++ src/sys/dev/pci/if_jme.c Sun Aug 21 14:36:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_jme.c,v 1.52 2022/08/21 14:12:59 thorpej Exp $ */ +/* $NetBSD: if_jme.c,v 1.53 2022/08/21 14:36:15 thorpej Exp $ */ /* * Copyright (c) 2008 Manuel Bouyer. All rights reserved. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.52 2022/08/21 14:12:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.53 2022/08/21 14:36:15 thorpej Exp $"); #include @@ -1320,10 +1320,9 @@ jme_ifioctl(struct ifnet *ifp, unsigned } static int -jme_encap(struct jme_softc *sc, struct mbuf **m_headp) +jme_encap(struct jme_softc *sc, struct mbuf * const m) { struct jme_desc *desc; - struct mbuf * const m = *m_headp; int error, i, prod, headdsc, nsegs; uint32_t cflags, tso_segsz; @@ -1427,8 +1426,7 @@ jme_encap(struct jme_softc *sc, struct m log(LOG_ERR, "%s: Tx packet consumes too many " "DMA segments, dropping...\n", device_xname(sc->jme_dev)); - m_freem(m); - *m_headp = NULL; + /* Caller will free the packet. */ } return (error); } @@ -1623,7 +1621,7 @@ jme_ifstart(struct ifnet *ifp) { jme_softc_t *sc = ifp->if_softc; struct mbuf *mb_head; - int enq; + int enq, error; /* * check if we can free some desc. @@ -1646,10 +1644,11 @@ nexttx: break; } /* try to add this mbuf to the TX ring */ - if (jme_encap(sc, _head)) { - if (mb_head == NULL) { + if ((error = jme_encap(sc, mb_head)) != 0) { + if (error == EFBIG) { +/* This error is fatal to the packet. */ +m_freem(mb_head); if_statinc(ifp, if_oerrors); -/* packet dropped, try next one */ goto nexttx; } /* resource shortage, try again later */
CVS commit: src/sys/dev/pci
Module Name:src Committed By: thorpej Date: Sun Aug 21 14:36:15 UTC 2022 Modified Files: src/sys/dev/pci: if_jme.c Log Message: Don't allow jme_encap() to modify the head-of-mbuf-chain pointer. Instead, act on fatal packet errors in jme_ifstart(). To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/if_jme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: thorpej Date: Sun Aug 21 14:13:00 UTC 2022 Modified Files: src/sys/dev/pci: if_jme.c Log Message: jme_encap(): Fix up some botched formatting, and don't use (*m_head) all over the place (just assign m = *m_head earlier). NFCI. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/pci/if_jme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_jme.c diff -u src/sys/dev/pci/if_jme.c:1.51 src/sys/dev/pci/if_jme.c:1.52 --- src/sys/dev/pci/if_jme.c:1.51 Wed Mar 16 10:08:02 2022 +++ src/sys/dev/pci/if_jme.c Sun Aug 21 14:12:59 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_jme.c,v 1.51 2022/03/16 10:08:02 andvar Exp $ */ +/* $NetBSD: if_jme.c,v 1.52 2022/08/21 14:12:59 thorpej Exp $ */ /* * Copyright (c) 2008 Manuel Bouyer. All rights reserved. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.51 2022/03/16 10:08:02 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.52 2022/08/21 14:12:59 thorpej Exp $"); #include @@ -1320,15 +1320,14 @@ jme_ifioctl(struct ifnet *ifp, unsigned } static int -jme_encap(struct jme_softc *sc, struct mbuf **m_head) +jme_encap(struct jme_softc *sc, struct mbuf **m_headp) { struct jme_desc *desc; - struct mbuf *m; + struct mbuf * const m = *m_headp; int error, i, prod, headdsc, nsegs; uint32_t cflags, tso_segsz; - if (((*m_head)->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6)) - != 0) { + if ((m->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6)) != 0) { /* * Due to the adherence to NDIS specification JMC250 * assumes upper stack computed TCP pseudo checksum @@ -1337,10 +1336,10 @@ jme_encap(struct jme_softc *sc, struct m * pseudo checksum for JMC250. Hopefully this wouldn't * be much burden on modern CPUs. */ - bool v4 = ((*m_head)->m_pkthdr.csum_flags & M_CSUM_TSOv4) != 0; + bool v4 = (m->m_pkthdr.csum_flags & M_CSUM_TSOv4) != 0; int iphl = v4 ? - M_CSUM_DATA_IPv4_IPHL((*m_head)->m_pkthdr.csum_data) : - M_CSUM_DATA_IPv6_IPHL((*m_head)->m_pkthdr.csum_data); + M_CSUM_DATA_IPv4_IPHL(m->m_pkthdr.csum_data) : + M_CSUM_DATA_IPv6_IPHL(m->m_pkthdr.csum_data); /* * note: we support vlan offloading, so we should never have * a ETHERTYPE_VLAN packet here - so ETHER_HDR_LEN is always @@ -1348,90 +1347,88 @@ jme_encap(struct jme_softc *sc, struct m */ int hlen = ETHER_HDR_LEN + iphl; - if (__predict_false((*m_head)->m_len < + if (__predict_false(m->m_len < (hlen + sizeof(struct tcphdr { - /* - * TCP/IP headers are not in the first mbuf; we need - * to do this the slow and painful way. Let's just - * hope this doesn't happen very often. - */ - struct tcphdr th; - - m_copydata((*m_head), hlen, sizeof(th), ); - if (v4) { -struct ip ip; - -m_copydata((*m_head), ETHER_HDR_LEN, -sizeof(ip), ); -ip.ip_len = 0; -m_copyback((*m_head), - ETHER_HDR_LEN + offsetof(struct ip, ip_len), - sizeof(ip.ip_len), _len); -th.th_sum = in_cksum_phdr(ip.ip_src.s_addr, - ip.ip_dst.s_addr, htons(IPPROTO_TCP)); - } else { + /* + * + * TCP/IP headers are not in the first mbuf; we need + * to do this the slow and painful way. Let's just + * hope this doesn't happen very often. + */ + struct tcphdr th; + + m_copydata(m, hlen, sizeof(th), ); + if (v4) { +struct ip ip; + +m_copydata(m, ETHER_HDR_LEN, sizeof(ip), ); +ip.ip_len = 0; +m_copyback(m, +ETHER_HDR_LEN + offsetof(struct ip, ip_len), +sizeof(ip.ip_len), _len); +th.th_sum = in_cksum_phdr(ip.ip_src.s_addr, +ip.ip_dst.s_addr, htons(IPPROTO_TCP)); + } else { #if INET6 -struct ip6_hdr ip6; +struct ip6_hdr ip6; -m_copydata((*m_head), ETHER_HDR_LEN, +m_copydata(m, ETHER_HDR_LEN, sizeof(ip6), ); -ip6.ip6_plen = 0; -m_copyback((*m_head), ETHER_HDR_LEN + +ip6.ip6_plen = 0; +m_copyback(m, ETHER_HDR_LEN + offsetof(struct ip6_hdr, ip6_plen), - sizeof(ip6.ip6_plen), _plen); -th.th_sum = in6_cksum_phdr(_src, - _dst, 0, htonl(IPPROTO_TCP)); +sizeof(ip6.ip6_plen), _plen); +th.th_sum = in6_cksum_phdr(_src, +_dst, 0, htonl(IPPROTO_TCP)); #endif /* INET6 */ - } - m_copyback((*m_head), - hlen + offsetof(struct tcphdr, th_sum), -sizeof(th.th_sum), _sum); + } + m_copyback(m, hlen + offsetof(struct tcphdr, th_sum), + sizeof(th.th_sum), _sum); - hlen += th.th_off << 2; + hlen += th.th_off << 2; } else { - /* - * TCP/IP headers are in the first mbuf; we can do - * this the easy way. - */ - struct tcphdr *th; - - if (v4) { -struct ip *ip = - (void *)(mtod((*m_head), char *) + - ETHER_HDR_LEN); -
CVS commit: src/sys/dev/pci
Module Name:src Committed By: thorpej Date: Sun Aug 21 14:13:00 UTC 2022 Modified Files: src/sys/dev/pci: if_jme.c Log Message: jme_encap(): Fix up some botched formatting, and don't use (*m_head) all over the place (just assign m = *m_head earlier). NFCI. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/pci/if_jme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/modules/x86_pte_tester
Module Name:src Committed By: mlelstv Date: Sun Aug 21 14:06:42 UTC 2022 Modified Files: src/tests/modules/x86_pte_tester: x86_pte_tester.c Log Message: requires pmap_private.h now. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/modules/x86_pte_tester/x86_pte_tester.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/modules/x86_pte_tester/x86_pte_tester.c diff -u src/tests/modules/x86_pte_tester/x86_pte_tester.c:1.2 src/tests/modules/x86_pte_tester/x86_pte_tester.c:1.3 --- src/tests/modules/x86_pte_tester/x86_pte_tester.c:1.2 Sun Apr 26 11:56:38 2020 +++ src/tests/modules/x86_pte_tester/x86_pte_tester.c Sun Aug 21 14:06:42 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_pte_tester.c,v 1.2 2020/04/26 11:56:38 maxv Exp $ */ +/* $NetBSD: x86_pte_tester.c,v 1.3 2022/08/21 14:06:42 mlelstv Exp $ */ /* * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -40,6 +40,7 @@ #if defined(__x86_64__) # include +# include # define NLEVEL 4 #else # error "Unsupported configuration"
CVS commit: src/tests/modules/x86_pte_tester
Module Name:src Committed By: mlelstv Date: Sun Aug 21 14:06:42 UTC 2022 Modified Files: src/tests/modules/x86_pte_tester: x86_pte_tester.c Log Message: requires pmap_private.h now. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/modules/x86_pte_tester/x86_pte_tester.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amd64
Module Name:src Committed By: mlelstv Date: Sun Aug 21 14:05:52 UTC 2022 Modified Files: src/sys/arch/amd64/amd64: prekern.c src/sys/arch/amd64/stand/prekern: pdir.h prekern.h Log Message: Adapt to pmap/bootspace migrations. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/amd64/prekern.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/stand/prekern/pdir.h cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/stand/prekern/prekern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/prekern.c diff -u src/sys/arch/amd64/amd64/prekern.c:1.5 src/sys/arch/amd64/amd64/prekern.c:1.6 --- src/sys/arch/amd64/amd64/prekern.c:1.5 Sun Aug 12 15:31:01 2018 +++ src/sys/arch/amd64/amd64/prekern.c Sun Aug 21 14:05:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prekern.c,v 1.5 2018/08/12 15:31:01 maxv Exp $ */ +/* $NetBSD: prekern.c,v 1.6 2022/08/21 14:05:52 mlelstv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -40,9 +40,12 @@ #include #include +#include #include #include +#include + #include #include Index: src/sys/arch/amd64/stand/prekern/pdir.h diff -u src/sys/arch/amd64/stand/prekern/pdir.h:1.7 src/sys/arch/amd64/stand/prekern/pdir.h:1.8 --- src/sys/arch/amd64/stand/prekern/pdir.h:1.7 Sat May 23 08:25:32 2020 +++ src/sys/arch/amd64/stand/prekern/pdir.h Sun Aug 21 14:05:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pdir.h,v 1.7 2020/05/23 08:25:32 maxv Exp $ */ +/* $NetBSD: pdir.h,v 1.8 2022/08/21 14:05:52 mlelstv Exp $ */ /* * Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved. @@ -70,7 +70,3 @@ #define VA_SIGN_MASK 0x #define VA_SIGN_NEG(va) ((va) | VA_SIGN_MASK) -#define pl1_i(va) (((va) & L1_FRAME) >> L1_SHIFT) -#define pl2_i(va) (((va) & L2_FRAME) >> L2_SHIFT) -#define pl3_i(va) (((va) & L3_FRAME) >> L3_SHIFT) -#define pl4_i(va) (((va) & L4_FRAME) >> L4_SHIFT) Index: src/sys/arch/amd64/stand/prekern/prekern.h diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.24 src/sys/arch/amd64/stand/prekern/prekern.h:1.25 --- src/sys/arch/amd64/stand/prekern/prekern.h:1.24 Tue May 4 21:09:16 2021 +++ src/sys/arch/amd64/stand/prekern/prekern.h Sun Aug 21 14:05:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: prekern.h,v 1.24 2021/05/04 21:09:16 khorben Exp $ */ +/* $NetBSD: prekern.h,v 1.25 2022/08/21 14:05:52 mlelstv Exp $ */ /* * Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved. @@ -32,8 +32,12 @@ #include #include #include + +#include #include +#include + #include "pdir.h" #include "redef.h" @@ -59,34 +63,6 @@ typedef enum /* -- */ -#define BTSEG_NONE 0 -#define BTSEG_TEXT 1 -#define BTSEG_RODATA 2 -#define BTSEG_DATA 3 -#define BTSPACE_NSEGS 64 -struct bootspace { - struct { - vaddr_t va; - paddr_t pa; - size_t sz; - } head; - struct { - int type; - vaddr_t va; - paddr_t pa; - size_t sz; - } segs[BTSPACE_NSEGS]; - struct { - vaddr_t va; - paddr_t pa; - size_t sz; - } boot; - vaddr_t spareva; - vaddr_t pdir; - vaddr_t smodule; - vaddr_t emodule; -}; - /* console.c */ void init_cons(void); void print_ext(int, char *);
CVS commit: src/sys/arch/amd64
Module Name:src Committed By: mlelstv Date: Sun Aug 21 14:05:52 UTC 2022 Modified Files: src/sys/arch/amd64/amd64: prekern.c src/sys/arch/amd64/stand/prekern: pdir.h prekern.h Log Message: Adapt to pmap/bootspace migrations. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/amd64/prekern.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/stand/prekern/pdir.h cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/stand/prekern/prekern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/include
Module Name:src Committed By: riastradh Date: Sun Aug 21 13:15:15 UTC 2022 Modified Files: src/sys/arch/i386/include: vmparam.h Log Message: i386/vmparam.h: Need some constants from i386/pte.h. These are used by VM_MIN/MAX_KERNEL_ADDRESS. pte.h is small and likely stable enough that it's not worthwhile to migrate them to vmparam.h instead. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/arch/i386/include/vmparam.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/include/vmparam.h diff -u src/sys/arch/i386/include/vmparam.h:1.87 src/sys/arch/i386/include/vmparam.h:1.88 --- src/sys/arch/i386/include/vmparam.h:1.87 Sat Aug 20 23:48:50 2022 +++ src/sys/arch/i386/include/vmparam.h Sun Aug 21 13:15:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.87 2022/08/20 23:48:50 riastradh Exp $ */ +/* $NetBSD: vmparam.h,v 1.88 2022/08/21 13:15:15 riastradh Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -39,6 +39,8 @@ #include +#include + /* * Machine dependent constants for 386. */
CVS commit: src/sys/arch/i386/include
Module Name:src Committed By: riastradh Date: Sun Aug 21 13:15:15 UTC 2022 Modified Files: src/sys/arch/i386/include: vmparam.h Log Message: i386/vmparam.h: Need some constants from i386/pte.h. These are used by VM_MIN/MAX_KERNEL_ADDRESS. pte.h is small and likely stable enough that it's not worthwhile to migrate them to vmparam.h instead. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/arch/i386/include/vmparam.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/scsictl
Module Name:src Committed By: mlelstv Date: Sun Aug 21 12:44:16 UTC 2022 Modified Files: src/sbin/scsictl: scsictl.8 scsictl.c Log Message: Add REPORT_LUNS command. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sbin/scsictl/scsictl.8 cvs rdiff -u -r1.39 -r1.40 src/sbin/scsictl/scsictl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/scsictl/scsictl.8 diff -u src/sbin/scsictl/scsictl.8:1.31 src/sbin/scsictl/scsictl.8:1.32 --- src/sbin/scsictl/scsictl.8:1.31 Wed Mar 8 11:45:14 2017 +++ src/sbin/scsictl/scsictl.8 Sun Aug 21 12:44:16 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: scsictl.8,v 1.31 2017/03/08 11:45:14 tsutsui Exp $ +.\" $NetBSD: scsictl.8,v 1.32 2022/08/21 12:44:16 mlelstv Exp $ .\" .\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -196,6 +196,27 @@ If the drive's automatic reallocation pa .Ar save after the automatic reallocation enable state will cause the parameters to be saved in non-volatile storage. +.It Cm reportluns Ar normal|wellknown|all|# +Report Logical Units provided by the drive. +.Bl -hang -compact +.It normal +report all but well-known logical units. +This is also the default. +.It wellknown +report the well known logical units instead. E.g., +.Bl -inset -compact +.It 0xc101h +Addressable objects +.It 0xc102h +Addressable objects associations +.It 0xc103h +SCSI target device identification +.El +.It all +report all logical units. +.It # +Use the given numeric select report value (0-255). +.El .El .Sh BUS COMMANDS The following commands are supported for SCSI busses: Index: src/sbin/scsictl/scsictl.c diff -u src/sbin/scsictl/scsictl.c:1.39 src/sbin/scsictl/scsictl.c:1.40 --- src/sbin/scsictl/scsictl.c:1.39 Sat Nov 19 08:43:40 2016 +++ src/sbin/scsictl/scsictl.c Sun Aug 21 12:44:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: scsictl.c,v 1.39 2016/11/19 08:43:40 flxd Exp $ */ +/* $NetBSD: scsictl.c,v 1.40 2022/08/21 12:44:16 mlelstv Exp $ */ /*- * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include #ifndef lint -__RCSID("$NetBSD: scsictl.c,v 1.39 2016/11/19 08:43:40 flxd Exp $"); +__RCSID("$NetBSD: scsictl.c,v 1.40 2022/08/21 12:44:16 mlelstv Exp $"); #endif @@ -93,6 +93,7 @@ static void device_flushcache(int, char static void device_setspeed(int, char *[]); static void device_getrealloc(int, char *[]); static void device_setrealloc(int, char *[]); +static void device_reportluns(int, char *[]); static struct command device_commands[] = { { "defects", "[primary] [grown] [block|byte|physical]", @@ -115,6 +116,7 @@ static struct command device_commands[] { "setspeed", "[speed]", device_setspeed }, { "getrealloc", "", device_getrealloc }, { "setrealloc", "none|r|w|rw [save]", device_setrealloc }, + { "reportluns", "normal|wellknown|all|#", device_reportluns }, { NULL, NULL, NULL }, }; @@ -985,6 +987,88 @@ device_setspeed(int argc, char *argv[]) } /* + * device_reportluns: + * + * Report the known LUNs to which the initiator can send commands + */ +static void +device_reportluns(int argc, char *argv[]) +{ + struct scsi_report_luns cmd; + struct { + struct scsi_report_luns_header header; + struct scsi_report_luns_lun desc[1]; + } *data; + u_int32_t dlen, len; + u_int64_t lun; + size_t count, idx; + unsigned long sel; + char *endp; + int i; + + dlen = USHRT_MAX; /* good for > 8000 LUNs */ + data = malloc(dlen); + if (data == NULL) + errx(1, "unable to allocate lun report"); + + memset(, 0, sizeof(cmd)); + cmd.opcode = SCSI_REPORT_LUNS; + cmd.selectreport = SELECTREPORT_NORMAL; + + /* determine which report to read. */ + for (i = 0; i < argc; i++) { + if (strcmp("normal", argv[i]) == 0) { + cmd.selectreport = SELECTREPORT_NORMAL; + continue; + } + if (strcmp("wellknown", argv[i]) == 0) { + cmd.selectreport = SELECTREPORT_WELLKNOWN; + continue; + } + if (strcmp("all", argv[i]) == 0) { + cmd.selectreport = SELECTREPORT_ALL; + continue; + } + sel = strtoul(argv[i], , 0); + if (*endp != '\0' || sel > 255) + errx(1, "Unknown select report '%s'", argv[i]); + cmd.selectreport = sel; + } + + _lto4b(dlen, [0]); + cmd.control = 0x00; + + scsi_command(fd, , sizeof(cmd), data, dlen, 3, SCCMD_READ); + + len = _4btol(data->header.length); + if (len > dlen) { + /* XXX reallocate and retry */ + printf("%s: report truncated %" PRIu32 "to %" PRIu32 "\n", + dvname, len, dlen); + len = dlen; + } + + count = len / sizeof(data->desc[0]); + + for (idx=0; idxdesc[idx].lun); + + /* + * swizzle bits so that LUNs 0..255 are + * mapped to numbers 0..255 + */ + lun = (lun & 0xull) >> 48 + | (lun & 0xull) >> 16 + | (lun & 0xull) << 16 + | (lun & 0xull) << 48; + + printf("%s: lun %" PRIu64 "\n", dvname, lun); + } + + free(data); +} + +/* *
CVS commit: src/sbin/scsictl
Module Name:src Committed By: mlelstv Date: Sun Aug 21 12:44:16 UTC 2022 Modified Files: src/sbin/scsictl: scsictl.8 scsictl.c Log Message: Add REPORT_LUNS command. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sbin/scsictl/scsictl.8 cvs rdiff -u -r1.39 -r1.40 src/sbin/scsictl/scsictl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: skrll Date: Sun Aug 21 12:34:40 UTC 2022 Modified Files: src/sys/net: if.c Log Message: Sprinkle more const. NFC. To generate a diff of this commit: cvs rdiff -u -r1.519 -r1.520 src/sys/net/if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if.c diff -u src/sys/net/if.c:1.519 src/sys/net/if.c:1.520 --- src/sys/net/if.c:1.519 Sun Aug 21 07:17:19 2022 +++ src/sys/net/if.c Sun Aug 21 12:34:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.519 2022/08/21 07:17:19 skrll Exp $ */ +/* $NetBSD: if.c,v 1.520 2022/08/21 12:34:39 skrll Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.519 2022/08/21 07:17:19 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.520 2022/08/21 12:34:39 skrll Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -618,7 +618,6 @@ void if_free_sadl(struct ifnet *ifp, int factory) { struct ifaddr *ifa; - int s; if (factory && ifp->if_hwdl != NULL) { ifa = ifp->if_hwdl; @@ -634,7 +633,7 @@ if_free_sadl(struct ifnet *ifp, int fact KASSERT(ifp->if_sadl != NULL); - s = splsoftnet(); + const int s = splsoftnet(); KASSERT(ifa->ifa_addr->sa_family == AF_LINK); ifa_remove(ifp, ifa); if_deactivate_sadl(ifp); @@ -1184,9 +1183,7 @@ static void if_attachdomain1(struct ifnet *ifp) { struct domain *dp; - int s; - - s = splsoftnet(); + const int s = splsoftnet(); /* address family dependent data region */ memset(ifp->if_afdata, 0, sizeof(ifp->if_afdata)); @@ -1206,9 +1203,7 @@ if_attachdomain1(struct ifnet *ifp) void if_deactivate(struct ifnet *ifp) { - int s; - - s = splsoftnet(); + const int s = splsoftnet(); ifp->if_output = if_nulloutput; ifp->_if_input = if_nullinput; @@ -2940,7 +2935,6 @@ ifunit(const char *name) const char *cp = name; u_int unit = 0; u_int i; - int s; /* * If the entire name is a number, treat it as an ifindex. @@ -2956,7 +2950,7 @@ ifunit(const char *name) return if_byindex(unit); ifp = NULL; - s = pserialize_read_enter(); + const int s = pserialize_read_enter(); IFNET_READER_FOREACH(ifp) { if (if_is_deactivated(ifp)) continue; @@ -2980,7 +2974,6 @@ if_get(const char *name, struct psref *p const char *cp = name; u_int unit = 0; u_int i; - int s; /* * If the entire name is a number, treat it as an ifindex. @@ -2996,7 +2989,7 @@ if_get(const char *name, struct psref *p return if_get_byindex(unit, psref); ifp = NULL; - s = pserialize_read_enter(); + const int s = pserialize_read_enter(); IFNET_READER_FOREACH(ifp) { if (if_is_deactivated(ifp)) continue; @@ -3061,9 +3054,8 @@ ifnet_t * if_get_byindex(u_int idx, struct psref *psref) { ifnet_t *ifp; - int s; - s = pserialize_read_enter(); + const int s = pserialize_read_enter(); ifp = if_byindex(idx); if (__predict_true(ifp != NULL)) { PSREF_DEBUG_FILL_RETURN_ADDRESS(psref); @@ -3078,9 +3070,8 @@ ifnet_t * if_get_bylla(const void *lla, unsigned char lla_len, struct psref *psref) { ifnet_t *ifp; - int s; - s = pserialize_read_enter(); + const int s = pserialize_read_enter(); IFNET_READER_FOREACH(ifp) { if (if_is_deactivated(ifp)) continue; @@ -3228,7 +3219,6 @@ if_export_if_data(ifnet_t * const ifp, s int ifioctl_common(struct ifnet *ifp, u_long cmd, void *data) { - int s; struct ifreq *ifr; struct ifcapreq *ifcr; struct ifdatareq *ifdr; @@ -3296,12 +3286,12 @@ ifioctl_common(struct ifnet *ifp, u_long */ KERNEL_LOCK_IF_IFP_MPSAFE(ifp); if (ifp->if_flags & IFF_UP && (ifr->ifr_flags & IFF_UP) == 0) { - s = splsoftnet(); + const int s = splsoftnet(); if_down_locked(ifp); splx(s); } if (ifr->ifr_flags & IFF_UP && (ifp->if_flags & IFF_UP) == 0) { - s = splsoftnet(); + const int s = splsoftnet(); if_up_locked(ifp); splx(s); } @@ -3647,7 +3637,7 @@ doifioctl(struct socket *so, u_long cmd, if (((oif_flags ^ ifp->if_flags) & IFF_UP) != 0) { if ((ifp->if_flags & IFF_UP) != 0) { - int s = splsoftnet(); + const int s = splsoftnet(); if_up_locked(ifp); splx(s); } @@ -3707,7 +3697,6 @@ ifconf(u_long cmd, void *data) int space = 0, error = 0; const int sz = (int)sizeof(struct ifreq); const bool docopy = ifc->ifc_req != NULL; - int s; struct psref psref; if (docopy) { @@ -3720,7 +3709,7 @@ ifconf(u_long cmd, void *data) memset(, 0, sizeof(ifr)); const int bound = curlwp_bind(); - s = pserialize_read_enter(); + int s = pserialize_read_enter(); IFNET_READER_FOREACH(ifp) { psref_acquire(, >if_psref, ifnet_psref_class); pserialize_read_exit(s);
CVS commit: src/sys/net
Module Name:src Committed By: skrll Date: Sun Aug 21 12:34:40 UTC 2022 Modified Files: src/sys/net: if.c Log Message: Sprinkle more const. NFC. To generate a diff of this commit: cvs rdiff -u -r1.519 -r1.520 src/sys/net/if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/rump/librump/rumpkern/arch/x86
Module Name:src Committed By: riastradh Date: Sun Aug 21 12:08:12 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern/arch/x86: rump_x86_pmap.c Log Message: rump/x86: Add stubs for pmap_resident_count, pmap_wired_count. These are no longer static inlines, now that struct pmap is private. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c diff -u src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.4 src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.5 --- src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.4 Tue Jan 26 23:12:18 2016 +++ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c Sun Aug 21 12:08:12 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_x86_pmap.c,v 1.4 2016/01/26 23:12:18 pooka Exp $ */ +/* $NetBSD: rump_x86_pmap.c,v 1.5 2022/08/21 12:08:12 riastradh Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rump_x86_pmap.c,v 1.4 2016/01/26 23:12:18 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump_x86_pmap.c,v 1.5 2022/08/21 12:08:12 riastradh Exp $"); #include @@ -107,3 +107,17 @@ void pmap_write_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) { } + +long +pmap_resident_count(struct pmap *pmap) + +{ + return 0; +} + +long +pmap_wired_count(struct pmap *pmap) +{ + + return 0; +}
CVS commit: src/sys/rump/librump/rumpkern/arch/x86
Module Name:src Committed By: riastradh Date: Sun Aug 21 12:08:12 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern/arch/x86: rump_x86_pmap.c Log Message: rump/x86: Add stubs for pmap_resident_count, pmap_wired_count. These are no longer static inlines, now that struct pmap is private. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/ia64/stand/ia64/ski
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:30:54 UTC 2022 Modified Files: src/sys/arch/ia64/stand/ia64/ski: efi_stub.c Log Message: ia64: Use designated initializers for ski efi tables. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/stand/ia64/ski/efi_stub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/ia64/stand/ia64/ski/efi_stub.c diff -u src/sys/arch/ia64/stand/ia64/ski/efi_stub.c:1.6 src/sys/arch/ia64/stand/ia64/ski/efi_stub.c:1.7 --- src/sys/arch/ia64/stand/ia64/ski/efi_stub.c:1.6 Sun Aug 21 10:30:36 2022 +++ src/sys/arch/ia64/stand/ia64/ski/efi_stub.c Sun Aug 21 10:30:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: efi_stub.c,v 1.6 2022/08/21 10:30:36 riastradh Exp $ */ +/* $NetBSD: efi_stub.c,v 1.7 2022/08/21 10:30:54 riastradh Exp $ */ /*- * Copyright (c) 2003,2004 Marcel Moolenaar @@ -48,8 +48,8 @@ extern void acpi_stub_init(void); extern void sal_stub_init(void); struct efi_cfgtbl efi_cfgtab[] = { - { EFI_TABLE_ACPI20, _root }, - { EFI_TABLE_SAL, _systab } + { .ct_uuid = EFI_TABLE_ACPI20, .ct_data = _root }, + { .ct_uuid = EFI_TABLE_SAL, .ct_data = _systab }, }; static efi_status GetTime(struct efi_tm *, struct efi_tmcap *); @@ -72,55 +72,57 @@ static efi_status ResetSystem(enum efi_r struct efi_rt efi_rttab = { /* Header. */ - { 0, /* XXX Signature */ - 0, /* XXX Revision */ - 0, /* XXX HeaderSize */ - 0, /* XXX CRC32 */ + .rt_hdr = { + .th_sig = 0, /* XXX Signature */ + .th_rev = 0, /* XXX Revision */ + .th_hdrsz = 0, /* XXX HeaderSize */ + .th_crc32 = 0, /* XXX CRC32 */ }, /* Time services */ - GetTime, - SetTime, - GetWakeupTime, - SetWakeupTime, + .rt_gettime = GetTime, + .rt_settime = SetTime, + .rt_getwaketime = GetWakeupTime, + .rt_setwaketime = SetWakeupTime, /* Virtual memory services */ - SetVirtualAddressMap, - ConvertPointer, + .rt_setvirtual = SetVirtualAddressMap, + .rt_cvtptr = ConvertPointer, /* Variable services */ - GetVariable, - GetNextVariableName, - SetVariable, + .rt_getvar = GetVariable, + .rt_scanvar = GetNextVariableName, + .rt_setvar = SetVariable, /* Misc */ - GetNextHighMonotonicCount, - ResetSystem + .rt_gethicnt = GetNextHighMonotonicCount, + .rt_reset = ResetSystem }; struct efi_systbl efi_systab = { /* Header. */ - { EFI_SYSTBL_SIG, - 0, /* XXX Revision */ - 0, /* XXX HeaderSize */ - 0, /* XXX CRC32 */ + .st_hdr = { + .th_sig = EFI_SYSTBL_SIG, + .th_rev = 0, /* XXX Revision */ + .th_hdrsz = 0, /* XXX HeaderSize */ + .th_crc32 = 0, /* XXX CRC32 */ }, /* Firmware info. */ - L"FreeBSD", 0, 0, + .st_fwvendor = L"FreeBSD", .st_fwrev = 0, .__pad = 0, /* Console stuff. */ - NULL, NULL, - NULL, NULL, - NULL, NULL, + .st_cin = NULL, .st_cinif = NULL, + .st_cout = NULL, .st_coutif = NULL, + .st_cerr = NULL, .st_cerrif = NULL, /* Services (runtime first). */ - _rttab, - NULL, + .st_rt = _rttab, + .st_bs = NULL, /* Configuration tables. */ - sizeof(efi_cfgtab)/sizeof(struct efi_cfgtbl), - efi_cfgtab + .st_entries = sizeof(efi_cfgtab)/sizeof(struct efi_cfgtbl), + .st_cfgtbl = efi_cfgtab, }; static efi_status
CVS commit: src/sys/arch/ia64/stand/ia64/ski
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:30:54 UTC 2022 Modified Files: src/sys/arch/ia64/stand/ia64/ski: efi_stub.c Log Message: ia64: Use designated initializers for ski efi tables. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/stand/ia64/ski/efi_stub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/ia64/stand/ia64/ski
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:30:36 UTC 2022 Modified Files: src/sys/arch/ia64/stand/ia64/ski: efi_stub.c Log Message: ia64: Fix fallout from uint64 -> void * changes in efi.h. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/stand/ia64/ski/efi_stub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/ia64/stand/ia64/ski/efi_stub.c diff -u src/sys/arch/ia64/stand/ia64/ski/efi_stub.c:1.5 src/sys/arch/ia64/stand/ia64/ski/efi_stub.c:1.6 --- src/sys/arch/ia64/stand/ia64/ski/efi_stub.c:1.5 Sat Aug 20 10:35:50 2022 +++ src/sys/arch/ia64/stand/ia64/ski/efi_stub.c Sun Aug 21 10:30:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: efi_stub.c,v 1.5 2022/08/20 10:35:50 riastradh Exp $ */ +/* $NetBSD: efi_stub.c,v 1.6 2022/08/21 10:30:36 riastradh Exp $ */ /*- * Copyright (c) 2003,2004 Marcel Moolenaar @@ -48,8 +48,8 @@ extern void acpi_stub_init(void); extern void sal_stub_init(void); struct efi_cfgtbl efi_cfgtab[] = { - { EFI_TABLE_ACPI20, (intptr_t)_root }, - { EFI_TABLE_SAL, (intptr_t)_systab } + { EFI_TABLE_ACPI20, _root }, + { EFI_TABLE_SAL, _systab } }; static efi_status GetTime(struct efi_tm *, struct efi_tmcap *); @@ -115,12 +115,12 @@ struct efi_systbl efi_systab = { NULL, NULL, /* Services (runtime first). */ - (intptr_t)_rttab, + _rttab, NULL, /* Configuration tables. */ sizeof(efi_cfgtab)/sizeof(struct efi_cfgtbl), - (intptr_t)efi_cfgtab + efi_cfgtab }; static efi_status
CVS commit: src/sys/arch/ia64/stand/ia64/ski
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:30:36 UTC 2022 Modified Files: src/sys/arch/ia64/stand/ia64/ski: efi_stub.c Log Message: ia64: Fix fallout from uint64 -> void * changes in efi.h. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/stand/ia64/ski/efi_stub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/rump/kern/lib/libsysproxy
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:24:23 UTC 2022 Modified Files: src/sys/rump/kern/lib/libsysproxy: sysproxy.c Log Message: rump libsysproxy: More workarounds for pmap abuse. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/rump/kern/lib/libsysproxy/sysproxy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/rump/kern/lib/libsysproxy
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:24:23 UTC 2022 Modified Files: src/sys/rump/kern/lib/libsysproxy: sysproxy.c Log Message: rump libsysproxy: More workarounds for pmap abuse. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/rump/kern/lib/libsysproxy/sysproxy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/kern/lib/libsysproxy/sysproxy.c diff -u src/sys/rump/kern/lib/libsysproxy/sysproxy.c:1.8 src/sys/rump/kern/lib/libsysproxy/sysproxy.c:1.9 --- src/sys/rump/kern/lib/libsysproxy/sysproxy.c:1.8 Sun Oct 6 15:11:17 2019 +++ src/sys/rump/kern/lib/libsysproxy/sysproxy.c Sun Aug 21 10:24:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: sysproxy.c,v 1.8 2019/10/06 15:11:17 uwe Exp $ */ +/* $NetBSD: sysproxy.c,v 1.9 2022/08/21 10:24:23 riastradh Exp $ */ /* * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sysproxy.c,v 1.8 2019/10/06 15:11:17 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysproxy.c,v 1.9 2022/08/21 10:24:23 riastradh Exp $"); #include #include @@ -38,6 +38,19 @@ __KERNEL_RCSID(0, "$NetBSD: sysproxy.c,v #include #include +#if defined(__i386__) || defined(__x86_64__) +/* + * This file abuses the pmap abstraction to create its own statically + * allocated struct pmap object, even though it can't do anything + * useful with such a thing from userland. On x86 the struct pmap + * definition is private, so we have to go to extra effort to abuse it + * there. This should be fixed -- all of the struct pmap definitions + * should be private, and then rump can furnish its own fake struct + * pmap without clashing with anything. + */ +#include +#endif + #define _RUMP_SYSPROXY #include
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:18:20 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern: vm.c Log Message: rumpkern: Abusing struct pmap internals now requires extra effort. (as it should) To generate a diff of this commit: cvs rdiff -u -r1.192 -r1.193 src/sys/rump/librump/rumpkern/vm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/vm.c diff -u src/sys/rump/librump/rumpkern/vm.c:1.192 src/sys/rump/librump/rumpkern/vm.c:1.193 --- src/sys/rump/librump/rumpkern/vm.c:1.192 Thu Sep 16 21:29:42 2021 +++ src/sys/rump/librump/rumpkern/vm.c Sun Aug 21 10:18:20 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: vm.c,v 1.192 2021/09/16 21:29:42 andvar Exp $ */ +/* $NetBSD: vm.c,v 1.193 2022/08/21 10:18:20 riastradh Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.192 2021/09/16 21:29:42 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.193 2022/08/21 10:18:20 riastradh Exp $"); #include #include @@ -56,6 +56,19 @@ __KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.192 #include +#if defined(__i386__) || defined(__x86_64__) +/* + * This file abuses the pmap abstraction to create its own statically + * allocated struct pmap object, even though it can't do anything + * useful with such a thing from userland. On x86 the struct pmap + * definition is private, so we have to go to extra effort to abuse it + * there. This should be fixed -- all of the struct pmap definitions + * should be private, and then rump can furnish its own fake struct + * pmap without clashing with anything. + */ +#include +#endif + #include #include #include
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:18:20 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern: vm.c Log Message: rumpkern: Abusing struct pmap internals now requires extra effort. (as it should) To generate a diff of this commit: cvs rdiff -u -r1.192 -r1.193 src/sys/rump/librump/rumpkern/vm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/rump/librump/rumpkern/arch/x86
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:18:11 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern/arch/x86: rump_x86_cpu.c Log Message: rump/x86: Need x86/cpufunc.h for declaration of wbinvd. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c diff -u src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c:1.4 src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c:1.5 --- src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c:1.4 Tue Jan 26 23:12:18 2016 +++ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c Sun Aug 21 10:18:11 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_x86_cpu.c,v 1.4 2016/01/26 23:12:18 pooka Exp $ */ +/* $NetBSD: rump_x86_cpu.c,v 1.5 2022/08/21 10:18:11 riastradh Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -29,13 +29,15 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rump_x86_cpu.c,v 1.4 2016/01/26 23:12:18 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump_x86_cpu.c,v 1.5 2022/08/21 10:18:11 riastradh Exp $"); #include #include #include +#include + #include #include "rump_curlwp.h"
CVS commit: src/sys/rump/librump/rumpkern/arch/x86
Module Name:src Committed By: riastradh Date: Sun Aug 21 10:18:11 UTC 2022 Modified Files: src/sys/rump/librump/rumpkern/arch/x86: rump_x86_cpu.c Log Message: rump/x86: Need x86/cpufunc.h for declaration of wbinvd. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: riastradh Date: Sun Aug 21 09:12:43 UTC 2022 Modified Files: src/sys/arch/amd64/include: pmap_private.h pte.h src/sys/arch/i386/include: pmap_private.h pte.h Log Message: x86 Move VA_SIGN_POS/NEG to machine/pte.h. It's used by pl[1-4]_pi, also defined in machine/pte.h, and used in libkvm without pmap_private.h. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/include/pmap_private.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/pte.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/include/pmap_private.h cvs rdiff -u -r1.35 -r1.36 src/sys/arch/i386/include/pte.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/include/pmap_private.h diff -u src/sys/arch/amd64/include/pmap_private.h:1.3 src/sys/arch/amd64/include/pmap_private.h:1.4 --- src/sys/arch/amd64/include/pmap_private.h:1.3 Sat Aug 20 23:49:48 2022 +++ src/sys/arch/amd64/include/pmap_private.h Sun Aug 21 09:12:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_private.h,v 1.3 2022/08/20 23:49:48 riastradh Exp $ */ +/* $NetBSD: pmap_private.h,v 1.4 2022/08/21 09:12:43 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -86,14 +86,6 @@ #include #endif -/* - * Mask to get rid of the sign-extended part of addresses. - */ -#define VA_SIGN_MASK 0x -#define VA_SIGN_NEG(va) ((va) | VA_SIGN_MASK) -/* XXXfvdl this one's not right. */ -#define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK) - #ifdef KASAN #define L4_SLOT_KASAN 256 #define NL4_SLOT_KASAN 32 Index: src/sys/arch/amd64/include/pte.h diff -u src/sys/arch/amd64/include/pte.h:1.16 src/sys/arch/amd64/include/pte.h:1.17 --- src/sys/arch/amd64/include/pte.h:1.16 Sat Aug 20 23:19:08 2022 +++ src/sys/arch/amd64/include/pte.h Sun Aug 21 09:12:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.16 2022/08/20 23:19:08 riastradh Exp $ */ +/* $NetBSD: pte.h,v 1.17 2022/08/21 09:12:43 riastradh Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -74,6 +74,14 @@ typedef uint64_t pt_entry_t; /* PTE */ #endif /* + * Mask to get rid of the sign-extended part of addresses. + */ +#define VA_SIGN_MASK 0x +#define VA_SIGN_NEG(va) ((va) | VA_SIGN_MASK) +/* XXXfvdl this one's not right. */ +#define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK) + +/* * Now we define various constants for playing with virtual addresses. */ #define L1_SHIFT 12 Index: src/sys/arch/i386/include/pmap_private.h diff -u src/sys/arch/i386/include/pmap_private.h:1.3 src/sys/arch/i386/include/pmap_private.h:1.4 --- src/sys/arch/i386/include/pmap_private.h:1.3 Sat Aug 20 23:49:48 2022 +++ src/sys/arch/i386/include/pmap_private.h Sun Aug 21 09:12:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_private.h,v 1.3 2022/08/20 23:49:48 riastradh Exp $ */ +/* $NetBSD: pmap_private.h,v 1.4 2022/08/21 09:12:43 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -204,16 +204,6 @@ */ /* - * Mask to get rid of the sign-extended part of addresses. - */ -#define VA_SIGN_MASK 0 -#define VA_SIGN_NEG(va) ((va) | VA_SIGN_MASK) -/* - * XXXfvdl this one's not right. - */ -#define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK) - -/* * the following defines give the virtual addresses of various MMU * data structures: * PTE_BASE: the base VA of the linear PTE mappings Index: src/sys/arch/i386/include/pte.h diff -u src/sys/arch/i386/include/pte.h:1.35 src/sys/arch/i386/include/pte.h:1.36 --- src/sys/arch/i386/include/pte.h:1.35 Sat Aug 20 23:19:08 2022 +++ src/sys/arch/i386/include/pte.h Sun Aug 21 09:12:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.35 2022/08/20 23:19:08 riastradh Exp $ */ +/* $NetBSD: pte.h,v 1.36 2022/08/21 09:12:43 riastradh Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -97,6 +97,16 @@ typedef uint32_t pt_entry_t; /* PTE */ #endif +/* + * Mask to get rid of the sign-extended part of addresses. + */ +#define VA_SIGN_MASK 0 +#define VA_SIGN_NEG(va) ((va) | VA_SIGN_MASK) +/* + * XXXfvdl this one's not right. + */ +#define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK) + #ifdef PAE #define L1_SHIFT 12 #define L2_SHIFT 21
CVS commit: src/sys/arch
Module Name:src Committed By: riastradh Date: Sun Aug 21 09:12:43 UTC 2022 Modified Files: src/sys/arch/amd64/include: pmap_private.h pte.h src/sys/arch/i386/include: pmap_private.h pte.h Log Message: x86 Move VA_SIGN_POS/NEG to machine/pte.h. It's used by pl[1-4]_pi, also defined in machine/pte.h, and used in libkvm without pmap_private.h. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/include/pmap_private.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/pte.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/include/pmap_private.h cvs rdiff -u -r1.35 -r1.36 src/sys/arch/i386/include/pte.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: lukem Date: Sun Aug 21 07:57:50 UTC 2022 Modified Files: src: build.sh Log Message: build.sh: usage improvements Use UPPERCASE as the convention to describe an option argument, as it's more noticable than lowercase in the help description. Expand tabs in the help. Editorial improvements. To generate a diff of this commit: cvs rdiff -u -r1.364 -r1.365 src/build.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: lukem Date: Sun Aug 21 07:57:50 UTC 2022 Modified Files: src: build.sh Log Message: build.sh: usage improvements Use UPPERCASE as the convention to describe an option argument, as it's more noticable than lowercase in the help description. Expand tabs in the help. Editorial improvements. To generate a diff of this commit: cvs rdiff -u -r1.364 -r1.365 src/build.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/build.sh diff -u src/build.sh:1.364 src/build.sh:1.365 --- src/build.sh:1.364 Sun Aug 21 07:10:03 2022 +++ src/build.sh Sun Aug 21 07:57:50 2022 @@ -1,5 +1,5 @@ #! /usr/bin/env sh -# $NetBSD: build.sh,v 1.364 2022/08/21 07:10:03 lukem Exp $ +# $NetBSD: build.sh,v 1.365 2022/08/21 07:57:50 lukem Exp $ # # Copyright (c) 2001-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1027,12 +1027,12 @@ synopsis() { cat <<_usage_ -Usage: ${progname} [-EnoPRrUux] [-a arch] [-B buildid] [-C cdextras] -[-c compiler] [-D dest] [-j njob] [-M obj] [-m mach] -[-N noisy] [-O obj] [-R release] [-S seed] [-T tools] -[-V var=[value]] [-w wrapper] [-X x11src] -[-Z var] -operation [...] +Usage: ${progname} [-EnoPRrUux] [-a ARCH] [-B BID] [-C EXTRAS] +[-c COMPILER] [-D DEST] [-j NJOB] [-M MOBJ] [-m MACH] +[-N NOISY] [-O OOBJ] [-R RELEASE] [-S SEED] [-T TOOLS] +[-V VAR=[VALUE]] [-w WRAPPER] [-X X11SRC] +[-Z VAR] +OPERATION ... ${progname} ( -h | -? ) _usage_ @@ -1044,27 +1044,27 @@ help() { synopsis cat <<_usage_ - Build operations (all imply "obj" and "tools"): + Build OPERATIONs (all imply "obj" and "tools"): build Run "make build". distributionRun "make distribution" (includes DESTDIR/etc/ files). release Run "make release" (includes kernels & distrib media). - Other operations: + Other OPERATIONs: helpShow this message and exit. makewrapper Create ${toolprefix}make-\${MACHINE} wrapper and ${toolprefix}make. Always performed. cleandirRun "make cleandir". [Default unless -u is used] -dtb Build devicetree blobs. +dtb Build devicetree blobs. obj Run "make obj". [Default unless -o is used] tools Build and install tools. -install=idirRun "make installworld" to 'idir' to install all sets -except 'etc'. Useful after "distribution" or "release" -kernel=conf Build kernel with config file 'conf' -kernel.gdb=conf Build kernel (including netbsd.gdb) with config -file 'conf' -releasekernel=conf Install kernel built by kernel=conf to RELEASEDIR. -kernels Build all kernels -installmodules=idir Run "make installmodules" to 'idir' to install all +install=IDIRRun "make installworld" to IDIR to install all sets +except 'etc'. Useful after "distribution" or "release". +kernel=CONF Build kernel with config file CONF. +kernel.gdb=CONF Build kernel (including netbsd.gdb) with config +file CONF. +releasekernel=CONF Install kernel built by kernel=CONF to RELEASEDIR. +kernels Build all kernels. +installmodules=IDIR Run "make installmodules" to IDIR to install all kernel modules. modules Build kernel modules. rumptestDo a linktest for rump (for developers). @@ -1081,8 +1081,8 @@ help() RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage. install-image Create bootable installation image in RELEASEDIR/RELEASEMACHINEDIR/installation/installimage. -disk-image=target Create bootable disk image in -RELEASEDIR/RELEASEMACHINEDIR/binary/gzimg/target.img.gz. +disk-image=TARGET Create bootable disk image in +RELEASEDIR/RELEASEMACHINEDIR/binary/gzimg/TARGET.img.gz. params Display various make(1) parameters. list-arch Display a list of valid MACHINE/MACHINE_ARCH values, and exit. The list may be narrowed by passing glob @@ -1091,55 +1091,58 @@ help() builds and exit. Requires -P or -V MKREPRO=yes. Options: --a archSet MACHINE_ARCH to arch. [Default: deduced from MACHINE] --B buildid Set BUILDID to buildid. --C cdextrasAppend cdextras to CDEXTRA variable for inclusion on CD-ROM. --c compilerSelect compiler: +-a ARCHSet MACHINE_ARCH=ARCH. [Default: deduced from MACHINE] +-B BID Set BUILDID=BID. +
CVS commit: src/sbin/drvctl
Module Name:src Committed By: mlelstv Date: Sun Aug 21 07:51:31 UTC 2022 Modified Files: src/sbin/drvctl: drvctl.c Log Message: When extracting properties, don't bail for non-existent or invalid path elements, but continue with next properry. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sbin/drvctl/drvctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/drvctl
Module Name:src Committed By: mlelstv Date: Sun Aug 21 07:51:31 UTC 2022 Modified Files: src/sbin/drvctl: drvctl.c Log Message: When extracting properties, don't bail for non-existent or invalid path elements, but continue with next properry. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sbin/drvctl/drvctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/drvctl/drvctl.c diff -u src/sbin/drvctl/drvctl.c:1.21 src/sbin/drvctl/drvctl.c:1.22 --- src/sbin/drvctl/drvctl.c:1.21 Thu Jun 11 13:49:57 2020 +++ src/sbin/drvctl/drvctl.c Sun Aug 21 07:51:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: drvctl.c,v 1.21 2020/06/11 13:49:57 thorpej Exp $ */ +/* $NetBSD: drvctl.c,v 1.22 2022/08/21 07:51:30 mlelstv Exp $ */ /* * Copyright (c) 2004 @@ -230,17 +230,20 @@ extract_property(prop_dictionary_t dict, case PROP_TYPE_DICTIONARY: obj = prop_dictionary_get(obj, cur); if (obj == NULL) -exit(EXIT_FAILURE); +p = NULL; break; case PROP_TYPE_ARRAY: ind = strtoul(cur, NULL, 0); obj = prop_array_get(obj, ind); if (obj == NULL) -exit(EXIT_FAILURE); +p = NULL; break; default: - errx(EXIT_FAILURE, "Select neither dict nor array with" - " `%s'", cur); + fprintf(stderr, "Select neither dict nor array with" + " `%s'\n", cur); + obj = NULL; + p = NULL; + break; } }
CVS commit: src/usr.bin/pmap
Module Name:src Committed By: mlelstv Date: Sun Aug 21 07:46:52 UTC 2022 Modified Files: src/usr.bin/pmap: main.c main.h pmap.1 pmap.c pmap.h Log Message: Add -t option to print pmap as underlying RB tree. Report gap/maxgap fields when dumping vm_map structure. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/pmap/main.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/pmap/main.h cvs rdiff -u -r1.19 -r1.20 src/usr.bin/pmap/pmap.1 cvs rdiff -u -r1.56 -r1.57 src/usr.bin/pmap/pmap.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/pmap/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/pmap
Module Name:src Committed By: mlelstv Date: Sun Aug 21 07:46:52 UTC 2022 Modified Files: src/usr.bin/pmap: main.c main.h pmap.1 pmap.c pmap.h Log Message: Add -t option to print pmap as underlying RB tree. Report gap/maxgap fields when dumping vm_map structure. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/pmap/main.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/pmap/main.h cvs rdiff -u -r1.19 -r1.20 src/usr.bin/pmap/pmap.1 cvs rdiff -u -r1.56 -r1.57 src/usr.bin/pmap/pmap.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/pmap/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/pmap/main.c diff -u src/usr.bin/pmap/main.c:1.29 src/usr.bin/pmap/main.c:1.30 --- src/usr.bin/pmap/main.c:1.29 Wed Nov 4 01:37:55 2020 +++ src/usr.bin/pmap/main.c Sun Aug 21 07:46:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.29 2020/11/04 01:37:55 chs Exp $ */ +/* $NetBSD: main.c,v 1.30 2022/08/21 07:46:52 mlelstv Exp $ */ /* * Copyright (c) 2002, 2003, 2020 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.29 2020/11/04 01:37:55 chs Exp $"); +__RCSID("$NetBSD: main.c,v 1.30 2022/08/21 07:46:52 mlelstv Exp $"); #endif #include @@ -60,6 +60,7 @@ struct vm_map *st_map, *pt_map, *module_ u_long kernel_map_addr; int debug, verbose, recurse, page_size; int print_all, print_map, print_maps, print_solaris, print_ddb; +int tree; rlim_t maxssiz; struct nlist ksyms[] = { @@ -133,12 +134,13 @@ main(int argc, char *argv[]) pid = -1; which = verbose = debug = 0; print_all = print_map = print_maps = print_solaris = print_ddb = 0; + tree = 0; recurse = 0; kmem = kernel = NULL; address = 0; vmspace = - while ((ch = getopt(argc, argv, "A:aD:dE:lM:mN:Pp:RrS:sV:vx")) != -1) { + while ((ch = getopt(argc, argv, "A:aD:dE:lM:mN:Pp:RrS:stV:vx")) != -1) { switch (ch) { case 'A': case 'E': @@ -204,6 +206,9 @@ main(int argc, char *argv[]) case 's': print_solaris = 1; break; + case 't': + tree = 1; + break; case 'v': verbose++; break; @@ -213,7 +218,7 @@ main(int argc, char *argv[]) /*NOTREACHED*/ case '?': default: - fprintf(stderr, "usage: %s [-adlmPRsv] [-A address] " + fprintf(stderr, "usage: %s [-adlmPRstv] [-A address] " "[-D number] [-E address] [-M core]\n" "\t[-N system] [-p pid] [-S address] " "[-V address] [pid ...]\n", Index: src/usr.bin/pmap/main.h diff -u src/usr.bin/pmap/main.h:1.6 src/usr.bin/pmap/main.h:1.7 --- src/usr.bin/pmap/main.h:1.6 Mon Apr 28 20:24:14 2008 +++ src/usr.bin/pmap/main.h Sun Aug 21 07:46:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.h,v 1.6 2008/04/28 20:24:14 martin Exp $ */ +/* $NetBSD: main.h,v 1.7 2022/08/21 07:46:52 mlelstv Exp $ */ /* * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -31,6 +31,7 @@ extern int debug, verbose, recurse, page_size; extern int print_all, print_map, print_maps, print_solaris, print_ddb; +extern int tree; extern u_long kernel_map_addr; extern void *uvm_vnodeops, *uvm_deviceops, *aobj_pager, *ubc_pager; extern rlim_t maxssiz; Index: src/usr.bin/pmap/pmap.1 diff -u src/usr.bin/pmap/pmap.1:1.19 src/usr.bin/pmap/pmap.1:1.20 --- src/usr.bin/pmap/pmap.1:1.19 Mon Jul 3 21:34:20 2017 +++ src/usr.bin/pmap/pmap.1 Sun Aug 21 07:46:52 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: pmap.1,v 1.19 2017/07/03 21:34:20 wiz Exp $ +.\" $NetBSD: pmap.1,v 1.20 2022/08/21 07:46:52 mlelstv Exp $ .\" .\" Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,7 +35,7 @@ .Nd display process memory map .Sh SYNOPSIS .Nm -.Op Fl adlmPRsv +.Op Fl adlmPRstv .Op Fl A Ar address .Op Fl D Ar number .Op Fl E Ar address @@ -170,6 +170,9 @@ Dumps the vmspace structure found at The Solaris style output format, modeled after the Solaris command of the same name. This is the default output style. +.It Fl t +Print entries to the underlying RB tree, root first, followed by lower +and higher subtree, indented similar to submaps. .It Fl V Ar address Dumps the vm_map structure found at .Ar address . Index: src/usr.bin/pmap/pmap.c diff -u src/usr.bin/pmap/pmap.c:1.56 src/usr.bin/pmap/pmap.c:1.57 --- src/usr.bin/pmap/pmap.c:1.56 Wed Nov 4 01:37:55 2020 +++ src/usr.bin/pmap/pmap.c Sun Aug 21 07:46:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.56 2020/11/04 01:37:55 chs Exp $ */ +/* $NetBSD: pmap.c,v 1.57 2022/08/21 07:46:52 mlelstv Exp $ */ /* * Copyright (c) 2002, 2003, 2020 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: pmap.c,v 1.56 2020/11/04 01:37:55 chs Exp $"); +__RCSID("$NetBSD: pmap.c,v 1.57 2022/08/21 07:46:52 mlelstv Exp $"); #endif #include @@ -45,9 +45,10 @@ static char *findname(kvm_t *, struct kb struct kbit *, struct kbit *); static int search_cache(kvm_t *, struct vnode *, char **, char *, size_t); -/* when
CVS commit: src/sys/net
Module Name:src Committed By: skrll Date: Sun Aug 21 07:17:19 UTC 2022 Modified Files: src/sys/net: if.c Log Message: Sprinkle const. NFC. To generate a diff of this commit: cvs rdiff -u -r1.518 -r1.519 src/sys/net/if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: skrll Date: Sun Aug 21 07:17:19 UTC 2022 Modified Files: src/sys/net: if.c Log Message: Sprinkle const. NFC. To generate a diff of this commit: cvs rdiff -u -r1.518 -r1.519 src/sys/net/if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if.c diff -u src/sys/net/if.c:1.518 src/sys/net/if.c:1.519 --- src/sys/net/if.c:1.518 Sun Aug 21 07:03:09 2022 +++ src/sys/net/if.c Sun Aug 21 07:17:19 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.518 2022/08/21 07:03:09 skrll Exp $ */ +/* $NetBSD: if.c,v 1.519 2022/08/21 07:17:19 skrll Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.518 2022/08/21 07:03:09 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.519 2022/08/21 07:17:19 skrll Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -584,17 +584,16 @@ void if_activate_sadl(struct ifnet *ifp, struct ifaddr *ifa0, const struct sockaddr_dl *sdl) { - int s, ss; struct ifaddr *ifa; - int bound = curlwp_bind(); + const int bound = curlwp_bind(); KASSERT(ifa_held(ifa0)); - s = splsoftnet(); + const int s = splsoftnet(); if_replace_sadl(ifp, ifa0); - ss = pserialize_read_enter(); + int ss = pserialize_read_enter(); IFADDR_READER_FOREACH(ifa, ifp) { struct psref psref; ifa_acquire(ifa, ); @@ -889,9 +888,8 @@ if_percpuq_dequeue(struct if_percpuq *ip { struct mbuf *m; struct ifqueue *ifq; - int s; - s = splnet(); + const int s = splnet(); ifq = percpu_getref(ipq->ipq_ifqs); IF_DEQUEUE(ifq, m); percpu_putref(ipq->ipq_ifqs); @@ -926,11 +924,10 @@ void if_percpuq_enqueue(struct if_percpuq *ipq, struct mbuf *m) { struct ifqueue *ifq; - int s; KASSERT(ipq != NULL); - s = splnet(); + const int s = splnet(); ifq = percpu_getref(ipq->ipq_ifqs); if (IF_QFULL(ifq)) { IF_DROP(ifq); @@ -1064,9 +1061,7 @@ if_deferred_start_softint(void *arg) static void if_deferred_start_common(struct ifnet *ifp) { - int s; - - s = splnet(); + const int s = splnet(); if_start_lock(ifp); splx(s); } @@ -1170,10 +1165,9 @@ void if_attachdomain(void) { struct ifnet *ifp; - int s; - int bound = curlwp_bind(); + const int bound = curlwp_bind(); - s = pserialize_read_enter(); + int s = pserialize_read_enter(); IFNET_READER_FOREACH(ifp) { struct psref psref; psref_acquire(, >if_psref, ifnet_psref_class); @@ -1333,7 +1327,7 @@ if_detach(struct ifnet *ifp) #endif struct domain *dp; const struct protosw *pr; - int s, i, family, purged; + int i, family, purged; #ifdef IFAREF_DEBUG if_build_ifa_list(ifp); @@ -1344,7 +1338,7 @@ if_detach(struct ifnet *ifp) */ memset(, 0, sizeof(so)); - s = splnet(); + const int s = splnet(); sysctl_teardown(>if_sysctl_log); @@ -2387,7 +2381,7 @@ static void if_link_state_change_process(struct ifnet *ifp, int link_state) { struct domain *dp; - int s = splnet(); + const int s = splnet(); bool notify; KASSERT(!cpu_intr_p()); @@ -2455,11 +2449,10 @@ static void if_link_state_change_work(struct work *work, void *arg) { struct ifnet *ifp = container_of(work, struct ifnet, if_link_work); - int s; uint8_t state; KERNEL_LOCK_UNLESS_NET_MPSAFE(); - s = splnet(); + const int s = splnet(); /* * Pop a link state change from the queue and process it. @@ -2515,8 +2508,8 @@ void if_domain_link_state_change(struct ifnet *ifp, int link_state) { struct domain *dp; - int s = splnet(); + const int s = splnet(); KERNEL_LOCK_UNLESS_NET_MPSAFE(); DOMAIN_FOREACH(dp) { @@ -2588,14 +2581,13 @@ _if_down(struct ifnet *ifp) { struct ifaddr *ifa; struct domain *dp; - int s, bound; struct psref psref; ifp->if_flags &= ~IFF_UP; nanotime(>if_lastchange); - bound = curlwp_bind(); - s = pserialize_read_enter(); + const int bound = curlwp_bind(); + int s = pserialize_read_enter(); IFADDR_READER_FOREACH(ifa, ifp) { ifa_acquire(ifa, ); pserialize_read_exit(s); @@ -2691,9 +2683,7 @@ static bool if_slowtimo_countdown(struct ifnet *ifp) { bool fire = false; - int s; - - s = splnet(); + const int s = splnet(); KERNEL_LOCK(1, NULL); if (ifp->if_timer != 0 && --ifp->if_timer == 0) fire = true; @@ -2730,9 +2720,7 @@ if_slowtimo_work(struct work *work, void struct if_slowtimo_data *isd = container_of(work, struct if_slowtimo_data, isd_work); struct ifnet *ifp = isd->isd_ifp; - int s; - - s = splnet(); + const int s = splnet(); KERNEL_LOCK(1, NULL); (*ifp->if_slowtimo)(ifp); KERNEL_UNLOCK_ONE(NULL); @@ -3522,7 +3510,6 @@ doifioctl(struct socket *so, u_long cmd, struct oifreq *oifr = NULL; int r; struct psref psref; - int bound; bool do_if43_post = false; bool do_ifm80_post = false; @@ -3558,8 +3545,8 @@ doifioctl(struct socket *so, u_long cmd, switch (cmd) { case SIOCIFCREATE: - case SIOCIFDESTROY: -
CVS commit: src
Module Name:src Committed By: lukem Date: Sun Aug 21 07:15:29 UTC 2022 Modified Files: src: UPDATING Log Message: UPDATING: extsrc deprecated To generate a diff of this commit: cvs rdiff -u -r1.329 -r1.330 src/UPDATING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/UPDATING diff -u src/UPDATING:1.329 src/UPDATING:1.330 --- src/UPDATING:1.329 Fri Jul 15 05:26:08 2022 +++ src/UPDATING Sun Aug 21 07:15:28 2022 @@ -1,4 +1,4 @@ -$NetBSD: UPDATING,v 1.329 2022/07/15 05:26:08 mrg Exp $ +$NetBSD: UPDATING,v 1.330 2022/08/21 07:15:28 lukem Exp $ This file (UPDATING) is intended to be a brief reference to recent changes that might cause problems in the build process, and a guide for @@ -19,6 +19,10 @@ See also: BUILDING, build.sh, Makefile. Recent changes: ^^^ +20220821: + Support for building extsrc/ has been deprecated. + EXTSRCSRCDIR and MKEXTSRC have been deprecated. + 20220714: Updates to xorg-server and associated drivers may cause builds to fail. Cleaning both DESTDIR and the xorg build tree may be needed.
CVS commit: src
Module Name:src Committed By: lukem Date: Sun Aug 21 07:15:29 UTC 2022 Modified Files: src: UPDATING Log Message: UPDATING: extsrc deprecated To generate a diff of this commit: cvs rdiff -u -r1.329 -r1.330 src/UPDATING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: lukem Date: Sun Aug 21 07:12:54 UTC 2022 Modified Files: src: BUILDING Log Message: BUILDING: regen for removal of extsrc/ To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/BUILDING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/BUILDING diff -u src/BUILDING:1.142 src/BUILDING:1.143 --- src/BUILDING:1.142 Sat May 28 21:54:56 2022 +++ src/BUILDING Sun Aug 21 07:12:54 2022 @@ -83,9 +83,6 @@ FILES "Reachover" build structure for modular Xorg; the source is in X11SRCDIR. - extsrc/"Reachover" build structure for externally added programs -and libraries; the source is in EXTSRCSRCDIR. - Build tree layout The NetBSD build tree is described in hier(7), and the release layout is described in release(7). @@ -211,13 +208,6 @@ CONFIGURATION Note: build.sh will provide a default of destdir.MACHINE (in the top-level .OBJDIR) unless run in `expert' mode. - EXTSRCSRCDIR - Directory containing sources of externally added programs and - libraries. If specified, must be an absolute path. - - Default: NETBSDSRCDIR/../extsrc, if that exists; otherwise - /usr/extsrc. - MAKECONFThe name of the make(1) configuration file. Only settable in the process environment. @@ -264,39 +254,18 @@ CONFIGURATION Default: "no" - MKDEBUGKERNEL - Can be set to "yes" or "no". Force generation of full-debug - symbol versions of all kernels compiled. Alongside of the - netbsd kernel file, an unstripped version netbsd.gdb is - created. This is useful if a cross-gdb is built as well (see - MKCROSSGDB). - - Default: "no" - MKDEBUGLIB Can be set to "yes" or "no". Indicates whether debug information (see MKDEBUG) should also be generated for all libraries built. Default: "no" - MKDEBUGTOOLS - Can be set to "yes" or "no". Indicates whether debug - information (see MKDEBUG) should also be generated for all - tools built. - - Default: "no" - MKDOC Can be set to "yes" or "no". Indicates whether system documentation destined for DESTDIR/usr/share/doc will be installed during a build. Default: "yes" - MKEXTSRCCan be set to "yes" or "no". Indicates whether extsrc is - built from EXTSRCSRCDIR. - - Default: "no" - MKHTML Can be set to "yes" or "no". Indicates whether preformatted HTML manual pages will be built and installed @@ -320,6 +289,14 @@ CONFIGURATION Default: "yes" + MKKDEBUGCan be set to "yes" or "no". Force generation of full-debug + symbol versions of all kernels compiled. Alongside of the + netbsd kernel file, an unstripped version netbsd.gdb is + created. This is useful if a cross-gdb is built as well (see + MKCROSSGDB). + + Default: "no" + MKKMOD Can be set to "yes" or "no". Indicates whether kernel modules are built and installed. @@ -1070,13 +1047,6 @@ BUILDING -xSet MKX11=yes. - -Y extsrcdir - Set the value of EXTSRCSRCDIR to extsrcdir. If a relative path - is specified, it will be converted to an absolute path before - being used. - - -ySet MKEXTSRC=yes. - -Z varUnset ("zap") the environment variable var. This is propagated to the nbmake wrapper.
CVS commit: src
Module Name:src Committed By: lukem Date: Sun Aug 21 07:12:54 UTC 2022 Modified Files: src: BUILDING Log Message: BUILDING: regen for removal of extsrc/ To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/BUILDING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/extsrc
Module Name:src Committed By: lukem Date: Sun Aug 21 07:12:05 UTC 2022 Removed Files: src/extsrc: Makefile Makefile.extsrc src/extsrc/external: Makefile Log Message: Deprecate extsrc/ Remove extsrc/*. No more tab completion mismatches with external/ As proposed on tech-kern and tech-userlevel on 2022-01-07 and followed up on 2022-08-21. To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 src/extsrc/Makefile src/extsrc/Makefile.extsrc cvs rdiff -u -r1.1 -r0 src/extsrc/external/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/extsrc
Module Name:src Committed By: lukem Date: Sun Aug 21 07:12:05 UTC 2022 Removed Files: src/extsrc: Makefile Makefile.extsrc src/extsrc/external: Makefile Log Message: Deprecate extsrc/ Remove extsrc/*. No more tab completion mismatches with external/ As proposed on tech-kern and tech-userlevel on 2022-01-07 and followed up on 2022-08-21. To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 src/extsrc/Makefile src/extsrc/Makefile.extsrc cvs rdiff -u -r1.1 -r0 src/extsrc/external/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: lukem Date: Sun Aug 21 07:10:03 UTC 2022 Modified Files: src: Makefile build.sh src/distrib/sets: Makefile checkflist comments descrs makeflist makeobsolete makesrctars maketars mkvars.mk sets.subr src/doc: BUILDING.mdoc src/etc: Makefile src/etc/mtree: Makefile src/share/man/man7: src.7 src/share/mk: bsd.README bsd.own.mk Log Message: Deprecate extsrc/, EXTSRCSRCDIR, MKEXTSRC Remove support for building extsrc/: 1. Makefile: remove do-extsrc target. 2. build.sh: remove options -y and -Y extsrcdir. 3. distrib/sets: remove support for extsrc in various tools including the options -L ext and -y, and the extsrc sets. 4. doc/BUILDING.mdoc: remove docs for extsrc/, EXTSRCSRCDIR, MKEXTSRC (etc) 5. bsd.own.mk and various Makefiles: remove support for extsrc/, EXTSRCSRCDIR, MKEXTSRC. As proposed on tech-kern and tech-userlevel on 2022-01-07 and followed up on 2022-08-21. To generate a diff of this commit: cvs rdiff -u -r1.334 -r1.335 src/Makefile cvs rdiff -u -r1.363 -r1.364 src/build.sh cvs rdiff -u -r1.107 -r1.108 src/distrib/sets/Makefile cvs rdiff -u -r1.45 -r1.46 src/distrib/sets/checkflist cvs rdiff -u -r1.29 -r1.30 src/distrib/sets/comments src/distrib/sets/descrs cvs rdiff -u -r1.77 -r1.78 src/distrib/sets/makeflist cvs rdiff -u -r1.31 -r1.32 src/distrib/sets/makeobsolete cvs rdiff -u -r1.43 -r1.44 src/distrib/sets/makesrctars cvs rdiff -u -r1.93 -r1.94 src/distrib/sets/maketars cvs rdiff -u -r1.40 -r1.41 src/distrib/sets/mkvars.mk cvs rdiff -u -r1.201 -r1.202 src/distrib/sets/sets.subr cvs rdiff -u -r1.134 -r1.135 src/doc/BUILDING.mdoc cvs rdiff -u -r1.465 -r1.466 src/etc/Makefile cvs rdiff -u -r1.47 -r1.48 src/etc/mtree/Makefile cvs rdiff -u -r1.16 -r1.17 src/share/man/man7/src.7 cvs rdiff -u -r1.440 -r1.441 src/share/mk/bsd.README cvs rdiff -u -r1.1287 -r1.1288 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/Makefile diff -u src/Makefile:1.334 src/Makefile:1.335 --- src/Makefile:1.334 Sat Mar 19 14:35:13 2022 +++ src/Makefile Sun Aug 21 07:10:03 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.334 2022/03/19 14:35:13 rillig Exp $ +# $NetBSD: Makefile,v 1.335 2022/08/21 07:10:03 lukem Exp $ # # This is the top-level makefile for building NetBSD. For an outline of @@ -99,7 +99,6 @@ # do-x11: builds and installs X11 tools and libraries #from src/external/mit/xorg if ${MKX11} != "no". # do-build:builds and installs the entire system. -# do-extsrc: builds and installs extsrc if ${MKEXTSRC} != "no". # do-obsolete: installs the obsolete sets (for the postinstall-* targets). # @@ -251,9 +250,6 @@ BUILDTARGETS+= do-x11 .endif .if !defined(NOBINARIES) BUILDTARGETS+= do-build -.if ${MKEXTSRC} != "no" -BUILDTARGETS+= do-extsrc -.endif BUILDTARGETS+= do-obsolete .endif @@ -514,14 +510,6 @@ do-x11: .PHONY .MAKE @false .endif -do-extsrc: .PHONY .MAKE -.if ${MKEXTSRC} != "no" - ${MAKEDIRTARGET} extsrc build -.else - @echo "MKEXTSRC is not enabled" - @false -.endif - do-obsolete: .PHONY .MAKE ${MAKEDIRTARGET} etc install-obsolete-lists Index: src/build.sh diff -u src/build.sh:1.363 src/build.sh:1.364 --- src/build.sh:1.363 Mon Aug 15 10:06:00 2022 +++ src/build.sh Sun Aug 21 07:10:03 2022 @@ -1,5 +1,5 @@ #! /usr/bin/env sh -# $NetBSD: build.sh,v 1.363 2022/08/15 10:06:00 lukem Exp $ +# $NetBSD: build.sh,v 1.364 2022/08/21 07:10:03 lukem Exp $ # # Copyright (c) 2001-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1027,10 +1027,10 @@ synopsis() { cat <<_usage_ -Usage: ${progname} [-EnoPRrUuxy] [-a arch] [-B buildid] [-C cdextras] +Usage: ${progname} [-EnoPRrUux] [-a arch] [-B buildid] [-C cdextras] [-c compiler] [-D dest] [-j njob] [-M obj] [-m mach] [-N noisy] [-O obj] [-R release] [-S seed] [-T tools] -[-V var=[value]] [-w wrapper] [-X x11src] [-Y extsrcsrc] +[-V var=[value]] [-w wrapper] [-X x11src] [-Z var] operation [...] ${progname} ( -h | -? ) @@ -1139,8 +1139,6 @@ help() [Default: \${TOOLDIR}/bin/${toolprefix}make-\${MACHINE}] -X x11src Set X11SRCDIR to x11src. [Default: /usr/xsrc] -x Set MKX11=yes; build X11 from X11SRCDIR --Y extsrcsrc Set EXTSRCSRCDIR to extsrcsrc. [Default: /usr/extsrc] --y Set MKEXTSRC=yes; build extsrc from EXTSRCSRCDIR -Z var Unset ("zap") variable 'var'. -? Print this help message, and exit. @@ -1161,7 +1159,7 @@ usage() parseoptions() { - opts='a:B:C:c:D:Ehj:M:m:N:nO:oPR:rS:T:UuV:w:X:xY:yZ:' + opts='a:B:C:c:D:Ehj:M:m:N:nO:oPR:rS:T:UuV:w:X:xZ:' opt_a=false opt_m=false @@ -1355,15 +1353,6 @@ parseoptions() setmakeenv MKX11 yes
CVS commit: src
Module Name:src Committed By: lukem Date: Sun Aug 21 07:10:03 UTC 2022 Modified Files: src: Makefile build.sh src/distrib/sets: Makefile checkflist comments descrs makeflist makeobsolete makesrctars maketars mkvars.mk sets.subr src/doc: BUILDING.mdoc src/etc: Makefile src/etc/mtree: Makefile src/share/man/man7: src.7 src/share/mk: bsd.README bsd.own.mk Log Message: Deprecate extsrc/, EXTSRCSRCDIR, MKEXTSRC Remove support for building extsrc/: 1. Makefile: remove do-extsrc target. 2. build.sh: remove options -y and -Y extsrcdir. 3. distrib/sets: remove support for extsrc in various tools including the options -L ext and -y, and the extsrc sets. 4. doc/BUILDING.mdoc: remove docs for extsrc/, EXTSRCSRCDIR, MKEXTSRC (etc) 5. bsd.own.mk and various Makefiles: remove support for extsrc/, EXTSRCSRCDIR, MKEXTSRC. As proposed on tech-kern and tech-userlevel on 2022-01-07 and followed up on 2022-08-21. To generate a diff of this commit: cvs rdiff -u -r1.334 -r1.335 src/Makefile cvs rdiff -u -r1.363 -r1.364 src/build.sh cvs rdiff -u -r1.107 -r1.108 src/distrib/sets/Makefile cvs rdiff -u -r1.45 -r1.46 src/distrib/sets/checkflist cvs rdiff -u -r1.29 -r1.30 src/distrib/sets/comments src/distrib/sets/descrs cvs rdiff -u -r1.77 -r1.78 src/distrib/sets/makeflist cvs rdiff -u -r1.31 -r1.32 src/distrib/sets/makeobsolete cvs rdiff -u -r1.43 -r1.44 src/distrib/sets/makesrctars cvs rdiff -u -r1.93 -r1.94 src/distrib/sets/maketars cvs rdiff -u -r1.40 -r1.41 src/distrib/sets/mkvars.mk cvs rdiff -u -r1.201 -r1.202 src/distrib/sets/sets.subr cvs rdiff -u -r1.134 -r1.135 src/doc/BUILDING.mdoc cvs rdiff -u -r1.465 -r1.466 src/etc/Makefile cvs rdiff -u -r1.47 -r1.48 src/etc/mtree/Makefile cvs rdiff -u -r1.16 -r1.17 src/share/man/man7/src.7 cvs rdiff -u -r1.440 -r1.441 src/share/mk/bsd.README cvs rdiff -u -r1.1287 -r1.1288 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: skrll Date: Sun Aug 21 07:03:09 UTC 2022 Modified Files: src/sys/net: if.c Log Message: Style / whitespace. To generate a diff of this commit: cvs rdiff -u -r1.517 -r1.518 src/sys/net/if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if.c diff -u src/sys/net/if.c:1.517 src/sys/net/if.c:1.518 --- src/sys/net/if.c:1.517 Sat Aug 20 15:11:27 2022 +++ src/sys/net/if.c Sun Aug 21 07:03:09 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.517 2022/08/20 15:11:27 riastradh Exp $ */ +/* $NetBSD: if.c,v 1.518 2022/08/21 07:03:09 skrll Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.517 2022/08/20 15:11:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.518 2022/08/21 07:03:09 skrll Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -3583,12 +3583,11 @@ doifioctl(struct socket *so, u_long cmd, curlwp_bindx(bound); return r; - case SIOCIFGCLONERS: - { - struct if_clonereq *req = (struct if_clonereq *)data; - return if_clone_list(req->ifcr_count, req->ifcr_buffer, - >ifcr_total); - } + case SIOCIFGCLONERS: { + struct if_clonereq *req = (struct if_clonereq *)data; + return if_clone_list(req->ifcr_count, req->ifcr_buffer, + >ifcr_total); + } } if ((cmd & IOC_IN) == 0 || IOCPARM_LEN(cmd) < sizeof(ifr->ifr_name))
CVS commit: src/sys/net
Module Name:src Committed By: skrll Date: Sun Aug 21 07:03:09 UTC 2022 Modified Files: src/sys/net: if.c Log Message: Style / whitespace. To generate a diff of this commit: cvs rdiff -u -r1.517 -r1.518 src/sys/net/if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.