CVS commit: src/share/man/man9
Module Name:src Committed By: knakahara Date: Tue Jan 12 05:08:50 UTC 2021 Modified Files: src/share/man/man9: pci_msi.9 Log Message: Fix PR kern/55920 . Add pci_msi_count() and pci_msix_count() description. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/pci_msi.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/pci_msi.9 diff -u src/share/man/man9/pci_msi.9:1.17 src/share/man/man9/pci_msi.9:1.18 --- src/share/man/man9/pci_msi.9:1.17 Tue Nov 27 20:13:43 2018 +++ src/share/man/man9/pci_msi.9 Tue Jan 12 05:08:50 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: pci_msi.9,v 1.17 2018/11/27 20:13:43 jdolecek Exp $ +.\" $NetBSD: pci_msi.9,v 1.18 2021/01/12 05:08:50 knakahara Exp $ .\" .\" Copyright (c) 2015 Internet Initiative Japan Inc. .\" All rights reserved. @@ -24,7 +24,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 27, 2018 +.Dd January 12, 2021 .Dt PCI_MSI 9 .Os .Sh NAME @@ -96,6 +96,14 @@ which contains, among other things, info of the device in the PCI bus topology sufficient to allow interrupts from the device to be handled. .Pp +.Fn pci_msi_count +returns the max number of the device's MSI. +If the device can not use MSI, +.Fn pci_msi_count +returns zero. +.Fn pci_msix_count +works in the same manner for MSI-X. +.Pp If a driver wishes to establish an MSI handler for the device, it should pass the .Ft struct pci_attach_args *
CVS commit: src/sys
Module Name:src Committed By: skrll Date: Mon Jan 11 22:02:29 UTC 2021 Modified Files: src/sys/arch/xen/xen: xenevt.c src/sys/fs/udf: udf_subr.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/xen/xen/xenevt.c cvs rdiff -u -r1.151 -r1.152 src/sys/fs/udf/udf_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xenevt.c diff -u src/sys/arch/xen/xen/xenevt.c:1.62 src/sys/arch/xen/xen/xenevt.c:1.63 --- src/sys/arch/xen/xen/xenevt.c:1.62 Mon Jan 11 22:01:14 2021 +++ src/sys/arch/xen/xen/xenevt.c Mon Jan 11 22:02:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: xenevt.c,v 1.62 2021/01/11 22:01:14 skrll Exp $ */ +/* $NetBSD: xenevt.c,v 1.63 2021/01/11 22:02:28 skrll Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.62 2021/01/11 22:01:14 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.63 2021/01/11 22:02:28 skrll Exp $"); #include "opt_xen.h" #include @@ -158,7 +158,7 @@ static evtchn_port_t xenevt_alloc_event( op.u.alloc_unbound.dom = DOMID_SELF; op.u.alloc_unbound.remote_dom = DOMID_SELF; if (HYPERVISOR_event_channel_op() != 0) - panic("%s: Failed to allocate loopback event\n", __func__); + panic("%s: Failed to allocate loopback event\n", __func__); return op.u.alloc_unbound.port; } @@ -604,7 +604,7 @@ xenevt_fioctl(struct file *fp, u_long cm case IOCTL_EVTCHN_UNBIND: { struct ioctl_evtchn_unbind *unbind = addr; - + if (unbind->port >= NR_EVENT_CHANNELS) return EINVAL; mutex_enter(_lock); @@ -625,7 +625,7 @@ xenevt_fioctl(struct file *fp, u_long cm case IOCTL_EVTCHN_NOTIFY: { struct ioctl_evtchn_notify *notify = addr; - + if (notify->port >= NR_EVENT_CHANNELS) return EINVAL; mutex_enter(_lock); @@ -645,11 +645,11 @@ xenevt_fioctl(struct file *fp, u_long cm return 0; } -/* - * Support for poll() system call +/* + * Support for poll() system call * * Return true if the specific operation will not block indefinitely. - */ + */ static int xenevt_fpoll(struct file *fp, int events) Index: src/sys/fs/udf/udf_subr.c diff -u src/sys/fs/udf/udf_subr.c:1.151 src/sys/fs/udf/udf_subr.c:1.152 --- src/sys/fs/udf/udf_subr.c:1.151 Mon Jan 11 22:01:15 2021 +++ src/sys/fs/udf/udf_subr.c Mon Jan 11 22:02:28 2021 @@ -1,9 +1,9 @@ -/* $NetBSD: udf_subr.c,v 1.151 2021/01/11 22:01:15 skrll Exp $ */ +/* $NetBSD: udf_subr.c,v 1.152 2021/01/11 22:02:28 skrll Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,7 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. @@ -23,13 +23,13 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * */ #include #ifndef lint -__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.151 2021/01/11 22:01:15 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.152 2021/01/11 22:02:28 skrll Exp $"); #endif /* not lint */ @@ -809,7 +809,7 @@ udf_lock_node(struct udf_node *udf_node, if (ret == EWOULDBLOCK) { DPRINTF(LOCKING, ( "udf_lock_node: udf_node %p would block " "wanted at %s:%d, previously locked at %s:%d\n", -udf_node, fname, lineno, +udf_node, fname, lineno, udf_node->lock_fname, udf_node->lock_lineno)); } } @@ -982,7 +982,7 @@ udf_get_record_vpart(struct udf_mount *u } -/* +/* * BUGALERT: some rogue implementations use random physical partition * numbers to break other implementations so lookup the number. */ @@ -1590,7 +1590,7 @@ udf_read_physical_partition_spacetables( if (partd == NULL) continue; parthdr = >_impl_use.part_hdr; - + len = udf_rw32(parthdr->unalloc_space_table.len); if (len) { printf("UDF mount: space tables not supported\n"); @@ -1649,7 +1649,7 @@ udf_read_physical_partition_spacetables( if (partd == NULL) continue; parthdr = >_impl_use.part_hdr; - + len = udf_rw32(parthdr->freed_space_table.len); if (len) { printf("UDF mount: space tables not supported\n"); @@ -2014,7 +2014,7 @@ udf_process_vds(struct udf_mount *ump) {
CVS commit: src/sys
Module Name:src Committed By: skrll Date: Mon Jan 11 22:01:15 UTC 2021 Modified Files: src/sys/arch/sun68k/stand/libsa: Makefile.inc src/sys/arch/xen/xen: xenevt.c src/sys/fs/udf: udf_subr.c Log Message: Fix spelling of preferred in comments. While here improve grammar in one of the comments. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sun68k/stand/libsa/Makefile.inc cvs rdiff -u -r1.61 -r1.62 src/sys/arch/xen/xen/xenevt.c cvs rdiff -u -r1.150 -r1.151 src/sys/fs/udf/udf_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sun68k/stand/libsa/Makefile.inc diff -u src/sys/arch/sun68k/stand/libsa/Makefile.inc:1.6 src/sys/arch/sun68k/stand/libsa/Makefile.inc:1.7 --- src/sys/arch/sun68k/stand/libsa/Makefile.inc:1.6 Wed Apr 22 11:28:56 2020 +++ src/sys/arch/sun68k/stand/libsa/Makefile.inc Mon Jan 11 22:01:14 2021 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.6 2020/04/22 11:28:56 rin Exp $ +# $NetBSD: Makefile.inc,v 1.7 2021/01/11 22:01:14 skrll Exp $ S!= cd ${SA_EXTRADIR}/../../../..; pwd .PATH.c: ${SA_EXTRADIR} -# prefered local sources: gets.c panic.c +# preferred local sources: gets.c panic.c SRCS+= clock.c dev_disk.c devopen.c \ idprom.c netif_sun.c \ Index: src/sys/arch/xen/xen/xenevt.c diff -u src/sys/arch/xen/xen/xenevt.c:1.61 src/sys/arch/xen/xen/xenevt.c:1.62 --- src/sys/arch/xen/xen/xenevt.c:1.61 Mon Nov 30 17:06:02 2020 +++ src/sys/arch/xen/xen/xenevt.c Mon Jan 11 22:01:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: xenevt.c,v 1.61 2020/11/30 17:06:02 bouyer Exp $ */ +/* $NetBSD: xenevt.c,v 1.62 2021/01/11 22:01:14 skrll Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.61 2020/11/30 17:06:02 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.62 2021/01/11 22:01:14 skrll Exp $"); #include "opt_xen.h" #include @@ -129,7 +129,7 @@ struct xenevt_d { #define XENEVT_F_OVERFLOW 0x01 /* ring overflow */ #define XENEVT_F_FREE 0x02 /* free entry */ struct selinfo sel; /* used by poll */ - struct cpu_info *ci; /* prefered CPU for events for this device */ + struct cpu_info *ci; /* preferred CPU for events for this device */ }; static struct intrhand *xenevt_ih; Index: src/sys/fs/udf/udf_subr.c diff -u src/sys/fs/udf/udf_subr.c:1.150 src/sys/fs/udf/udf_subr.c:1.151 --- src/sys/fs/udf/udf_subr.c:1.150 Mon Apr 6 14:31:06 2020 +++ src/sys/fs/udf/udf_subr.c Mon Jan 11 22:01:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: udf_subr.c,v 1.150 2020/04/06 14:31:06 hannken Exp $ */ +/* $NetBSD: udf_subr.c,v 1.151 2021/01/11 22:01:15 skrll Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk @@ -29,7 +29,7 @@ #include #ifndef lint -__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.150 2020/04/06 14:31:06 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.151 2021/01/11 22:01:15 skrll Exp $"); #endif /* not lint */ @@ -928,7 +928,7 @@ udf_read_anchors(struct udf_mount *ump) positions[1] = track_end-256; positions[2] = track_end; positions[3] = track_start+512; /* [UDF 2.60/6.11.2] */ - /* XXX shouldn't +512 be prefered above +256 for compat with Roxio CD */ + /* XXX shouldn't +512 be preferred over +256 for compat with Roxio CD */ ok = 0; anchorsp = ump->anchors;
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: skrll Date: Mon Jan 11 21:58:31 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: cpu.c Log Message: Improve a comment To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/arch/aarch64/aarch64/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/cpu.c diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.57 src/sys/arch/aarch64/aarch64/cpu.c:1.58 --- src/sys/arch/aarch64/aarch64/cpu.c:1.57 Fri Dec 11 18:03:33 2020 +++ src/sys/arch/aarch64/aarch64/cpu.c Mon Jan 11 21:58:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.57 2020/12/11 18:03:33 skrll Exp $ */ +/* $NetBSD: cpu.c,v 1.58 2021/01/11 21:58:31 skrll Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.57 2020/12/11 18:03:33 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.58 2021/01/11 21:58:31 skrll Exp $"); #include "locators.h" #include "opt_arm_debug.h" @@ -86,8 +86,8 @@ static void cpu_setup_chacha(device_t, s #endif /* MULTIPROCESSOR */ /* - * Our exported CPU info; - * these will be refered from secondary cpus in the middle of hatching. + * Our exported cpu_info structs; these will be first used by the + * secondary cpus as part of cpu_mpstart and the hatching process. */ struct cpu_info cpu_info_store[NCPUINFO] = { [0] = {
CVS commit: src/sys/sys
Module Name:src Committed By: skrll Date: Mon Jan 11 21:51:20 UTC 2021 Modified Files: src/sys/sys: ras.h Log Message: Correct the spelling of preferred. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/sys/ras.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/sys/ras.h diff -u src/sys/sys/ras.h:1.14 src/sys/sys/ras.h:1.15 --- src/sys/sys/ras.h:1.14 Mon Aug 11 21:51:14 2008 +++ src/sys/sys/ras.h Mon Jan 11 21:51:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ras.h,v 1.14 2008/08/11 21:51:14 skrll Exp $ */ +/* $NetBSD: ras.h,v 1.15 2021/01/11 21:51:20 skrll Exp $ */ /*- * Copyright (c) 2002, 2004, 2007 The NetBSD Foundation, Inc. @@ -102,7 +102,7 @@ __END_DECLS /* * RAS_START_ASM and RAS_END_ASM are for use within assembly code. - * This is the prefered method of coding a RAS. + * This is the preferred method of coding a RAS. */ #define RAS_START_ASM(name) \ .globl _C_LABEL(__CONCAT(name,_ras_start)) _ASM_LS_CHAR \
CVS commit: src/external/bsd/ppp/usr.sbin/pppd
Module Name:src Committed By: christos Date: Mon Jan 11 21:45:22 UTC 2021 Modified Files: src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c Log Message: Make this compile without -DINET6 (Kurt Schreiner) To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c diff -u src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.8 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.9 --- src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.8 Sat Jan 9 11:39:29 2021 +++ src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c Mon Jan 11 16:45:22 2021 @@ -121,6 +121,8 @@ __RCSID("NetBSD: sys-bsd.c,v 1.68 2013/0 #endif #include +#ifdef INET6 + #define s6_addr32 __u6_addr.__u6_addr32 /* Non-standard */ #define IN6_SOCKADDR_FROM_EUI64(s, eui64) do { \ @@ -146,8 +148,10 @@ __RCSID("NetBSD: sys-bsd.c,v 1.68 2013/0 sin6.s6_addr16[0] = htons(0xfe80); \ eui64_copy(eui64, sin6.s6_addr32[2]); \ } while (/*CONSTCOND*/0) -#endif -#endif +#endif /* __KAME__ */ +#endif /* IN6_LLADDR_FROM_EUI64 */ + +#endif /* INET6 */ #if RTM_VERSION >= 3 #include @@ -201,8 +205,9 @@ static int if6_is_up; /* the interface #endif /* INET6 */ static u_int32_t ifaddrs[2]; /* local and remote addresses we set */ static u_int32_t default_route_gateway; /* gateway addr for default route */ -static eui64_t default_route_gateway6; /* Gateway for default IPv6 route added -*/ +#ifdef INET6 +static eui64_t default_route_gateway6; /* Gateway for default IPv6 route added */ +#endif /* INET6 */ static u_int32_t proxy_arp_addr; /* remote addr for proxy arp */ /* Prototypes for procedures local to this file. */ @@ -307,8 +312,10 @@ sys_cleanup(void) cifaddr(0, ifaddrs[0], ifaddrs[1]); if (default_route_gateway) cifdefaultroute(0, 0, default_route_gateway); +#ifdef INET6 if (default_route_gateway6.e32[0] != 0 || default_route_gateway6.e32[1] != 0) cif6defaultroute(0, default_route_gateway6, default_route_gateway6); +#endif if (proxy_arp_addr) cifproxyarp(0, proxy_arp_addr); doing_cleanup = 0; @@ -1659,6 +1666,7 @@ dodefaultroute(u_int32_t g, int cmd) } +#ifdef INET6 /* * dodefaultroute - assign/clear a default route through the address given. */ @@ -1725,6 +1733,8 @@ cif6defaultroute(int u, eui64_t l, eui64 return dodefaultroute6(u, l, g, 'c'); } +#endif + #if RTM_VERSION >= 3 /*
CVS commit: src/tests/lib/libc/stdlib
Module Name:src Committed By: christos Date: Mon Jan 11 20:31:34 UTC 2021 Modified Files: src/tests/lib/libc/stdlib: t_mktemp.c Log Message: Only try to create up-to NAME_MAX filenames. XXX: this should be moved to stdio/t_mktemp.c where the rest of the tests are and the code lives. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/stdlib/t_mktemp.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/stdlib/t_mktemp.c diff -u src/tests/lib/libc/stdlib/t_mktemp.c:1.3 src/tests/lib/libc/stdlib/t_mktemp.c:1.4 --- src/tests/lib/libc/stdlib/t_mktemp.c:1.3 Sun Nov 1 13:19:54 2020 +++ src/tests/lib/libc/stdlib/t_mktemp.c Mon Jan 11 15:31:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_mktemp.c,v 1.3 2020/11/01 18:19:54 gson Exp $ */ +/* $NetBSD: t_mktemp.c,v 1.4 2021/01/11 20:31:34 christos Exp $ */ /*- * Copyright (c) 2013, 2020 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_mktemp.c,v 1.3 2020/11/01 18:19:54 gson Exp $"); +__RCSID("$NetBSD: t_mktemp.c,v 1.4 2021/01/11 20:31:34 christos Exp $"); #include @@ -79,10 +79,17 @@ ATF_TC_HEAD(mktemp_large_template, tc) ATF_TC_BODY(mktemp_large_template, tc) { const char *path = "/tmp/mktemp.XX"; - char template[PATH_MAX] = { 0 }; + char *template; size_t i; + long name_max; + size_t tlen; - atf_tc_expect_fail("PR lib/55441"); + name_max = pathconf("/tmp/", _PC_NAME_MAX); + ATF_REQUIRE(name_max > 0); + + tlen = (size_t)name_max + sizeof("/tmp/"); + template = malloc(tlen); + ATF_REQUIRE(template != NULL); ATF_REQUIRE(strcpy(template, path) != NULL); ATF_REQUIRE(mktemp(template) != NULL); @@ -90,16 +97,17 @@ ATF_TC_BODY(mktemp_large_template, tc) ATF_REQUIRE(strcmp(template, path) != 0); ATF_REQUIRE(strncmp(template, "/tmp/mktemp.", 12) == 0); - (void)memset(template, '\0', sizeof(template)); + (void)memset(template, '\0', tlen); (void)strcpy(template, "/tmp/mktemp."); - for (i = 12; i < sizeof(template) - 1; i++) + for (i = 12; i < tlen - 1; i++) template[i] = 'X'; ATF_REQUIRE(mktemp(template) != NULL); - ATF_REQUIRE(strlen(template) == sizeof(template) - 1); + ATF_REQUIRE(strlen(template) == tlen - 1); ATF_REQUIRE(strcmp(template, path) != 0); ATF_REQUIRE(strncmp(template, "/tmp/mktemp.", 12) == 0); + free(template); } ATF_TC(mkstemp_basic);
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jan 11 20:04:01 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: split typeok into several functions To generate a diff of this commit: cvs rdiff -u -r1.149 -r1.150 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.149 src/usr.bin/xlint/lint1/tree.c:1.150 --- src/usr.bin/xlint/lint1/tree.c:1.149 Mon Jan 11 19:29:49 2021 +++ src/usr.bin/xlint/lint1/tree.c Mon Jan 11 20:04:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.149 2021/01/11 19:29:49 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.150 2021/01/11 20:04:01 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.149 2021/01/11 19:29:49 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.150 2021/01/11 20:04:01 rillig Exp $"); #endif #include @@ -1037,33 +1037,10 @@ typeok_assign(const mod_t *mp, const tno return true; } -/* - * Perform most type checks. First the types are checked using - * the information from modtab[]. After that it is done by hand for - * more complicated operators and type combinations. - * - * If the types are ok, typeok() returns 1, otherwise 0. - */ -bool -typeok(op_t op, int arg, const tnode_t *ln, const tnode_t *rn) +/* Check the types using the information from modtab[]. */ +static bool +typeok_scalar(op_t op, const mod_t *mp, tspec_t lt, tspec_t rt) { - mod_t *mp; - tspec_t lt, rt; - type_t *ltp, *rtp; - - mp = [op]; - - lint_assert((ltp = ln->tn_type) != NULL); - lt = ltp->t_tspec; - - if (mp->m_binary) { - lint_assert((rtp = rn->tn_type) != NULL); - rt = rtp->t_tspec; - } else { - rtp = NULL; - rt = NOTSPEC; - } - if (mp->m_requires_integer) { if (!is_integer(lt) || (mp->m_binary && !is_integer(rt))) { warn_incompatible_types(op, lt, rt); @@ -1087,7 +1064,15 @@ typeok(op_t op, int arg, const tnode_t * return false; } } + return true; +} +/* Check the types for specific operators and type combinations. */ +static bool +typeok_op(op_t op, const mod_t *mp, int arg, + const tnode_t *ln, const type_t *ltp, tspec_t lt, + const tnode_t *rn, const type_t *rtp, tspec_t rt) +{ switch (op) { case POINT: /* @@ -1239,18 +1224,54 @@ typeok(op_t op, int arg, const tnode_t * case IMAG: break; } + return true; +} +static void +typeok_enum(op_t op, const mod_t *mp, int arg, + const tnode_t *ln, const type_t *ltp, + const tnode_t *rn, const type_t *rtp) +{ if (mp->m_bad_on_enum && (ltp->t_isenum || (mp->m_binary && rtp->t_isenum))) { check_bad_enum_operation(op, ln, rn); } else if (mp->m_valid_on_enum && - (ltp->t_isenum && rtp && rtp->t_isenum)) { + (ltp->t_isenum && rtp && rtp->t_isenum)) { check_enum_type_mismatch(op, arg, ln, rn); } else if (mp->m_valid_on_enum && - (ltp->t_isenum || (rtp && rtp->t_isenum))) { + (ltp->t_isenum || (rtp && rtp->t_isenum))) { check_enum_int_mismatch(op, arg, ln, rn); } +} + +/* Perform most type checks. Return whether the types are ok. */ +bool +typeok(op_t op, int arg, const tnode_t *ln, const tnode_t *rn) +{ + mod_t *mp; + tspec_t lt, rt; + type_t *ltp, *rtp; + + mp = [op]; + + lint_assert((ltp = ln->tn_type) != NULL); + lt = ltp->t_tspec; + + if (mp->m_binary) { + lint_assert((rtp = rn->tn_type) != NULL); + rt = rtp->t_tspec; + } else { + rtp = NULL; + rt = NOTSPEC; + } + + if (!typeok_scalar(op, mp, lt, rt)) + return false; + + if (!typeok_op(op, mp, arg, ln, ltp, lt, rn, rtp, rt)) + return false; + typeok_enum(op, mp, arg, ln, ltp, rn, rtp); return true; }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jan 11 19:29:49 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: decl.c emit1.c externs1.h tree.c Log Message: lint: sprinkle a few const modifiers throughout the code To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.35 -r1.36 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.53 -r1.54 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.148 -r1.149 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.120 src/usr.bin/xlint/lint1/decl.c:1.121 --- src/usr.bin/xlint/lint1/decl.c:1.120 Sun Jan 10 18:22:52 2021 +++ src/usr.bin/xlint/lint1/decl.c Mon Jan 11 19:29:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.120 2021/01/10 18:22:52 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.121 2021/01/11 19:29:49 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.120 2021/01/10 18:22:52 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.121 2021/01/11 19:29:49 rillig Exp $"); #endif #include @@ -67,8 +67,8 @@ static void settdsym(type_t *, sym_t *); static tspec_t merge_type_specifiers(tspec_t, tspec_t); static void align(int, int); static sym_t *newtag(sym_t *, scl_t, int, int); -static int eqargs(type_t *, type_t *, int *); -static int mnoarg(type_t *, int *); +static int eqargs(const type_t *, const type_t *, int *); +static int mnoarg(const type_t *, int *); static int check_old_style_definition(sym_t *, sym_t *); static int check_prototype_declaration(sym_t *, sym_t *); static sym_t *new_style_function(sym_t *, sym_t *); @@ -172,7 +172,7 @@ tduptyp(const type_t *tp) * struct, union or enum type. */ int -incompl(type_t *tp) +incompl(const type_t *tp) { tspec_t t; @@ -882,7 +882,7 @@ merge_type_specifiers(tspec_t t, tspec_t * if name is not NULL. */ int -length(type_t *tp, const char *name) +length(const type_t *tp, const char *name) { int elem, elsz; @@ -926,7 +926,7 @@ length(type_t *tp, const char *name) * Get the alignment of the given Type in bits. */ int -getbound(type_t *tp) +getbound(const type_t *tp) { size_t a; tspec_t t; @@ -2108,7 +2108,8 @@ eqptrtype(const type_t *tp1, const type_ * compatible with a prototype */ int -eqtype(type_t *tp1, type_t *tp2, int ignqual, int promot, int *dowarn) +eqtype(const type_t *tp1, const type_t *tp2, + int ignqual, int promot, int *dowarn) { tspec_t t; @@ -2171,7 +2172,7 @@ eqtype(type_t *tp1, type_t *tp2, int ign * Compares the parameter types of two prototypes. */ static int -eqargs(type_t *tp1, type_t *tp2, int *dowarn) +eqargs(const type_t *tp1, const type_t *tp2, int *dowarn) { sym_t *a1, *a2; @@ -2205,7 +2206,7 @@ eqargs(type_t *tp1, type_t *tp2, int *do * is applied on it */ static int -mnoarg(type_t *tp, int *dowarn) +mnoarg(const type_t *tp, int *dowarn) { sym_t *arg; tspec_t t; @@ -3213,7 +3214,7 @@ check_global_variable_size(const sym_t * * Prints information about location of previous definition/declaration. */ void -print_previous_declaration(int msg, sym_t *psym) +print_previous_declaration(int msg, const sym_t *psym) { pos_t cpos; Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.35 src/usr.bin/xlint/lint1/emit1.c:1.36 --- src/usr.bin/xlint/lint1/emit1.c:1.35 Sun Jan 10 00:05:46 2021 +++ src/usr.bin/xlint/lint1/emit1.c Mon Jan 11 19:29:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.35 2021/01/10 00:05:46 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.36 2021/01/11 19:29:49 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: emit1.c,v 1.35 2021/01/10 00:05:46 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.36 2021/01/11 19:29:49 rillig Exp $"); #endif #include @@ -92,7 +92,7 @@ static void outfstrg(strg_t *); * and 'v' (for volatile) */ void -outtype(type_t *tp) +outtype(const type_t *tp) { int t, s, na; sym_t *arg; @@ -166,7 +166,7 @@ outtype(type_t *tp) * it uses its own output buffer for conversion */ const char * -ttos(type_t *tp) +ttos(const type_t *tp) { static ob_t tob; ob_t tmp; @@ -226,7 +226,7 @@ outtt(sym_t *tag, sym_t *tdef) * not here */ void -outsym(sym_t *sym, scl_t sc, def_t def) +outsym(const sym_t *sym, scl_t sc, def_t def) { /* @@ -301,10 +301,11 @@ outsym(sym_t *sym, scl_t sc, def_t def) * they are called with proper argument types */ void -outfdef(sym_t *fsym, pos_t *posp, int rval, int osdef, sym_t *args) +outfdef(const sym_t *fsym, const pos_t *posp, int rval, int osdef, + const sym_t *args) { - int narg;
CVS commit: src/sys/kern
Module Name:src Committed By: skrll Date: Mon Jan 11 17:18:51 UTC 2021 Modified Files: src/sys/kern: kern_sig.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.395 -r1.396 src/sys/kern/kern_sig.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/kern/kern_sig.c diff -u src/sys/kern/kern_sig.c:1.395 src/sys/kern/kern_sig.c:1.396 --- src/sys/kern/kern_sig.c:1.395 Sun Nov 1 18:51:02 2020 +++ src/sys/kern/kern_sig.c Mon Jan 11 17:18:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.395 2020/11/01 18:51:02 pgoyette Exp $ */ +/* $NetBSD: kern_sig.c,v 1.396 2021/01/11 17:18:51 skrll Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.395 2020/11/01 18:51:02 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.396 2021/01/11 17:18:51 skrll Exp $"); #include "opt_execfmt.h" #include "opt_ptrace.h" @@ -548,7 +548,7 @@ siggetinfo(sigpend_t *sp, ksiginfo_t *ou if (ksi->ksi_signo != signo) continue; if (count++ > 0) /* Only remove the first, count all of them */ - continue; + continue; TAILQ_REMOVE(>sp_info, ksi, ksi_list); KASSERT((ksi->ksi_flags & KSI_FROMPOOL) != 0); KASSERT((ksi->ksi_flags & KSI_QUEUED) != 0); @@ -578,7 +578,7 @@ out: * Fetch the first pending signal from a set. Optionally, also fetch * or manufacture a ksiginfo element. Returns the number of the first * pending signal, or zero. - */ + */ int sigget(sigpend_t *sp, ksiginfo_t *out, int signo, const sigset_t *mask) { @@ -646,7 +646,7 @@ sigput(sigpend_t *sp, struct proc *p, ks return 0; } } - + if (count >= SIGQUEUE_MAX) { #ifdef DIAGNOSTIC printf("%s(%d): Signal queue is full signal=%d\n", @@ -656,7 +656,7 @@ sigput(sigpend_t *sp, struct proc *p, ks } ksi->ksi_flags |= KSI_QUEUED; TAILQ_INSERT_TAIL(>sp_info, ksi, ksi_list); - + return 0; } @@ -715,7 +715,7 @@ sigclearall(struct proc *p, const sigset * * This should only ever be called with (l == curlwp), unless the * result does not matter (procfs, sysctl). - */ + */ int sigispending(struct lwp *l, int signo) { @@ -990,7 +990,7 @@ repeat: const bool ignored = action == SIG_IGN; if (masked || ignored) { mutex_enter(>sa_mutex); - sigdelset(mask, signo); + sigdelset(mask, signo); sigdelset(>p_sigctx.ps_sigcatch, signo); sigdelset(>p_sigctx.ps_sigignore, signo); sigdelset(_PS(ps, signo).sa_mask, signo); @@ -2004,7 +2004,7 @@ issignal(struct lwp *l) /* * If there is a pending stop signal to process with - * default action, stop here, then clear the signal. + * default action, stop here, then clear the signal. * However, if process is member of an orphaned * process group, ignore tty stop signals. */ @@ -2231,7 +2231,7 @@ killproc(struct proc *p, const char *why * if appropriate. We bypass the normal tests for masked and caught * signals, allowing unrecoverable failures to terminate the process without * changing signal state. Mark the accounting record with the signal - * termination. If dumping core, save the signal number for the debugger. + * termination. If dumping core, save the signal number for the debugger. * Calls exit and does not return. */ void @@ -2443,7 +2443,7 @@ proc_stop(struct proc *p, int signo) * interruptably into the LSSTOP state. * * Note that we are not concerned about keeping all LWPs stopped while the - * process is stopped: stopped LWPs can awaken briefly to handle signals. + * process is stopped: stopped LWPs can awaken briefly to handle signals. * What we do need to ensure is that all LWPs in a stopping process have * stopped at least once, so that notification can be sent to the parent * process.
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: skrll Date: Mon Jan 11 17:12:13 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: cpufunc.c Log Message: Small simplification To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/aarch64/aarch64/cpufunc.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/aarch64/aarch64/cpufunc.c diff -u src/sys/arch/aarch64/aarch64/cpufunc.c:1.26 src/sys/arch/aarch64/aarch64/cpufunc.c:1.27 --- src/sys/arch/aarch64/aarch64/cpufunc.c:1.26 Thu Oct 22 07:31:15 2020 +++ src/sys/arch/aarch64/aarch64/cpufunc.c Mon Jan 11 17:12:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.c,v 1.26 2020/10/22 07:31:15 skrll Exp $ */ +/* $NetBSD: cpufunc.c,v 1.27 2021/01/11 17:12:13 skrll Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -30,7 +30,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.26 2020/10/22 07:31:15 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.27 2021/01/11 17:12:13 skrll Exp $"); #include #include @@ -439,7 +439,6 @@ set_cpufuncs(void) struct cpu_info * const ci = curcpu(); const uint64_t ctr = reg_ctr_el0_read(); const uint64_t clidr = reg_clidr_el1_read(); - const uint32_t midr __unused = reg_midr_el1_read(); /* install default functions */ ci->ci_cpufuncs.cf_set_ttbr0 = aarch64_set_ttbr0; @@ -463,6 +462,8 @@ set_cpufuncs(void) } #ifdef CPU_THUNDERX + const uint32_t midr = reg_midr_el1_read(); + /* Cavium erratum 27456 */ if ((midr == CPU_ID_THUNDERXP1d0) || (midr == CPU_ID_THUNDERXP1d1) ||
CVS commit: src/sys/external/bsd/dwc2/dist
Module Name:src Committed By: skrll Date: Mon Jan 11 17:00:19 UTC 2021 Modified Files: src/sys/external/bsd/dwc2/dist: dwc2_hcd.c Log Message: Tidy up more error handling confusion To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/dwc2/dist/dwc2_hcd.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/external/bsd/dwc2/dist/dwc2_hcd.c diff -u src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.24 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.25 --- src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.24 Sun Apr 5 20:59:38 2020 +++ src/sys/external/bsd/dwc2/dist/dwc2_hcd.c Mon Jan 11 17:00:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc2_hcd.c,v 1.24 2020/04/05 20:59:38 skrll Exp $ */ +/* $NetBSD: dwc2_hcd.c,v 1.25 2021/01/11 17:00:18 skrll Exp $ */ /* * hcd.c - DesignWare HS OTG Controller host-mode routines @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.24 2020/04/05 20:59:38 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.25 2021/01/11 17:00:18 skrll Exp $"); #include #include @@ -2391,10 +2391,10 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso */ hsotg->status_buf = NULL; if (hsotg->core_params->dma_enable > 0) { - retval = usb_allocmem(>hsotg_sc->sc_bus, + int error = usb_allocmem(>hsotg_sc->sc_bus, DWC2_HCD_STATUS_BUF_SIZE, 0, USBMALLOC_COHERENT, >status_buf_usbdma); - if (!retval) { + if (!error) { hsotg->status_buf = KERNADDR(>status_buf_usbdma, 0); hsotg->status_buf_dma = DMAADDR(>status_buf_usbdma, 0); } @@ -2402,6 +2402,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso hsotg->status_buf = kmem_zalloc(DWC2_HCD_STATUS_BUF_SIZE, KM_SLEEP); + /* retval is already -ENOMEM */ if (!hsotg->status_buf) goto error3;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Mon Jan 11 16:48:35 UTC 2021 Modified Files: src/sys/dev/ic: ahcisata_core.c siisata.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/dev/ic/ahcisata_core.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ic/siisata.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/ic/ahcisata_core.c diff -u src/sys/dev/ic/ahcisata_core.c:1.94 src/sys/dev/ic/ahcisata_core.c:1.95 --- src/sys/dev/ic/ahcisata_core.c:1.94 Tue Dec 29 08:00:48 2020 +++ src/sys/dev/ic/ahcisata_core.c Mon Jan 11 16:48:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_core.c,v 1.94 2020/12/29 08:00:48 skrll Exp $ */ +/* $NetBSD: ahcisata_core.c,v 1.95 2021/01/11 16:48:35 skrll Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.94 2020/12/29 08:00:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.95 2021/01/11 16:48:35 skrll Exp $"); #include #include @@ -729,7 +729,7 @@ ahci_intr_port_common(struct ata_channel * commands active before we start processing. */ - for (slot=0; slot < sc->sc_ncmds; slot++) { + for (slot = 0; slot < sc->sc_ncmds; slot++) { if ((aslots & __BIT(slot)) != 0 && (sact & __BIT(slot)) == 0) { xfer = ata_queue_hwslot_to_xfer(chp, slot); Index: src/sys/dev/ic/siisata.c diff -u src/sys/dev/ic/siisata.c:1.45 src/sys/dev/ic/siisata.c:1.46 --- src/sys/dev/ic/siisata.c:1.45 Mon Jan 11 16:48:03 2021 +++ src/sys/dev/ic/siisata.c Mon Jan 11 16:48:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: siisata.c,v 1.45 2021/01/11 16:48:03 skrll Exp $ */ +/* $NetBSD: siisata.c,v 1.46 2021/01/11 16:48:35 skrll Exp $ */ /* from ahcisata_core.c */ @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.45 2021/01/11 16:48:03 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.46 2021/01/11 16:48:35 skrll Exp $"); #include #include @@ -604,7 +604,7 @@ process: */ uint32_t aslots = ata_queue_active(chp); - for (int slot=0; slot < SIISATA_MAX_SLOTS; slot++) { + for (int slot = 0; slot < SIISATA_MAX_SLOTS; slot++) { if ((aslots & __BIT(slot)) != 0 && (pss & PR_PXSS(slot)) == 0) { xfer = ata_queue_hwslot_to_xfer(chp, slot);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Mon Jan 11 16:48:03 UTC 2021 Modified Files: src/sys/dev/ic: siisata.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/siisata.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/ic/siisata.c diff -u src/sys/dev/ic/siisata.c:1.44 src/sys/dev/ic/siisata.c:1.45 --- src/sys/dev/ic/siisata.c:1.44 Fri Dec 25 12:33:03 2020 +++ src/sys/dev/ic/siisata.c Mon Jan 11 16:48:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: siisata.c,v 1.44 2020/12/25 12:33:03 skrll Exp $ */ +/* $NetBSD: siisata.c,v 1.45 2021/01/11 16:48:03 skrll Exp $ */ /* from ahcisata_core.c */ @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.44 2020/12/25 12:33:03 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.45 2021/01/11 16:48:03 skrll Exp $"); #include #include @@ -561,7 +561,7 @@ siisata_intr_port(struct siisata_channel * We don't expect the recovery to trigger error, * but handle this just in case. */ - if (!ISSET(chp->ch_flags, ATACH_RECOVERING)) + if (!ISSET(chp->ch_flags, ATACH_RECOVERING)) recover = true; else { aprint_error_dev(sc->sc_atac.atac_dev, @@ -841,7 +841,7 @@ siisata_probe_drive(struct ata_channel * } if (timed_out) { aprint_error_dev(sc->sc_atac.atac_dev, - "timed out waiting for PORT_READY on port %d, " + "timed out waiting for PORT_READY on port %d, " "reinitializing\n", chp->ch_channel); if (siisata_reinit_port(chp, -1)) siisata_reset_channel(chp, AT_WAIT);