CVS commit: src/sys/net/lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:29:16 UTC 2021 Modified Files: src/sys/net/lagg: if_lagg.c if_lagg.h Log Message: remove unused ioctl command named SIOCGLAGGPORT to get status of l2tp(4) added to lagg NOTE: SIOCGLAGGPORT is based on FreeBSD implementation. And, currently, it is not used in NetBSD kernel/userland. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/net/lagg/if_lagg.c cvs rdiff -u -r1.2 -r1.3 src/sys/net/lagg/if_lagg.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/net/lagg/if_lagg.c diff -u src/sys/net/lagg/if_lagg.c:1.19 src/sys/net/lagg/if_lagg.c:1.20 --- src/sys/net/lagg/if_lagg.c:1.19 Mon Nov 8 06:22:16 2021 +++ src/sys/net/lagg/if_lagg.c Mon Nov 8 06:29:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_lagg.c,v 1.19 2021/11/08 06:22:16 yamaguchi Exp $ */ +/* $NetBSD: if_lagg.c,v 1.20 2021/11/08 06:29:16 yamaguchi Exp $ */ /* * Copyright (c) 2005, 2006 Reyk Floeter @@ -20,7 +20,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.19 2021/11/08 06:22:16 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.20 2021/11/08 06:29:16 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2645,15 +2645,9 @@ lagg_unconfig_promisc(struct lagg_softc static int lagg_port_ioctl(struct ifnet *ifp, u_long cmd, void *data) { - struct ifreq *ifr = (struct ifreq *)data; struct lagg_softc *sc; - struct lagg_variant *var; struct lagg_port *lp; - struct lagg_req laggreq; - struct laggreqport *rp; - struct psref psref; int error = 0; - int bound; u_int ifflags; if ((lp = ifp->if_lagg) == NULL || @@ -2662,33 +2656,6 @@ lagg_port_ioctl(struct ifnet *ifp, u_lon } switch (cmd) { - case SIOCGLAGGPORT: - error = copyin(ifr->ifr_data, , sizeof(laggreq)); - if (error != 0) - break; - - if (laggreq.lrq_nports != 1) { - error = EINVAL; - break; - } - - rp = _reqports[0]; - - if (rp->rp_portname[0] == '\0' || - ifunit(rp->rp_portname) != ifp) { - error = EINVAL; - break; - } - - bound = curlwp_bind(); - var = lagg_variant_getref(sc, ); - - rp->rp_prio = lp->lp_prio; - rp->rp_flags = lp->lp_flags; - lagg_proto_portstat(var, lp, rp); - lagg_variant_putref(var, ); - curlwp_bindx(bound); - break; case SIOCSIFCAP: case SIOCSIFMTU: case SIOCSETHERCAP: Index: src/sys/net/lagg/if_lagg.h diff -u src/sys/net/lagg/if_lagg.h:1.2 src/sys/net/lagg/if_lagg.h:1.3 --- src/sys/net/lagg/if_lagg.h:1.2 Mon May 24 06:08:28 2021 +++ src/sys/net/lagg/if_lagg.h Mon Nov 8 06:29:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_lagg.h,v 1.2 2021/05/24 06:08:28 yamaguchi Exp $ */ +/* $NetBSD: if_lagg.h,v 1.3 2021/11/08 06:29:16 yamaguchi Exp $ */ /* * Copyright (c) 2005, 2006 Reyk Floeter @@ -189,5 +189,4 @@ struct lagg_req { #define SIOCGLAGG SIOCGIFGENERIC #define SIOCSLAGG SIOCSIFGENERIC -#define SIOCGLAGGPORT SIOCGIFGENERIC #endif
CVS commit: src/sys/net/lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:29:16 UTC 2021 Modified Files: src/sys/net/lagg: if_lagg.c if_lagg.h Log Message: remove unused ioctl command named SIOCGLAGGPORT to get status of l2tp(4) added to lagg NOTE: SIOCGLAGGPORT is based on FreeBSD implementation. And, currently, it is not used in NetBSD kernel/userland. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/net/lagg/if_lagg.c cvs rdiff -u -r1.2 -r1.3 src/sys/net/lagg/if_lagg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:24:11 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added tests for lagg(4) about MAC addresses To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/net/if_lagg/t_lagg.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_lagg/t_lagg.sh diff -u src/tests/net/if_lagg/t_lagg.sh:1.5 src/tests/net/if_lagg/t_lagg.sh:1.6 --- src/tests/net/if_lagg/t_lagg.sh:1.5 Tue Nov 2 01:57:16 2021 +++ src/tests/net/if_lagg/t_lagg.sh Mon Nov 8 06:24:11 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.5 2021/11/02 01:57:16 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.6 2021/11/08 06:24:11 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -228,6 +228,7 @@ lagg_macaddr_head() lagg_macaddr_body() { local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + local lnkaddr0="02:00:00:00:00:01" # 02: I/G = 0, G/L = 1 rump_server_start $SOCK_HOST0 lagg @@ -242,26 +243,68 @@ lagg_macaddr_body() $atf_ifconfig lagg0 laggproto lacp + # + # Copy MAC address from shmif0 that is + # the first port to lagg. + # (laggport: (none) => shmif0) + # $atf_ifconfig lagg0 laggport shmif0 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig lagg0 + atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0 + # + # Copy MAC address assigned to lagg0 to shmif1 + # (laggport: shmif0 => shmif0, shmif1) + # $atf_ifconfig lagg0 laggport shmif1 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig lagg0 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif1 + # + # Change MAC address on the detaching + # the first port (shmif0) from lagg0 + # (laggport: shmif0, shmif1 => shmif1) + # $atf_ifconfig lagg0 -laggport shmif0 atf_check -s exit:0 -o match:$maddr1 rump.ifconfig lagg0 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0 + atf_check -s exit:0 -o match:$maddr1 rump.ifconfig shmif1 + # + # Copy lagg0's MAC address to shmif0 even if + # lagg0 had used shmif0's MAC address + # (laggport: shmif1 => shmif1, shmif0) + # $atf_ifconfig lagg0 laggport shmif0 atf_check -s exit:0 -o match:$maddr1 rump.ifconfig lagg0 atf_check -s exit:0 -o match:$maddr1 rump.ifconfig shmif0 + # + # should not change MAC address of lagg0 on detaching + # shmif0 that copied mac address from lagg0 + # (laggport: shmif1, shmif0 => shmif1) + # $atf_ifconfig lagg0 -laggport shmif0 + atf_check -s exit:0 -o match:$maddr1 rump.ifconfig lagg0 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0 + # + # Use the generated MAC address + # when all port detached from lagg0 + # (laggport: shmif1 => (none)) $atf_ifconfig lagg0 -laggport shmif1 atf_check -s exit:0 -o match:$maddr rump.ifconfig lagg0 + + # + # Copy the active MAC address from shmif0 to lagg0 + # when shmif0 has two MAC addresses + # + $atf_ifconfig shmif0 link $lnkaddr0 + $atf_ifconfig lagg0 laggport shmif0 + atf_check -s exit:0 -o match:$maddr0 rump.ifconfig lagg0 + atf_check -s exit:0 -o not-match:$lnkaddr0 rump.ifconfig lagg0 + atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0 + atf_check -s exit:0 -o match:$lnkaddr0 rump.ifconfig shmif0 } lagg_macaddr_cleanup()
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:24:11 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added tests for lagg(4) about MAC addresses To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/net/if_lagg/t_lagg.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net/lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:22:16 UTC 2021 Modified Files: src/sys/net/lagg: if_lagg.c Log Message: lagg: renew MAC addresses to change the value of interface type The interface type(ifnet::if_type) is changed on adding to lagg(4) and deleting from it. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/net/lagg/if_lagg.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/lagg/if_lagg.c diff -u src/sys/net/lagg/if_lagg.c:1.18 src/sys/net/lagg/if_lagg.c:1.19 --- src/sys/net/lagg/if_lagg.c:1.18 Mon Nov 8 06:17:05 2021 +++ src/sys/net/lagg/if_lagg.c Mon Nov 8 06:22:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_lagg.c,v 1.18 2021/11/08 06:17:05 yamaguchi Exp $ */ +/* $NetBSD: if_lagg.c,v 1.19 2021/11/08 06:22:16 yamaguchi Exp $ */ /* * Copyright (c) 2005, 2006 Reyk Floeter @@ -20,7 +20,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.18 2021/11/08 06:17:05 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.19 2021/11/08 06:22:16 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -31,6 +31,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v #include #include +#include #include #include #include @@ -133,6 +134,7 @@ static const struct lagg_proto lagg_prot }, }; +static int lagg_chg_sadl(struct ifnet *, uint8_t *, size_t); static struct mbuf * lagg_input_ethernet(struct ifnet *, struct mbuf *); static int lagg_clone_create(struct if_clone *, int); @@ -2086,8 +2088,8 @@ lagg_port_setsadl(struct lagg_port *lp, break; } - if_set_sadl(ifp_port, lladdr, - ETHER_ADDR_LEN, false); + lagg_chg_sadl(ifp_port, + lladdr, ETHER_ADDR_LEN); if (!ISSET(ifp_port->if_flags, IFF_RUNNING)) { break; @@ -2123,11 +2125,11 @@ lagg_port_unsetsadl(struct lagg_port *lp switch (lp->lp_iftype) { case IFT_ETHER: - /* reset if_type before if_set_sadl */ + /* reset if_type before changing ifp->if_sadl */ ifp_port->if_type = lp->lp_iftype; - if_set_sadl(ifp_port, lp->lp_lladdr, - ETHER_ADDR_LEN, false); + lagg_chg_sadl(ifp_port, + lp->lp_lladdr, ETHER_ADDR_LEN); if (!ISSET(ifp_port->if_flags, IFF_RUNNING)) { break; @@ -2237,7 +2239,7 @@ lagg_sadl_update(struct lagg_softc *sc, if (lagg_lladdr_equal(lladdr_prev, lladdr) == false) return; - if_set_sadl(ifp, sc->sc_lladdr, ETHER_ADDR_LEN, false); + lagg_chg_sadl(ifp, sc->sc_lladdr, ETHER_ADDR_LEN); LAGG_PORTS_FOREACH(sc, lp) { IFNET_LOCK(lp->lp_ifp); @@ -2899,6 +2901,120 @@ lagg_workq_wait(struct workqueue *wq, st workqueue_wait(wq, >lw_cookie); } +static int +lagg_chg_sadl(struct ifnet *ifp, uint8_t *lla, size_t lla_len) +{ + struct psref psref_cur, psref_next; + struct ifaddr *ifa_cur, *ifa_next, *ifa_lla; + const struct sockaddr_dl *sdl, *nsdl; + int s, error; + + KASSERT(!cpu_intr_p() && !cpu_softintr_p()); + KASSERT(IFNET_LOCKED(ifp)); + KASSERT(ifp->if_addrlen == lla_len); + + error = 0; + ifa_lla = NULL; + + while (1) { + s = pserialize_read_enter(); + IFADDR_READER_FOREACH(ifa_cur, ifp) { + sdl = satocsdl(ifa_cur->ifa_addr); + if (sdl->sdl_family != AF_LINK) +continue; + + if (sdl->sdl_type != ifp->if_type) { +ifa_acquire(ifa_cur, _cur); +break; + } + } + pserialize_read_exit(s); + + if (ifa_cur == NULL) + break; + + ifa_next = if_dl_create(ifp, ); + if (ifa_next == NULL) { + error = ENOMEM; + ifa_release(ifa_cur, _cur); + goto done; + } + ifa_acquire(ifa_next, _next); + (void)sockaddr_dl_setaddr(__UNCONST(nsdl), nsdl->sdl_len, + CLLADDR(sdl), ifp->if_addrlen); + ifa_insert(ifp, ifa_next); + + if (ifa_lla == NULL && + memcmp(CLLADDR(sdl), lla, lla_len) == 0) { + ifa_lla = ifa_next; + ifaref(ifa_lla); + } + + if (ifa_cur == ifp->if_dl) + if_activate_sadl(ifp, ifa_next, nsdl); + + if (ifa_cur == ifp->if_hwdl) { + ifp->if_hwdl = ifa_next; + ifaref(ifa_next); + ifafree(ifa_cur); + } + + ifaref(ifa_cur); + ifa_release(ifa_cur, _cur); + ifa_remove(ifp, ifa_cur); + KASSERTMSG(ifa_cur->ifa_refcnt == 1, + "ifa_refcnt=%d", ifa_cur->ifa_refcnt); + ifafree(ifa_cur); + ifa_release(ifa_next, _next); + } + + if (ifa_lla != NULL) { + ifa_next = ifa_lla; + + ifa_acquire(ifa_next, _next); + ifafree(ifa_lla); + + nsdl = satocsdl(ifa_next->ifa_addr); + } else { + ifa_next = if_dl_create(ifp, ); + if (ifa_next == NULL) { + error = ENOMEM; + goto done; + } + ifa_acquire(ifa_next, _next); + (void)sockaddr_dl_setaddr(__UNCONST(nsdl), + nsdl->sdl_len, lla, ifp->if_addrlen); + ifa_insert(ifp, ifa_next); + } + + if (ifa_next != ifp->if_dl) { + ifa_cur = ifp->if_dl; + if (ifa_cur != NULL) + ifa_acquire(ifa_cur, _cur); + + if_activate_sadl(ifp, ifa_next, nsdl); + + if (ifa_cur != NULL) { + if (ifa_cur != ifp->if_hwdl) { +ifaref(ifa_cur); +ifa_release(ifa_cur, _cur); +ifa_remove(ifp,
CVS commit: src/sys/net/lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:22:16 UTC 2021 Modified Files: src/sys/net/lagg: if_lagg.c Log Message: lagg: renew MAC addresses to change the value of interface type The interface type(ifnet::if_type) is changed on adding to lagg(4) and deleting from it. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/net/lagg/if_lagg.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/lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:17:05 UTC 2021 Modified Files: src/sys/net/lagg: if_lagg.c Log Message: Update the MAC address of all child interface when that of lagg is changed. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/net/lagg/if_lagg.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/lagg/if_lagg.c diff -u src/sys/net/lagg/if_lagg.c:1.17 src/sys/net/lagg/if_lagg.c:1.18 --- src/sys/net/lagg/if_lagg.c:1.17 Fri Oct 22 06:20:47 2021 +++ src/sys/net/lagg/if_lagg.c Mon Nov 8 06:17:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_lagg.c,v 1.17 2021/10/22 06:20:47 yamaguchi Exp $ */ +/* $NetBSD: if_lagg.c,v 1.18 2021/11/08 06:17:05 yamaguchi Exp $ */ /* * Copyright (c) 2005, 2006 Reyk Floeter @@ -20,7 +20,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.17 2021/10/22 06:20:47 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.18 2021/11/08 06:17:05 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2221,6 +2221,7 @@ static void lagg_sadl_update(struct lagg_softc *sc, uint8_t *lladdr_prev) { struct ifnet *ifp; + struct lagg_port *lp; const uint8_t *lladdr; ifp = >sc_if; @@ -2238,6 +2239,12 @@ lagg_sadl_update(struct lagg_softc *sc, if_set_sadl(ifp, sc->sc_lladdr, ETHER_ADDR_LEN, false); + LAGG_PORTS_FOREACH(sc, lp) { + IFNET_LOCK(lp->lp_ifp); + lagg_port_setsadl(lp, sc->sc_lladdr, false); + IFNET_UNLOCK(lp->lp_ifp); + } + LAGG_UNLOCK(sc); lagg_in6_ifdetach(ifp); lagg_in6_ifattach(ifp);
CVS commit: src/sys/net/lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:17:05 UTC 2021 Modified Files: src/sys/net/lagg: if_lagg.c Log Message: Update the MAC address of all child interface when that of lagg is changed. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/net/lagg/if_lagg.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: andvar Date: Sun Nov 7 20:31:10 UTC 2021 Modified Files: src/games/quiz: rxp.c src/lib/libc/compat/net: compat_ns_addr.c src/lib/libresolv: dst_internal.h src/lib/librpcsvc: nfs_prot.x src/sys/dev/dm/doc: design.txt src/sys/netinet: dccp_var.h src/tests/usr.bin/sed: t_sed.sh src/usr.sbin/sysinst: partitions.h Log Message: fix various typos, mainly s/prefered/preferred/ To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/games/quiz/rxp.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/compat/net/compat_ns_addr.c cvs rdiff -u -r1.2 -r1.3 src/lib/libresolv/dst_internal.h cvs rdiff -u -r1.7 -r1.8 src/lib/librpcsvc/nfs_prot.x cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dm/doc/design.txt cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/dccp_var.h cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/sed/t_sed.sh cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/partitions.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/quiz/rxp.c diff -u src/games/quiz/rxp.c:1.13 src/games/quiz/rxp.c:1.14 --- src/games/quiz/rxp.c:1.13 Thu Aug 27 00:31:12 2009 +++ src/games/quiz/rxp.c Sun Nov 7 20:31:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rxp.c,v 1.13 2009/08/27 00:31:12 dholland Exp $ */ +/* $NetBSD: rxp.c,v 1.14 2021/11/07 20:31:09 andvar Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: rxp.c,v 1.13 2009/08/27 00:31:12 dholland Exp $"); +__RCSID("$NetBSD: rxp.c,v 1.14 2021/11/07 20:31:09 andvar Exp $"); #endif #endif /* not lint */ @@ -50,7 +50,7 @@ __RCSID("$NetBSD: rxp.c,v 1.13 2009/08/2 * TRUE success * FALSE parse failure; error message will be in char rxperr[] * metas are: - * {...} optional pattern, equialent to [...|] + * {...} optional pattern, equivalent to [...|] * | alternate pattern * [...] pattern delimiters * Index: src/lib/libc/compat/net/compat_ns_addr.c diff -u src/lib/libc/compat/net/compat_ns_addr.c:1.3 src/lib/libc/compat/net/compat_ns_addr.c:1.4 --- src/lib/libc/compat/net/compat_ns_addr.c:1.3 Mon Oct 15 22:22:01 2012 +++ src/lib/libc/compat/net/compat_ns_addr.c Sun Nov 7 20:31:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_ns_addr.c,v 1.3 2012/10/15 22:22:01 msaitoh Exp $ */ +/* $NetBSD: compat_ns_addr.c,v 1.4 2021/11/07 20:31:09 andvar Exp $ */ /* * Copyright (c) 1986, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93"; #else -__RCSID("$NetBSD: compat_ns_addr.c,v 1.3 2012/10/15 22:22:01 msaitoh Exp $"); +__RCSID("$NetBSD: compat_ns_addr.c,v 1.4 2021/11/07 20:31:09 andvar Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -65,10 +65,10 @@ ns_addr(const char *name) (void)strlcpy(buf, name, sizeof(buf)); /* - * First, figure out what he intends as a field separtor. - * Despite the way this routine is written, the prefered + * First, figure out what he intends as a field separator. + * Despite the way this routine is written, the preferred * form 2-272.AA001234H.01777, i.e. XDE standard. - * Great efforts are made to insure backward compatibility. + * Great efforts are made to ensure backward compatibility. */ if ((hostname = strchr(buf, '#')) != NULL) separator = '#'; @@ -138,7 +138,7 @@ Field(char *buf, uint8_t *out, int len) } /* * This is REALLY stretching it but there was a - * comma notation separting shorts -- definitely non standard + * comma notation separating shorts -- definitely non standard */ if (1 < (i = sscanf(buf,"%x,%x,%x", [0], [1], [2]))) { Index: src/lib/libresolv/dst_internal.h diff -u src/lib/libresolv/dst_internal.h:1.2 src/lib/libresolv/dst_internal.h:1.3 --- src/lib/libresolv/dst_internal.h:1.2 Fri Nov 16 02:11:05 2012 +++ src/lib/libresolv/dst_internal.h Sun Nov 7 20:31:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dst_internal.h,v 1.2 2012/11/16 02:11:05 joerg Exp $ */ +/* $NetBSD: dst_internal.h,v 1.3 2021/11/07 20:31:09 andvar Exp $ */ #ifndef DST_INTERNAL_H #define DST_INTERNAL_H @@ -50,7 +50,7 @@ typedef struct dst_key { #include /* * define what crypto systems are supported for RSA, - * BSAFE is prefered over RSAREF; only one can be set at any time + * BSAFE is preferred over RSAREF; only one can be set at any time */ #if defined(BSAFE) && defined(RSAREF) # error "Cannot have both BSAFE and RSAREF defined" Index: src/lib/librpcsvc/nfs_prot.x diff -u src/lib/librpcsvc/nfs_prot.x:1.7 src/lib/librpcsvc/nfs_prot.x:1.8 --- src/lib/librpcsvc/nfs_prot.x:1.7 Thu Jul 1 22:52:34 2004 +++ src/lib/librpcsvc/nfs_prot.x Sun Nov 7 20:31:09 2021 @@ -32,7 +32,7 @@ %#ifndef __lint__ %/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/ %/*static char sccsid[] = "from: @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ -%__RCSID("$NetBSD: nfs_prot.x,v 1.7
CVS commit: src
Module Name:src Committed By: andvar Date: Sun Nov 7 20:31:10 UTC 2021 Modified Files: src/games/quiz: rxp.c src/lib/libc/compat/net: compat_ns_addr.c src/lib/libresolv: dst_internal.h src/lib/librpcsvc: nfs_prot.x src/sys/dev/dm/doc: design.txt src/sys/netinet: dccp_var.h src/tests/usr.bin/sed: t_sed.sh src/usr.sbin/sysinst: partitions.h Log Message: fix various typos, mainly s/prefered/preferred/ To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/games/quiz/rxp.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/compat/net/compat_ns_addr.c cvs rdiff -u -r1.2 -r1.3 src/lib/libresolv/dst_internal.h cvs rdiff -u -r1.7 -r1.8 src/lib/librpcsvc/nfs_prot.x cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dm/doc/design.txt cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/dccp_var.h cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/sed/t_sed.sh cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/partitions.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 20:16:50 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_ident.c Log Message: tests/indent: document quick-and-dirty approach of lex_number To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/token_ident.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/usr.bin/indent/token_ident.c diff -u src/tests/usr.bin/indent/token_ident.c:1.2 src/tests/usr.bin/indent/token_ident.c:1.3 --- src/tests/usr.bin/indent/token_ident.c:1.2 Sun Nov 7 19:25:26 2021 +++ src/tests/usr.bin/indent/token_ident.c Sun Nov 7 20:16:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_ident.c,v 1.2 2021/11/07 19:25:26 rillig Exp $ */ +/* $NetBSD: token_ident.c,v 1.3 2021/11/07 20:16:50 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -77,3 +77,18 @@ const char SYS$LOGIN[]="$HOME"; int $ = jQuery; // just kidding const char SYS$LOGIN[] = "$HOME"; #indent end + + +/* + * Text the tokenizer for number constants. + * + * When the tokenizer reads a character that makes a token invalid (such as + * '0x') but may later be extended to form a valid token (such as '0x123'), + * indent does not care about this invalid prefix and returns it nevertheless. + */ +#indent input +int unfinished_hex_prefix = 0x; +double unfinished_hex_float = 0x123p; +#indent end + +#indent run-equals-input -di0
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 20:16:50 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_ident.c Log Message: tests/indent: document quick-and-dirty approach of lex_number To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/token_ident.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 19:25:26 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_ident.c Log Message: tests/indent: test identifiers containing '$' To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/token_ident.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/usr.bin/indent/token_ident.c diff -u src/tests/usr.bin/indent/token_ident.c:1.1 src/tests/usr.bin/indent/token_ident.c:1.2 --- src/tests/usr.bin/indent/token_ident.c:1.1 Mon Oct 18 18:10:20 2021 +++ src/tests/usr.bin/indent/token_ident.c Sun Nov 7 19:25:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_ident.c,v 1.1 2021/10/18 18:10:20 rillig Exp $ */ +/* $NetBSD: token_ident.c,v 1.2 2021/11/07 19:25:26 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -62,3 +62,18 @@ t(void) x._y = 5; } #indent end + + +/* + * Test identifiers containing '$', which some compilers support as an + * extension to the C standard. + */ +#indent input +int $ = jQuery; // just kidding +const char SYS$LOGIN[]="$HOME"; +#indent end + +#indent run +int $ = jQuery; // just kidding +const char SYS$LOGIN[] = "$HOME"; +#indent end
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 19:25:26 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_ident.c Log Message: tests/indent: test identifiers containing '$' To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/token_ident.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/arm
Module Name:src Committed By: jmcneill Date: Sun Nov 7 19:21:33 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_dwmac.c src/sys/arch/arm/rockchip: rk_gmac.c src/sys/arch/arm/sunxi: sunxi_emac.c sunxi_gmac.c Log Message: Handle RGMII variants. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/amlogic/meson_dwmac.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/rockchip/rk_gmac.c cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/sunxi/sunxi_emac.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_gmac.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/arm/amlogic/meson_dwmac.c diff -u src/sys/arch/arm/amlogic/meson_dwmac.c:1.11 src/sys/arch/arm/amlogic/meson_dwmac.c:1.12 --- src/sys/arch/arm/amlogic/meson_dwmac.c:1.11 Wed Jan 27 03:10:18 2021 +++ src/sys/arch/arm/amlogic/meson_dwmac.c Sun Nov 7 19:21:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_dwmac.c,v 1.11 2021/01/27 03:10:18 thorpej Exp $ */ +/* $NetBSD: meson_dwmac.c,v 1.12 2021/11/07 19:21:32 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.11 2021/01/27 03:10:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.12 2021/11/07 19:21:32 jmcneill Exp $"); #include #include @@ -207,7 +207,7 @@ meson_dwmac_attach(device_t parent, devi phandle_phy = phandle; } - if (strcmp(phy_mode, "rgmii") == 0) { + if (strncmp(phy_mode, "rgmii", 5) == 0) { meson_dwmac_set_mode_rgmii(phandle, sc->sc_bst, prgeth_bsh, clk_in[0]); } else if (strcmp(phy_mode, "rmii") == 0) { meson_dwmac_set_mode_rmii(phandle, sc->sc_bst, prgeth_bsh); Index: src/sys/arch/arm/rockchip/rk_gmac.c diff -u src/sys/arch/arm/rockchip/rk_gmac.c:1.19 src/sys/arch/arm/rockchip/rk_gmac.c:1.20 --- src/sys/arch/arm/rockchip/rk_gmac.c:1.19 Wed Jan 27 03:10:19 2021 +++ src/sys/arch/arm/rockchip/rk_gmac.c Sun Nov 7 19:21:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_gmac.c,v 1.19 2021/01/27 03:10:19 thorpej Exp $ */ +/* $NetBSD: rk_gmac.c,v 1.20 2021/11/07 19:21:33 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.19 2021/01/27 03:10:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.20 2021/11/07 19:21:33 jmcneill Exp $"); #include #include @@ -416,7 +416,7 @@ rk_gmac_attach(device_t parent, device_t switch (rk_sc->sc_type) { case GMAC_RK3328: - if (strcmp(phy_mode, "rgmii") == 0) { + if (strncmp(phy_mode, "rgmii", 5) == 0) { rk3328_gmac_set_mode_rgmii(sc, tx_delay, rx_delay, set_delay); @@ -427,7 +427,7 @@ rk_gmac_attach(device_t parent, device_t } break; case GMAC_RK3399: - if (strcmp(phy_mode, "rgmii") == 0) { + if (strncmp(phy_mode, "rgmii", 5) == 0) { rk3399_gmac_set_mode_rgmii(sc, tx_delay, rx_delay, set_delay); Index: src/sys/arch/arm/sunxi/sunxi_emac.c diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.33 src/sys/arch/arm/sunxi/sunxi_emac.c:1.34 --- src/sys/arch/arm/sunxi/sunxi_emac.c:1.33 Wed Jan 27 03:10:20 2021 +++ src/sys/arch/arm/sunxi/sunxi_emac.c Sun Nov 7 19:21:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_emac.c,v 1.33 2021/01/27 03:10:20 thorpej Exp $ */ +/* $NetBSD: sunxi_emac.c,v 1.34 2021/11/07 19:21:33 jmcneill Exp $ */ /*- * Copyright (c) 2016-2017 Jared McNeill @@ -33,7 +33,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.33 2021/01/27 03:10:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.34 2021/11/07 19:21:33 jmcneill Exp $"); #include #include @@ -987,7 +987,7 @@ sunxi_emac_setup_phy(struct sunxi_emac_s reg = syscon_read_4(sc->syscon, EMAC_CLK_REG); reg &= ~(EMAC_CLK_PIT | EMAC_CLK_SRC | EMAC_CLK_RMII_EN); - if (strcmp(phy_type, "rgmii") == 0) + if (strncmp(phy_type, "rgmii", 5) == 0) reg |= EMAC_CLK_PIT_RGMII | EMAC_CLK_SRC_RGMII; else if (strcmp(phy_type, "rmii") == 0) reg |= EMAC_CLK_RMII_EN; Index: src/sys/arch/arm/sunxi/sunxi_gmac.c diff -u src/sys/arch/arm/sunxi/sunxi_gmac.c:1.9 src/sys/arch/arm/sunxi/sunxi_gmac.c:1.10 --- src/sys/arch/arm/sunxi/sunxi_gmac.c:1.9 Wed Jan 27 03:10:20 2021 +++ src/sys/arch/arm/sunxi/sunxi_gmac.c Sun Nov 7 19:21:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_gmac.c,v 1.9 2021/01/27 03:10:20 thorpej Exp $ */ +/* $NetBSD: sunxi_gmac.c,v 1.10 2021/11/07 19:21:33 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.9 2021/01/27 03:10:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.10 2021/11/07 19:21:33 jmcneill Exp $"); #include #include @@ -177,7 +177,7 @@ sunxi_gmac_attach(device_t parent, devic aprint_error(": failed to set TX clock rate (MII)\n"); return; } - } else if (strcmp(phy_mode, "rgmii")
CVS commit: src/sys/arch/arm
Module Name:src Committed By: jmcneill Date: Sun Nov 7 19:21:33 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_dwmac.c src/sys/arch/arm/rockchip: rk_gmac.c src/sys/arch/arm/sunxi: sunxi_emac.c sunxi_gmac.c Log Message: Handle RGMII variants. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/amlogic/meson_dwmac.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/rockchip/rk_gmac.c cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/sunxi/sunxi_emac.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_gmac.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: rillig Date: Sun Nov 7 19:18:57 UTC 2021 Modified Files: src/tests/usr.bin/indent: opt_bl_br.c t_misc.sh src/usr.bin/indent: indent.c Log Message: indent: fix handling of C99 comments after 'if (expr)' To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/opt_bl_br.c cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/indent/t_misc.sh cvs rdiff -u -r1.217 -r1.218 src/usr.bin/indent/indent.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/usr.bin/indent/opt_bl_br.c diff -u src/tests/usr.bin/indent/opt_bl_br.c:1.1 src/tests/usr.bin/indent/opt_bl_br.c:1.2 --- src/tests/usr.bin/indent/opt_bl_br.c:1.1 Fri Oct 22 20:54:36 2021 +++ src/tests/usr.bin/indent/opt_bl_br.c Sun Nov 7 19:18:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt_bl_br.c,v 1.1 2021/10/22 20:54:36 rillig Exp $ */ +/* $NetBSD: opt_bl_br.c,v 1.2 2021/11/07 19:18:56 rillig Exp $ */ /* $FreeBSD$ */ #indent input @@ -65,3 +65,59 @@ example(int n) } } #indent end + + +/* + * Test C99 comments after 'if (expr)', which is handled by search_stmt. + */ +#indent input +void function(void) +{ + if (expr) // C99 comment + stmt(); + + if (expr) // C99 comment + { + stmt(); + } +} +#indent end + +#indent run +void +function(void) +{ + if (expr) // C99 comment + stmt(); + + if (expr) { // C99 comment + stmt(); + } +} +#indent end + + +/* + * Test multiple mixed comments after 'if (expr)'. + */ +#indent input +void +function(void) +{ + if (expr) // C99 comment 1 + // C99 comment 2 + // C99 comment 3 + stmt(); +} +#indent end + +#indent run +void +function(void) +{ + if (expr) // C99 comment 1 + // C99 comment 2 + // C99 comment 3 + stmt(); +} +#indent end Index: src/tests/usr.bin/indent/t_misc.sh diff -u src/tests/usr.bin/indent/t_misc.sh:1.14 src/tests/usr.bin/indent/t_misc.sh:1.15 --- src/tests/usr.bin/indent/t_misc.sh:1.14 Sun Nov 7 19:04:46 2021 +++ src/tests/usr.bin/indent/t_misc.sh Sun Nov 7 19:18:56 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_misc.sh,v 1.14 2021/11/07 19:04:46 rillig Exp $ +# $NetBSD: t_misc.sh,v 1.15 2021/11/07 19:18:56 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -364,23 +364,6 @@ several_profiles_body() "$indent" -Pnonexistent.pro -Perror.pro -Plast.pro code.c -st } -atf_test_case 'if_expr_c99_comment' -if_expr_c99_comment_body() -{ - cat <<-\EOF >> code.c - void function(void) { - if (expr) // C99 comment -stmt(); - } - EOF - cat <<-\EOF >> code.err - error: code.c:2: Internal buffer overflow - Move big comment from right after if, while, or whatever - EOF - - atf_check -s 'exit:1' -o 'ignore' -e 'file:code.err' \ - "$indent" code.c -st -} - atf_init_test_cases() { atf_add_test_case 'in_place' @@ -394,5 +377,4 @@ atf_init_test_cases() atf_add_test_case 'line_no_counting' atf_add_test_case 'default_backup_extension' atf_add_test_case 'several_profiles' - atf_add_test_case 'if_expr_c99_comment' } Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.217 src/usr.bin/indent/indent.c:1.218 --- src/usr.bin/indent/indent.c:1.217 Sun Nov 7 18:49:02 2021 +++ src/usr.bin/indent/indent.c Sun Nov 7 19:18:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.217 2021/11/07 18:49:02 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.218 2021/11/07 19:18:56 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.217 2021/11/07 18:49:02 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.218 2021/11/07 19:18:56 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -316,16 +316,15 @@ search_stmt_comment(void) save_com, sc_end, "\"\n"); } -sc_add_char('/'); -sc_add_char('*'); - -for (;;) { /* loop until the end of the comment */ - sc_add_char(inp_next()); - if (sc_end[-1] == '*' && *inp.s == '/') { +sc_add_range(token.s, token.e); +if (token.e[-1] == '/') { + while (inp.s[0] != '\n') sc_add_char(inp_next()); - debug_save_com("search_stmt_comment end"); - break; - } + debug_save_com("search_stmt_comment end C99"); +} else { + while (!(sc_end[-2] == '*' && sc_end[-1] == '/')) + sc_add_char(inp_next()); + debug_save_com("search_stmt_comment end block"); } }
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 7 19:18:57 UTC 2021 Modified Files: src/tests/usr.bin/indent: opt_bl_br.c t_misc.sh src/usr.bin/indent: indent.c Log Message: indent: fix handling of C99 comments after 'if (expr)' To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/opt_bl_br.c cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/indent/t_misc.sh cvs rdiff -u -r1.217 -r1.218 src/usr.bin/indent/indent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 19:04:46 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_misc.sh Log Message: indent: demonstrate controlled buffer overflow in C99 comment To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/indent/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/indent/t_misc.sh diff -u src/tests/usr.bin/indent/t_misc.sh:1.13 src/tests/usr.bin/indent/t_misc.sh:1.14 --- src/tests/usr.bin/indent/t_misc.sh:1.13 Sun Nov 7 15:01:50 2021 +++ src/tests/usr.bin/indent/t_misc.sh Sun Nov 7 19:04:46 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_misc.sh,v 1.13 2021/11/07 15:01:50 rillig Exp $ +# $NetBSD: t_misc.sh,v 1.14 2021/11/07 19:04:46 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -364,6 +364,23 @@ several_profiles_body() "$indent" -Pnonexistent.pro -Perror.pro -Plast.pro code.c -st } +atf_test_case 'if_expr_c99_comment' +if_expr_c99_comment_body() +{ + cat <<-\EOF >> code.c + void function(void) { + if (expr) // C99 comment +stmt(); + } + EOF + cat <<-\EOF >> code.err + error: code.c:2: Internal buffer overflow - Move big comment from right after if, while, or whatever + EOF + + atf_check -s 'exit:1' -o 'ignore' -e 'file:code.err' \ + "$indent" code.c -st +} + atf_init_test_cases() { atf_add_test_case 'in_place' @@ -377,4 +394,5 @@ atf_init_test_cases() atf_add_test_case 'line_no_counting' atf_add_test_case 'default_backup_extension' atf_add_test_case 'several_profiles' + atf_add_test_case 'if_expr_c99_comment' }
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 19:04:46 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_misc.sh Log Message: indent: demonstrate controlled buffer overflow in C99 comment To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/indent/t_misc.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: rillig Date: Sun Nov 7 18:49:02 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_form_feed.c src/usr.bin/indent: indent.c Log Message: indent: demonstrate disappearing form feed To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/token_form_feed.c cvs rdiff -u -r1.216 -r1.217 src/usr.bin/indent/indent.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/usr.bin/indent/token_form_feed.c diff -u src/tests/usr.bin/indent/token_form_feed.c:1.2 src/tests/usr.bin/indent/token_form_feed.c:1.3 --- src/tests/usr.bin/indent/token_form_feed.c:1.2 Sun Nov 7 18:38:34 2021 +++ src/tests/usr.bin/indent/token_form_feed.c Sun Nov 7 18:49:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_form_feed.c,v 1.2 2021/11/07 18:38:34 rillig Exp $ */ +/* $NetBSD: token_form_feed.c,v 1.3 2021/11/07 18:49:02 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -19,3 +19,28 @@ void function_1(void); void function_2(void); #indent end + + +/* + * Test form feed after 'if (expr)', which is handled in search_stmt. + */ +#indent input +void function(void) +{ + if (expr) + /* <-- form feed */ + { + } +} +#indent end + +#indent run +void +function(void) +{ + if (expr) { + /* $ XXX: The form feed has disappeared. */ + /* <-- form feed */ + } +} +#indent end Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.216 src/usr.bin/indent/indent.c:1.217 --- src/usr.bin/indent/indent.c:1.216 Sun Nov 7 18:26:17 2021 +++ src/usr.bin/indent/indent.c Sun Nov 7 18:49:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.216 2021/11/07 18:26:17 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.217 2021/11/07 18:49:02 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.216 2021/11/07 18:26:17 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.217 2021/11/07 18:49:02 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -475,6 +475,7 @@ search_stmt(lexer_symbol *lsym, bool *fo search_stmt_newline(force_nl); break; case lsym_form_feed: + /* XXX: Is simply removed from the source code. */ break; case lsym_comment: search_stmt_comment();
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 7 18:49:02 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_form_feed.c src/usr.bin/indent: indent.c Log Message: indent: demonstrate disappearing form feed To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/token_form_feed.c cvs rdiff -u -r1.216 -r1.217 src/usr.bin/indent/indent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 18:38:35 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_form_feed.c Log Message: tests/indent: fix test for form feed Previously, I had written a vertical tab instead of a form feed, which had a different effect. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/token_form_feed.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/usr.bin/indent/token_form_feed.c diff -u src/tests/usr.bin/indent/token_form_feed.c:1.1 src/tests/usr.bin/indent/token_form_feed.c:1.2 --- src/tests/usr.bin/indent/token_form_feed.c:1.1 Mon Oct 18 22:30:34 2021 +++ src/tests/usr.bin/indent/token_form_feed.c Sun Nov 7 18:38:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_form_feed.c,v 1.1 2021/10/18 22:30:34 rillig Exp $ */ +/* $NetBSD: token_form_feed.c,v 1.2 2021/11/07 18:38:34 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -7,8 +7,15 @@ #indent input void function_1(void); - + void function_2(void); #indent end -#indent run-equals-input -di0 +#indent run -di0 +void function_1(void); + +/* $ XXX: The form feed is not preserved. */ +/* $ XXX: Why 2 empty lines? */ + +void function_2(void); +#indent end
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 18:38:35 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_form_feed.c Log Message: tests/indent: fix test for form feed Previously, I had written a vertical tab instead of a form feed, which had a different effect. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/token_form_feed.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 18:26:17 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h lexi.c parse.c pr_comment.c Log Message: indent: various cleanups Make several comments more precise. Rename process_end_of_file to process_eof to match the token name. Change the order of assignments in analyze_comment to keep the com_ind computations closer together. In copy_comment_wrap, use pointer difference instead of pointer addition to stay away from undefined behavior. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 src/usr.bin/indent/indent.c cvs rdiff -u -r1.85 -r1.86 src/usr.bin/indent/indent.h cvs rdiff -u -r1.137 -r1.138 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.47 -r1.48 src/usr.bin/indent/parse.c cvs rdiff -u -r1.115 -r1.116 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 18:26:17 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h lexi.c parse.c pr_comment.c Log Message: indent: various cleanups Make several comments more precise. Rename process_end_of_file to process_eof to match the token name. Change the order of assignments in analyze_comment to keep the com_ind computations closer together. In copy_comment_wrap, use pointer difference instead of pointer addition to stay away from undefined behavior. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 src/usr.bin/indent/indent.c cvs rdiff -u -r1.85 -r1.86 src/usr.bin/indent/indent.h cvs rdiff -u -r1.137 -r1.138 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.47 -r1.48 src/usr.bin/indent/parse.c cvs rdiff -u -r1.115 -r1.116 src/usr.bin/indent/pr_comment.c 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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.215 src/usr.bin/indent/indent.c:1.216 --- src/usr.bin/indent/indent.c:1.215 Sun Nov 7 15:18:25 2021 +++ src/usr.bin/indent/indent.c Sun Nov 7 18:26:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.215 2021/11/07 15:18:25 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.216 2021/11/07 18:26:17 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.215 2021/11/07 15:18:25 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.216 2021/11/07 18:26:17 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -294,8 +294,8 @@ search_stmt_comment(void) if (sc_end == NULL) { /* * Copy everything from the start of the line, because - * process_comment() will use that to calculate original indentation - * of a boxed comment. + * process_comment() will use that to calculate the original + * indentation of a boxed comment. */ /* * FIXME: This '4' needs an explanation. For example, in the snippet @@ -665,7 +665,7 @@ code_add_decl_indent(int decl_ind, bool } static void __attribute__((__noreturn__)) -process_end_of_file(void) +process_eof(void) { if (lab.s != lab.e || code.s != code.e || com.s != com.e) dump_line(); @@ -940,8 +940,8 @@ process_semicolon(bool *seen_case, int * } ps.in_decl = ps.decl_level > 0; /* if we were in a first level - * structure declaration, we aren't - * anymore */ + * structure declaration before, we + * aren't anymore */ if ((!*spaced_expr || hd != hd_for) && ps.p_l_follow > 0) { @@ -1395,7 +1395,7 @@ main_loop(void) search_stmt(, _nl, _else); if (lsym == lsym_eof) { - process_end_of_file(); + process_eof(); /* NOTREACHED */ } Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.85 src/usr.bin/indent/indent.h:1.86 --- src/usr.bin/indent/indent.h:1.85 Sun Nov 7 15:18:25 2021 +++ src/usr.bin/indent/indent.h Sun Nov 7 18:26:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.85 2021/11/07 15:18:25 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.86 2021/11/07 18:26:17 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -150,7 +150,8 @@ extern FILE *input; extern FILE *output; extern struct buffer inp; /* one line of input, ready to be split into - * tokens */ + * tokens; occasionally this buffer switches + * to sc_buf */ extern struct buffer token; /* the current token to be processed, is * typically copied to the buffer 'code', @@ -271,7 +272,9 @@ extern struct parser_state { bool next_unary; /* whether the following operator should be * unary */ -char procname[100]; /* The name of the current procedure */ +char procname[100]; /* The name of the current procedure; TODO: + * document the difference between procname[0] + * being '\0', ' ' and a real character */ bool want_blank; /* whether the following token should be @@ -279,10 +282,11 @@ extern struct parser_state { * ignored in some cases.) */ int paren_level; /* parenthesization level. used to indent - * within statements */ + * within statements, initializers and + * declarations */ /* TODO: rename to next_line_paren_level */ int p_l_follow; /* how to indent the remaining lines of the - * statement */ + * statement or initializer or declaration */ short paren_indents[20]; /* indentation of the operand/argument of each * level of parentheses or brackets, relative * to the enclosing statement; if negative, @@ -327,7 +331,9 @@ extern struct parser_state { bool decl_indent_done; /* whether the indentation for a declaration * has been added to the code buffer. */ -bool in_stmt; +bool
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 7 18:09:56 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_errors.sh src/usr.bin/indent: args.c Log Message: indent: parse special options strictly To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/indent/t_errors.sh cvs rdiff -u -r1.69 -r1.70 src/usr.bin/indent/args.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: rillig Date: Sun Nov 7 18:09:56 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_errors.sh src/usr.bin/indent: args.c Log Message: indent: parse special options strictly To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/indent/t_errors.sh cvs rdiff -u -r1.69 -r1.70 src/usr.bin/indent/args.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/usr.bin/indent/t_errors.sh diff -u src/tests/usr.bin/indent/t_errors.sh:1.19 src/tests/usr.bin/indent/t_errors.sh:1.20 --- src/tests/usr.bin/indent/t_errors.sh:1.19 Sun Nov 7 15:54:00 2021 +++ src/tests/usr.bin/indent/t_errors.sh Sun Nov 7 18:09:56 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_errors.sh,v 1.19 2021/11/07 15:54:00 rillig Exp $ +# $NetBSD: t_errors.sh,v 1.20 2021/11/07 18:09:56 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -146,27 +146,24 @@ option_cli_trailing_garbage_body() atf_test_case 'option_npro_trailing_garbage' option_npro_trailing_garbage_body() { - # TODO: reject -npro-garbage, only allow -npro without trailing garbage. - - atf_check \ + atf_check -s 'exit:1' \ + -e 'inline:indent: Command line: unknown option "-npro-garbage"'"$nl" \ "$indent" -npro-garbage } atf_test_case 'option_st_trailing_garbage' option_st_trailing_garbage_body() { - # TODO: reject -stdio, only allow -st without trailing garbage. - - atf_check \ + atf_check -s 'exit:1' \ + -e 'inline:indent: Command line: unknown option "-stdio"'"$nl" \ "$indent" -stdio } atf_test_case 'option_version_trailing_garbage' option_version_trailing_garbage_body() { - # TODO: reject --version-dump, only allow --version without trailing garbage. - - atf_check -o 'inline:NetBSD indent 2.1'"$nl" \ + atf_check -s 'exit:1' \ + -e 'inline:indent: Command line: unknown option "--version-dump"'"$nl" \ "$indent" --version-dump } Index: src/usr.bin/indent/args.c diff -u src/usr.bin/indent/args.c:1.69 src/usr.bin/indent/args.c:1.70 --- src/usr.bin/indent/args.c:1.69 Fri Nov 5 21:52:17 2021 +++ src/usr.bin/indent/args.c Sun Nov 7 18:09:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.69 2021/11/05 21:52:17 rillig Exp $ */ +/* $NetBSD: args.c,v 1.70 2021/11/07 18:09:56 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.69 2021/11/05 21:52:17 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.70 2021/11/07 18:09:56 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -152,12 +152,12 @@ set_special_option(const char *arg, cons { const char *arg_end; -if (strncmp(arg, "-version", 8) == 0) { +if (strcmp(arg, "-version") == 0) { printf("NetBSD indent 2.1\n"); exit(0); } -if (arg[0] == 'P' || strncmp(arg, "npro", 4) == 0) +if (arg[0] == 'P' || strcmp(arg, "npro") == 0) return true; if (strncmp(arg, "cli", 3) == 0) { @@ -172,7 +172,7 @@ set_special_option(const char *arg, cons return true; } -if (strncmp(arg, "st", 2) == 0) { +if (strcmp(arg, "st") == 0) { if (input == NULL) input = stdin; if (output == NULL)
CVS commit: src/tests/lib/libc/gen/posix_spawn
Module Name:src Committed By: martin Date: Sun Nov 7 18:05:37 UTC 2021 Modified Files: src/tests/lib/libc/gen/posix_spawn: Makefile Log Message: Fix linking for multi-source file tests, the second part of the tuple needs to be the C source file (not the base name) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/posix_spawn/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/gen/posix_spawn/Makefile diff -u src/tests/lib/libc/gen/posix_spawn/Makefile:1.3 src/tests/lib/libc/gen/posix_spawn/Makefile:1.4 --- src/tests/lib/libc/gen/posix_spawn/Makefile:1.3 Sun Nov 7 15:46:20 2021 +++ src/tests/lib/libc/gen/posix_spawn/Makefile Sun Nov 7 18:05:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2021/11/07 15:46:20 christos Exp $ +# $NetBSD: Makefile,v 1.4 2021/11/07 18:05:36 martin Exp $ NOMAN= # defined WARNS=4 @@ -11,8 +11,8 @@ TESTS_C= t_spawn TESTS_C+= t_fileactions TESTS_C+= t_spawnattr -SRCS.t_spawn += t_spawn fa_spawn_utils -SRCS.t_fileactions += t_fileactions fa_spawn_utils +SRCS.t_spawn += t_spawn fa_spawn_utils.c +SRCS.t_fileactions += t_fileactions fa_spawn_utils.c BINDIR= ${TESTSDIR} SCRIPTSDIR= ${TESTSDIR}
CVS commit: src/tests/lib/libc/gen/posix_spawn
Module Name:src Committed By: martin Date: Sun Nov 7 18:05:37 UTC 2021 Modified Files: src/tests/lib/libc/gen/posix_spawn: Makefile Log Message: Fix linking for multi-source file tests, the second part of the tuple needs to be the C source file (not the base name) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/posix_spawn/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:17:24 UTC 2021 Modified Files: src/doc: CHANGES Log Message: dts: Import dts files from Linux 5.15. To generate a diff of this commit: cvs rdiff -u -r1.2848 -r1.2849 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2848 src/doc/CHANGES:1.2849 --- src/doc/CHANGES:1.2848 Sat Nov 6 13:39:06 2021 +++ src/doc/CHANGES Sun Nov 7 17:17:24 2021 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2848 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2849 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -452,3 +452,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: acpi(4): Updated ACPICA to 20210930. [christos 20211028] sht3xtemp(4): Driver for the Sensirion SHT30/SHT31/SHT35 temperature and humidity sensor [brad 20211106] + dts: Import dts files from Linux 5.15. [jmcneill 20211107]
CVS commit: src/doc
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:17:24 UTC 2021 Modified Files: src/doc: CHANGES Log Message: dts: Import dts files from Linux 5.15. To generate a diff of this commit: cvs rdiff -u -r1.2848 -r1.2849 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:16:19 UTC 2021 Modified Files: src/doc: 3RDPARTY Log Message: dts updated to 5.15 To generate a diff of this commit: cvs rdiff -u -r1.1825 -r1.1826 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1825 src/doc/3RDPARTY:1.1826 --- src/doc/3RDPARTY:1.1825 Thu Oct 28 14:54:32 2021 +++ src/doc/3RDPARTY Sun Nov 7 17:16:19 2021 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1825 2021/10/28 14:54:32 christos Exp $ +# $NetBSD: 3RDPARTY,v 1.1826 2021/11/07 17:16:19 jmcneill Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -1712,10 +1712,10 @@ Notes: external/gpl2/dtc/dtc2netbsd should be used to create directories to import Package: dts -Version: 5.1.4 -Current Vers: 5.1.4 +Version: 5.15 +Current Vers: 5.15 Maintainer: https://www.kernel.org/ -Archive Site: https://cdn.kernel.org/pub/linux/kernel/v4.x/ +Archive Site: https://cdn.kernel.org/pub/linux/kernel/v5.x/ Home Page: https://www.kernel.org/ Mailing List: mailto:devicet...@vger.kernel.org Responsible: jmcneill
CVS commit: src/doc
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:16:19 UTC 2021 Modified Files: src/doc: 3RDPARTY Log Message: dts updated to 5.15 To generate a diff of this commit: cvs rdiff -u -r1.1825 -r1.1826 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:38 UTC 2021 Modified Files: src/sys/dev/i2c: cwfg.c Log Message: cwfg: update for dts-5.15 binding changes To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/cwfg.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/i2c/cwfg.c diff -u src/sys/dev/i2c/cwfg.c:1.4 src/sys/dev/i2c/cwfg.c:1.5 --- src/sys/dev/i2c/cwfg.c:1.4 Wed Jan 27 02:29:48 2021 +++ src/sys/dev/i2c/cwfg.c Sun Nov 7 17:14:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cwfg.c,v 1.4 2021/01/27 02:29:48 thorpej Exp $ */ +/* $NetBSD: cwfg.c,v 1.5 2021/11/07 17:14:38 jmcneill Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cwfg.c,v 1.4 2021/01/27 02:29:48 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cwfg.c,v 1.5 2021/11/07 17:14:38 jmcneill Exp $"); #include #include @@ -102,7 +102,8 @@ struct cwfg_softc { #define CWFG_ALERT_LEVEL_DEFAULT 0 static const struct device_compatible_entry compat_data[] = { - { .compat = "cellwise,cw201x" }, + { .compat = "cellwise,cw2015" }, + { .compat = "cellwise,cw201x" }, /* DTCOMPAT */ DEVICE_COMPAT_EOL }; @@ -357,10 +358,16 @@ static int cwfg_parse_resources(struct cwfg_softc *sc) { const u_int *batinfo; + u_int val; int len = 0, n; batinfo = fdtbus_get_prop(sc->sc_phandle, - "cellwise,bat-config-info", ); + "cellwise,battery-profile", ); + if (batinfo == NULL) { + /* DTCOMPAT */ + batinfo = fdtbus_get_prop(sc->sc_phandle, + "cellwise,bat-config-info", ); + } switch (len) { case BATINFO_SIZE: memcpy(sc->sc_batinfo, batinfo, BATINFO_SIZE); @@ -376,12 +383,25 @@ cwfg_parse_resources(struct cwfg_softc * } if (of_getprop_uint32(sc->sc_phandle, - "cellwise,monitor-interval", >sc_monitor_interval) != 0) { + "cellwise,monitor-interval-ms", ) == 0) { + sc->sc_monitor_interval = howmany(val, 1000); + } else if (of_getprop_uint32(sc->sc_phandle, + "cellwise,monitor-interval", ) == 0) { + /* DTCOMPAT */ + sc->sc_monitor_interval = val; + } else { sc->sc_monitor_interval = CWFG_MONITOR_INTERVAL_DEFAULT; } - if (of_getprop_uint32(sc->sc_phandle, - "cellwise,design-capacity", >sc_design_capacity) != 0) { + const int bphandle = fdtbus_get_phandle(sc->sc_phandle, "monitored-battery"); + if (bphandle != -1 && of_getprop_uint32(bphandle, + "charge-full-design-microamp-hours", ) == 0) { + sc->sc_design_capacity = howmany(val, 1000); + } else if (of_getprop_uint32(sc->sc_phandle, + "cellwise,design-capacity", ) == 0) { + /* DTCOMPAT */ + sc->sc_design_capacity = val; + } else { sc->sc_design_capacity = CWFG_DESIGN_CAPACITY_DEFAULT; }
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:38 UTC 2021 Modified Files: src/sys/dev/i2c: cwfg.c Log Message: cwfg: update for dts-5.15 binding changes To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/cwfg.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/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:20 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Look for child node by compat string snps,dwc3 instead of by name. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/dwc3_fdt.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/fdt/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.18 src/sys/dev/fdt/dwc3_fdt.c:1.19 --- src/sys/dev/fdt/dwc3_fdt.c:1.18 Tue Sep 14 22:00:11 2021 +++ src/sys/dev/fdt/dwc3_fdt.c Sun Nov 7 17:14:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.18 2021/09/14 22:00:11 jmcneill Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.19 2021/11/07 17:14:20 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.18 2021/09/14 22:00:11 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.19 2021/11/07 17:14:20 jmcneill Exp $"); #include #include @@ -244,7 +244,10 @@ dwc3_fdt_attach(device_t parent, device_ /* Find dwc3 sub-node */ if (of_compatible_lookup(phandle, compat_data_dwc3) == NULL) { - dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3"); + dwc3_phandle = of_find_bycompat(phandle, "snps,dwc3"); + if (dwc3_phandle <= 0) { + dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3"); + } } else { dwc3_phandle = phandle; }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:20 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Look for child node by compat string snps,dwc3 instead of by name. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/dwc3_fdt.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/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:09 UTC 2021 Modified Files: src/sys/dev/fdt: pwm_backlight.c Log Message: pwm_backlight: pick defaults if none are provided To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/pwm_backlight.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/fdt/pwm_backlight.c diff -u src/sys/dev/fdt/pwm_backlight.c:1.9 src/sys/dev/fdt/pwm_backlight.c:1.10 --- src/sys/dev/fdt/pwm_backlight.c:1.9 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/pwm_backlight.c Sun Nov 7 17:14:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pwm_backlight.c,v 1.9 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: pwm_backlight.c,v 1.10 2021/11/07 17:14:09 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.9 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.10 2021/11/07 17:14:09 jmcneill Exp $"); #include #include @@ -86,7 +86,7 @@ pwm_backlight_attach(device_t parent, de struct fdt_attach_args * const faa = aux; const int phandle = faa->faa_phandle; const u_int *levels; - u_int default_level; + u_int default_level = 0; u_int n; int len; @@ -107,14 +107,18 @@ pwm_backlight_attach(device_t parent, de } levels = fdtbus_get_prop(phandle, "brightness-levels", ); - if (len < 4) { - aprint_error(": couldn't get 'brightness-levels' property\n"); - return; + if (levels != NULL) { + sc->sc_nlevels = len / 4; + sc->sc_levels = kmem_alloc(len, KM_SLEEP); + for (n = 0; n < sc->sc_nlevels; n++) + sc->sc_levels[n] = be32toh(levels[n]); + } else { + sc->sc_nlevels = 256; + sc->sc_levels = kmem_alloc(sc->sc_nlevels * 4, KM_SLEEP); + for (n = 0; n < sc->sc_nlevels; n++) + sc->sc_levels[n] = n; + default_level = 200; } - sc->sc_levels = kmem_alloc(len, KM_SLEEP); - sc->sc_nlevels = len / 4; - for (n = 0; n < sc->sc_nlevels; n++) - sc->sc_levels[n] = be32toh(levels[n]); aprint_naive("\n"); aprint_normal(": PWM Backlight"); @@ -127,7 +131,8 @@ pwm_backlight_attach(device_t parent, de sc->sc_lid_state = true; - if (of_getprop_uint32(phandle, "default-brightness-level", _level) == 0) { + of_getprop_uint32(phandle, "default-brightness-level", _level); + if (default_level != 0) { /* set the default level now */ pwm_backlight_set(sc, default_level, true); }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:09 UTC 2021 Modified Files: src/sys/dev/fdt: pwm_backlight.c Log Message: pwm_backlight: pick defaults if none are provided To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/pwm_backlight.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/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:53 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_intr.c fdtvar.h Log Message: fdt: add helper for finding intr parent phandle To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/fdt/fdt_intr.c cvs rdiff -u -r1.72 -r1.73 src/sys/dev/fdt/fdtvar.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/dev/fdt/fdt_intr.c diff -u src/sys/dev/fdt/fdt_intr.c:1.29 src/sys/dev/fdt/fdt_intr.c:1.30 --- src/sys/dev/fdt/fdt_intr.c:1.29 Fri Jan 15 22:59:49 2021 +++ src/sys/dev/fdt/fdt_intr.c Sun Nov 7 17:13:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_intr.c,v 1.29 2021/01/15 22:59:49 jmcneill Exp $ */ +/* $NetBSD: fdt_intr.c,v 1.30 2021/11/07 17:13:53 jmcneill Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.29 2021/01/15 22:59:49 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.30 2021/11/07 17:13:53 jmcneill Exp $"); #include #include @@ -177,6 +177,12 @@ fdtbus_put_interrupt_cookie(struct fdtbu mutex_exit(_interrupt_cookie_mutex); } +int +fdtbus_intr_parent(int phandle) +{ + return fdtbus_get_interrupt_parent(phandle); +} + void * fdtbus_intr_establish(int phandle, u_int index, int ipl, int flags, int (*func)(void *), void *arg) Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.72 src/sys/dev/fdt/fdtvar.h:1.73 --- src/sys/dev/fdt/fdtvar.h:1.72 Mon Sep 6 14:03:18 2021 +++ src/sys/dev/fdt/fdtvar.h Sun Nov 7 17:13:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.72 2021/09/06 14:03:18 jmcneill Exp $ */ +/* $NetBSD: fdtvar.h,v 1.73 2021/11/07 17:13:53 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -336,6 +336,7 @@ void fdtbus_intr_unmask(int, void *); void fdtbus_intr_disestablish(int, void *); bool fdtbus_intr_str(int, u_int, char *, size_t); bool fdtbus_intr_str_raw(int, const u_int *, char *, size_t); +int fdtbus_intr_parent(int); int fdtbus_gpio_count(int, const char *); struct fdtbus_gpio_pin *fdtbus_gpio_acquire(int, const char *, int); struct fdtbus_gpio_pin *fdtbus_gpio_acquire_index(int, const char *, int, int);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:53 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_intr.c fdtvar.h Log Message: fdt: add helper for finding intr parent phandle To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/fdt/fdt_intr.c cvs rdiff -u -r1.72 -r1.73 src/sys/dev/fdt/fdtvar.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/arm/sunxi
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:38 UTC 2021 Modified Files: src/sys/arch/arm/sunxi: sunxi_nmi.c Log Message: sunxi: nmi: add support for #interrupt-cells 3 bindings To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sunxi/sunxi_nmi.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/arm/sunxi/sunxi_nmi.c diff -u src/sys/arch/arm/sunxi/sunxi_nmi.c:1.11 src/sys/arch/arm/sunxi/sunxi_nmi.c:1.12 --- src/sys/arch/arm/sunxi/sunxi_nmi.c:1.11 Wed Jan 27 03:10:20 2021 +++ src/sys/arch/arm/sunxi/sunxi_nmi.c Sun Nov 7 17:13:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_nmi.c,v 1.11 2021/01/27 03:10:20 thorpej Exp $ */ +/* $NetBSD: sunxi_nmi.c,v 1.12 2021/11/07 17:13:38 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -29,7 +29,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_nmi.c,v 1.11 2021/01/27 03:10:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_nmi.c,v 1.12 2021/11/07 17:13:38 jmcneill Exp $"); #include #include @@ -105,6 +105,9 @@ struct sunxi_nmi_softc { bus_space_handle_t sc_bsh; int sc_phandle; + u_int sc_intr_nmi; + u_int sc_intr_cells; + kmutex_t sc_intr_lock; const struct sunxi_nmi_config *sc_config; @@ -177,22 +180,54 @@ sunxi_nmi_fdt_establish(device_t dev, u_ int (*func)(void *), void *arg, const char *xname) { struct sunxi_nmi_softc * const sc = device_private(dev); - u_int irq_type; + u_int irq_type, irq, pol; int ist; - /* 1st cell is the interrupt number */ - const u_int irq = be32toh(specifier[0]); - /* 2nd cell is polarity */ - const u_int pol = be32toh(specifier[1]); + if (sc->sc_intr_cells == 2) { + /* 1st cell is the interrupt number */ + irq = be32toh(specifier[0]); + /* 2nd cell is polarity */ + pol = be32toh(specifier[1]); + } else { + /* 1st cell is the GIC interrupt type and must be GIC_SPI */ + if (be32toh(specifier[0]) != 0) { +#ifdef DIAGNOSTIC + device_printf(dev, "GIC intr type %u is invalid\n", + be32toh(specifier[0])); +#endif + return NULL; + } + /* 2nd cell is the interrupt number */ + irq = be32toh(specifier[1]); + /* 3rd cell is polarity */ + pol = be32toh(specifier[2]); + } - if (irq != 0) { + if (sc->sc_intr_cells == 3 && irq != sc->sc_intr_nmi) { + /* + * Driver is requesting a wakeup irq, which we don't + * support today. Just pass it through to the parent + * interrupt controller. + */ + const int ihandle = fdtbus_intr_parent(sc->sc_phandle); + if (ihandle == -1) { +#ifdef DIAGNOSTIC + device_printf(dev, "couldn't find interrupt parent\n"); +#endif + return NULL; + } + return fdtbus_intr_establish_raw(ihandle, specifier, ipl, + flags, func, arg, xname); + } + + if (sc->sc_intr_cells == 2 && irq != 0) { #ifdef DIAGNOSTIC device_printf(dev, "IRQ %u is invalid\n", irq); #endif return NULL; } - switch (pol & 0x7) { + switch (pol & 0xf) { case 1: /* IRQ_TYPE_EDGE_RISING */ irq_type = NMI_CTRL_IRQ_HIGH_EDGE; ist = IST_EDGE; @@ -201,11 +236,11 @@ sunxi_nmi_fdt_establish(device_t dev, u_ irq_type = NMI_CTRL_IRQ_LOW_EDGE; ist = IST_EDGE; break; - case 3: /* IRQ_TYPE_LEVEL_HIGH */ + case 4: /* IRQ_TYPE_LEVEL_HIGH */ irq_type = NMI_CTRL_IRQ_HIGH_LEVEL; ist = IST_LEVEL; break; - case 4: /* IRQ_TYPE_LEVEL_LOW */ + case 8: /* IRQ_TYPE_LEVEL_LOW */ irq_type = NMI_CTRL_IRQ_LOW_LEVEL; ist = IST_LEVEL; break; @@ -296,6 +331,18 @@ sunxi_nmi_fdt_intrstr(device_t dev, u_in { struct sunxi_nmi_softc * const sc = device_private(dev); + if (sc->sc_intr_cells == 3) { + const u_int irq = be32toh(specifier[1]); + if (irq != sc->sc_intr_nmi) { + const int ihandle = fdtbus_intr_parent(sc->sc_phandle); + if (ihandle == -1) { +return false; + } + return fdtbus_intr_str_raw(ihandle, specifier, buf, + buflen); + } + } + snprintf(buf, buflen, "%s", sc->sc_config->name); return true; @@ -323,9 +370,10 @@ sunxi_nmi_attach(device_t parent, device struct sunxi_nmi_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; const int phandle = faa->faa_phandle; + const u_int *interrupts; bus_addr_t addr; bus_size_t size; - int error; + int error, len; if (fdtbus_get_reg(phandle, 0, , ) != 0) { aprint_error(": couldn't get registers\n"); @@ -341,8 +389,18 @@ sunxi_nmi_attach(device_t parent, device return; } + of_getprop_uint32(phandle, "#interrupt-cells", >sc_intr_cells); + interrupts = fdtbus_get_prop(phandle, "interrupts", ); + if (interrupts == NULL || len != 12 || + be32toh(interrupts[0]) != 0 /* GIC_SPI */ || + be32toh(interrupts[2]) != 4 /* IRQ_TYPE_LEVEL_HIGH */) { + aprint_error(": couldn't find GIC SPI for NMI\n"); + return; + } + sc->sc_intr_nmi = be32toh(interrupts[1]); + aprint_naive("\n"); - aprint_normal(": %s\n", sc->sc_config->name); + aprint_normal(":
CVS commit: src/sys/arch/arm/sunxi
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:38 UTC 2021 Modified Files: src/sys/arch/arm/sunxi: sunxi_nmi.c Log Message: sunxi: nmi: add support for #interrupt-cells 3 bindings To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sunxi/sunxi_nmi.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/arm/sunxi
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:26 UTC 2021 Modified Files: src/sys/arch/arm/sunxi: sun50i_a64_ccu.c Log Message: sunxi: sun50i-a64: add support for A64_CLK_CPUX clock To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/sunxi/sun50i_a64_ccu.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/arm/sunxi/sun50i_a64_ccu.c diff -u src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.23 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.24 --- src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.23 Wed Jan 27 03:10:20 2021 +++ src/sys/arch/arm/sunxi/sun50i_a64_ccu.c Sun Nov 7 17:13:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sun50i_a64_ccu.c,v 1.23 2021/01/27 03:10:20 thorpej Exp $ */ +/* $NetBSD: sun50i_a64_ccu.c,v 1.24 2021/11/07 17:13:26 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.23 2021/01/27 03:10:20 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.24 2021/11/07 17:13:26 jmcneill Exp $"); #include #include @@ -48,6 +48,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun50i_a64_c #define PLL_VIDEO1_CTRL_REG 0x030 #define PLL_GPU_CTRL_REG 0x038 #define PLL_DE_CTRL_REG 0x048 +#define CPUX_AXI_CFG_REG 0x050 #define AHB1_APB1_CFG_REG 0x054 #define APB2_CFG_REG 0x058 #define AHB2_CFG_REG 0x05c @@ -153,6 +154,7 @@ static struct sunxi_ccu_reset sun50i_a64 SUNXI_CCU_RESET(A64_RST_BUS_UART3, BUS_SOFT_RST_REG4, 19), }; +static const char *cpux_parents[] = { "losc", "hosc", "pll_cpux", "pll_cpux" }; static const char *ahb1_parents[] = { "losc", "hosc", "axi", "pll_periph0" }; static const char *ahb2_parents[] = { "ahb1", "pll_periph0" }; static const char *apb1_parents[] = { "ahb1" }; @@ -347,6 +349,11 @@ static struct sunxi_ccu_clk sun50i_a64_c __BIT(31), /* enable */ SUNXI_CCU_FRACTIONAL_PLUSONE | SUNXI_CCU_FRACTIONAL_SET_ENABLE), + SUNXI_CCU_MUX(A64_CLK_CPUX, "cpux", cpux_parents, + CPUX_AXI_CFG_REG, /* reg */ + __BITS(17,16), /* sel */ + 0), + SUNXI_CCU_PREDIV(A64_CLK_AHB1, "ahb1", ahb1_parents, AHB1_APB1_CFG_REG, /* reg */ __BITS(7,6), /* prediv */
CVS commit: src/sys/arch/arm/sunxi
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:26 UTC 2021 Modified Files: src/sys/arch/arm/sunxi: sun50i_a64_ccu.c Log Message: sunxi: sun50i-a64: add support for A64_CLK_CPUX clock To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/sunxi/sun50i_a64_ccu.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/arm/sunxi
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:12 UTC 2021 Modified Files: src/sys/arch/arm/sunxi: files.sunxi sunxi_ccu.c sunxi_ccu.h Added Files: src/sys/arch/arm/sunxi: sunxi_ccu_mux.c Log Message: sunxi: ccu: add support for basic "mux" clocks To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/arch/arm/sunxi/files.sunxi cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sunxi/sunxi_ccu.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/sunxi/sunxi_ccu.h cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_ccu_mux.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/arm/sunxi/files.sunxi diff -u src/sys/arch/arm/sunxi/files.sunxi:1.69 src/sys/arch/arm/sunxi/files.sunxi:1.70 --- src/sys/arch/arm/sunxi/files.sunxi:1.69 Wed May 5 10:24:04 2021 +++ src/sys/arch/arm/sunxi/files.sunxi Sun Nov 7 17:13:12 2021 @@ -1,4 +1,4 @@ -# $NetBSD: files.sunxi,v 1.69 2021/05/05 10:24:04 jmcneill Exp $ +# $NetBSD: files.sunxi,v 1.70 2021/11/07 17:13:12 jmcneill Exp $ # # Configuration info for Allwinner sunxi family SoCs # @@ -16,6 +16,7 @@ file arch/arm/sunxi/sunxi_ccu_div.c sun file arch/arm/sunxi/sunxi_ccu_fixed_factor.c sunxi_ccu file arch/arm/sunxi/sunxi_ccu_fractional.c sunxi_ccu file arch/arm/sunxi/sunxi_ccu_gate.c sunxi_ccu +file arch/arm/sunxi/sunxi_ccu_mux.c sunxi_ccu file arch/arm/sunxi/sunxi_ccu_nm.c sunxi_ccu file arch/arm/sunxi/sunxi_ccu_nkmp.c sunxi_ccu file arch/arm/sunxi/sunxi_ccu_phase.c sunxi_ccu Index: src/sys/arch/arm/sunxi/sunxi_ccu.c diff -u src/sys/arch/arm/sunxi/sunxi_ccu.c:1.13 src/sys/arch/arm/sunxi/sunxi_ccu.c:1.14 --- src/sys/arch/arm/sunxi/sunxi_ccu.c:1.13 Thu Nov 29 20:33:09 2018 +++ src/sys/arch/arm/sunxi/sunxi_ccu.c Sun Nov 7 17:13:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_ccu.c,v 1.13 2018/11/29 20:33:09 jakllsch Exp $ */ +/* $NetBSD: sunxi_ccu.c,v 1.14 2021/11/07 17:13:12 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -31,7 +31,7 @@ #include "opt_console.h" #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu.c,v 1.13 2018/11/29 20:33:09 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu.c,v 1.14 2021/11/07 17:13:12 jmcneill Exp $"); #include #include @@ -359,6 +359,7 @@ sunxi_ccu_print(struct sunxi_ccu_softc * case SUNXI_CCU_PHASE: type = "phase"; break; case SUNXI_CCU_FIXED_FACTOR: type = "fixed-factor"; break; case SUNXI_CCU_FRACTIONAL: type = "fractional"; break; + case SUNXI_CCU_MUX: type = "mux"; break; default: type = "???"; break; } Index: src/sys/arch/arm/sunxi/sunxi_ccu.h diff -u src/sys/arch/arm/sunxi/sunxi_ccu.h:1.22 src/sys/arch/arm/sunxi/sunxi_ccu.h:1.23 --- src/sys/arch/arm/sunxi/sunxi_ccu.h:1.22 Sat Nov 23 03:59:39 2019 +++ src/sys/arch/arm/sunxi/sunxi_ccu.h Sun Nov 7 17:13:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_ccu.h,v 1.22 2019/11/23 03:59:39 jakllsch Exp $ */ +/* $NetBSD: sunxi_ccu.h,v 1.23 2021/11/07 17:13:12 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -64,6 +64,7 @@ enum sunxi_ccu_clktype { SUNXI_CCU_PHASE, SUNXI_CCU_FIXED_FACTOR, SUNXI_CCU_FRACTIONAL, + SUNXI_CCU_MUX, }; struct sunxi_ccu_gate { @@ -413,6 +414,34 @@ const char *sunxi_ccu_fractional_get_par .get_parent = sunxi_ccu_fractional_get_parent, \ } +struct sunxi_ccu_mux { + bus_size_t reg; + const char **parents; + u_int nparents; + uint32_t sel; + uint32_t flags; +}; + +int sunxi_ccu_mux_set_parent(struct sunxi_ccu_softc *, + struct sunxi_ccu_clk *, + const char *); +const char *sunxi_ccu_mux_get_parent(struct sunxi_ccu_softc *, + struct sunxi_ccu_clk *); + +#define SUNXI_CCU_MUX(_id, _name, _parents, _reg, _sel, _flags) \ + [_id] = { \ + .type = SUNXI_CCU_MUX,\ + .base.name = (_name),\ + .u.mux.reg = (_reg),\ + .u.mux.parents = (_parents), \ + .u.mux.nparents = __arraycount(_parents), \ + .u.mux.sel = (_sel),\ + .u.mux.flags = (_flags), \ + .set_parent = sunxi_ccu_mux_set_parent, \ + .get_parent = sunxi_ccu_mux_get_parent, \ + } + + struct sunxi_ccu_clk { struct clk base; enum sunxi_ccu_clktype type; @@ -425,6 +454,7 @@ struct sunxi_ccu_clk { struct sunxi_ccu_phase phase; struct sunxi_ccu_fixed_factor fixed_factor; struct sunxi_ccu_fractional fractional; + struct sunxi_ccu_mux mux; } u; int (*enable)(struct sunxi_ccu_softc *, Added files: Index: src/sys/arch/arm/sunxi/sunxi_ccu_mux.c diff -u /dev/null src/sys/arch/arm/sunxi/sunxi_ccu_mux.c:1.1 --- /dev/null Sun Nov 7 17:13:12 2021 +++ src/sys/arch/arm/sunxi/sunxi_ccu_mux.c Sun Nov 7 17:13:12 2021 @@ -0,0 +1,82 @@ +/* $NetBSD: sunxi_ccu_mux.c,v 1.1 2021/11/07 17:13:12 jmcneill Exp $ */ + +/*- + * Copyright (c) 2021 Jared McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: +
CVS commit: src/sys/arch/arm/sunxi
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:12 UTC 2021 Modified Files: src/sys/arch/arm/sunxi: files.sunxi sunxi_ccu.c sunxi_ccu.h Added Files: src/sys/arch/arm/sunxi: sunxi_ccu_mux.c Log Message: sunxi: ccu: add support for basic "mux" clocks To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/arch/arm/sunxi/files.sunxi cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sunxi/sunxi_ccu.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/sunxi/sunxi_ccu.h cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_ccu_mux.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/arm/ti
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:55 UTC 2021 Modified Files: src/sys/arch/arm/ti: if_cpsw.c Log Message: ti: cpsw: adapt to dts-5.15 bindings To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/ti/if_cpsw.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/arm/ti/if_cpsw.c diff -u src/sys/arch/arm/ti/if_cpsw.c:1.14 src/sys/arch/arm/ti/if_cpsw.c:1.15 --- src/sys/arch/arm/ti/if_cpsw.c:1.14 Wed Jan 27 03:10:20 2021 +++ src/sys/arch/arm/ti/if_cpsw.c Sun Nov 7 17:12:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.14 2021/01/27 03:10:20 thorpej Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.15 2021/11/07 17:12:55 jmcneill Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.14 2021/01/27 03:10:20 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.15 2021/11/07 17:12:55 jmcneill Exp $"); #include #include @@ -310,6 +310,7 @@ cpsw_rxdesc_paddr(struct cpsw_softc * co } static const struct device_compatible_entry compat_data[] = { + { .compat = "ti,am335x-cpsw-switch" }, { .compat = "ti,am335x-cpsw" }, { .compat = "ti,cpsw" }, DEVICE_COMPAT_EOL @@ -417,7 +418,13 @@ cpsw_attach(device_t parent, device_t se macaddr = NULL; slave = of_find_firstchild_byname(phandle, "slave"); - if (slave > 0) { + if (slave == -1) { + slave = of_find_firstchild_byname(phandle, "ethernet-ports"); + if (slave != -1) { + slave = of_find_firstchild_byname(slave, "port"); + } + } + if (slave != -1) { macaddr = fdtbus_get_prop(slave, "mac-address", ); if (len != ETHER_ADDR_LEN) macaddr = NULL;
CVS commit: src/sys/arch/arm/ti
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:55 UTC 2021 Modified Files: src/sys/arch/arm/ti: if_cpsw.c Log Message: ti: cpsw: adapt to dts-5.15 bindings To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/ti/if_cpsw.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/arm/ti
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:45 UTC 2021 Modified Files: src/sys/arch/arm/ti: ti_omaptimer.c ti_sdhc.c Log Message: arm: ti: adapt to dts-5.15 bindings To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/ti/ti_omaptimer.c \ src/sys/arch/arm/ti/ti_sdhc.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/arm/ti/ti_omaptimer.c diff -u src/sys/arch/arm/ti/ti_omaptimer.c:1.10 src/sys/arch/arm/ti/ti_omaptimer.c:1.11 --- src/sys/arch/arm/ti/ti_omaptimer.c:1.10 Thu Sep 9 12:14:37 2021 +++ src/sys/arch/arm/ti/ti_omaptimer.c Sun Nov 7 17:12:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_omaptimer.c,v 1.10 2021/09/09 12:14:37 jakllsch Exp $ */ +/* $NetBSD: ti_omaptimer.c,v 1.11 2021/11/07 17:12:45 jmcneill Exp $ */ /* * Copyright (c) 2017 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_omaptimer.c,v 1.10 2021/09/09 12:14:37 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_omaptimer.c,v 1.11 2021/11/07 17:12:45 jmcneill Exp $"); #include #include @@ -176,7 +176,6 @@ omaptimer_attach(device_t parent, device struct fdt_attach_args * const faa = aux; const int phandle = faa->faa_phandle; struct timecounter *tc = >sc_tc; - const char *modname; struct clk *hwmod; bus_addr_t addr; bus_size_t size; @@ -203,28 +202,24 @@ omaptimer_attach(device_t parent, device return; } - modname = fdtbus_get_string(phandle, "ti,hwmods"); - if (modname == NULL) - modname = fdtbus_get_string(OF_parent(phandle), "ti,hwmods"); - aprint_naive("\n"); - aprint_normal(": Timer (%s)\n", modname); + aprint_normal(": Timer\n"); rate = clk_get_rate(hwmod); - if (strcmp(modname, "timer2") == 0) { + if (device_unit(self) == 1) { omaptimer_enable(sc, 0); /* Install timecounter */ tc->tc_get_timecount = omaptimer_get_timecount; tc->tc_counter_mask = ~0u; tc->tc_frequency = rate; - tc->tc_name = modname; + tc->tc_name = device_xname(self); tc->tc_quality = 200; tc->tc_priv = sc; tc_init(tc); - } else if (strcmp(modname, "timer3") == 0) { + } else if (device_unit(self) == 2) { const uint32_t value = (0x - ((rate / hz) - 1)); omaptimer_enable(sc, value); Index: src/sys/arch/arm/ti/ti_sdhc.c diff -u src/sys/arch/arm/ti/ti_sdhc.c:1.10 src/sys/arch/arm/ti/ti_sdhc.c:1.11 --- src/sys/arch/arm/ti/ti_sdhc.c:1.10 Wed Jan 27 03:10:20 2021 +++ src/sys/arch/arm/ti/ti_sdhc.c Sun Nov 7 17:12:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_sdhc.c,v 1.10 2021/01/27 03:10:20 thorpej Exp $ */ +/* $NetBSD: ti_sdhc.c,v 1.11 2021/11/07 17:12:45 jmcneill Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.10 2021/01/27 03:10:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.11 2021/11/07 17:12:45 jmcneill Exp $"); #include #include @@ -85,6 +85,10 @@ static const struct ti_sdhc_config omap4 .regoff = 0x100 }; +static const struct ti_sdhc_config am335_sdhci_config = { + .regoff = 0x100 +}; + static const struct device_compatible_entry compat_data[] = { { .compat = "ti,omap2-hsmmc", .data = _hsmmc_config }, @@ -94,6 +98,8 @@ static const struct device_compatible_en .data = _pre_es3_hsmmc_config }, { .compat = "ti,omap4-hsmmc", .data = _hsmmc_config }, + { .compat = "ti,am335-sdhci", + .data = _sdhci_config }, DEVICE_COMPAT_EOL };
CVS commit: src/sys/arch/arm/ti
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:45 UTC 2021 Modified Files: src/sys/arch/arm/ti: ti_omaptimer.c ti_sdhc.c Log Message: arm: ti: adapt to dts-5.15 bindings To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/ti/ti_omaptimer.c \ src/sys/arch/arm/ti/ti_sdhc.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/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:26 UTC 2021 Modified Files: src/sys/dev/fdt: pinctrl_single.c Log Message: pinctrl-single: support #pinctrl-cells 2 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/pinctrl_single.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/fdt/pinctrl_single.c diff -u src/sys/dev/fdt/pinctrl_single.c:1.5 src/sys/dev/fdt/pinctrl_single.c:1.6 --- src/sys/dev/fdt/pinctrl_single.c:1.5 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/pinctrl_single.c Sun Nov 7 17:12:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pinctrl_single.c,v 1.5 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: pinctrl_single.c,v 1.6 2021/11/07 17:12:25 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.5 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.6 2021/11/07 17:12:25 jmcneill Exp $"); #include #include @@ -110,7 +110,7 @@ pinctrl_single_pins_set_config(device_t const u_int *pins; int pinslen; - if (len != 4) + if (len != 4 && len != 8) return -1; const int phandle = fdtbus_get_phandle_from_native(be32dec(data)); @@ -119,13 +119,14 @@ pinctrl_single_pins_set_config(device_t if (pins == NULL) return -1; - while (pinslen >= 8) { + while (pinslen >= 4 + len) { const int off = be32toh(pins[0]); const int val = be32toh(pins[1]); + const int mux = len == 4 ? 0 : be32toh(pins[2]); - pinctrl_single_pins_write(sc, off, val); - pins += 2; - pinslen -= 8; + pinctrl_single_pins_write(sc, off, val | mux); + pins += 1 + (len / 4); + pinslen -= (4 + len); } return 0;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:26 UTC 2021 Modified Files: src/sys/dev/fdt: pinctrl_single.c Log Message: pinctrl-single: support #pinctrl-cells 2 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/pinctrl_single.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/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:16 UTC 2021 Modified Files: src/sys/dev/fdt: fdtbus.c Log Message: fdtbus: match simple-pm-bus To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/fdt/fdtbus.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/fdt/fdtbus.c diff -u src/sys/dev/fdt/fdtbus.c:1.43 src/sys/dev/fdt/fdtbus.c:1.44 --- src/sys/dev/fdt/fdtbus.c:1.43 Mon Sep 6 14:03:18 2021 +++ src/sys/dev/fdt/fdtbus.c Sun Nov 7 17:12:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtbus.c,v 1.43 2021/09/06 14:03:18 jmcneill Exp $ */ +/* $NetBSD: fdtbus.c,v 1.44 2021/11/07 17:12:15 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.43 2021/09/06 14:03:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.44 2021/11/07 17:12:15 jmcneill Exp $"); #include #include @@ -89,6 +89,7 @@ static void fdt_post_attach(struct fdt_n static const struct device_compatible_entry compat_data[] = { { .compat = "simple-bus" }, + { .compat = "simple-pm-bus" }, DEVICE_COMPAT_EOL };
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:16 UTC 2021 Modified Files: src/sys/dev/fdt: fdtbus.c Log Message: fdtbus: match simple-pm-bus To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/fdt/fdtbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:11:58 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_sdhc.c src/sys/arch/arm/sunxi: sunxi_thermal.c src/sys/dev/fdt: fdt_panel.c Log Message: dts: adapt to dts-5.15 bindings To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/amlogic/meson_sdhc.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sunxi/sunxi_thermal.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_panel.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/arm/amlogic/meson_sdhc.c diff -u src/sys/arch/arm/amlogic/meson_sdhc.c:1.5 src/sys/arch/arm/amlogic/meson_sdhc.c:1.6 --- src/sys/arch/arm/amlogic/meson_sdhc.c:1.5 Sat Aug 7 16:18:43 2021 +++ src/sys/arch/arm/amlogic/meson_sdhc.c Sun Nov 7 17:11:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_sdhc.c,v 1.5 2021/08/07 16:18:43 thorpej Exp $ */ +/* $NetBSD: meson_sdhc.c,v 1.6 2021/11/07 17:11:58 jmcneill Exp $ */ /*- * Copyright (c) 2015-2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson_sdhc.c,v 1.5 2021/08/07 16:18:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_sdhc.c,v 1.6 2021/11/07 17:11:58 jmcneill Exp $"); #include #include @@ -151,7 +151,8 @@ meson_sdhc_set_clear(struct meson_sdhc_s } static const struct device_compatible_entry compat_data[] = { - { .compat = "amlogic,meson8b-sdhc" }, + { .compat = "amlogic,meson8-sdhc" }, + { .compat = "amlogic,meson8b-sdhc" }, /* DTCOMPAT */ DEVICE_COMPAT_EOL }; @@ -191,14 +192,20 @@ meson_sdhc_attach(device_t parent, devic } clk_core = fdtbus_clock_get(phandle, "core"); + if (clk_core == NULL) { + clk_core = fdtbus_clock_get(phandle, "pclk"); + } if (clk_core == NULL || clk_enable(clk_core) != 0) { - aprint_error(": failed to enable core clock\n"); + aprint_error(": failed to enable core/pclk clock\n"); return; } clk_clkin = fdtbus_clock_get(phandle, "clkin"); + if (clk_clkin == NULL) { + clk_clkin = fdtbus_clock_get(phandle, "clkin2"); + } if (clk_clkin == NULL || clk_enable(clk_clkin) != 0) { - aprint_error(": failed to get clkin clock\n"); + aprint_error(": failed to get clkin/clkin2 clock\n"); return; } Index: src/sys/arch/arm/sunxi/sunxi_thermal.c diff -u src/sys/arch/arm/sunxi/sunxi_thermal.c:1.13 src/sys/arch/arm/sunxi/sunxi_thermal.c:1.14 --- src/sys/arch/arm/sunxi/sunxi_thermal.c:1.13 Wed Jan 27 03:10:20 2021 +++ src/sys/arch/arm/sunxi/sunxi_thermal.c Sun Nov 7 17:11:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_thermal.c,v 1.13 2021/01/27 03:10:20 thorpej Exp $ */ +/* $NetBSD: sunxi_thermal.c,v 1.14 2021/11/07 17:11:58 jmcneill Exp $ */ /*- * Copyright (c) 2016-2017 Jared McNeill @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.13 2021/01/27 03:10:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.14 2021/11/07 17:11:58 jmcneill Exp $"); #include #include @@ -306,6 +306,14 @@ static const struct sunxi_thermal_config }; static struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun8i-a83t-ths", .data = _config }, + { .compat = "allwinner,sun8i-h3-ths", .data = _config }, + { .compat = "allwinner,sun50i-a64-ths", .data = _config }, + { .compat = "allwinner,sun50i-h5-ths", .data = _config }, + + /* + * DTCOMPAT: Old compat strings. Do not add to this list. + */ { .compat = "allwinner,sun8i-a83t-ts", .data = _config }, { .compat = "allwinner,sun8i-h3-ts", .data = _config }, { .compat = "allwinner,sun50i-a64-ts", .data = _config }, Index: src/sys/dev/fdt/fdt_panel.c diff -u src/sys/dev/fdt/fdt_panel.c:1.3 src/sys/dev/fdt/fdt_panel.c:1.4 --- src/sys/dev/fdt/fdt_panel.c:1.3 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/fdt_panel.c Sun Nov 7 17:11:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_panel.c,v 1.3 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: fdt_panel.c,v 1.4 2021/11/07 17:11:58 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_panel.c,v 1.3 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_panel.c,v 1.4 2021/11/07 17:11:58 jmcneill Exp $"); #include #include @@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_panel.c, static const struct device_compatible_entry compat_data[] = { { .compat = "simple-panel" }, + { .compat = "boe,nv140fhmn49" }, DEVICE_COMPAT_EOL };
CVS commit: src/sys
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:11:58 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_sdhc.c src/sys/arch/arm/sunxi: sunxi_thermal.c src/sys/dev/fdt: fdt_panel.c Log Message: dts: adapt to dts-5.15 bindings To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/amlogic/meson_sdhc.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sunxi/sunxi_thermal.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_panel.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/arm/dts
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:11:43 UTC 2021 Modified Files: src/sys/arch/arm/dts: meson8b-odroidc1.dts meson8b.dtsi rk3399-pinebook-pro.dts rk3399-rockpro64.dts sun50i-a64-pine64-plus.dts sun50i-a64-pinebook.dts sun50i-a64-sopine-baseboard.dts sun50i-a64.dtsi sun7i-a20-olinuxino-lime2-emmc-spi.dts sun8i-a83t.dtsi sun8i-h3-nanopi-neo.dts Removed Files: src/sys/arch/arm/dts: meson-g12b-odroid-n2-plus.dts rk3328-rock64.dts rk3328.dtsi sun50i-h5-libretech-all-h3-cc.dts sun50i-h5-nanopi-neo-plus2.dts sun50i-h5.dtsi sun50i-h6-orangepi-lite2.dts sun8i-h3-nanopi-duo2.dts sun8i-h3-nanopi-m1.dts sun8i-h3-nanopi-r1.dts sun8i-h3.dtsi Log Message: arm: dts: adapt for dts-5.15 To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts \ src/sys/arch/arm/dts/sun50i-h5-libretech-all-h3-cc.dts \ src/sys/arch/arm/dts/sun50i-h6-orangepi-lite2.dts \ src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/dts/meson8b-odroidc1.dts \ src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/dts/meson8b.dtsi cvs rdiff -u -r1.6 -r0 src/sys/arch/arm/dts/rk3328-rock64.dts \ src/sys/arch/arm/dts/sun8i-h3.dtsi cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/dts/rk3328.dtsi \ src/sys/arch/arm/dts/sun50i-h5.dtsi cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/rk3399-pinebook-pro.dts \ src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/dts/rk3399-rockpro64.dts cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts \ src/sys/arch/arm/dts/sun8i-a83t.dtsi cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/dts/sun50i-a64.dtsi cvs rdiff -u -r1.4 -r0 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts cvs rdiff -u -r1.1 -r1.2 \ src/sys/arch/arm/dts/sun7i-a20-olinuxino-lime2-emmc-spi.dts cvs rdiff -u -r1.3 -r0 src/sys/arch/arm/dts/sun8i-h3-nanopi-m1.dts \ src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts 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/arm/dts/meson8b-odroidc1.dts diff -u src/sys/arch/arm/dts/meson8b-odroidc1.dts:1.5 src/sys/arch/arm/dts/meson8b-odroidc1.dts:1.6 --- src/sys/arch/arm/dts/meson8b-odroidc1.dts:1.5 Thu Mar 5 14:24:46 2020 +++ src/sys/arch/arm/dts/meson8b-odroidc1.dts Sun Nov 7 17:11:43 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: meson8b-odroidc1.dts,v 1.5 2020/03/05 14:24:46 tnn Exp $ */ +/* $NetBSD: meson8b-odroidc1.dts,v 1.6 2021/11/07 17:11:43 jmcneill Exp $ */ /*- - * Copyright (c) 2019 Jared McNeill + * Copyright (c) 2019,2021 Jared McNeill * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,11 +34,6 @@ }; { - status = "okay"; - - pinctrl-0 = <_c_pins>; - pinctrl-names = "default"; - /* eMMC card */ emmc_card_slot: slot@2 { compatible = "mmc-slot"; @@ -52,13 +47,3 @@ disable-wp; }; }; - - { - /delete-property/ snps,reset-gpio; - /delete-property/ snps,reset-active-low; - /delete-property/ snps,reset-delays-us; -}; - - { - /delete-property/ cpu-supply; -}; Index: src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts diff -u src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.5 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.6 --- src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.5 Tue Aug 10 16:52:43 2021 +++ src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts Sun Nov 7 17:11:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.5 2021/08/10 16:52:43 jmcneill Exp $ */ +/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.6 2021/11/07 17:11:43 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -36,16 +36,3 @@ _hdmi { status = "okay"; }; - - { -cpu-supply = <_dcdc2>; -operating-points = < -/* kHzuV */ -1152000 130 -1104000 126 -1008000 120 -816000 108 -648000 104 -408000 100 ->; -}; Index: src/sys/arch/arm/dts/meson8b.dtsi diff -u src/sys/arch/arm/dts/meson8b.dtsi:1.7 src/sys/arch/arm/dts/meson8b.dtsi:1.8 --- src/sys/arch/arm/dts/meson8b.dtsi:1.7 Wed Aug 14 09:54:34 2019 +++ src/sys/arch/arm/dts/meson8b.dtsi Sun Nov 7 17:11:43 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: meson8b.dtsi,v 1.7 2019/08/14 09:54:34 jmcneill Exp $ */ +/* $NetBSD: meson8b.dtsi,v 1.8 2021/11/07 17:11:43 jmcneill Exp $ */ /*- - * Copyright (c) 2019 Jared McNeill + * Copyright (c) 2019,2021 Jared McNeill * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,33 +35,3 @@
CVS commit: src/sys/arch/arm/dts
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:11:43 UTC 2021 Modified Files: src/sys/arch/arm/dts: meson8b-odroidc1.dts meson8b.dtsi rk3399-pinebook-pro.dts rk3399-rockpro64.dts sun50i-a64-pine64-plus.dts sun50i-a64-pinebook.dts sun50i-a64-sopine-baseboard.dts sun50i-a64.dtsi sun7i-a20-olinuxino-lime2-emmc-spi.dts sun8i-a83t.dtsi sun8i-h3-nanopi-neo.dts Removed Files: src/sys/arch/arm/dts: meson-g12b-odroid-n2-plus.dts rk3328-rock64.dts rk3328.dtsi sun50i-h5-libretech-all-h3-cc.dts sun50i-h5-nanopi-neo-plus2.dts sun50i-h5.dtsi sun50i-h6-orangepi-lite2.dts sun8i-h3-nanopi-duo2.dts sun8i-h3-nanopi-m1.dts sun8i-h3-nanopi-r1.dts sun8i-h3.dtsi Log Message: arm: dts: adapt for dts-5.15 To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts \ src/sys/arch/arm/dts/sun50i-h5-libretech-all-h3-cc.dts \ src/sys/arch/arm/dts/sun50i-h6-orangepi-lite2.dts \ src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/dts/meson8b-odroidc1.dts \ src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/dts/meson8b.dtsi cvs rdiff -u -r1.6 -r0 src/sys/arch/arm/dts/rk3328-rock64.dts \ src/sys/arch/arm/dts/sun8i-h3.dtsi cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/dts/rk3328.dtsi \ src/sys/arch/arm/dts/sun50i-h5.dtsi cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/rk3399-pinebook-pro.dts \ src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/dts/rk3399-rockpro64.dts cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts \ src/sys/arch/arm/dts/sun8i-a83t.dtsi cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/dts/sun50i-a64.dtsi cvs rdiff -u -r1.4 -r0 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts cvs rdiff -u -r1.1 -r1.2 \ src/sys/arch/arm/dts/sun7i-a20-olinuxino-lime2-emmc-spi.dts cvs rdiff -u -r1.3 -r0 src/sys/arch/arm/dts/sun8i-h3-nanopi-m1.dts \ src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/sets/lists/dtb
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:11:05 UTC 2021 Modified Files: src/distrib/sets/lists/dtb: ad.aarch64 ad.aarch64eb ad.earmv6 ad.earmv6eb ad.earmv6hf ad.earmv6hfeb ad.earmv7 ad.earmv7hf ad.earmv7hfeb Log Message: dtb: Re-generate set lists for 5.15 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/dtb/ad.aarch64 cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/dtb/ad.aarch64eb \ src/distrib/sets/lists/dtb/ad.earmv7 \ src/distrib/sets/lists/dtb/ad.earmv7hf \ src/distrib/sets/lists/dtb/ad.earmv7hfeb cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/dtb/ad.earmv6 \ src/distrib/sets/lists/dtb/ad.earmv6eb \ src/distrib/sets/lists/dtb/ad.earmv6hf \ src/distrib/sets/lists/dtb/ad.earmv6hfeb Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/dtb/ad.aarch64 diff -u src/distrib/sets/lists/dtb/ad.aarch64:1.7 src/distrib/sets/lists/dtb/ad.aarch64:1.8 --- src/distrib/sets/lists/dtb/ad.aarch64:1.7 Wed Jun 2 10:31:18 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64 Sun Nov 7 17:11:05 2021 @@ -1,9 +1,10 @@ -# $NetBSD: ad.aarch64,v 1.7 2021/06/02 10:31:18 jmcneill Exp $ +# $NetBSD: ad.aarch64,v 1.8 2021/11/07 17:11:05 jmcneill Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb # ./boot/dtb/allwinner dtb-base-boot dtb +./boot/dtb/allwinner/sun50i-a100-allwinner-perf1.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-a64-amarula-relic.dtbdtb-base-boot dtb ./boot/dtb/allwinner/sun50i-a64-bananapi-m64.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-a64-nanopi-a64.dtb dtb-base-boot dtb @@ -15,14 +16,22 @@ ./boot/dtb/allwinner/sun50i-a64-pine64-plus.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-a64-pine64.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-a64-pinebook.dtb dtb-base-boot dtb +./boot/dtb/allwinner/sun50i-a64-pinephone-1.0.dtbdtb-base-boot dtb +./boot/dtb/allwinner/sun50i-a64-pinephone-1.1.dtbdtb-base-boot dtb +./boot/dtb/allwinner/sun50i-a64-pinephone-1.2.dtbdtb-base-boot dtb +./boot/dtb/allwinner/sun50i-a64-pinetab-early-adopter.dtbdtb-base-boot dtb +./boot/dtb/allwinner/sun50i-a64-pinetab.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-a64-sopine-baseboard.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-a64-teres-i.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-bananapi-m2-plus-v1.2.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-bananapi-m2-plus.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-emlid-neutis-n5-devboard.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-libretech-all-h3-cc.dtb dtb-base-boot dtb +./boot/dtb/allwinner/sun50i-h5-libretech-all-h3-it.dtb dtb-base-boot dtb +./boot/dtb/allwinner/sun50i-h5-libretech-all-h5-cc.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-nanopi-neo-plus2.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-nanopi-neo2.dtb dtb-base-boot dtb +./boot/dtb/allwinner/sun50i-h5-nanopi-r1s-h5.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-orangepi-pc2.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-orangepi-prime.dtbdtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h5-orangepi-zero-plus.dtbdtb-base-boot dtb @@ -31,6 +40,7 @@ ./boot/dtb/allwinner/sun50i-h6-orangepi-3.dtbdtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h6-orangepi-lite2.dtbdtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h6-orangepi-one-plus.dtb dtb-base-boot dtb +./boot/dtb/allwinner/sun50i-h6-pine-h64-model-b.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h6-pine-h64.dtb dtb-base-boot dtb ./boot/dtb/allwinner/sun50i-h6-tanix-tx6.dtb dtb-base-boot dtb ./boot/dtb/amlogic dtb-base-boot dtb @@ -40,10 +50,14 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-gsking-x.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-gtking-pro.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-gtking.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot
CVS commit: src/sys/dtb/arm64
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:10:47 UTC 2021 Modified Files: src/sys/dtb/arm64/amlogic: Makefile src/sys/dtb/arm64/rockchip: Makefile Log Message: Extra dts files no longer required. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dtb/arm64/amlogic/Makefile cvs rdiff -u -r1.2 -r1.3 src/sys/dtb/arm64/rockchip/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dtb/arm64/amlogic/Makefile diff -u src/sys/dtb/arm64/amlogic/Makefile:1.2 src/sys/dtb/arm64/amlogic/Makefile:1.3 --- src/sys/dtb/arm64/amlogic/Makefile:1.2 Sat Jan 2 11:36:36 2021 +++ src/sys/dtb/arm64/amlogic/Makefile Sun Nov 7 17:10:46 2021 @@ -1,11 +1,8 @@ -# $NetBSD: Makefile,v 1.2 2021/01/02 11:36:36 ryo Exp $ +# $NetBSD: Makefile,v 1.3 2021/11/07 17:10:46 jmcneill Exp $ DTSSUBDIR= amlogic DTSMAKEVARS= CONFIG_ARCH_MESON=y DTSFILESCMD= ${MAKE} -C ${ARCHDTSDIR}/${DTSSUBDIR} ${DTSMAKEVARS} -v dtb-y DTS= ${DTSFILESCMD:sh} -# Extra .dts files from sys/arch/arm/dts -DTS+= meson-g12b-odroid-n2-plus.dts - .include Index: src/sys/dtb/arm64/rockchip/Makefile diff -u src/sys/dtb/arm64/rockchip/Makefile:1.2 src/sys/dtb/arm64/rockchip/Makefile:1.3 --- src/sys/dtb/arm64/rockchip/Makefile:1.2 Wed Jun 2 10:31:18 2021 +++ src/sys/dtb/arm64/rockchip/Makefile Sun Nov 7 17:10:46 2021 @@ -1,13 +1,10 @@ -# $NetBSD: Makefile,v 1.2 2021/06/02 10:31:18 jmcneill Exp $ +# $NetBSD: Makefile,v 1.3 2021/11/07 17:10:46 jmcneill Exp $ DTSSUBDIR= rockchip DTSMAKEVARS= CONFIG_ARCH_ROCKCHIP=y DTSFILESCMD= ${MAKE} -C ${ARCHDTSDIR}/${DTSSUBDIR} ${DTSMAKEVARS} -v dtb-y DTS= ${DTSFILESCMD:sh} -# Extra .dts files from sys/arch/arm/dts -DTS+= rk3399-pinebook-pro.dts - # For compatibility with factory firmware, copy rk3399-pinebook-pro.dtb to # the base directory. DTB_NOSUBDIR+= rk3399-pinebook-pro.dtb
CVS commit: src/distrib/sets/lists/dtb
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:11:05 UTC 2021 Modified Files: src/distrib/sets/lists/dtb: ad.aarch64 ad.aarch64eb ad.earmv6 ad.earmv6eb ad.earmv6hf ad.earmv6hfeb ad.earmv7 ad.earmv7hf ad.earmv7hfeb Log Message: dtb: Re-generate set lists for 5.15 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/dtb/ad.aarch64 cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/dtb/ad.aarch64eb \ src/distrib/sets/lists/dtb/ad.earmv7 \ src/distrib/sets/lists/dtb/ad.earmv7hf \ src/distrib/sets/lists/dtb/ad.earmv7hfeb cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/dtb/ad.earmv6 \ src/distrib/sets/lists/dtb/ad.earmv6eb \ src/distrib/sets/lists/dtb/ad.earmv6hf \ src/distrib/sets/lists/dtb/ad.earmv6hfeb Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dtb/arm64
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:10:47 UTC 2021 Modified Files: src/sys/dtb/arm64/amlogic: Makefile src/sys/dtb/arm64/rockchip: Makefile Log Message: Extra dts files no longer required. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dtb/arm64/amlogic/Makefile cvs rdiff -u -r1.2 -r1.3 src/sys/dtb/arm64/rockchip/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dtb/arm
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:10:23 UTC 2021 Modified Files: src/sys/dtb/arm: Makefile Log Message: CONFIG_ARCH_SOCFPGA has been renamed CONFIG_ARCH_INTEL_SOCFPGA To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dtb/arm/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dtb/arm/Makefile diff -u src/sys/dtb/arm/Makefile:1.3 src/sys/dtb/arm/Makefile:1.4 --- src/sys/dtb/arm/Makefile:1.3 Wed Jun 10 18:53:31 2020 +++ src/sys/dtb/arm/Makefile Sun Nov 7 17:10:23 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2020/06/10 18:53:31 jmcneill Exp $ +# $NetBSD: Makefile,v 1.4 2021/11/07 17:10:23 jmcneill Exp $ DTSARCH= arm DTSGNUARCH= arm @@ -15,7 +15,7 @@ DTSMAKEVARS= CONFIG_SOC_AM33XX=y \ CONFIG_SOC_IMX7D=y \ CONFIG_MACH_MESON8=y \ CONFIG_ARCH_OMAP3=y \ - CONFIG_ARCH_SOCFPGA=y \ + CONFIG_ARCH_INTEL_SOCFPGA=y \ CONFIG_MACH_SUN4I=y \ CONFIG_MACH_SUN5I=y \ CONFIG_MACH_SUN6I=y \
CVS commit: src/sys/dtb/arm
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:10:23 UTC 2021 Modified Files: src/sys/dtb/arm: Makefile Log Message: CONFIG_ARCH_SOCFPGA has been renamed CONFIG_ARCH_INTEL_SOCFPGA To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dtb/arm/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/gpl2/dts/dist
Module Name:src Committed By: jmcneill Date: Sun Nov 7 16:57:40 UTC 2021 Modified Files: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: bcm2835-common.dtsi bcm2835-rpi-zero-w.dts bcm2835-rpi.dtsi bcm283x.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner: sun50i-h5-nanopi-neo-plus2.dts sun50i-h6-pine-h64.dts sun50i-h6.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: Makefile meson-gx.dtsi meson-gxbb.dtsi meson-gxl.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/arm: vexpress-v2m-rs1.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip: rk3328-rock64.dts src/sys/external/gpl2/dts/dist/include/dt-bindings/clock: sun50i-h6-r-ccu.h src/sys/external/gpl2/dts/dist/include/dt-bindings/input: linux-event-codes.h src/sys/external/gpl2/dts/dist/include/dt-bindings/reset: sun50i-h6-r-ccu.h Added Files: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: meson-g12b-odroid-n2-plus.dts Removed Files: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: at91-kizboxmini.dts atlas6-evb.dts atlas6.dtsi atlas7-evb.dts atlas7.dtsi efm32gg-dk3750.dts efm32gg.dtsi imx6q-dhcom-som.dtsi mt8135-pinfunc.h picoxcell-pc3x2.dtsi picoxcell-pc3x3.dtsi picoxcell-pc7302-pc3x2.dts picoxcell-pc7302-pc3x3.dts prima2-evb.dts prima2.dtsi ste-href-ab8505.dtsi ste-href-tvk1281618.dtsi ste-u300.dts stm32h743-pinctrl.dtsi stm32mp157-pinctrl.dtsi stm32mp157c.dtsi stm32mp157xaa-pinctrl.dtsi stm32mp157xab-pinctrl.dtsi stm32mp157xac-pinctrl.dtsi stm32mp157xad-pinctrl.dtsi tango4-common.dtsi tango4-smp8758.dtsi tango4-vantage-1172.dts zx296702-ad1.dts zx296702.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/al: Makefile alpine-v2-evp.dts alpine-v2.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/stingray: stingray-sata.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/mediatek: mt8183-pinfunc.h src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/qcom: apq8016-sbc-pmic-pins.dtsi apq8016-sbc-soc-pins.dtsi apq8096-db820c-pins.dtsi apq8096-db820c-pmic-pins.dtsi msm8992-pins.dtsi msm8994-pins.dtsi msm8994-smd-rpm.dtsi msm8996-pins.dtsi msm8998-pins.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/renesas: r8a7795-es1-h3ulcb-kf.dts r8a7795-es1-h3ulcb.dts r8a7795-es1-salvator-x.dts r8a7795-es1.dtsi r8a7795-h3ulcb-kf.dts r8a7795-h3ulcb.dts r8a7795-salvator-x.dts r8a7795-salvator-xs.dts r8a7795.dtsi r8a7796-m3ulcb-kf.dts r8a7796-m3ulcb.dts r8a7796-salvator-x.dts r8a7796-salvator-xs.dts r8a7796.dtsi r8a77965-m3nulcb-kf.dts r8a77965-m3nulcb.dts src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip: rk3399-rock-pi-4.dts src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/xilinx: zynqmp-clk.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/zte: Makefile zx296718-evb.dts zx296718-pcbox.dts zx296718.dtsi src/sys/external/gpl2/dts/dist/include/dt-bindings/clk: ti-dra7-atl.h src/sys/external/gpl2/dts/dist/include/dt-bindings/clock: zx296702-clock.h zx296718-clock.h src/sys/external/gpl2/dts/dist/include/dt-bindings/soc: zte,pm_domains.h Log Message: Merge conflicts. To generate a diff of this commit: cvs rdiff -u -r1.1.1.5 -r0 \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/at91-kizboxmini.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/stm32mp157c.dtsi cvs rdiff -u -r1.1.1.3 -r0 \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/atlas6-evb.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/atlas6.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/atlas7-evb.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/atlas7.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/efm32gg-dk3750.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/imx6q-dhcom-som.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/picoxcell-pc7302-pc3x2.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/picoxcell-pc7302-pc3x3.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/prima2-evb.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/prima2.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/ste-href-tvk1281618.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/tango4-common.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/tango4-smp8758.dtsi \
CVS commit: src/sys/external/gpl2/dts/dist
Module Name:src Committed By: jmcneill Date: Sun Nov 7 16:57:40 UTC 2021 Modified Files: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: bcm2835-common.dtsi bcm2835-rpi-zero-w.dts bcm2835-rpi.dtsi bcm283x.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner: sun50i-h5-nanopi-neo-plus2.dts sun50i-h6-pine-h64.dts sun50i-h6.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: Makefile meson-gx.dtsi meson-gxbb.dtsi meson-gxl.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/arm: vexpress-v2m-rs1.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip: rk3328-rock64.dts src/sys/external/gpl2/dts/dist/include/dt-bindings/clock: sun50i-h6-r-ccu.h src/sys/external/gpl2/dts/dist/include/dt-bindings/input: linux-event-codes.h src/sys/external/gpl2/dts/dist/include/dt-bindings/reset: sun50i-h6-r-ccu.h Added Files: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: meson-g12b-odroid-n2-plus.dts Removed Files: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: at91-kizboxmini.dts atlas6-evb.dts atlas6.dtsi atlas7-evb.dts atlas7.dtsi efm32gg-dk3750.dts efm32gg.dtsi imx6q-dhcom-som.dtsi mt8135-pinfunc.h picoxcell-pc3x2.dtsi picoxcell-pc3x3.dtsi picoxcell-pc7302-pc3x2.dts picoxcell-pc7302-pc3x3.dts prima2-evb.dts prima2.dtsi ste-href-ab8505.dtsi ste-href-tvk1281618.dtsi ste-u300.dts stm32h743-pinctrl.dtsi stm32mp157-pinctrl.dtsi stm32mp157c.dtsi stm32mp157xaa-pinctrl.dtsi stm32mp157xab-pinctrl.dtsi stm32mp157xac-pinctrl.dtsi stm32mp157xad-pinctrl.dtsi tango4-common.dtsi tango4-smp8758.dtsi tango4-vantage-1172.dts zx296702-ad1.dts zx296702.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/al: Makefile alpine-v2-evp.dts alpine-v2.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/stingray: stingray-sata.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/mediatek: mt8183-pinfunc.h src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/qcom: apq8016-sbc-pmic-pins.dtsi apq8016-sbc-soc-pins.dtsi apq8096-db820c-pins.dtsi apq8096-db820c-pmic-pins.dtsi msm8992-pins.dtsi msm8994-pins.dtsi msm8994-smd-rpm.dtsi msm8996-pins.dtsi msm8998-pins.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/renesas: r8a7795-es1-h3ulcb-kf.dts r8a7795-es1-h3ulcb.dts r8a7795-es1-salvator-x.dts r8a7795-es1.dtsi r8a7795-h3ulcb-kf.dts r8a7795-h3ulcb.dts r8a7795-salvator-x.dts r8a7795-salvator-xs.dts r8a7795.dtsi r8a7796-m3ulcb-kf.dts r8a7796-m3ulcb.dts r8a7796-salvator-x.dts r8a7796-salvator-xs.dts r8a7796.dtsi r8a77965-m3nulcb-kf.dts r8a77965-m3nulcb.dts src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip: rk3399-rock-pi-4.dts src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/xilinx: zynqmp-clk.dtsi src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/zte: Makefile zx296718-evb.dts zx296718-pcbox.dts zx296718.dtsi src/sys/external/gpl2/dts/dist/include/dt-bindings/clk: ti-dra7-atl.h src/sys/external/gpl2/dts/dist/include/dt-bindings/clock: zx296702-clock.h zx296718-clock.h src/sys/external/gpl2/dts/dist/include/dt-bindings/soc: zte,pm_domains.h Log Message: Merge conflicts. To generate a diff of this commit: cvs rdiff -u -r1.1.1.5 -r0 \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/at91-kizboxmini.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/stm32mp157c.dtsi cvs rdiff -u -r1.1.1.3 -r0 \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/atlas6-evb.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/atlas6.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/atlas7-evb.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/atlas7.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/efm32gg-dk3750.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/imx6q-dhcom-som.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/picoxcell-pc7302-pc3x2.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/picoxcell-pc7302-pc3x3.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/prima2-evb.dts \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/prima2.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/ste-href-tvk1281618.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/tango4-common.dtsi \ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/tango4-smp8758.dtsi \
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 15:54:01 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_errors.sh Log Message: tests/indent: test lenient option parsing To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/tests/usr.bin/indent/t_errors.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 15:54:01 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_errors.sh Log Message: tests/indent: test lenient option parsing To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/tests/usr.bin/indent/t_errors.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/indent/t_errors.sh diff -u src/tests/usr.bin/indent/t_errors.sh:1.18 src/tests/usr.bin/indent/t_errors.sh:1.19 --- src/tests/usr.bin/indent/t_errors.sh:1.18 Sun Nov 7 10:42:58 2021 +++ src/tests/usr.bin/indent/t_errors.sh Sun Nov 7 15:54:00 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_errors.sh,v 1.18 2021/11/07 10:42:58 rillig Exp $ +# $NetBSD: t_errors.sh,v 1.19 2021/11/07 15:54:00 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -143,6 +143,33 @@ option_cli_trailing_garbage_body() -cli3garbage } +atf_test_case 'option_npro_trailing_garbage' +option_npro_trailing_garbage_body() +{ + # TODO: reject -npro-garbage, only allow -npro without trailing garbage. + + atf_check \ + "$indent" -npro-garbage +} + +atf_test_case 'option_st_trailing_garbage' +option_st_trailing_garbage_body() +{ + # TODO: reject -stdio, only allow -st without trailing garbage. + + atf_check \ + "$indent" -stdio +} + +atf_test_case 'option_version_trailing_garbage' +option_version_trailing_garbage_body() +{ + # TODO: reject --version-dump, only allow --version without trailing garbage. + + atf_check -o 'inline:NetBSD indent 2.1'"$nl" \ + "$indent" --version-dump +} + atf_test_case 'option_buffer_overflow' option_buffer_overflow_body() { @@ -489,6 +516,9 @@ atf_init_test_cases() atf_add_test_case 'option_tabsize_very_large' atf_add_test_case 'option_int_trailing_garbage' atf_add_test_case 'option_cli_trailing_garbage' + atf_add_test_case 'option_npro_trailing_garbage' + atf_add_test_case 'option_st_trailing_garbage' + atf_add_test_case 'option_version_trailing_garbage' atf_add_test_case 'option_indent_size_zero' atf_add_test_case 'unterminated_comment_wrap' atf_add_test_case 'unterminated_comment_nowrap'
CVS commit: src/tests/lib/libc/gen/posix_spawn
Module Name:src Committed By: christos Date: Sun Nov 7 15:46:20 UTC 2021 Modified Files: src/tests/lib/libc/gen/posix_spawn: Makefile h_fileactions.c h_spawn.c h_spawnattr.c t_fileactions.c t_spawn.c t_spawnattr.c Added Files: src/tests/lib/libc/gen/posix_spawn: fa_spawn_utils.c fa_spawn_utils.h Log Message: new tests for posix_spawn_chdir from Piyush Sachdeva To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/gen/posix_spawn/Makefile \ src/tests/lib/libc/gen/posix_spawn/h_spawn.c \ src/tests/lib/libc/gen/posix_spawn/h_spawnattr.c cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/gen/posix_spawn/fa_spawn_utils.c \ src/tests/lib/libc/gen/posix_spawn/fa_spawn_utils.h cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/gen/posix_spawn/h_fileactions.c cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/gen/posix_spawn/t_fileactions.c cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/posix_spawn/t_spawn.c cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/gen/posix_spawn/t_spawnattr.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/lib/libc/gen/posix_spawn/Makefile diff -u src/tests/lib/libc/gen/posix_spawn/Makefile:1.2 src/tests/lib/libc/gen/posix_spawn/Makefile:1.3 --- src/tests/lib/libc/gen/posix_spawn/Makefile:1.2 Mon Feb 13 19:13:54 2012 +++ src/tests/lib/libc/gen/posix_spawn/Makefile Sun Nov 7 10:46:20 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2012/02/14 00:13:54 martin Exp $ +# $NetBSD: Makefile,v 1.3 2021/11/07 15:46:20 christos Exp $ NOMAN= # defined WARNS=4 @@ -11,6 +11,9 @@ TESTS_C= t_spawn TESTS_C+= t_fileactions TESTS_C+= t_spawnattr +SRCS.t_spawn += t_spawn fa_spawn_utils +SRCS.t_fileactions += t_fileactions fa_spawn_utils + BINDIR= ${TESTSDIR} SCRIPTSDIR= ${TESTSDIR} Index: src/tests/lib/libc/gen/posix_spawn/h_spawn.c diff -u src/tests/lib/libc/gen/posix_spawn/h_spawn.c:1.2 src/tests/lib/libc/gen/posix_spawn/h_spawn.c:1.3 --- src/tests/lib/libc/gen/posix_spawn/h_spawn.c:1.2 Sun May 2 07:18:11 2021 +++ src/tests/lib/libc/gen/posix_spawn/h_spawn.c Sun Nov 7 10:46:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: h_spawn.c,v 1.2 2021/05/02 11:18:11 martin Exp $ */ +/* $NetBSD: h_spawn.c,v 1.3 2021/11/07 15:46:20 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,6 +29,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include +__RCSID("$NetBSD: h_spawn.c,v 1.3 2021/11/07 15:46:20 christos Exp $"); #include #include Index: src/tests/lib/libc/gen/posix_spawn/h_spawnattr.c diff -u src/tests/lib/libc/gen/posix_spawn/h_spawnattr.c:1.2 src/tests/lib/libc/gen/posix_spawn/h_spawnattr.c:1.3 --- src/tests/lib/libc/gen/posix_spawn/h_spawnattr.c:1.2 Sat Aug 21 19:00:32 2021 +++ src/tests/lib/libc/gen/posix_spawn/h_spawnattr.c Sun Nov 7 10:46:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: h_spawnattr.c,v 1.2 2021/08/21 23:00:32 andvar Exp $ */ +/* $NetBSD: h_spawnattr.c,v 1.3 2021/11/07 15:46:20 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,6 +29,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include +__RCSID("$NetBSD: h_spawnattr.c,v 1.3 2021/11/07 15:46:20 christos Exp $"); #include #include Index: src/tests/lib/libc/gen/posix_spawn/h_fileactions.c diff -u src/tests/lib/libc/gen/posix_spawn/h_fileactions.c:1.1 src/tests/lib/libc/gen/posix_spawn/h_fileactions.c:1.2 --- src/tests/lib/libc/gen/posix_spawn/h_fileactions.c:1.1 Mon Feb 13 16:03:08 2012 +++ src/tests/lib/libc/gen/posix_spawn/h_fileactions.c Sun Nov 7 10:46:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: h_fileactions.c,v 1.1 2012/02/13 21:03:08 martin Exp $ */ +/* $NetBSD: h_fileactions.c,v 1.2 2021/11/07 15:46:20 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,6 +29,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include +__RCSID("$NetBSD: h_fileactions.c,v 1.2 2021/11/07 15:46:20 christos Exp $"); #include #include Index: src/tests/lib/libc/gen/posix_spawn/t_fileactions.c diff -u src/tests/lib/libc/gen/posix_spawn/t_fileactions.c:1.6 src/tests/lib/libc/gen/posix_spawn/t_fileactions.c:1.7 --- src/tests/lib/libc/gen/posix_spawn/t_fileactions.c:1.6 Tue Jan 10 17:36:29 2017 +++ src/tests/lib/libc/gen/posix_spawn/t_fileactions.c Sun Nov 7 10:46:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_fileactions.c,v 1.6 2017/01/10 22:36:29 christos Exp $ */ +/* $NetBSD: t_fileactions.c,v 1.7 2021/11/07 15:46:20 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,6 +29,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include +__RCSID("$NetBSD: t_fileactions.c,v 1.7 2021/11/07
CVS commit: src/tests/lib/libc/gen/posix_spawn
Module Name:src Committed By: christos Date: Sun Nov 7 15:46:20 UTC 2021 Modified Files: src/tests/lib/libc/gen/posix_spawn: Makefile h_fileactions.c h_spawn.c h_spawnattr.c t_fileactions.c t_spawn.c t_spawnattr.c Added Files: src/tests/lib/libc/gen/posix_spawn: fa_spawn_utils.c fa_spawn_utils.h Log Message: new tests for posix_spawn_chdir from Piyush Sachdeva To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/gen/posix_spawn/Makefile \ src/tests/lib/libc/gen/posix_spawn/h_spawn.c \ src/tests/lib/libc/gen/posix_spawn/h_spawnattr.c cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/gen/posix_spawn/fa_spawn_utils.c \ src/tests/lib/libc/gen/posix_spawn/fa_spawn_utils.h cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/gen/posix_spawn/h_fileactions.c cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/gen/posix_spawn/t_fileactions.c cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/posix_spawn/t_spawn.c cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/gen/posix_spawn/t_spawnattr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 15:44:28 UTC 2021 Modified Files: src/tests/usr.bin/indent: opt_cs.c opt_v.c token_keyword_struct_union_enum.c Log Message: tests/indent: test cast, line counting, comment in struct To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/opt_cs.c \ src/tests/usr.bin/indent/opt_v.c cvs rdiff -u -r1.2 -r1.3 \ src/tests/usr.bin/indent/token_keyword_struct_union_enum.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/usr.bin/indent/opt_cs.c diff -u src/tests/usr.bin/indent/opt_cs.c:1.3 src/tests/usr.bin/indent/opt_cs.c:1.4 --- src/tests/usr.bin/indent/opt_cs.c:1.3 Sat Oct 16 21:32:10 2021 +++ src/tests/usr.bin/indent/opt_cs.c Sun Nov 7 15:44:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt_cs.c,v 1.3 2021/10/16 21:32:10 rillig Exp $ */ +/* $NetBSD: opt_cs.c,v 1.4 2021/11/07 15:44:28 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -26,3 +26,25 @@ int i0 = (int)3.0; int i1 = (int)3.0; int i3 = (int)3.0; #indent end + + +#indent input +struct s s3 = (struct s) s; +struct s *ptr = (struct s *) s; +union u u3 = (union u) u; +enum e e3 = (enum e) e; +#indent end + +#indent run -cs +struct s s3 = (struct s) s; +struct s *ptr = (struct s *) s; +union u u3 = (union u) u; +enum e e3 = (enum e) e; +#indent end + +#indent run -ncs +struct s s3 = (struct s)s; +struct s *ptr = (struct s *)s; +union u u3 = (union u)u; +enum e e3 = (enum e)e; +#indent end Index: src/tests/usr.bin/indent/opt_v.c diff -u src/tests/usr.bin/indent/opt_v.c:1.3 src/tests/usr.bin/indent/opt_v.c:1.4 --- src/tests/usr.bin/indent/opt_v.c:1.3 Fri Oct 22 19:27:53 2021 +++ src/tests/usr.bin/indent/opt_v.c Sun Nov 7 15:44:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt_v.c,v 1.3 2021/10/22 19:27:53 rillig Exp $ */ +/* $NetBSD: opt_v.c,v 1.4 2021/11/07 15:44:28 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -90,3 +90,33 @@ There were 5 output lines and 1 comments * XXX: It's rather strange that -v writes to stdout, even in filter mode. * This output belongs on stderr instead. */ + + +/* + * Test line counting in preprocessor directives. + */ +#indent input +#if 0 +int line = 1; +int line = 2; +int line = 3; +#else +int line = 5; +#endif +#indent end + +#indent run -v -di0 +#if 0 +int line = 1; +int line = 2; +int line = 3; +#else +int line = 5; +#endif +There were 3 output lines and 0 comments +(Lines with comments)/(Lines with code): 0.000 +#indent end +/* + * FIXME: The lines within the conditional compilation directives must be + * counted as well. TODO: Move stats out of parser_state. + */ Index: src/tests/usr.bin/indent/token_keyword_struct_union_enum.c diff -u src/tests/usr.bin/indent/token_keyword_struct_union_enum.c:1.2 src/tests/usr.bin/indent/token_keyword_struct_union_enum.c:1.3 --- src/tests/usr.bin/indent/token_keyword_struct_union_enum.c:1.2 Fri Oct 22 19:46:41 2021 +++ src/tests/usr.bin/indent/token_keyword_struct_union_enum.c Sun Nov 7 15:44:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_keyword_struct_union_enum.c,v 1.2 2021/10/22 19:46:41 rillig Exp $ */ +/* $NetBSD: token_keyword_struct_union_enum.c,v 1.3 2021/11/07 15:44:28 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -68,3 +68,13 @@ u(struct x a) struct y c = (struct y *) } #indent end + + +/* Comment between 'struct' and the tag name; doesn't occur in practice. */ +#indent input +struct /* comment */ tag var; +#indent end + +#indent run -di0 +struct /* comment */ tag var; +#indent end
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 15:44:28 UTC 2021 Modified Files: src/tests/usr.bin/indent: opt_cs.c opt_v.c token_keyword_struct_union_enum.c Log Message: tests/indent: test cast, line counting, comment in struct To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/opt_cs.c \ src/tests/usr.bin/indent/opt_v.c cvs rdiff -u -r1.2 -r1.3 \ src/tests/usr.bin/indent/token_keyword_struct_union_enum.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 15:18:25 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h lexi.c Log Message: indent: rename ps.decl_nest to decl_level This better matches the comment. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.214 -r1.215 src/usr.bin/indent/indent.c cvs rdiff -u -r1.84 -r1.85 src/usr.bin/indent/indent.h cvs rdiff -u -r1.136 -r1.137 src/usr.bin/indent/lexi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 15:18:25 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h lexi.c Log Message: indent: rename ps.decl_nest to decl_level This better matches the comment. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.214 -r1.215 src/usr.bin/indent/indent.c cvs rdiff -u -r1.84 -r1.85 src/usr.bin/indent/indent.h cvs rdiff -u -r1.136 -r1.137 src/usr.bin/indent/lexi.c 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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.214 src/usr.bin/indent/indent.c:1.215 --- src/usr.bin/indent/indent.c:1.214 Sun Nov 7 14:00:35 2021 +++ src/usr.bin/indent/indent.c Sun Nov 7 15:18:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.214 2021/11/07 14:00:35 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.215 2021/11/07 15:18:25 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.214 2021/11/07 14:00:35 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.215 2021/11/07 15:18:25 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -920,7 +920,7 @@ static void process_semicolon(bool *seen_case, int *quest_level, int decl_ind, bool tabs_to_var, bool *spaced_expr, stmt_head hd, bool *force_nl) { -if (ps.decl_nest == 0) +if (ps.decl_level == 0) ps.init_or_struct = false; *seen_case = false; /* these will only need resetting in an error */ *quest_level = 0; @@ -939,7 +939,7 @@ process_semicolon(bool *seen_case, int * ps.decl_indent_done = true; } -ps.in_decl = ps.decl_nest > 0; /* if we were in a first level +ps.in_decl = ps.decl_level > 0; /* if we were in a first level * structure declaration, we aren't * anymore */ @@ -1011,11 +1011,11 @@ process_lbrace(bool *force_nl, bool *spa if (code.s == code.e) ps.ind_stmt = false; /* don't indent the '{' itself */ if (ps.in_decl && ps.init_or_struct) { - di_stack[ps.decl_nest] = *decl_ind; - if (++ps.decl_nest == di_stack_cap) { + di_stack[ps.decl_level] = *decl_ind; + if (++ps.decl_level == di_stack_cap) { diag(0, "Reached internal limit of %d struct levels", di_stack_cap); - ps.decl_nest--; + ps.decl_level--; } } else { ps.decl_on_line = false; /* we can't be in the middle of a @@ -1063,9 +1063,9 @@ process_rbrace(bool *spaced_expr, int *d ps.want_blank = true; ps.in_stmt = ps.ind_stmt = false; -if (ps.decl_nest > 0) { /* we are in multi-level structure declaration */ - *decl_ind = di_stack[--ps.decl_nest]; - if (ps.decl_nest == 0 && !ps.in_parameter_declaration) { +if (ps.decl_level > 0) { /* we are in multi-level structure declaration */ + *decl_ind = di_stack[--ps.decl_level]; + if (ps.decl_level == 0 && !ps.in_parameter_declaration) { ps.just_saw_decl = 2; *decl_ind = ps.ind_level == 0 ? opt.decl_indent : opt.local_decl_indent; @@ -1079,7 +1079,7 @@ process_rbrace(bool *spaced_expr, int *d && ps.s_sym[ps.tos] == psym_if_expr_stmt && ps.s_ind_level[ps.tos] >= ps.ind_level; -if (ps.tos <= 1 && opt.blanklines_after_procs && ps.decl_nest <= 0) +if (ps.tos <= 1 && opt.blanklines_after_procs && ps.decl_level <= 0) blank_line_after = true; } @@ -1130,20 +1130,20 @@ process_type(int *decl_ind, bool *tabs_t } if (ps.in_parameter_declaration && opt.indent_parameters && - ps.decl_nest == 0) { + ps.decl_level == 0) { ps.ind_level = ps.ind_level_follow = 1; ps.ind_stmt = false; } ps.init_or_struct = /* maybe */ true; ps.in_decl = ps.decl_on_line = ps.prev_token != lsym_typedef; -if (ps.decl_nest <= 0) +if (ps.decl_level <= 0) ps.just_saw_decl = 2; blank_line_before = false; int len = (int)buf_len() + 1; -int ind = ps.ind_level == 0 || ps.decl_nest > 0 +int ind = ps.ind_level == 0 || ps.decl_level > 0 ? opt.decl_indent /* global variable or local member */ : opt.local_decl_indent; /* local variable */ *decl_ind = ind > 0 ? ind : len; @@ -1387,7 +1387,7 @@ main_loop(void) bool seen_case = false; /* set to true when we see a 'case', so we * know what to do with the following colon */ -di_stack[ps.decl_nest = 0] = 0; +di_stack[ps.decl_level = 0] = 0; for (;;) { /* loop until we reach eof */ lexer_symbol lsym = lexi(); Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.84 src/usr.bin/indent/indent.h:1.85 --- src/usr.bin/indent/indent.h:1.84 Sun Nov 7 14:00:35 2021 +++ src/usr.bin/indent/indent.h Sun Nov 7 15:18:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.84 2021/11/07 14:00:35 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.85 2021/11/07 15:18:25
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 15:01:50 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_misc.sh Log Message: tests/indent: test options without '-' in profile files To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/indent/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/indent/t_misc.sh diff -u src/tests/usr.bin/indent/t_misc.sh:1.12 src/tests/usr.bin/indent/t_misc.sh:1.13 --- src/tests/usr.bin/indent/t_misc.sh:1.12 Sat Oct 30 09:32:46 2021 +++ src/tests/usr.bin/indent/t_misc.sh Sun Nov 7 15:01:50 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_misc.sh,v 1.12 2021/10/30 09:32:46 rillig Exp $ +# $NetBSD: t_misc.sh,v 1.13 2021/11/07 15:01:50 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -190,6 +190,21 @@ option_P_in_profile_file_body() "$indent" < code.c } +atf_test_case 'option_without_hyphen' +option_without_hyphen_body() +{ + # TODO: Options in profile files should be required to start with + # '-', just like in the command line arguments. + + printf ' -i3 xi5 +di0\n' > .indent.pro + + printf '%s\n' 'int var[] = {' '1,' '}' > code.c + printf '%s\n' 'int var[] = {' ' 1,' '}' > code.exp + + atf_check -o 'file:code.exp' \ + "$indent" < code.c +} + atf_test_case 'opt' opt_body() { @@ -355,6 +370,7 @@ atf_init_test_cases() atf_add_test_case 'verbose_profile' atf_add_test_case 'nested_struct_declarations' atf_add_test_case 'option_P_in_profile_file' + atf_add_test_case 'option_without_hyphen' atf_add_test_case 'opt' atf_add_test_case 'opt_npro' atf_add_test_case 'opt_U'
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 15:01:50 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_misc.sh Log Message: tests/indent: test options without '-' in profile files To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/indent/t_misc.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: christos Date: Sun Nov 7 14:34:30 UTC 2021 Modified Files: src/include: spawn.h src/lib/libc/gen: posix_spawn_fileactions.c Log Message: Commit the userland portion of the posix_spawn_chdir project by Piyush Sachdeva To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/include/spawn.h cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/posix_spawn_fileactions.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: christos Date: Sun Nov 7 14:34:30 UTC 2021 Modified Files: src/include: spawn.h src/lib/libc/gen: posix_spawn_fileactions.c Log Message: Commit the userland portion of the posix_spawn_chdir project by Piyush Sachdeva To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/include/spawn.h cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/posix_spawn_fileactions.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/include/spawn.h diff -u src/include/spawn.h:1.4 src/include/spawn.h:1.5 --- src/include/spawn.h:1.4 Wed Feb 22 12:51:01 2012 +++ src/include/spawn.h Sun Nov 7 09:34:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spawn.h,v 1.4 2012/02/22 17:51:01 martin Exp $ */ +/* $NetBSD: spawn.h,v 1.5 2021/11/07 14:34:30 christos Exp $ */ /*- * Copyright (c) 2008 Ed Schouten @@ -56,6 +56,10 @@ int posix_spawn_file_actions_addopen(pos int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int); int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int); +int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t * __restrict, +const char * __restrict); +int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *, int); + /* * Spawn attributes */ Index: src/lib/libc/gen/posix_spawn_fileactions.c diff -u src/lib/libc/gen/posix_spawn_fileactions.c:1.4 src/lib/libc/gen/posix_spawn_fileactions.c:1.5 --- src/lib/libc/gen/posix_spawn_fileactions.c:1.4 Sun Feb 2 09:54:39 2014 +++ src/lib/libc/gen/posix_spawn_fileactions.c Sun Nov 7 09:34:30 2021 @@ -25,7 +25,7 @@ */ #include -__RCSID("$NetBSD: posix_spawn_fileactions.c,v 1.4 2014/02/02 14:54:39 martin Exp $"); +__RCSID("$NetBSD: posix_spawn_fileactions.c,v 1.5 2021/11/07 14:34:30 christos Exp $"); #include "namespace.h" @@ -171,3 +171,47 @@ posix_spawn_file_actions_addclose(posix_ return 0; } + +int +posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t * __restrict fa, + const char * __restrict path) +{ + char *dirpath; + unsigned int i; + int error; + + error = posix_spawn_file_actions_getentry(fa, ); + if (error) + return error; + + dirpath = strdup(path); + if (dirpath == NULL) + return ENOMEM; + + fa->fae[i].fae_action = FAE_CHDIR; + fa->fae[i].fae_chdir_path = dirpath; + fa->fae[i].fae_fildes = -1; + fa->len++; + + return 0; +} + +int +posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *fa, int fildes) +{ + unsigned int i; + int error; + + if (fildes < 0) + return EBADF; + + error = posix_spawn_file_actions_getentry(fa, ); + if (error) + return error; + + fa->fae[i].fae_action = FAE_FCHDIR; + fa->fae[i].fae_fildes = fildes; + fa->len++; + + return 0; +}
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 14:04:35 UTC 2021 Modified Files: src/usr.bin/indent: lexi.c Log Message: indent: move ps.p_l_follow closer to lsym_type_outside_parentheses This makes it easier to see the relation between these two. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.136 src/usr.bin/indent/lexi.c 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/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.135 src/usr.bin/indent/lexi.c:1.136 --- src/usr.bin/indent/lexi.c:1.135 Sun Nov 7 07:44:59 2021 +++ src/usr.bin/indent/lexi.c Sun Nov 7 14:04:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.135 2021/11/07 07:44:59 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.136 2021/11/07 14:04:34 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.135 2021/11/07 07:44:59 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.136 2021/11/07 14:04:34 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -415,8 +415,6 @@ lex_char_or_string(void) static bool probably_typename(void) { -if (ps.p_l_follow > 0) - return false; if (ps.block_init || ps.in_stmt) return false; if (inp.s[0] == '*' && inp.s[1] != '=') @@ -538,7 +536,7 @@ found_typename: return lsym_funcname; no_function_definition:; -} else if (probably_typename()) { +} else if (ps.p_l_follow == 0 && probably_typename()) { ps.next_unary = true; return lsym_type_outside_parentheses; }
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 14:04:35 UTC 2021 Modified Files: src/usr.bin/indent: lexi.c Log Message: indent: move ps.p_l_follow closer to lsym_type_outside_parentheses This makes it easier to see the relation between these two. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.136 src/usr.bin/indent/lexi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 14:00:35 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h Log Message: indent: reduce negations in process_else, clean up comments No functional change. To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/usr.bin/indent/indent.c cvs rdiff -u -r1.83 -r1.84 src/usr.bin/indent/indent.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.213 src/usr.bin/indent/indent.c:1.214 --- src/usr.bin/indent/indent.c:1.213 Sun Nov 7 13:30:15 2021 +++ src/usr.bin/indent/indent.c Sun Nov 7 14:00:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.213 2021/11/07 13:30:15 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.214 2021/11/07 14:00:35 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.213 2021/11/07 13:30:15 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.214 2021/11/07 14:00:35 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -484,7 +484,7 @@ search_stmt(lexer_symbol *lsym, bool *fo if (search_stmt_lbrace()) goto switch_buffer; /* FALLTHROUGH */ - default: /* it is the start of a normal statement */ + default: if (!search_stmt_other(*lsym, force_nl, comment_buffered, *last_else)) return; @@ -1105,7 +1105,7 @@ process_else(bool *force_nl, bool *last_ { ps.in_stmt = false; -if (code.e > code.s && (!opt.cuddle_else || code.e[-1] != '}')) { +if (code.e > code.s && !(opt.cuddle_else && code.e[-1] == '}')) { if (opt.verbose) diag(0, "Line broken"); dump_line(); /* make sure this starts a line */ Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.83 src/usr.bin/indent/indent.h:1.84 --- src/usr.bin/indent/indent.h:1.83 Sun Nov 7 13:43:11 2021 +++ src/usr.bin/indent/indent.h Sun Nov 7 14:00:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.83 2021/11/07 13:43:11 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.84 2021/11/07 14:00:35 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -263,7 +263,8 @@ extern bool inhibit_formatting; /* true #define STACKSIZE 256 extern struct parser_state { -lexer_symbol prev_token; +lexer_symbol prev_token; /* the previous token, but never comment, + * newline or preprocessing line */ bool curr_col_1; /* whether the current token started in column * 1 of the unformatted input */ bool next_col_1;
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 14:00:35 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h Log Message: indent: reduce negations in process_else, clean up comments No functional change. To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/usr.bin/indent/indent.c cvs rdiff -u -r1.83 -r1.84 src/usr.bin/indent/indent.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: christos Date: Sun Nov 7 13:47:50 UTC 2021 Modified Files: src/sys/kern: kern_exec.c vfs_syscalls.c src/sys/sys: spawn.h vfs_syscalls.h Log Message: Merge the kernel portion of the posix-spawn-chdir project by Piyush Sachdeva. To generate a diff of this commit: cvs rdiff -u -r1.510 -r1.511 src/sys/kern/kern_exec.c cvs rdiff -u -r1.553 -r1.554 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.6 -r1.7 src/sys/sys/spawn.h cvs rdiff -u -r1.28 -r1.29 src/sys/sys/vfs_syscalls.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/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.510 src/sys/kern/kern_exec.c:1.511 --- src/sys/kern/kern_exec.c:1.510 Sun Oct 10 14:07:51 2021 +++ src/sys/kern/kern_exec.c Sun Nov 7 08:47:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.510 2021/10/10 18:07:51 thorpej Exp $ */ +/* $NetBSD: kern_exec.c,v 1.511 2021/11/07 13:47:49 christos Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.510 2021/10/10 18:07:51 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.511 2021/11/07 13:47:49 christos Exp $"); #include "opt_exec.h" #include "opt_execfmt.h" @@ -103,6 +103,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_exec.c, #include #include #include +#include #if NVERIEXEC > 0 #include #endif /* NVERIEXEC > 0 */ @@ -2132,6 +2133,13 @@ handle_posix_spawn_file_actions(struct p } error = fd_close(fae->fae_fildes); break; + case FAE_CHDIR: + error = do_sys_chdir(l, fae->fae_chdir_path, + UIO_SYSSPACE, ); + break; + case FAE_FCHDIR: + error = do_sys_fchdir(l, fae->fae_fildes, ); + break; } if (error) return error; @@ -2361,15 +2369,27 @@ spawn_return(void *arg) exit1(l, 127, 0); } +static __inline char ** +posix_spawn_fae_path(struct posix_spawn_file_actions_entry *fae) +{ + switch (fae->fae_action) { + case FAE_OPEN: + return >fae_path; + case FAE_CHDIR: + return >fae_chdir_path; + default: + return NULL; + } +} + void posix_spawn_fa_free(struct posix_spawn_file_actions *fa, size_t len) { for (size_t i = 0; i < len; i++) { - struct posix_spawn_file_actions_entry *fae = >fae[i]; - if (fae->fae_action != FAE_OPEN) - continue; - kmem_strfree(fae->fae_path); + char **pathp = posix_spawn_fae_path(>fae[i]); + if (pathp) + kmem_strfree(*pathp); } if (fa->len > 0) kmem_free(fa->fae, sizeof(*fa->fae) * fa->len); @@ -2408,14 +2428,14 @@ posix_spawn_fa_alloc(struct posix_spawn_ pbuf = PNBUF_GET(); for (; i < fa->len; i++) { - fae = >fae[i]; - if (fae->fae_action != FAE_OPEN) + char **pathp = posix_spawn_fae_path(>fae[i]); + if (pathp == NULL) continue; - error = copyinstr(fae->fae_path, pbuf, MAXPATHLEN, ); + error = copyinstr(*pathp, pbuf, MAXPATHLEN, ); if (error) goto out; - fae->fae_path = kmem_alloc(fal, KM_SLEEP); - memcpy(fae->fae_path, pbuf, fal); + *pathp = kmem_alloc(fal, KM_SLEEP); + memcpy(*pathp, pbuf, fal); } PNBUF_PUT(pbuf); Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.553 src/sys/kern/vfs_syscalls.c:1.554 --- src/sys/kern/vfs_syscalls.c:1.553 Sun Sep 26 17:29:38 2021 +++ src/sys/kern/vfs_syscalls.c Sun Nov 7 08:47:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.553 2021/09/26 21:29:38 thorpej Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.554 2021/11/07 13:47:50 christos Exp $ */ /*- * Copyright (c) 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.553 2021/09/26 21:29:38 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.554 2021/11/07 13:47:50 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -1459,24 +1459,19 @@ sys___getvfsstat90(struct lwp *l, const /* * Change current working directory to a given file descriptor. */ -/* ARGSUSED */ int -sys_fchdir(struct lwp *l, const struct sys_fchdir_args *uap, register_t *retval) +do_sys_fchdir(struct lwp *l, int fd, register_t *retval) { - /* { - syscallarg(int) fd; - } */ struct proc *p = l->l_proc; struct cwdinfo *cwdi; struct vnode *vp, *tdp; struct mount *mp; file_t *fp; - int error, fd; + int error; /* fd_getvnode() will use the descriptor for us */ - fd = SCARG(uap, fd); if ((error = fd_getvnode(fd, )) != 0) - return (error); + return error; vp = fp->f_vnode; vref(vp); @@ -1517,9 +1512,22 @@ sys_fchdir(struct lwp *l, const struct s } rw_exit(>cwdi_lock); - out: +out: fd_putfile(fd); - return (error); + return error; +} + +/* + * Change current working directory to a given file descriptor. + */ +/* ARGSUSED */ +int +sys_fchdir(struct lwp *l, const struct sys_fchdir_args *uap, register_t *retval) +{ + /* { + syscallarg(int) fd; + } */ + return do_sys_fchdir(l,
CVS commit: src/sys
Module Name:src Committed By: christos Date: Sun Nov 7 13:47:50 UTC 2021 Modified Files: src/sys/kern: kern_exec.c vfs_syscalls.c src/sys/sys: spawn.h vfs_syscalls.h Log Message: Merge the kernel portion of the posix-spawn-chdir project by Piyush Sachdeva. To generate a diff of this commit: cvs rdiff -u -r1.510 -r1.511 src/sys/kern/kern_exec.c cvs rdiff -u -r1.553 -r1.554 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.6 -r1.7 src/sys/sys/spawn.h cvs rdiff -u -r1.28 -r1.29 src/sys/sys/vfs_syscalls.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/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 13:43:11 UTC 2021 Modified Files: src/usr.bin/indent: indent.h Log Message: indent: document the comment buffer more accurately To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/usr.bin/indent/indent.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/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.82 src/usr.bin/indent/indent.h:1.83 --- src/usr.bin/indent/indent.h:1.82 Sun Nov 7 08:24:50 2021 +++ src/usr.bin/indent/indent.h Sun Nov 7 13:43:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.82 2021/11/07 08:24:50 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.83 2021/11/07 13:43:11 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -159,7 +159,9 @@ extern struct buffer token; /* the curre extern struct buffer lab; /* the label or preprocessor directive */ extern struct buffer code; /* the main part of the current line of code */ extern struct buffer com; /* the trailing comment of the line, or the - * start or end of a multi-line comment */ + * start or end of a multi-line comment, or + * while in process_comment, a single line of + * a multi-line comment */ extern char sc_buf[sc_size]; /* input text is saved here when looking for * the brace after an if, while, etc */
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 13:43:11 UTC 2021 Modified Files: src/usr.bin/indent: indent.h Log Message: indent: document the comment buffer more accurately To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/usr.bin/indent/indent.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/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 13:38:32 UTC 2021 Modified Files: src/usr.bin/indent: pr_comment.c Log Message: indent: remove code that accessed out-of-bounds data from buffer Saving and restoring the exact buffer position had been necessary before NetBSD pr_comment.c 1.114. The code accessed the buffer data out of the bounds of [com.s, com.e), which was rather surprising. More specifically, it accessed com.e[-1] in a case where com.e == com.s, relying on com.e[-1] being ' ' in most cases and '*' in the case where the comment delimiter was written to a separate output line. Make the code easier understandable by only ever accessing the buffer data in the bounds [buf.s, buf.e). No functional change. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/usr.bin/indent/pr_comment.c 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/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.114 src/usr.bin/indent/pr_comment.c:1.115 --- src/usr.bin/indent/pr_comment.c:1.114 Sun Nov 7 13:30:15 2021 +++ src/usr.bin/indent/pr_comment.c Sun Nov 7 13:38:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.114 2021/11/07 13:30:15 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.115 2021/11/07 13:38:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.114 2021/11/07 13:30:15 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.115 2021/11/07 13:38:32 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -181,14 +181,12 @@ analyze_comment(bool *p_may_wrap, bool * break_delim = false; if (break_delim) { - char *t = com.e; com.e = com.s + 2; *com.e = '\0'; if (opt.blanklines_before_block_comments && ps.prev_token != lsym_lbrace) blank_line_before = true; dump_line(); - com.e = com.s = t; com_add_delim(); }
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 13:38:32 UTC 2021 Modified Files: src/usr.bin/indent: pr_comment.c Log Message: indent: remove code that accessed out-of-bounds data from buffer Saving and restoring the exact buffer position had been necessary before NetBSD pr_comment.c 1.114. The code accessed the buffer data out of the bounds of [com.s, com.e), which was rather surprising. More specifically, it accessed com.e[-1] in a case where com.e == com.s, relying on com.e[-1] being ' ' in most cases and '*' in the case where the comment delimiter was written to a separate output line. Make the code easier understandable by only ever accessing the buffer data in the bounds [buf.s, buf.e). No functional change. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/usr.bin/indent/pr_comment.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: rillig Date: Sun Nov 7 13:30:15 UTC 2021 Modified Files: src/tests/usr.bin/indent: opt_cdb.c src/usr.bin/indent: indent.c pr_comment.c Log Message: indent: only access buffer data in the range [buf.s, buf.e) No functional change. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/opt_cdb.c cvs rdiff -u -r1.212 -r1.213 src/usr.bin/indent/indent.c cvs rdiff -u -r1.113 -r1.114 src/usr.bin/indent/pr_comment.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/usr.bin/indent/opt_cdb.c diff -u src/tests/usr.bin/indent/opt_cdb.c:1.4 src/tests/usr.bin/indent/opt_cdb.c:1.5 --- src/tests/usr.bin/indent/opt_cdb.c:1.4 Mon Oct 18 07:11:31 2021 +++ src/tests/usr.bin/indent/opt_cdb.c Sun Nov 7 13:30:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt_cdb.c,v 1.4 2021/10/18 07:11:31 rillig Exp $ */ +/* $NetBSD: opt_cdb.c,v 1.5 2021/11/07 13:30:15 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -131,3 +131,39 @@ example(void) int lc; } #indent end + + +#indent input +/* + + */ +#indent end + +#indent run -cdb +/* + * + */ +#indent end + +#indent run -ncdb +/* + * */ +#indent end + + +#indent input +/* + +*/ +#indent end + +#indent run -cdb +/* + * + */ +#indent end + +#indent run -ncdb +/* + * */ +#indent end Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.212 src/usr.bin/indent/indent.c:1.213 --- src/usr.bin/indent/indent.c:1.212 Sun Nov 7 07:44:59 2021 +++ src/usr.bin/indent/indent.c Sun Nov 7 13:30:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.212 2021/11/07 07:44:59 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.213 2021/11/07 13:30:15 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.212 2021/11/07 07:44:59 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.213 2021/11/07 13:30:15 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -840,7 +840,7 @@ want_blank_before_unary_op(void) if (ps.want_blank) return true; if (token.s[0] == '+' || token.s[0] == '-') - return code.e[-1] == token.s[0]; + return code.e > code.s && code.e[-1] == token.s[0]; return false; } @@ -1105,7 +1105,7 @@ process_else(bool *force_nl, bool *last_ { ps.in_stmt = false; -if (code.e != code.s && (!opt.cuddle_else || code.e[-1] != '}')) { +if (code.e > code.s && (!opt.cuddle_else || code.e[-1] != '}')) { if (opt.verbose) diag(0, "Line broken"); dump_line(); /* make sure this starts a line */ @@ -1199,7 +1199,7 @@ process_string_prefix(void) static void process_period(void) { -if (code.e[-1] == ',') +if (code.e > code.s && code.e[-1] == ',') *code.e++ = ' '; *code.e++ = '.'; ps.want_blank = false; Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.113 src/usr.bin/indent/pr_comment.c:1.114 --- src/usr.bin/indent/pr_comment.c:1.113 Sun Nov 7 12:29:58 2021 +++ src/usr.bin/indent/pr_comment.c Sun Nov 7 13:30:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.113 2021/11/07 12:29:58 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.114 2021/11/07 13:30:15 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.113 2021/11/07 12:29:58 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.114 2021/11/07 13:30:15 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -239,7 +239,7 @@ copy_comment_wrap(int adj_max_line_lengt } else { ps.next_col_1 = true; - if (!ch_isblank(com.e[-1])) + if (!(com.e > com.s && ch_isblank(com.e[-1]))) com_add_char(' '); last_blank = com.e - 1 - com.buf; } @@ -273,7 +273,7 @@ copy_comment_wrap(int adj_max_line_lengt com_add_char(' '); } - if (!ch_isblank(com.e[-1])) + if (!(com.e > com.s && ch_isblank(com.e[-1]))) com_add_char(' '); com_add_char('*'); com_add_char('/');
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 7 13:30:15 UTC 2021 Modified Files: src/tests/usr.bin/indent: opt_cdb.c src/usr.bin/indent: indent.c pr_comment.c Log Message: indent: only access buffer data in the range [buf.s, buf.e) No functional change. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/opt_cdb.c cvs rdiff -u -r1.212 -r1.213 src/usr.bin/indent/indent.c cvs rdiff -u -r1.113 -r1.114 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 12:29:58 UTC 2021 Modified Files: src/usr.bin/indent: pr_comment.c Log Message: indent: do not expand comment buffer unnecessarily This may have been a simple typo or a really tricky optimization that isn't obvious even after studying the code for several months. Either of these is bad, so use the standard form of resetting the buffer. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 12:29:58 UTC 2021 Modified Files: src/usr.bin/indent: pr_comment.c Log Message: indent: do not expand comment buffer unnecessarily This may have been a simple typo or a really tricky optimization that isn't obvious even after studying the code for several months. Either of these is bad, so use the standard form of resetting the buffer. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 src/usr.bin/indent/pr_comment.c 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/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.112 src/usr.bin/indent/pr_comment.c:1.113 --- src/usr.bin/indent/pr_comment.c:1.112 Sun Nov 7 11:30:45 2021 +++ src/usr.bin/indent/pr_comment.c Sun Nov 7 12:29:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.112 2021/11/07 11:30:45 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.113 2021/11/07 12:29:58 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.112 2021/11/07 11:30:45 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.113 2021/11/07 12:29:58 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -269,7 +269,7 @@ copy_comment_wrap(int adj_max_line_lengt if (com.e > com.s + 3) dump_line(); else - com.s = com.e; /* XXX: why not e = s? */ + com.e = com.s; com_add_char(' '); }
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 12:26:22 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_comment.c Log Message: tests/indent: improve code coverage for processing comments To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/indent/token_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 12:26:22 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_comment.c Log Message: tests/indent: improve code coverage for processing comments To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/indent/token_comment.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/usr.bin/indent/token_comment.c diff -u src/tests/usr.bin/indent/token_comment.c:1.21 src/tests/usr.bin/indent/token_comment.c:1.22 --- src/tests/usr.bin/indent/token_comment.c:1.21 Sun Nov 7 11:30:45 2021 +++ src/tests/usr.bin/indent/token_comment.c Sun Nov 7 12:26:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_comment.c,v 1.21 2021/11/07 11:30:45 rillig Exp $ */ +/* $NetBSD: token_comment.c,v 1.22 2021/11/07 12:26:22 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -1021,3 +1021,28 @@ line 4 #indent end #indent run-equals-input -nsc -ncdb + + +/* + * Cover the code for expanding the comment buffer. As of 2021-11-07, the + * default buffer size is 200. To actually fill the comment buffer, there must + * be a single line of a comment that is longer than 200 bytes. + */ +#indent input +/*-_102030405060708090___100___110___120___130___140___150___160___170___180___190___200 */ +#indent end + +#indent run-equals-input + +/* + * Cover the code for expanding the comment buffer in com_terminate. As of + * 2021-11-07, the default buffer size is 200, with a safety margin of 1 at + * the beginning and another safety margin of 5 at the end. To force the + * comment buffer to expanded in com_terminate, the comment must be exactly + * 193 bytes long. + */ +#indent input +/*-_102030405060708090___100___110___120___130___140___150___160___170___180___190 */ +#indent end + +#indent run-equals-input
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 7 11:30:45 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_comment.c src/usr.bin/indent: pr_comment.c Log Message: indent: remove dead code in analyze_comment The case of an otherwise empty line is already handled further above. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/tests/usr.bin/indent/token_comment.c cvs rdiff -u -r1.111 -r1.112 src/usr.bin/indent/pr_comment.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/usr.bin/indent/token_comment.c diff -u src/tests/usr.bin/indent/token_comment.c:1.20 src/tests/usr.bin/indent/token_comment.c:1.21 --- src/tests/usr.bin/indent/token_comment.c:1.20 Sun Nov 7 10:13:26 2021 +++ src/tests/usr.bin/indent/token_comment.c Sun Nov 7 11:30:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_comment.c,v 1.20 2021/11/07 10:13:26 rillig Exp $ */ +/* $NetBSD: token_comment.c,v 1.21 2021/11/07 11:30:45 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -986,3 +986,38 @@ f(void) #indent end #indent run-equals-input + + +/* + * Test two completely empty lines in a wrap comment. The second empty line + * covers the condition ps.next_col_1 in copy_comment_wrap. + */ +#indent input +/* line 1 + + +line 4 */ +#indent end + +#indent run +/* + * line 1 + * + * + * line 4 + */ +#indent end + +#indent run-equals-input -nfc1 +#indent run-equals-input -nfc1 -nsc + +#indent run -nsc +/* +line 1 + + +line 4 + */ +#indent end + +#indent run-equals-input -nsc -ncdb Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.111 src/usr.bin/indent/pr_comment.c:1.112 --- src/usr.bin/indent/pr_comment.c:1.111 Sun Nov 7 11:08:25 2021 +++ src/usr.bin/indent/pr_comment.c Sun Nov 7 11:30:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.111 2021/11/07 11:08:25 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.112 2021/11/07 11:30:45 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.111 2021/11/07 11:08:25 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.112 2021/11/07 11:30:45 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -132,13 +132,9 @@ analyze_comment(bool *p_may_wrap, bool * } else { break_delim = false; - int target_ind; - if (code.s != code.e) - target_ind = ind_add(compute_code_indent(), code.s, code.e); - else if (lab.s != lab.e) - target_ind = ind_add(compute_label_indent(), lab.s, lab.e); - else - target_ind = 0; + int target_ind = code.s != code.e + ? ind_add(compute_code_indent(), code.s, code.e) + : ind_add(compute_label_indent(), lab.s, lab.e); com_ind = ps.decl_on_line || ps.ind_level == 0 ? opt.decl_comment_column - 1 : opt.comment_column - 1;
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 7 11:30:45 UTC 2021 Modified Files: src/tests/usr.bin/indent: token_comment.c src/usr.bin/indent: pr_comment.c Log Message: indent: remove dead code in analyze_comment The case of an otherwise empty line is already handled further above. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/tests/usr.bin/indent/token_comment.c cvs rdiff -u -r1.111 -r1.112 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 11:08:25 UTC 2021 Modified Files: src/usr.bin/indent: pr_comment.c Log Message: indent: remove dead code from copy_comment_wrap C99 comments are not wrapped, therefore there is no need to check for them in copy_comment_wrap. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Nov 7 11:08:25 UTC 2021 Modified Files: src/usr.bin/indent: pr_comment.c Log Message: indent: remove dead code from copy_comment_wrap C99 comments are not wrapped, therefore there is no need to check for them in copy_comment_wrap. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/usr.bin/indent/pr_comment.c 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/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.110 src/usr.bin/indent/pr_comment.c:1.111 --- src/usr.bin/indent/pr_comment.c:1.110 Sun Nov 7 10:56:06 2021 +++ src/usr.bin/indent/pr_comment.c Sun Nov 7 11:08:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.110 2021/11/07 10:56:06 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.111 2021/11/07 11:08:25 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.110 2021/11/07 10:56:06 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.111 2021/11/07 11:08:25 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -224,9 +224,6 @@ copy_comment_wrap(int adj_max_line_lengt break; case '\n': - if (token.e[-1] == '/') - goto end_of_line_comment; - if (had_eof) { diag(1, "Unterminated comment"); dump_line(); @@ -268,11 +265,10 @@ copy_comment_wrap(int adj_max_line_lengt case '*': inp_skip(); - if (*inp.s == '/' && token.e[-1] == '*') { + if (*inp.s == '/') { end_of_comment: inp_skip(); - end_of_line_comment: if (break_delim) { if (com.e > com.s + 3) dump_line(); @@ -283,10 +279,8 @@ copy_comment_wrap(int adj_max_line_lengt if (!ch_isblank(com.e[-1])) com_add_char(' '); - if (token.e[-1] == '*') { - com_add_char('*'); - com_add_char('/'); - } + com_add_char('*'); + com_add_char('/'); com_terminate(); return;