CVS commit: src/sys/arch/alpha/include
Module Name:src Committed By: thorpej Date: Tue Jul 20 05:43:10 UTC 2021 Modified Files: src/sys/arch/alpha/include: alpha.h Log Message: Define the f_float in-memory format. Line of the fields in s_float and t_float. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/arch/alpha/include/alpha.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/include/alpha.h diff -u src/sys/arch/alpha/include/alpha.h:1.45 src/sys/arch/alpha/include/alpha.h:1.46 --- src/sys/arch/alpha/include/alpha.h:1.45 Wed May 5 15:36:17 2021 +++ src/sys/arch/alpha/include/alpha.h Tue Jul 20 05:43:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: alpha.h,v 1.45 2021/05/05 15:36:17 thorpej Exp $ */ +/* $NetBSD: alpha.h,v 1.46 2021/07/20 05:43:10 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -41,18 +41,26 @@ #ifndef _ALPHA_H_ #define _ALPHA_H_ +typedef union alpha_f_float { + uint32_t i; + uint32_t frac_hi: 7, + exp: 8, + sign: 1, + frac_lo: 16; +} f_float; + typedef union alpha_s_float { uint32_t i; uint32_t frac: 23, - exp: 8, - sign: 1; + exp: 8, + sign: 1; } s_float; typedef union alpha_t_float { uint64_t i; uint64_t frac: 52, - exp: 11, - sign: 1; + exp: 11, + sign: 1; } t_float; #ifdef _KERNEL @@ -73,6 +81,7 @@ extern u_long cpu_implver; /* from IMPL extern u_long cpu_amask; /* from AMASK instruction */ extern int bootdev_debug; extern int alpha_fp_sync_complete; +extern int alpha_fp_complete_debug; extern int alpha_unaligned_print, alpha_unaligned_fix, alpha_unaligned_sigbus; extern void (*alpha_delay_fn)(unsigned long);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Jul 20 02:42:10 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: db_instruction.h Log Message: Define the FIX float function codes (ITOFF, ITOFS, ITOFT). To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/alpha/db_instruction.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/db_instruction.h diff -u src/sys/arch/alpha/alpha/db_instruction.h:1.12 src/sys/arch/alpha/alpha/db_instruction.h:1.13 --- src/sys/arch/alpha/alpha/db_instruction.h:1.12 Mon Jun 21 02:10:46 2021 +++ src/sys/arch/alpha/alpha/db_instruction.h Tue Jul 20 02:42:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_instruction.h,v 1.12 2021/06/21 02:10:46 thorpej Exp $ */ +/* $NetBSD: db_instruction.h,v 1.13 2021/07/20 02:42:10 thorpej Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -445,6 +445,11 @@ typedef union { #define op_cvtql_v 0x130 #define op_cvtql_sv 0x530 + /* FIX FLOAT, "function" opcodes (bits 5..11) */ + +#define op_itofs 0x004 +#define op_itoff 0x014 +#define op_itoft 0x024 /* ieee FLOAT, "function" opcodes (bits 5..11) */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Jul 20 01:56:06 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: trap.c Log Message: Emulate the CIX extension instructions (CTPOP, CTTZ, CTLZ). To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.137 src/sys/arch/alpha/alpha/trap.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/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.136 src/sys/arch/alpha/alpha/trap.c:1.137 --- src/sys/arch/alpha/alpha/trap.c:1.136 Mon Jul 19 22:21:36 2021 +++ src/sys/arch/alpha/alpha/trap.c Tue Jul 20 01:56:06 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: trap.c,v 1.136 2021/07/19 22:21:36 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.137 2021/07/20 01:56:06 thorpej Exp $ */ /*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. + * Copyright (c) 2000, 2001, 2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -95,7 +95,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.136 2021/07/19 22:21:36 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.137 2021/07/20 01:56:06 thorpej Exp $"); #include #include @@ -106,6 +106,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1 #include #include #include +#include #include @@ -980,6 +981,17 @@ EVCNT_ATTACH_STATIC(emul_bwx_stw); EVCNT_ATTACH_STATIC(emul_bwx_sextb); EVCNT_ATTACH_STATIC(emul_bwx_sextw); +static struct evcnt emul_cix_ctpop = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul cix", "ctpop"); +static struct evcnt emul_cix_ctlz = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul cix", "ctlz"); +static struct evcnt emul_cix_cttz = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul cix", "cttz"); + +EVCNT_ATTACH_STATIC(emul_cix_ctpop); +EVCNT_ATTACH_STATIC(emul_cix_ctlz); +EVCNT_ATTACH_STATIC(emul_cix_cttz); + #define EMUL_COUNT(ev) atomic_inc_64(&(ev).ev_count) /* @@ -1129,6 +1141,60 @@ handle_opdec(struct lwp *l, u_long *ucod *regptr = w; break; } + if (inst.operate_reg_format.function == op_ctpop && + inst.operate_reg_format.zero == 0 && + inst.operate_reg_format.sbz == 0 && + inst.operate_reg_format.ra == 31) { + unsigned long val; + unsigned int res; + + EMUL_COUNT(emul_cix_ctpop); + regptr = irp(l, inst.operate_reg_format.rb); + val = (regptr != NULL) ? *regptr : 0; + res = popcount64(val); + regptr = irp(l, inst.operate_reg_format.rc); + if (regptr != NULL) { +*regptr = res; + } + break; + } + if (inst.operate_reg_format.function == op_ctlz && + inst.operate_reg_format.zero == 0 && + inst.operate_reg_format.sbz == 0 && + inst.operate_reg_format.ra == 31) { + unsigned long val; + unsigned int res; + + EMUL_COUNT(emul_cix_ctlz); + regptr = irp(l, inst.operate_reg_format.rb); + val = (regptr != NULL) ? *regptr : 0; + res = fls64(val); + res = (res == 0) ? 64 : 64 - res; + regptr = irp(l, inst.operate_reg_format.rc); + if (regptr != NULL) { +*regptr = res; + } + break; + } + if (inst.operate_reg_format.function == op_cttz && + inst.operate_reg_format.zero == 0 && + inst.operate_reg_format.sbz == 0 && + inst.operate_reg_format.ra == 31) { + unsigned long val; + unsigned int res; + + EMUL_COUNT(emul_cix_cttz); + regptr = irp(l, inst.operate_reg_format.rb); + val = (regptr != NULL) ? *regptr : 0; + res = ffs64(val); + res = (res == 0) ? 64 : res - 1; + regptr = irp(l, inst.operate_reg_format.rc); + if (regptr != NULL) { +*regptr = res; + } + break; + } + goto sigill; default:
CVS commit: src/sys/ufs/chfs
Module Name:src Committed By: andvar Date: Mon Jul 19 22:24:55 UTC 2021 Modified Files: src/sys/ufs/chfs: chfs_gc.c Log Message: NFC - if/else blocks start with the same mutex_exit, just move it up. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/chfs/chfs_gc.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/ufs/chfs/chfs_gc.c diff -u src/sys/ufs/chfs/chfs_gc.c:1.10 src/sys/ufs/chfs/chfs_gc.c:1.11 --- src/sys/ufs/chfs/chfs_gc.c:1.10 Fri Jul 16 21:18:41 2021 +++ src/sys/ufs/chfs/chfs_gc.c Mon Jul 19 22:24:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: chfs_gc.c,v 1.10 2021/07/16 21:18:41 andvar Exp $ */ +/* $NetBSD: chfs_gc.c,v 1.11 2021/07/19 22:24:55 andvar Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -232,15 +232,13 @@ chfs_gc_fetch_inode(struct chfs_mount *c mutex_exit(>chm_lock_vnocache); return NULL; } + mutex_exit(>chm_lock_vnocache); if (vc->state != VNO_STATE_CHECKEDABSENT) { -mutex_exit(>chm_lock_vnocache); /* XXX why do we need the delay here?! */ KASSERT(mutex_owned(>chm_lock_mountfields)); cv_timedwait_sig( >chm_gc_thread.gcth_wakeup, >chm_lock_mountfields, mstohz(50)); - } else { -mutex_exit(>chm_lock_vnocache); } return NULL; }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Mon Jul 19 22:21:36 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: trap.c Log Message: - In unaligned_fixup(), use defined constants for opcodes, not magic numbers. - In handle_opdec(), use ufetch_int() to fetch the instruction and _u{fetch,store}_{8,16}() when emulating BWX instructions rather than copyin() / copyout() (they're faster). - Add event counters for BWX instruction emulation. To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.136 src/sys/arch/alpha/alpha/trap.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/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.135 src/sys/arch/alpha/alpha/trap.c:1.136 --- src/sys/arch/alpha/alpha/trap.c:1.135 Thu Nov 21 19:23:58 2019 +++ src/sys/arch/alpha/alpha/trap.c Mon Jul 19 22:21:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.135 2019/11/21 19:23:58 ad Exp $ */ +/* $NetBSD: trap.c,v 1.136 2021/07/19 22:21:36 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -87,13 +87,15 @@ * rights to redistribute these changes. */ +#define __UFETCHSTORE_PRIVATE /* see handle_opdec() */ + #include "opt_fix_unaligned_vax_fp.h" #include "opt_ddb.h" #include "opt_multiprocessor.h" #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.135 2019/11/21 19:23:58 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.136 2021/07/19 22:21:36 thorpej Exp $"); #include #include @@ -875,65 +877,65 @@ unaligned_fixup(u_long va, u_long opcode signo = SIGSEGV; if (dofix && selected_tab->fixable) { switch (opcode) { - case 0x0c: /* ldwu */ + case op_ldwu: /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ unaligned_load_integer(worddata); break; - case 0x0d: /* stw */ + case op_stw: /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ unaligned_store_integer(worddata); break; #ifdef FIX_UNALIGNED_VAX_FP - case 0x20: /* ldf */ + case op_ldf: unaligned_load_floating(intdata, Ffloat_to_reg); break; - case 0x21: /* ldg */ + case op_ldg: unaligned_load_floating(longdata, Gfloat_reg_cvt); break; #endif - case 0x22: /* lds */ + case op_lds: unaligned_load_floating(intdata, Sfloat_to_reg); break; - case 0x23: /* ldt */ + case op_ldt: unaligned_load_floating(longdata, Tfloat_reg_cvt); break; #ifdef FIX_UNALIGNED_VAX_FP - case 0x24: /* stf */ + case op_stf: unaligned_store_floating(intdata, reg_to_Ffloat); break; - case 0x25: /* stg */ + case op_stg: unaligned_store_floating(longdata, Gfloat_reg_cvt); break; #endif - case 0x26: /* sts */ + case op_sts: unaligned_store_floating(intdata, reg_to_Sfloat); break; - case 0x27: /* stt */ + case op_stt: unaligned_store_floating(longdata, Tfloat_reg_cvt); break; - case 0x28: /* ldl */ + case op_ldl: unaligned_load_integer(intdata); break; - case 0x29: /* ldq */ + case op_ldq: unaligned_load_integer(longdata); break; - case 0x2c: /* stl */ + case op_stl: unaligned_store_integer(intdata); break; - case 0x2d: /* stq */ + case op_stq: unaligned_store_integer(longdata); break; @@ -958,6 +960,28 @@ unaligned_fixup(u_long va, u_long opcode return (signo); } +static struct evcnt emul_bwx_ldbu = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "ldbu"); +static struct evcnt emul_bwx_ldwu = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "ldwu"); +static struct evcnt emul_bwx_stb = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "stb"); +static struct evcnt emul_bwx_stw = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "stw"); +static struct evcnt emul_bwx_sextb = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "sextb"); +static struct evcnt emul_bwx_sextw = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "sextw"); + +EVCNT_ATTACH_STATIC(emul_bwx_ldbu); +EVCNT_ATTACH_STATIC(emul_bwx_ldwu); +EVCNT_ATTACH_STATIC(emul_bwx_stb); +EVCNT_ATTACH_STATIC(emul_bwx_stw); +EVCNT_ATTACH_STATIC(emul_bwx_sextb); +EVCNT_ATTACH_STATIC(emul_bwx_sextw); + +#define EMUL_COUNT(ev) atomic_inc_64(&(ev).ev_count) + /* * Reserved/unimplemented instruction (opDec fault) handler * @@ -986,7 +1010,7 @@ handle_opdec(struct lwp *l, u_long *ucod l->l_md.md_tf->tf_regs[FRAME_SP] = alpha_pal_rdusp(); inst_pc = memaddr = l->l_md.md_tf->tf_regs[FRAME_PC] - 4; - if (copyin((void *)inst_pc, , sizeof (inst)) != 0) { + if (ufetch_int((void *)inst_pc, ) != 0) { /* * really, this should never happen, but in case it * does we handle it. @@ -1012,6 +1036,11 @@ handle_opdec(struct lwp *l, u_long *ucod if (inst.mem_format.opcode == op_ldwu || inst.mem_format.opcode == op_stw) { if (memaddr & 0x01) { +if (inst.mem_format.opcode ==
CVS commit: src/sys
Module Name:src Committed By: jmcneill Date: Mon Jul 19 21:16:33 UTC 2021 Modified Files: src/sys/dev/pci: if_ena.c if_enavar.h src/sys/external/bsd/ena-com: ena_plat.h Log Message: Various ena(4) bug fixes, from KUSABA Takeshi : [PATCH 01/32] include device_xname for evcnt group. [PATCH 02/32] fix improper NULL check. [PATCH 03/32] add tx drop counter [PATCH 04/32] remove unimplemented m_getjcl [PATCH 05/32] make ENA_MEM_{ALLOC,FREE}_COHERENT symmetric. [PATCH 06/32] disestablish the correct interrupt. [PATCH 07/32] fix null check target. [PATCH 08/32] use if_initialize() and if_register() instead of [PATCH 09/32] free all pci-related resource. [PATCH 10/32] no need to call if_free(), but to call if_detach [PATCH 11/32] add some locking assertions. [PATCH 12/32] use bus_size_t for bus_dma instead of uint32_t. [PATCH 13/32] no need to pass interlock, ena_timer_service does not [PATCH 14/32] enable ena(4) to down I/F [PATCH 15/32] destroy I/O queues before disestablishing msix [PATCH 16/32] count input/output packet stats. [PATCH 17/32] fix missing #ifdef LRO, NetBSD does not support LRO [PATCH 18/32] MP-ify TX, allocate mbuf queue to each TX ring. [PATCH 19/32] down the interface first when to detach, to prevent [PATCH 20/32] default link speed should be unknown. [PATCH 21/32] protect ena_adapter members only by "global_mtx". [PATCH 22/32] lower global_mtx interrupt level [PATCH 23/32] reorder function declaration [PATCH 24/32] add locking notes and some marking. [PATCH 25/32] process RX in workqueue context, as same as FreeBSD [PATCH 26/32] count rx_drops correctly. [PATCH 27/32] no need to lock when attach/detach, down/up [PATCH 28/32] fix memory leak. [PATCH 29/32] add "stopping" flag to ena_ring. [PATCH 30/32] make the flags atomic. [PATCH 31/32] do not schedule timer when device is down. [PATCH 32/32] no need to start timer if I/F is down. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/if_ena.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_enavar.h cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/ena-com/ena_plat.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/pci/if_ena.c diff -u src/sys/dev/pci/if_ena.c:1.28 src/sys/dev/pci/if_ena.c:1.29 --- src/sys/dev/pci/if_ena.c:1.28 Thu Jul 1 17:22:10 2021 +++ src/sys/dev/pci/if_ena.c Mon Jul 19 21:16:33 2021 @@ -36,7 +36,7 @@ #if 0 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.28 2021/07/01 17:22:10 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.29 2021/07/19 21:16:33 jmcneill Exp $"); #include #include @@ -72,112 +72,154 @@ __KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1 /* * Function prototypes */ +/* cfattach interface functions */ static int ena_probe(device_t, cfdata_t, void *); -static int ena_intr_msix_mgmnt(void *); +static void ena_attach(device_t, device_t, void *); +static int ena_detach(device_t, int); + +/* ifnet interface functions */ +static int ena_init(struct ifnet *); +static void ena_stop(struct ifnet *, int); +static int ena_ioctl(struct ifnet *, u_long, void *); +static int ena_media_change(struct ifnet *); +static void ena_media_status(struct ifnet *, struct ifmediareq *); +static int ena_mq_start(struct ifnet *, struct mbuf *); + +/* attach or detach */ +static int ena_calc_io_queue_num(struct pci_attach_args *, + struct ena_adapter *, + struct ena_com_dev_get_features_ctx *); +static int ena_calc_queue_size(struct ena_adapter *, uint16_t *, + uint16_t *, struct ena_com_dev_get_features_ctx *); + static int ena_allocate_pci_resources(struct pci_attach_args *, struct ena_adapter *); static void ena_free_pci_resources(struct ena_adapter *); -static int ena_change_mtu(struct ifnet *, int); +static void ena_free_irqs(struct ena_adapter*); + static void ena_init_io_rings_common(struct ena_adapter *, -struct ena_ring *, uint16_t); +struct ena_ring *, uint16_t); static void ena_init_io_rings(struct ena_adapter *); static void ena_free_io_ring_resources(struct ena_adapter *, unsigned int); static void ena_free_all_io_rings_resources(struct ena_adapter *); -#if 0 -static int ena_setup_tx_dma_tag(struct ena_adapter *); -static int ena_free_tx_dma_tag(struct ena_adapter *); -static int ena_setup_rx_dma_tag(struct ena_adapter *); -static int ena_free_rx_dma_tag(struct ena_adapter *); -#endif -static int ena_setup_tx_resources(struct ena_adapter *, int); -static void ena_free_tx_resources(struct ena_adapter *, int); -static int ena_setup_all_tx_resources(struct ena_adapter *); -static void ena_free_all_tx_resources(struct ena_adapter *); -static inline int validate_rx_req_id(struct ena_ring *,
CVS commit: src/sys/ufs/chfs
Module Name:src Committed By: andvar Date: Mon Jul 19 21:04:39 UTC 2021 Modified Files: src/sys/ufs/chfs: chfs_build.c chfs_write.c Log Message: Release mutexes in few more places on failure path. Reviewed them in chfs code after fixing PR kern/56242. ok riastradh To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/chfs/chfs_build.c \ src/sys/ufs/chfs/chfs_write.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/ufs/chfs/chfs_build.c diff -u src/sys/ufs/chfs/chfs_build.c:1.5 src/sys/ufs/chfs/chfs_build.c:1.6 --- src/sys/ufs/chfs/chfs_build.c:1.5 Fri Oct 19 12:44:39 2012 +++ src/sys/ufs/chfs/chfs_build.c Mon Jul 19 21:04:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: chfs_build.c,v 1.5 2012/10/19 12:44:39 ttoth Exp $ */ +/* $NetBSD: chfs_build.c,v 1.6 2021/07/19 21:04:39 andvar Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -252,8 +252,10 @@ chfs_build_filesystem(struct chfs_mount if (chmp->chm_nextblock) { err = chfs_close_eraseblock(chmp, chmp->chm_nextblock); - if (err) + if (err) { + mutex_exit(>chm_lock_mountfields); return err; + } } chmp->chm_nextblock = >chm_blocks[i]; } else { @@ -261,8 +263,10 @@ chfs_build_filesystem(struct chfs_mount * dirty and put it on a list */ err = chfs_close_eraseblock(chmp, >chm_blocks[i]); -if (err) +if (err) { + mutex_exit(>chm_lock_mountfields); return err; +} } break; case CHFS_BLK_STATE_ALLDIRTY: Index: src/sys/ufs/chfs/chfs_write.c diff -u src/sys/ufs/chfs/chfs_write.c:1.5 src/sys/ufs/chfs/chfs_write.c:1.6 --- src/sys/ufs/chfs/chfs_write.c:1.5 Fri Oct 19 12:44:39 2012 +++ src/sys/ufs/chfs/chfs_write.c Mon Jul 19 21:04:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: chfs_write.c,v 1.5 2012/10/19 12:44:39 ttoth Exp $ */ +/* $NetBSD: chfs_write.c,v 1.6 2021/07/19 21:04:39 andvar Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -438,8 +438,10 @@ chfs_do_link(struct chfs_inode *ip, stru /* update vnode information */ error = chfs_write_flash_vnode(chmp, ip, ALLOC_NORMAL); - if (error) + if (error) { + mutex_exit(>chm_lock_mountfields); return error; + } /* write out the new dirent */ error = chfs_write_flash_dirent(chmp,
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Mon Jul 19 19:13:33 UTC 2021 Modified Files: src/sys/sys: param.h Log Message: Mention caution changing the defaults. To generate a diff of this commit: cvs rdiff -u -r1.697 -r1.698 src/sys/sys/param.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/param.h diff -u src/sys/sys/param.h:1.697 src/sys/sys/param.h:1.698 --- src/sys/sys/param.h:1.697 Tue Jun 29 17:03:37 2021 +++ src/sys/sys/param.h Mon Jul 19 15:13:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.697 2021/06/29 21:03:37 pgoyette Exp $ */ +/* $NetBSD: param.h,v 1.698 2021/07/19 19:13:33 christos Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -200,13 +200,19 @@ #define dbtob(x) ((x) << DEV_BSHIFT) #define btodb(x) ((x) >> DEV_BSHIFT) -/* Coherency unit: assumed cache line size. See also MIN_LWP_ALIGNMENT. */ +/* + * Coherency unit: assumed cache line size. See also MIN_LWP_ALIGNMENT. + * The MD code depends on the current values of these constants. Don't + * change them without coordinating. + */ #ifndef COHERENCY_UNIT #define COHERENCY_UNIT 64 #endif #ifndef CACHE_LINE_SIZE #define CACHE_LINE_SIZE 64 #endif + + #ifndef MAXCPUS #define MAXCPUS 32 #endif
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Mon Jul 19 16:31:19 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Re-arrange the kernel pmap fast-path in pmap_extract() so that when DEBUG is not enabled, the compiler can emit a tail-call to vtophys_internal(). To generate a diff of this commit: cvs rdiff -u -r1.298 -r1.299 src/sys/arch/alpha/alpha/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.298 src/sys/arch/alpha/alpha/pmap.c:1.299 --- src/sys/arch/alpha/alpha/pmap.c:1.298 Fri Jul 16 19:02:22 2021 +++ src/sys/arch/alpha/alpha/pmap.c Mon Jul 19 16:31:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.298 2021/07/16 19:02:22 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.298 2021/07/16 19:02:22 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $"); #include #include @@ -2578,18 +2578,18 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa * handles K0SEG. */ if (__predict_true(pmap == pmap_kernel())) { - if (__predict_true(vtophys_internal(va, pap))) { #ifdef DEBUG - if (pmapdebug & PDB_FOLLOW) + bool address_is_valid = vtophys_internal(va, pap); + if (pmapdebug & PDB_FOLLOW) { + if (address_is_valid) { printf("0x%lx (kernel vtophys)\n", *pap); -#endif - return true; + } else { +printf("failed (kernel vtophys)\n"); + } } -#ifdef DEBUG - if (pmapdebug & PDB_FOLLOW) - printf("failed (kernel vtophys)\n"); +#else + return vtophys_internal(va, pap); #endif - return false; } pt_entry_t * const lev1map = pmap_lev1map(pmap);
CVS commit: src/sys/arch/alpha/common
Module Name:src Committed By: thorpej Date: Mon Jul 19 16:25:54 UTC 2021 Modified Files: src/sys/arch/alpha/common: bus_dma.c sgmap_typedep.c Log Message: There is already a fast-path in pmap_extract() for the kernel pmap, so don't bother doing a conditional for kernel vs. user-space here. KASSERT() that pmap_extract() succeeds; it is a programming error if it does not, and it's not a great idea to insert a garbage address into the SGMAP page table. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/arch/alpha/common/bus_dma.c cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/common/sgmap_typedep.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/alpha/common/bus_dma.c diff -u src/sys/arch/alpha/common/bus_dma.c:1.72 src/sys/arch/alpha/common/bus_dma.c:1.73 --- src/sys/arch/alpha/common/bus_dma.c:1.72 Fri May 7 16:58:33 2021 +++ src/sys/arch/alpha/common/bus_dma.c Mon Jul 19 16:25:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.72 2021/05/07 16:58:33 thorpej Exp $ */ +/* $NetBSD: bus_dma.c,v 1.73 2021/07/19 16:25:54 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.72 2021/05/07 16:58:33 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.73 2021/07/19 16:25:54 thorpej Exp $"); #include #include @@ -138,6 +138,7 @@ _bus_dmamap_load_buffer_direct(bus_dma_t bus_addr_t curaddr, lastaddr, baddr, bmask; vaddr_t vaddr = (vaddr_t)buf; int seg; + bool address_is_valid __diagused; lastaddr = *lastaddrp; bmask = ~(map->_dm_boundary - 1); @@ -146,10 +147,9 @@ _bus_dmamap_load_buffer_direct(bus_dma_t /* * Get the physical address for this segment. */ - if (!VMSPACE_IS_KERNEL_P(vm)) - (void) pmap_extract(vm->vm_map.pmap, vaddr, ); - else - curaddr = vtophys(vaddr); + address_is_valid = + pmap_extract(vm->vm_map.pmap, vaddr, ); + KASSERT(address_is_valid); /* * If we're beyond the current DMA window, indicate Index: src/sys/arch/alpha/common/sgmap_typedep.c diff -u src/sys/arch/alpha/common/sgmap_typedep.c:1.43 src/sys/arch/alpha/common/sgmap_typedep.c:1.44 --- src/sys/arch/alpha/common/sgmap_typedep.c:1.43 Sun Jul 18 05:12:27 2021 +++ src/sys/arch/alpha/common/sgmap_typedep.c Mon Jul 19 16:25:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sgmap_typedep.c,v 1.43 2021/07/18 05:12:27 thorpej Exp $ */ +/* $NetBSD: sgmap_typedep.c,v 1.44 2021/07/19 16:25:54 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.43 2021/07/18 05:12:27 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.44 2021/07/19 16:25:54 thorpej Exp $"); #include "opt_ddb.h" @@ -74,6 +74,7 @@ __C(SGMAP_TYPE,_load_buffer)(bus_dma_tag bus_size_t sgvalen, extra_sgvalen, boundary, alignment; SGMAP_PTE_TYPE *pte, *page_table = sgmap->aps_pt; int pteidx, error, spill, seg = *segp; + bool address_is_valid __diagused; /* Initialize the spill page PTE if it hasn't been already. */ if (__C(SGMAP_TYPE,_prefetch_spill_page_pte) == 0) @@ -268,10 +269,8 @@ __C(SGMAP_TYPE,_load_buffer)(bus_dma_tag for (; va < endva; va += PAGE_SIZE, pteidx++, pte = _table[pteidx * SGMAP_PTE_SPACING]) { /* Get the physical address for this segment. */ - if (!VMSPACE_IS_KERNEL_P(vm)) - (void) pmap_extract(vm->vm_map.pmap, va, ); - else - pa = vtophys(va); + address_is_valid = pmap_extract(vm->vm_map.pmap, va, ); + KASSERT(address_is_valid); /* Load the current PTE with this page. */ *pte = (pa >> SGPTE_PGADDR_SHIFT) | SGPTE_VALID; @@ -289,10 +288,8 @@ __C(SGMAP_TYPE,_load_buffer)(bus_dma_tag /* va == endva == address of extra page */ KASSERT(va == endva); - if (!VMSPACE_IS_KERNEL_P(vm)) - (void) pmap_extract(vm->vm_map.pmap, va, ); - else - pa = vtophys(va); + address_is_valid = pmap_extract(vm->vm_map.pmap, va, ); + KASSERT(address_is_valid); /* * If a spill page is needed, the previous segment will
CVS commit: src/sys/arch/powerpc/oea
Module Name:src Committed By: chs Date: Mon Jul 19 14:49:45 UTC 2021 Modified Files: src/sys/arch/powerpc/oea: pmap.c Log Message: there is no need to keep pvos for unmanaged mappings on a hidden p/v list, since "unmanaged" means that we don't want to find such pvos on any p/v list. instead, just don't put such pvos on any p/v list at all and remove the two hidden p/v lists for unmanaged mappings. code mostly from martin, to implement rin's suggestion of unifying the two hidden lists. To generate a diff of this commit: cvs rdiff -u -r1.106 -r1.107 src/sys/arch/powerpc/oea/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/oea/pmap.c diff -u src/sys/arch/powerpc/oea/pmap.c:1.106 src/sys/arch/powerpc/oea/pmap.c:1.107 --- src/sys/arch/powerpc/oea/pmap.c:1.106 Sun Jun 27 12:26:33 2021 +++ src/sys/arch/powerpc/oea/pmap.c Mon Jul 19 14:49:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.106 2021/06/27 12:26:33 martin Exp $ */ +/* $NetBSD: pmap.c,v 1.107 2021/07/19 14:49:45 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -63,7 +63,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.106 2021/06/27 12:26:33 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.107 2021/07/19 14:49:45 chs Exp $"); #define PMAP_NOOPNAMES @@ -328,8 +328,6 @@ struct pvo_entry { TAILQ_HEAD(pvo_tqhead, pvo_entry); struct pvo_tqhead *pmap_pvo_table; /* pvo entries by ptegroup index */ -static struct pvo_head pmap_pvo_kunmanaged = LIST_HEAD_INITIALIZER(pmap_pvo_kunmanaged); /* list of unmanaged pages */ -static struct pvo_head pmap_pvo_unmanaged = LIST_HEAD_INITIALIZER(pmap_pvo_unmanaged); /* list of unmanaged pages */ struct pool pmap_pool; /* pool for pmap structures */ struct pool pmap_pvo_pool; /* pool for pvo entries */ @@ -652,7 +650,7 @@ pa_to_pvoh(paddr_t pa, struct vm_page ** if (pg_p != NULL) *pg_p = pg; if (pg == NULL) - return _pvo_unmanaged; + return NULL; md = VM_PAGE_TO_MD(pg); return >mdpg_pvoh; } @@ -1410,22 +1408,19 @@ pmap_pvo_check(const struct pvo_entry *p if (PVO_MANAGED_P(pvo)) { pvo_head = pa_to_pvoh(pvo->pvo_pte.pte_lo & PTE_RPGN, NULL); - } else { - if (pvo->pvo_vaddr < VM_MIN_KERNEL_ADDRESS) { - printf("pmap_pvo_check: pvo %p: non kernel address " - "on kernel unmanaged list\n", pvo); + LIST_FOREACH(pvo0, pvo_head, pvo_vlink) { + if (pvo0 == pvo) +break; + } + if (pvo0 == NULL) { + printf("pmap_pvo_check: pvo %p: not present " + "on its vlist head %p\n", pvo, pvo_head); failed = 1; } - pvo_head = _pvo_kunmanaged; - } - LIST_FOREACH(pvo0, pvo_head, pvo_vlink) { - if (pvo0 == pvo) - break; - } - if (pvo0 == NULL) { - printf("pmap_pvo_check: pvo %p: not present " - "on its vlist head %p\n", pvo, pvo_head); - failed = 1; + } else { + KASSERT(pvo->pvo_vaddr >= VM_MIN_KERNEL_ADDRESS); + if (__predict_false(pvo->pvo_vaddr < VM_MIN_KERNEL_ADDRESS)) + failed = 1; } if (pvo != pmap_pvo_find_va(pvo->pvo_pmap, pvo->pvo_vaddr, NULL)) { printf("pmap_pvo_check: pvo %p: not present " @@ -1620,7 +1615,7 @@ pmap_pvo_enter(pmap_t pm, struct pool *p } if (flags & PMAP_WIRED) pvo->pvo_vaddr |= PVO_WIRED; - if (pvo_head != _pvo_kunmanaged) { + if (pvo_head != NULL) { pvo->pvo_vaddr |= PVO_MANAGED; PMAPCOUNT(mappings); } else { @@ -1628,7 +1623,8 @@ pmap_pvo_enter(pmap_t pm, struct pool *p } pmap_pte_create(>pvo_pte, pm, va, pa | pte_lo); - LIST_INSERT_HEAD(pvo_head, pvo, pvo_vlink); + if (pvo_head != NULL) + LIST_INSERT_HEAD(pvo_head, pvo, pvo_vlink); if (PVO_WIRED_P(pvo)) pvo->pvo_pmap->pm_stats.wired_count++; pvo->pvo_pmap->pm_stats.resident_count++; @@ -1728,7 +1724,9 @@ pmap_pvo_remove(struct pvo_entry *pvo, i pvo->pvo_pmap->pm_stats.wired_count--; /* - * Save the REF/CHG bits into their cache if the page is managed. + * If the page is managed: + * Save the REF/CHG bits into their cache. + * Remove the PVO from the P/V list. */ if (PVO_MANAGED_P(pvo)) { register_t ptelo = pvo->pvo_pte.pte_lo; @@ -1760,15 +1758,15 @@ pmap_pvo_remove(struct pvo_entry *pvo, i pmap_attr_save(pg, ptelo & (PTE_REF|PTE_CHG)); } + LIST_REMOVE(pvo, pvo_vlink); PMAPCOUNT(unmappings); } else { PMAPCOUNT(kernel_unmappings); } /* - * Remove the PVO from its lists and return it to the pool. + * Remove the PVO from its list and return it to the pool. */ - LIST_REMOVE(pvo, pvo_vlink); TAILQ_REMOVE(_pvo_table[ptegidx], pvo, pvo_olink); if (pvol) { LIST_INSERT_HEAD(pvol, pvo, pvo_vlink); @@ -1861,9 +1859,10 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_ PMAP_LOCK(); if (__predict_false(!pmap_initialized)) { - pvo_head = _pvo_kunmanaged; + pvo_head = NULL; pg = NULL; was_exec = PTE_EXEC; + } else { pvo_head = pa_to_pvoh(pa, ); } @@ -1952,7 +1951,6 @@ pmap_enter(pmap_t pm,
CVS commit: src/sys/arch
Module Name:src Committed By: christos Date: Mon Jul 19 10:28:58 UTC 2021 Modified Files: src/sys/arch/alpha/include: param.h src/sys/arch/arm/include: param.h src/sys/arch/riscv/include: param.h Log Message: Remove definitions for CACHE_LINE_SIZE and COHERENCY_UNIT which are the same as the default. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/alpha/include/param.h cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/include/param.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/include/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/include/param.h diff -u src/sys/arch/alpha/include/param.h:1.49 src/sys/arch/alpha/include/param.h:1.50 --- src/sys/arch/alpha/include/param.h:1.49 Tue Jul 6 08:20:52 2021 +++ src/sys/arch/alpha/include/param.h Mon Jul 19 06:28:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.49 2021/07/06 12:20:52 thorpej Exp $ */ +/* $NetBSD: param.h,v 1.50 2021/07/19 10:28:58 christos Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -84,8 +84,6 @@ * EV4 (21064) and EV5 (21164) have a 32-byte cache line size. * EV6 (21264) and EV7 (21364) have a 64-byte cache line size. */ -#define COHERENCY_UNIT 64 -#define CACHE_LINE_SIZE 64 /* * Constants related to network buffer management. Index: src/sys/arch/arm/include/param.h diff -u src/sys/arch/arm/include/param.h:1.23 src/sys/arch/arm/include/param.h:1.24 --- src/sys/arch/arm/include/param.h:1.23 Sun Aug 16 05:37:30 2020 +++ src/sys/arch/arm/include/param.h Mon Jul 19 06:28:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.23 2020/08/16 09:37:30 skrll Exp $ */ +/* $NetBSD: param.h,v 1.24 2021/07/19 10:28:58 christos Exp $ */ /* * Copyright (c) 1994,1995 Mark Brinicombe. @@ -186,7 +186,4 @@ #endif #endif /* _KERNEL */ -#define COHERENCY_UNIT 64 -#define CACHE_LINE_SIZE 64 - #endif /* _ARM_PARAM_H_ */ Index: src/sys/arch/riscv/include/param.h diff -u src/sys/arch/riscv/include/param.h:1.5 src/sys/arch/riscv/include/param.h:1.6 --- src/sys/arch/riscv/include/param.h:1.5 Mon May 31 10:38:57 2021 +++ src/sys/arch/riscv/include/param.h Mon Jul 19 06:28:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.5 2021/05/31 14:38:57 simonb Exp $ */ +/* $NetBSD: param.h,v 1.6 2021/07/19 10:28:58 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -96,9 +96,6 @@ #define MSGBUFSIZE 65536 /* default message buffer size */ #endif -#define COHERENCY_UNIT 64 -#define CACHE_LINE_SIZE 64 - #define MAXCPUS 32 #ifdef _KERNEL
CVS commit: src/lib/libkvm
Module Name:src Committed By: christos Date: Mon Jul 19 10:30:36 UTC 2021 Modified Files: src/lib/libkvm: kvm_proc.c Log Message: Match the declaration in To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/lib/libkvm/kvm_proc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libkvm/kvm_proc.c diff -u src/lib/libkvm/kvm_proc.c:1.94 src/lib/libkvm/kvm_proc.c:1.95 --- src/lib/libkvm/kvm_proc.c:1.94 Wed Dec 11 15:19:27 2019 +++ src/lib/libkvm/kvm_proc.c Mon Jul 19 06:30:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: kvm_proc.c,v 1.94 2019/12/11 20:19:27 ad Exp $ */ +/* $NetBSD: kvm_proc.c,v 1.95 2021/07/19 10:30:36 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #if 0 static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93"; #else -__RCSID("$NetBSD: kvm_proc.c,v 1.94 2019/12/11 20:19:27 ad Exp $"); +__RCSID("$NetBSD: kvm_proc.c,v 1.95 2021/07/19 10:30:36 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -159,7 +159,9 @@ struct miniproc { */ struct kvm_kauth_cred { u_int cr_refcnt; /* reference count */ - uint8_t cr_pad[CACHE_LINE_SIZE - sizeof(u_int)]; +#if COHERENCY_UNIT > 4 + uint8_t cr_pad[COHERENCY_UNIT - 4]; +#endif uid_t cr_uid; /* user id */ uid_t cr_euid; /* effective user id */ uid_t cr_svuid; /* saved effective user id */
CVS commit: src/lib/libc/stdio
Module Name:src Committed By: christos Date: Mon Jul 19 10:00:33 UTC 2021 Modified Files: src/lib/libc/stdio: fvwrite.c Log Message: There's no need to adjust `iov' in the error path. Returning the amount written is all that's needed. from RVP To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/stdio/fvwrite.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/stdio/fvwrite.c diff -u src/lib/libc/stdio/fvwrite.c:1.28 src/lib/libc/stdio/fvwrite.c:1.29 --- src/lib/libc/stdio/fvwrite.c:1.28 Fri Jul 16 08:34:10 2021 +++ src/lib/libc/stdio/fvwrite.c Mon Jul 19 06:00:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fvwrite.c,v 1.28 2021/07/16 12:34:10 christos Exp $ */ +/* $NetBSD: fvwrite.c,v 1.29 2021/07/19 10:00:32 christos Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fvwrite.c,v 1.28 2021/07/16 12:34:10 christos Exp $"); +__RCSID("$NetBSD: fvwrite.c,v 1.29 2021/07/19 10:00:32 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -52,7 +52,7 @@ __RCSID("$NetBSD: fvwrite.c,v 1.28 2021/ #include "fvwrite.h" static int -flush_adj(FILE *fp, struct __suio *uio, struct __siov *iov, ssize_t w) +flush_adj(FILE *fp, struct __suio *uio, ssize_t w) { int rc; @@ -74,7 +74,6 @@ flush_adj(FILE *fp, struct __suio *uio, /* adjust amt. written */ uio->uio_resid -= i; - iov->iov_len -= i; } else { /* only old stuff was written */ @@ -136,7 +135,7 @@ __sfvwrite(FILE *fp, struct __suio *uio) if (w <= 0) \ goto err #define FLUSH(nw) \ - if (flush_adj(fp, uio, iov - 1, nw)) \ + if (flush_adj(fp, uio, nw)) \ goto err if (fp->_flags & __SNBF) {