Kill off old fops ->read() and ->write()
Subsystems (424)
Jens Axboe
maintainercover Kill off old fops ->read() and ->write()
Hi,
This patchset will obviously be split, commit messages updated, and specific driver patches targeted to where they belong. But I figured it'd be useful to blast out the full set at least once for reference, and then I'll continue down the right path for the next one.
Subject line says it all, really. 10 years ago we added ->read_iter() and ->write_iter() to struct file_operations. These are great, as they pass in an iov_iter rather than a user buffer + length, and they also take a struct kiocb rather than just a file. Since then we've had two paths for any read or write - one legacy one that can't do per-IO hints like "This read should be non-blocking", they strictly only work with O_NONBLOCK on the file, and a newer one that supports everything the old path does and a bunch more. We've had a few issues with the iov_iter based path being slower, but those have basically been resolved with solutions like ITER_UBUF to optimize the single segment case that is often the fast path.
There are basically three parts to this series:
1) Add generic helpers that we need to convert drivers.
2) Convert any use of fops->read() and ->write()
3) Kill off old cruft.
3a) Profit.
Notes:
- Part 1 adds FOPS_READ_ITER_HELPER() and FOPS_WRITE_ITER_HELPER() to ease conversion of some drivers, as those just wrap the existing read or write function with vfs_{read,write}_iter(). Where possible this has been avoided and a clean implementation been done. However, due to lack of man power, I didn't dig super deep in some spots. It's my hope that drivers with active developers/maintainers will take it a step further and help get their driver fully converted.
- This is based on my 'read_iter' branch that adds one helper and converts timerfd/userfaultfd/signalfd. This branch is queued for 6.10.
- I'm sure there are a few spots that I haven't converted just yet because I've missed them. If you see any, please let me know and I'll take care of it.
- The kernel builds allyesconfig/allmodconfig on (at least) the following architectures: x86-64, arm64, sparc64, s390, powerpc. With the above caveat that there may still be old crufty drivers somewhere in the tree that are missing a conversion, it should be fairly complete.
- Resulting kernel boots just fine, tested on x86-64 and arm64. Caveat emptor if you want to test it, however!
- As you may be able to tell, diffstat looks promising. The lines removed will continue to go up with removal of FOPS_*() wrappers. There are currently about 150 read side wrappers and 200 write side wrappers.
- I haven't done detailed analysis of text/bss sizes just yet, but preliminary looks show about a 100K reduction in kernel image size for my standard test box build.
Please have a look! A continually rebased branch for these patches can be found here:
https://git.kernel.dk/cgit/linux/log/?h=rw_iter
arch/arm/common/bL_switcher_dummy_if.c | 8 +- arch/mips/kernel/rtlx.c | 6 +- arch/mips/kernel/vpe.c | 14 +- arch/mips/mm/sc-debugfs.c | 16 +- arch/parisc/kernel/perf.c | 14 +- arch/powerpc/kernel/dawr.c | 10 +- arch/powerpc/kernel/eeh.c | 58 +- arch/powerpc/kvm/book3s_64_mmu_hv.c | 25 +- arch/powerpc/kvm/book3s_64_mmu_radix.c | 19 +- arch/powerpc/kvm/book3s_hv.c | 26 +- arch/powerpc/kvm/timing.c | 14 +- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 7 +- arch/powerpc/platforms/cell/spufs/file.c | 312 +++++------ arch/powerpc/platforms/cell/spufs/inode.c | 2 +- arch/powerpc/platforms/powernv/eeh-powernv.c | 11 +- arch/powerpc/platforms/powernv/memtrace.c | 9 +- arch/powerpc/platforms/powernv/opal-lpc.c | 6 +- arch/powerpc/platforms/powernv/opal-prd.c | 22 +- arch/powerpc/platforms/powernv/opal-xscom.c | 30 +- arch/powerpc/platforms/pseries/dtl.c | 16 +- arch/powerpc/platforms/pseries/lpar.c | 11 +- arch/powerpc/platforms/pseries/papr-vpd.c | 8 +- arch/s390/crypto/prng.c | 18 +- arch/s390/hypfs/hypfs_dbfs.c | 11 +- arch/s390/kernel/debug.c | 29 +- arch/s390/kernel/sysinfo.c | 6 +- arch/s390/pci/pci_debug.c | 12 +- arch/sh/mm/tlb-debugfs.c | 2 +- arch/sparc/kernel/mdesc.c | 18 +- arch/um/drivers/harddog_kern.c | 6 +- arch/um/drivers/hostaudio_kern.c | 22 +- arch/um/drivers/mmapper_kern.c | 16 +- arch/x86/kernel/apm_32.c | 10 +- arch/x86/kernel/callthunks.c | 2 +- arch/x86/kernel/cpu/debugfs.c | 4 +- arch/x86/kernel/cpu/mce/dev-mcelog.c | 38 +- arch/x86/kernel/cpu/mce/inject.c | 27 +- arch/x86/kernel/cpu/mce/severity.c | 11 +- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 18 +- arch/x86/kernel/cpuid.c | 16 +- arch/x86/kernel/kdebugfs.c | 14 +- arch/x86/kernel/msr.c | 28 +- arch/x86/kernel/tboot.c | 17 +- arch/x86/kvm/debugfs.c | 2 +- arch/x86/mm/pat/memtype.c | 2 +- arch/x86/mm/pat/set_memory.c | 2 +- arch/x86/mm/pkeys.c | 15 +- arch/x86/mm/tlb.c | 15 +- block/blk-mq-debugfs.c | 20 +- block/blk-mq-debugfs.h | 2 +- drivers/accel/habanalabs/common/debugfs.c | 307 +++++------ drivers/accel/habanalabs/common/habanalabs.h | 3 +- drivers/accel/ivpu/ivpu_debugfs.c | 84 ++- drivers/accessibility/speakup/devsynth.c | 27 +- drivers/accessibility/speakup/speakup_soft.c | 46 +- drivers/acpi/acpi_dbg.c | 6 +- drivers/acpi/apei/erst-dbg.c | 23 +- drivers/acpi/ec_sys.c | 6 +- drivers/acpi/pfr_update.c | 3 +- drivers/auxdisplay/charlcd.c | 3 +- drivers/auxdisplay/panel.c | 3 +- drivers/base/power/wakeup.c | 2 +- drivers/base/regmap/regmap-debugfs.c | 115 ++-- drivers/block/aoe/aoechr.c | 15 +- drivers/block/drbd/drbd_debugfs.c | 10 +- drivers/block/mtip32xx/mtip32xx.c | 36 +- drivers/block/zram/zram_drv.c | 14 +- drivers/bluetooth/btmrvl_debugfs.c | 57 +- drivers/bluetooth/btusb.c | 20 +- drivers/bluetooth/hci_vhci.c | 73 ++- drivers/bus/mhi/host/debugfs.c | 38 +- drivers/bus/moxtet.c | 30 +- drivers/cache/sifive_ccache.c | 8 +- drivers/char/adi.c | 26 +- drivers/char/apm-emulation.c | 10 +- drivers/char/applicom.c | 7 +- drivers/char/ds1620.c | 7 +- drivers/char/dsp56k.c | 6 +- drivers/char/dtlk.c | 6 +- drivers/char/hpet.c | 3 +- drivers/char/hw_random/core.c | 3 +- drivers/char/hw_random/s390-trng.c | 9 +- drivers/char/ipmi/bt-bmc.c | 27 +- drivers/char/ipmi/ipmb_dev_int.c | 19 +- drivers/char/ipmi/ipmi_watchdog.c | 16 +- drivers/char/ipmi/kcs_bmc_cdev_ipmi.c | 23 +- drivers/char/ipmi/ssif_bmc.c | 25 +- drivers/char/lp.c | 21 +- drivers/char/mem.c | 106 +--- drivers/char/mwave/mwavedd.c | 19 +- drivers/char/nsc_gpio.c | 22 +- drivers/char/nvram.c | 19 +- drivers/char/nwbutton.c | 7 +- drivers/char/nwflash.c | 12 +- drivers/char/pc8736x_gpio.c | 4 +- drivers/char/powernv-op-panel.c | 25 +- drivers/char/ppdev.c | 18 +- drivers/char/ps3flash.c | 6 +- drivers/char/scx200_gpio.c | 4 +- drivers/char/sonypi.c | 3 +- drivers/char/tlclk.c | 9 +- drivers/char/tpm/eventlog/common.c | 2 +- drivers/char/tpm/tpm-dev-common.c | 26 +- drivers/char/tpm/tpm-dev.c | 4 +- drivers/char/tpm/tpm-dev.h | 6 +- drivers/char/tpm/tpm_vtpm_proxy.c | 20 +- drivers/char/tpm/tpmrm-dev.c | 4 +- drivers/char/virtio_console.c | 6 +- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 31 +- drivers/char/xillybus/xillybus_core.c | 36 +- drivers/char/xillybus/xillyusb.c | 6 +- drivers/clk/clk.c | 11 +- .../clk/starfive/clk-starfive-jh7110-pll.c | 2 +- drivers/comedi/comedi_fops.c | 26 +- drivers/counter/counter-chrdev.c | 3 +- drivers/crypto/ccp/ccp-debugfs.c | 51 +- drivers/crypto/hisilicon/debugfs.c | 51 +- drivers/crypto/hisilicon/hpre/hpre_main.c | 23 +- drivers/crypto/hisilicon/qm.c | 22 +- drivers/crypto/hisilicon/sec2/sec_main.c | 23 +- drivers/crypto/hisilicon/zip/zip_main.c | 23 +- drivers/crypto/intel/iaa/iaa_crypto_stats.c | 2 +- .../intel/qat/qat_common/adf_cnv_dbgfs.c | 10 +- .../intel/qat/qat_common/adf_fw_counters.c | 2 +- .../qat/qat_common/adf_heartbeat_dbgfs.c | 60 +-- .../intel/qat/qat_common/adf_pm_dbgfs.c | 3 +- .../intel/qat/qat_common/adf_tl_debugfs.c | 18 +- drivers/dma/xilinx/xilinx_dpdma.c | 15 +- drivers/edac/altera_edac.c | 46 +- drivers/edac/debugfs.c | 9 +- drivers/edac/i5100_edac.c | 9 +- drivers/edac/npcm_edac.c | 8 +- drivers/edac/thunderx_edac.c | 71 ++- drivers/edac/versal_edac.c | 20 +- drivers/edac/xgene_edac.c | 43 +- drivers/edac/zynqmp_edac.c | 26 +- drivers/extcon/extcon-rtk-type-c.c | 4 +- drivers/firewire/core-cdev.c | 15 +- drivers/firewire/nosy.c | 18 +- drivers/firmware/arm_scmi/raw_mode.c | 94 ++-- drivers/firmware/cirrus/cs_dsp.c | 26 +- drivers/firmware/efi/capsule-loader.c | 16 +- drivers/firmware/psci/psci.c | 2 +- drivers/firmware/tegra/bpmp-debugfs.c | 26 +- drivers/firmware/turris-mox-rwtm.c | 22 +- drivers/firmware/xilinx/zynqmp-debug.c | 22 +- drivers/fsi/fsi-core.c | 28 +- drivers/fsi/fsi-occ.c | 20 +- drivers/fsi/fsi-sbefifo.c | 6 +- drivers/fsi/fsi-scom.c | 24 +- drivers/fsi/i2cr-scom.c | 23 +- drivers/gnss/core.c | 14 +- drivers/gpio/gpio-mockup.c | 26 +- drivers/gpio/gpiolib-cdev.c | 41 +- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 71 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- .../drm/amd/amdgpu/amdgpu_fw_attestation.c | 23 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 18 +- drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 34 +- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 22 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 6 +- .../gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 56 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +- drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c | 13 +- drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 19 +- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 111 ++-- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 11 +- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 17 +- drivers/gpu/drm/arm/malidp_drv.c | 11 +- drivers/gpu/drm/armada/armada_debugfs.c | 13 +- drivers/gpu/drm/bridge/ite-it6505.c | 14 +- drivers/gpu/drm/drm_debugfs.c | 28 +- drivers/gpu/drm/drm_debugfs_crc.c | 26 +- drivers/gpu/drm/drm_file.c | 22 +- drivers/gpu/drm/drm_mipi_dbi.c | 14 +- drivers/gpu/drm/gma500/psb_drv.c | 2 +- .../drm/i915/display/intel_display_debugfs.c | 114 ++-- .../display/intel_display_debugfs_params.c | 36 +- drivers/gpu/drm/i915/display/intel_hotplug.c | 28 +- drivers/gpu/drm/i915/display/intel_wm.c | 42 +- drivers/gpu/drm/i915/display/skl_watermark.c | 14 +- drivers/gpu/drm/i915/gt/intel_gt_debugfs.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt_debugfs.h | 2 +- .../drm/i915/gt/uc/intel_guc_log_debugfs.c | 13 +- drivers/gpu/drm/i915/i915_debugfs_params.c | 43 +- drivers/gpu/drm/i915/i915_driver.c | 2 +- drivers/gpu/drm/i915/i915_gpu_error.c | 28 +- drivers/gpu/drm/i915/i915_perf.c | 3 +- drivers/gpu/drm/imagination/pvr_fw_trace.c | 2 +- drivers/gpu/drm/imagination/pvr_params.c | 4 +- drivers/gpu/drm/loongson/lsdc_crtc.c | 14 +- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 20 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 20 +- drivers/gpu/drm/msm/dp/dp_debug.c | 15 +- drivers/gpu/drm/msm/msm_debugfs.c | 4 +- drivers/gpu/drm/msm/msm_perf.c | 12 +- drivers/gpu/drm/msm/msm_rd.c | 12 +- drivers/gpu/drm/nouveau/dispnv50/crc.c | 13 +- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 12 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- drivers/gpu/drm/omapdrm/dss/dss.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 40 +- drivers/gpu/drm/tegra/drm.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +- drivers/gpu/drm/xe/xe_device.c | 2 +- drivers/gpu/vga/vga_switcheroo.c | 10 +- drivers/greybus/es2.c | 29 +- drivers/greybus/svc.c | 27 +- drivers/hid/hid-debug.c | 3 +- drivers/hid/hid-picolcd_debugfs.c | 65 +-- drivers/hid/hid-roccat.c | 12 +- drivers/hid/hid-sensor-custom.c | 3 +- drivers/hid/hid-wiimote-debug.c | 15 +- drivers/hid/hidraw.c | 15 +- drivers/hid/uhid.c | 15 +- drivers/hid/usbhid/hiddev.c | 17 +- drivers/hsi/clients/cmt_speech.c | 22 +- drivers/hsi/clients/hsi_char.c | 22 +- drivers/hv/hv_utils_transport.c | 20 +- drivers/hwmon/asus_atk0110.c | 9 +- drivers/hwmon/fschmd.c | 10 +- drivers/hwmon/mr75203.c | 20 +- drivers/hwmon/pmbus/acbel-fsg032.c | 10 +- drivers/hwmon/pmbus/ibm-cffps.c | 35 +- drivers/hwmon/pmbus/max20730.c | 10 +- drivers/hwmon/pmbus/pmbus_core.c | 10 +- drivers/hwmon/pmbus/q54sj108a2.c | 25 +- drivers/hwmon/pmbus/ucd9000.c | 11 +- drivers/hwmon/pt5161l.c | 31 +- drivers/hwmon/w83793.c | 10 +- .../hwtracing/coresight/coresight-cpu-debug.c | 15 +- drivers/hwtracing/coresight/coresight-etb10.c | 18 +- .../hwtracing/coresight/coresight-tmc-core.c | 14 +- drivers/hwtracing/coresight/ultrasoc-smb.c | 12 +- drivers/hwtracing/intel_th/msu.c | 46 +- drivers/hwtracing/stm/core.c | 10 +- drivers/i2c/i2c-dev.c | 25 +- drivers/iio/gyro/adis16136.c | 9 +- drivers/iio/iio_core.h | 7 +- drivers/iio/imu/adis16400.c | 10 +- drivers/iio/imu/adis16475.c | 22 +- drivers/iio/imu/adis16480.c | 20 +- drivers/iio/imu/bno055/bno055.c | 9 +- drivers/iio/industrialio-buffer.c | 20 +- drivers/iio/industrialio-core.c | 34 +- drivers/iio/industrialio-event.c | 3 +- drivers/infiniband/core/ucma.c | 3 +- drivers/infiniband/core/user_mad.c | 6 +- drivers/infiniband/core/uverbs_main.c | 11 +- drivers/infiniband/hw/cxgb4/device.c | 35 +- drivers/infiniband/hw/hfi1/debugfs.c | 162 +++--- drivers/infiniband/hw/hfi1/debugfs.h | 6 +- drivers/infiniband/hw/hfi1/fault.c | 27 +- drivers/infiniband/hw/hns/hns_roce_debugfs.c | 2 +- drivers/infiniband/hw/mlx5/cong.c | 19 +- drivers/infiniband/hw/mlx5/devx.c | 24 +- drivers/infiniband/hw/mlx5/main.c | 20 +- drivers/infiniband/hw/mlx5/mr.c | 38 +- drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 26 +- drivers/infiniband/hw/qib/qib_debugfs.c | 2 +- drivers/infiniband/hw/qib/qib_diag.c | 18 +- drivers/infiniband/hw/qib/qib_file_ops.c | 4 +- drivers/infiniband/hw/qib/qib_fs.c | 119 ++--- drivers/infiniband/hw/usnic/usnic_debugfs.c | 22 +- drivers/input/evdev.c | 6 +- drivers/input/joydev.c | 22 +- drivers/input/keyboard/applespi.c | 11 +- drivers/input/misc/uinput.c | 6 +- drivers/input/mousedev.c | 16 +- drivers/input/serio/serio_raw.c | 6 +- drivers/input/serio/userio.c | 22 +- drivers/input/touchscreen/edt-ft5x06.c | 19 +- drivers/iommu/intel/debugfs.c | 14 +- drivers/iommu/omap-iommu-debug.c | 11 +- drivers/isdn/capi/capi.c | 22 +- drivers/isdn/mISDN/timerdev.c | 16 +- drivers/leds/uleds.c | 33 +- drivers/macintosh/adb.c | 22 +- drivers/macintosh/ans-lcd.c | 29 +- drivers/macintosh/smu.c | 40 +- drivers/macintosh/via-pmu.c | 19 +- drivers/mailbox/bcm-pdc-mailbox.c | 9 +- drivers/mailbox/mailbox-test.c | 37 +- drivers/md/bcache/debug.c | 11 +- drivers/media/cec/core/cec-core.c | 12 +- drivers/media/common/siano/smsdvb-debugfs.c | 17 +- drivers/media/dvb-core/dmxdev.c | 9 +- drivers/media/dvb-core/dvb_ca_en50221.c | 25 +- drivers/media/mc/mc-devnode.c | 6 +- drivers/media/pci/bt8xx/dst_ca.c | 8 +- drivers/media/pci/ddbridge/ddbridge-core.c | 6 +- drivers/media/pci/ngene/ngene-dvb.c | 6 +- drivers/media/platform/amphion/vpu_dbg.c | 24 +- .../mediatek/vcodec/common/mtk_vcodec_dbgfs.c | 21 +- drivers/media/platform/mediatek/vpu/mtk_vpu.c | 9 +- drivers/media/radio/radio-si476x.c | 60 +-- drivers/media/rc/imon.c | 26 +- drivers/media/rc/lirc_dev.c | 15 +- drivers/media/usb/uvc/uvc_debugfs.c | 10 +- drivers/media/v4l2-core/v4l2-dev.c | 6 +- drivers/mfd/aat2870-core.c | 20 +- drivers/mfd/tps65010.c | 2 +- drivers/misc/bcm-vk/bcm_vk.h | 6 +- drivers/misc/bcm-vk/bcm_vk_dev.c | 4 +- drivers/misc/bcm-vk/bcm_vk_msg.c | 23 +- drivers/misc/cxl/api.c | 7 +- drivers/misc/cxl/cxl.h | 2 +- drivers/misc/cxl/file.c | 23 +- drivers/misc/eeprom/idt_89hpesx.c | 21 +- drivers/misc/hpilo.c | 21 +- drivers/misc/ibmasm/ibmasmfs.c | 94 ++-- drivers/misc/ibmvmc.c | 40 +- drivers/misc/lis3lv02d/lis3lv02d.c | 13 +- drivers/misc/lkdtm/core.c | 40 +- drivers/misc/mei/debugfs.c | 12 +- drivers/misc/mei/main.c | 53 +- drivers/misc/ocxl/file.c | 20 +- drivers/misc/open-dice.c | 19 +- drivers/misc/tps6594-pfsm.c | 30 +- drivers/mmc/core/block.c | 10 +- drivers/mmc/core/debugfs.c | 11 +- drivers/mmc/core/mmc_test.c | 12 +- drivers/most/most_cdev.c | 50 +- drivers/mtd/mtdchar.c | 52 +- drivers/mtd/ubi/cdev.c | 58 +- drivers/mtd/ubi/debug.c | 38 +- drivers/mtd/ubi/ubi.h | 4 +- drivers/mtd/ubi/upd.c | 24 +- drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | 233 ++++---- .../net/ethernet/broadcom/bnxt/bnxt_debugfs.c | 13 +- .../net/ethernet/brocade/bna/bnad_debugfs.c | 47 +- .../ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 321 +++++------ drivers/net/ethernet/chelsio/cxgb4/l2t.c | 2 +- .../ethernet/hisilicon/hns3/hns3_debugfs.c | 15 +- .../net/ethernet/huawei/hinic/hinic_debugfs.c | 13 +- .../net/ethernet/intel/fm10k/fm10k_debugfs.c | 10 +- .../net/ethernet/intel/i40e/i40e_debugfs.c | 103 ++-- drivers/net/ethernet/intel/ice/ice_debugfs.c | 181 +++---- .../net/ethernet/intel/ixgbe/ixgbe_debugfs.c | 99 ++-- .../marvell/octeontx2/af/rvu_debugfs.c | 159 +++--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 78 +-- .../net/ethernet/mellanox/mlx5/core/debugfs.c | 49 +- .../net/ethernet/mellanox/mlx5/core/lib/sd.c | 13 +- drivers/net/ieee802154/ca8210.c | 29 +- drivers/net/netdevsim/dev.c | 73 ++- drivers/net/netdevsim/fib.c | 16 +- drivers/net/netdevsim/health.c | 12 +- drivers/net/netdevsim/hwstats.c | 13 +- drivers/net/netdevsim/ipsec.c | 10 +- drivers/net/netdevsim/psample.c | 12 +- drivers/net/netdevsim/udp_tunnels.c | 9 +- drivers/net/ppp/ppp_generic.c | 13 +- drivers/net/wireless/ath/ath10k/debug.c | 502 ++++++++---------- drivers/net/wireless/ath/ath10k/debugfs_sta.c | 119 ++--- drivers/net/wireless/ath/ath10k/spectral.c | 65 ++- drivers/net/wireless/ath/ath11k/debugfs.c | 300 +++++------ .../wireless/ath/ath11k/debugfs_htt_stats.c | 56 +- drivers/net/wireless/ath/ath11k/debugfs_sta.c | 163 +++--- drivers/net/wireless/ath/ath11k/spectral.c | 69 ++- drivers/net/wireless/ath/ath5k/debug.c | 148 +++--- drivers/net/wireless/ath/ath6kl/debug.c | 312 +++++------ drivers/net/wireless/ath/ath9k/common-debug.c | 36 +- .../net/wireless/ath/ath9k/common-spectral.c | 111 ++-- drivers/net/wireless/ath/ath9k/debug.c | 210 ++++---- drivers/net/wireless/ath/ath9k/debug_sta.c | 18 +- drivers/net/wireless/ath/ath9k/dfs_debug.c | 30 +- .../net/wireless/ath/ath9k/htc_drv_debug.c | 82 ++- drivers/net/wireless/ath/ath9k/tx99.c | 40 +- drivers/net/wireless/ath/carl9170/debug.c | 25 +- drivers/net/wireless/ath/wcn36xx/debug.c | 42 +- drivers/net/wireless/ath/wil6210/debugfs.c | 235 ++++---- drivers/net/wireless/ath/wil6210/pmc.c | 27 +- drivers/net/wireless/ath/wil6210/pmc.h | 2 +- drivers/net/wireless/broadcom/b43/debugfs.c | 30 +- .../net/wireless/broadcom/b43legacy/debugfs.c | 31 +- .../broadcom/brcm80211/brcmfmac/core.c | 10 +- .../broadcom/brcm80211/brcmsmac/debug.c | 2 +- drivers/net/wireless/intel/iwlegacy/3945-rs.c | 9 +- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 39 +- drivers/net/wireless/intel/iwlegacy/debug.c | 280 +++++----- .../net/wireless/intel/iwlwifi/dvm/debugfs.c | 455 ++++++++-------- drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 42 +- .../net/wireless/intel/iwlwifi/fw/debugfs.c | 23 +- drivers/net/wireless/intel/iwlwifi/mei/main.c | 18 +- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 7 +- .../wireless/intel/iwlwifi/mvm/debugfs-vif.c | 81 ++- .../net/wireless/intel/iwlwifi/mvm/debugfs.c | 227 ++++---- .../net/wireless/intel/iwlwifi/mvm/debugfs.h | 9 +- drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 62 ++- .../net/wireless/intel/iwlwifi/pcie/trans.c | 85 ++- .../net/wireless/marvell/libertas/debugfs.c | 242 ++++----- .../net/wireless/marvell/mwifiex/debugfs.c | 183 +++---- .../wireless/mediatek/mt76/mt7615/debugfs.c | 20 +- .../wireless/mediatek/mt76/mt7915/debugfs.c | 52 +- .../wireless/mediatek/mt76/mt7996/debugfs.c | 33 +- .../net/wireless/ralink/rt2x00/rt2x00debug.c | 122 ++--- drivers/net/wireless/realtek/rtlwifi/debug.c | 5 +- drivers/net/wireless/realtek/rtw88/debug.c | 163 +++--- drivers/net/wireless/realtek/rtw89/debug.c | 155 +++--- drivers/net/wireless/rsi/rsi_91x_debugfs.c | 20 +- drivers/net/wireless/silabs/wfx/debug.c | 34 +- drivers/net/wireless/st/cw1200/debug.c | 10 +- drivers/net/wireless/ti/wl1251/debugfs.c | 38 +- drivers/net/wireless/ti/wl18xx/debugfs.c | 73 ++- drivers/net/wireless/ti/wlcore/debugfs.c | 373 ++++++------- drivers/net/wireless/ti/wlcore/debugfs.h | 37 +- drivers/net/wwan/iosm/iosm_ipc_trace.c | 21 +- drivers/net/wwan/wwan_core.c | 26 +- drivers/net/wwan/wwan_hwsim.c | 42 +- drivers/net/xen-netback/xenbus.c | 19 +- drivers/nfc/virtual_ncidev.c | 21 +- drivers/ntb/hw/amd/ntb_hw_amd.c | 10 +- drivers/ntb/hw/idt/ntb_hw_idt.c | 29 +- drivers/ntb/hw/intel/ntb_hw_gen1.c | 21 +- drivers/ntb/hw/intel/ntb_hw_gen3.c | 8 +- drivers/ntb/hw/intel/ntb_hw_gen3.h | 3 +- drivers/ntb/hw/intel/ntb_hw_gen4.c | 8 +- drivers/ntb/hw/intel/ntb_hw_gen4.h | 5 +- drivers/ntb/ntb_transport.c | 9 +- drivers/ntb/test/ntb_perf.c | 49 +- drivers/ntb/test/ntb_tool.c | 307 +++++------ drivers/nvme/host/fabrics.c | 12 +- drivers/opp/debugfs.c | 9 +- drivers/parisc/eisa_eeprom.c | 12 +- drivers/pci/hotplug/cpqphp_sysfs.c | 9 +- drivers/pci/pcie/aer_inject.c | 9 +- drivers/pci/switch/switchtec.c | 33 +- drivers/pci/vgaarb.c | 21 +- drivers/phy/mediatek/phy-mtk-tphy.c | 28 +- drivers/pinctrl/pinmux.c | 10 +- drivers/platform/chrome/cros_ec_chardev.c | 20 +- drivers/platform/chrome/cros_ec_debugfs.c | 33 +- drivers/platform/chrome/wilco_ec/debugfs.c | 19 +- drivers/platform/chrome/wilco_ec/event.c | 18 +- drivers/platform/chrome/wilco_ec/telemetry.c | 20 +- drivers/platform/goldfish/goldfish_pipe.c | 6 +- drivers/platform/olpc/olpc-ec.c | 15 +- .../surface/surface_aggregator_cdev.c | 3 +- drivers/platform/surface/surface_dtx.c | 3 +- drivers/platform/x86/amd/pmc/pmc.c | 21 +- drivers/platform/x86/amd/pmf/tee-if.c | 10 +- drivers/platform/x86/apple-gmux.c | 25 +- drivers/platform/x86/asus-wmi.c | 2 +- drivers/platform/x86/dell/dell-smbios-wmi.c | 11 +- drivers/platform/x86/dell/dell-smo8800.c | 3 +- drivers/platform/x86/intel/pmc/core.c | 24 +- drivers/platform/x86/intel/pmc/core.h | 4 +- .../platform/x86/intel/telemetry/debugfs.c | 24 +- drivers/platform/x86/intel/tpmi.c | 11 +- drivers/platform/x86/sony-laptop.c | 3 +- drivers/rapidio/devices/rio_mport_cdev.c | 14 +- drivers/ras/amd/fmpm.c | 2 +- drivers/ras/debugfs.c | 2 +- drivers/regulator/core.c | 12 +- drivers/remoteproc/remoteproc_cdev.c | 9 +- drivers/remoteproc/remoteproc_debugfs.c | 68 ++- drivers/rtc/dev.c | 20 +- drivers/rtc/rtc-m41t80.c | 18 +- drivers/s390/block/dasd.c | 34 +- drivers/s390/block/dasd_eer.c | 12 +- drivers/s390/block/dasd_int.h | 1 + drivers/s390/block/dasd_proc.c | 2 +- drivers/s390/char/fs3270.c | 6 +- drivers/s390/char/hmcdrv_dev.c | 12 +- drivers/s390/char/monreader.c | 16 +- drivers/s390/char/monwriter.c | 12 +- drivers/s390/char/tape_char.c | 10 +- drivers/s390/char/vmcp.c | 23 +- drivers/s390/char/vmlogrdr.c | 15 +- drivers/s390/char/vmur.c | 6 +- drivers/s390/char/zcore.c | 25 +- drivers/s390/cio/cio_inject.c | 11 +- drivers/s390/cio/qdio_debug.c | 12 +- drivers/s390/crypto/zcrypt_api.c | 10 +- drivers/sbus/char/envctrl.c | 27 +- drivers/sbus/char/flash.c | 14 +- drivers/sbus/char/oradax.c | 37 +- drivers/scsi/bfa/bfad_debugfs.c | 51 +- drivers/scsi/csiostor/csio_init.c | 16 +- drivers/scsi/cxlflash/ocxl_hw.c | 17 +- drivers/scsi/fnic/fnic_debugfs.c | 82 ++- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 105 ++-- drivers/scsi/lpfc/lpfc_debugfs.c | 427 +++++++-------- drivers/scsi/megaraid/megaraid_sas_debugfs.c | 9 +- drivers/scsi/mpt3sas/mpt3sas_debugfs.c | 10 +- drivers/scsi/qedf/qedf_dbg.h | 6 +- drivers/scsi/qedf/qedf_debugfs.c | 76 ++- drivers/scsi/qedi/qedi_dbg.h | 6 +- drivers/scsi/qedi/qedi_debugfs.c | 20 +- drivers/scsi/qla2xxx/qla_dfs.c | 12 +- drivers/scsi/scsi_debug.c | 26 +- drivers/scsi/sg.c | 6 +- drivers/scsi/snic/snic_debugfs.c | 25 +- drivers/scsi/st.c | 10 +- drivers/soc/aspeed/aspeed-lpc-snoop.c | 3 +- drivers/soc/fsl/dpaa2-console.c | 15 +- drivers/soc/mediatek/mtk-svs.c | 15 +- drivers/soc/qcom/cmd-db.c | 2 +- drivers/soc/qcom/qcom_aoss.c | 14 +- drivers/soc/qcom/rmtfs_mem.c | 38 +- drivers/soc/qcom/socinfo.c | 4 +- drivers/spi/spidev.c | 33 +- drivers/staging/axis-fifo/axis-fifo.c | 35 +- drivers/staging/fieldbus/dev_core.c | 6 +- drivers/staging/greybus/camera.c | 22 +- drivers/staging/greybus/raw.c | 6 +- drivers/staging/media/av7110/av7110_av.c | 6 +- drivers/staging/media/av7110/av7110_ca.c | 6 +- drivers/staging/pi433/pi433_if.c | 13 +- .../interface/vchiq_arm/vchiq_debugfs.c | 16 +- drivers/staging/vme_user/vme_user.c | 6 +- drivers/thunderbolt/debugfs.c | 19 +- drivers/tty/serial/pch_uart.c | 9 +- drivers/tty/vt/vc_screen.c | 32 +- drivers/ufs/core/ufs-debugfs.c | 14 +- drivers/uio/uio.c | 22 +- drivers/usb/chipidea/debug.c | 13 +- drivers/usb/class/cdc-wdm.c | 18 +- drivers/usb/class/usblp.c | 6 +- drivers/usb/class/usbtmc.c | 6 +- drivers/usb/core/devices.c | 3 +- drivers/usb/core/devio.c | 3 +- drivers/usb/dwc2/debugfs.c | 12 +- drivers/usb/dwc3/debugfs.c | 48 +- drivers/usb/fotg210/fotg210-hcd.c | 17 +- drivers/usb/gadget/function/f_fs.c | 6 +- drivers/usb/gadget/function/f_hid.c | 17 +- drivers/usb/gadget/function/f_printer.c | 26 +- drivers/usb/gadget/legacy/inode.c | 6 +- drivers/usb/gadget/udc/atmel_usba_udc.c | 15 +- drivers/usb/gadget/udc/renesas_usb3.c | 14 +- drivers/usb/host/ehci-dbg.c | 19 +- drivers/usb/host/ohci-dbg.c | 17 +- drivers/usb/host/uhci-debug.c | 9 +- drivers/usb/host/xhci-debugfs.c | 28 +- drivers/usb/image/mdc800.c | 15 +- drivers/usb/misc/adutux.c | 6 +- drivers/usb/misc/chaoskey.c | 13 +- drivers/usb/misc/idmouse.c | 15 +- drivers/usb/misc/iowarrior.c | 6 +- drivers/usb/misc/ldusb.c | 24 +- drivers/usb/misc/legousbtower.c | 26 +- drivers/usb/misc/sisusbvga/sisusbvga.c | 6 +- drivers/usb/misc/usblcd.c | 20 +- drivers/usb/misc/yurex.c | 19 +- drivers/usb/mon/mon_bin.c | 3 +- drivers/usb/mon/mon_stat.c | 9 +- drivers/usb/mon/mon_text.c | 6 +- drivers/usb/mtu3/mtu3_debugfs.c | 40 +- drivers/usb/musb/musb_debugfs.c | 24 +- drivers/usb/usb-skeleton.c | 26 +- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 31 +- drivers/vfio/pci/mlx5/main.c | 6 +- drivers/vfio/pci/pds/lm.c | 32 +- drivers/vfio/vfio_main.c | 6 +- drivers/video/fbdev/core/fb_chrdev.c | 6 +- drivers/video/fbdev/pxa3xx-gcu.c | 12 +- drivers/virt/fsl_hypervisor.c | 14 +- drivers/watchdog/acquirewdt.c | 8 +- drivers/watchdog/advantechwdt.c | 8 +- drivers/watchdog/alim1535_wdt.c | 8 +- drivers/watchdog/alim7101_wdt.c | 8 +- drivers/watchdog/at91rm9200_wdt.c | 7 +- drivers/watchdog/ath79_wdt.c | 9 +- drivers/watchdog/cpu5wdt.c | 6 +- drivers/watchdog/cpwd.c | 13 +- drivers/watchdog/eurotechwdt.c | 14 +- drivers/watchdog/gef_wdt.c | 9 +- drivers/watchdog/geodewdt.c | 8 +- drivers/watchdog/ib700wdt.c | 8 +- drivers/watchdog/ibmasr.c | 8 +- drivers/watchdog/indydog.c | 6 +- drivers/watchdog/it8712f_wdt.c | 8 +- drivers/watchdog/m54xx_wdt.c | 9 +- drivers/watchdog/machzwd.c | 8 +- drivers/watchdog/mei_wdt.c | 18 +- drivers/watchdog/mixcomwd.c | 9 +- drivers/watchdog/mtx-1_wdt.c | 6 +- drivers/watchdog/nv_tco.c | 8 +- drivers/watchdog/pc87413_wdt.c | 14 +- drivers/watchdog/pcwd.c | 15 +- drivers/watchdog/pcwd_pci.c | 15 +- drivers/watchdog/pcwd_usb.c | 16 +- drivers/watchdog/pika_wdt.c | 9 +- drivers/watchdog/rc32434_wdt.c | 8 +- drivers/watchdog/rdc321x_wdt.c | 6 +- drivers/watchdog/riowd.c | 6 +- drivers/watchdog/sa1100_wdt.c | 6 +- drivers/watchdog/sb_wdog.c | 8 +- drivers/watchdog/sbc60xxwdt.c | 8 +- drivers/watchdog/sbc7240_wdt.c | 8 +- drivers/watchdog/sbc8360.c | 9 +- drivers/watchdog/sbc_epx_c3.c | 6 +- drivers/watchdog/sbc_fitpc2_wdt.c | 9 +- drivers/watchdog/sc1200wdt.c | 9 +- drivers/watchdog/sc520_wdt.c | 8 +- drivers/watchdog/sch311x_wdt.c | 8 +- drivers/watchdog/scx200_wdt.c | 9 +- drivers/watchdog/smsc37b787_wdt.c | 8 +- drivers/watchdog/w83877f_wdt.c | 8 +- drivers/watchdog/w83977f_wdt.c | 8 +- drivers/watchdog/wafer5823wdt.c | 8 +- drivers/watchdog/watchdog_dev.c | 10 +- drivers/watchdog/wdrtas.c | 21 +- drivers/watchdog/wdt.c | 28 +- drivers/watchdog/wdt285.c | 7 +- drivers/watchdog/wdt977.c | 9 +- drivers/watchdog/wdt_pci.c | 21 +- drivers/xen/evtchn.c | 25 +- drivers/xen/mcelog.c | 17 +- drivers/xen/xenbus/xenbus_dev_frontend.c | 24 +- drivers/xen/xenfs/super.c | 7 +- drivers/xen/xenfs/xenstored.c | 11 +- drivers/xen/xenfs/xensyms.c | 2 +- fs/9p/vfs_dir.c | 4 +- fs/adfs/dir.c | 2 +- fs/affs/dir.c | 2 +- fs/autofs/root.c | 4 +- fs/bcachefs/chardev.c | 10 +- fs/bcachefs/debug.c | 24 +- fs/bcachefs/fs.c | 2 +- fs/bcachefs/thread_with_file.c | 14 +- fs/befs/linuxvfs.c | 2 +- fs/bfs/dir.c | 2 +- fs/binfmt_misc.c | 27 +- fs/btrfs/inode.c | 2 +- fs/cachefiles/daemon.c | 35 +- fs/cachefiles/internal.h | 4 +- fs/cachefiles/ondemand.c | 5 +- fs/ceph/dir.c | 15 +- fs/coda/dir.c | 2 +- fs/coda/psdev.c | 17 +- fs/configfs/dir.c | 2 +- fs/cramfs/inode.c | 2 +- fs/debugfs/file.c | 160 +++--- fs/dlm/debug_fs.c | 51 +- fs/dlm/plock.c | 16 +- fs/dlm/user.c | 17 +- fs/ecryptfs/file.c | 2 +- fs/ecryptfs/miscdev.c | 24 +- fs/efivarfs/file.c | 31 +- fs/efs/dir.c | 2 +- fs/erofs/dir.c | 2 +- fs/eventfd.c | 12 +- fs/exfat/dir.c | 2 +- fs/ext2/dir.c | 2 +- fs/ext4/dir.c | 2 +- fs/f2fs/dir.c | 2 +- fs/fat/dir.c | 2 +- fs/file_table.c | 4 +- fs/freevxfs/vxfs_lookup.c | 2 +- fs/fsopen.c | 11 +- fs/fuse/control.c | 86 ++- fs/fuse/dir.c | 2 +- fs/gfs2/glock.c | 6 +- fs/hfs/dir.c | 2 +- fs/hfsplus/dir.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/dir.c | 2 +- fs/isofs/dir.c | 2 +- fs/jffs2/dir.c | 2 +- fs/jfs/namei.c | 2 +- fs/kernfs/dir.c | 2 +- fs/libfs.c | 127 ++++- fs/minix/dir.c | 2 +- fs/nfs/dir.c | 2 +- fs/nfsd/nfs4state.c | 5 +- fs/nfsd/nfsctl.c | 10 +- fs/nilfs2/dir.c | 2 +- fs/notify/fanotify/fanotify_user.c | 6 +- fs/notify/inotify/inotify_user.c | 3 +- fs/ntfs3/dir.c | 2 +- fs/ocfs2/cluster/heartbeat.c | 15 +- fs/ocfs2/cluster/netdebug.c | 17 +- fs/ocfs2/dlm/dlmdebug.c | 18 +- fs/ocfs2/dlmfs/dlmfs.c | 38 +- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/file.c | 4 +- fs/ocfs2/stack_user.c | 6 +- fs/ocfs2/super.c | 15 +- fs/omfs/dir.c | 2 +- fs/open.c | 4 +- fs/openpromfs/inode.c | 4 +- fs/orangefs/devorangefs-req.c | 23 +- fs/orangefs/dir.c | 2 +- fs/orangefs/orangefs-debugfs.c | 42 +- fs/overlayfs/readdir.c | 2 +- fs/proc/array.c | 2 +- fs/proc/base.c | 328 ++++++------ fs/proc/fd.c | 6 +- fs/proc/generic.c | 2 +- fs/proc/inode.c | 18 +- fs/proc/namespaces.c | 2 +- fs/proc/proc_net.c | 2 +- fs/proc/proc_sysctl.c | 2 +- fs/proc/root.c | 2 +- fs/proc/task_mmu.c | 37 +- fs/proc/task_nommu.c | 2 +- fs/pstore/ftrace.c | 16 +- fs/pstore/inode.c | 13 +- fs/pstore/pmsg.c | 3 +- fs/qnx4/dir.c | 2 +- fs/qnx6/dir.c | 2 +- fs/read_write.c | 74 ++- fs/reiserfs/dir.c | 2 +- fs/romfs/super.c | 2 +- fs/smb/client/cifsfs.c | 2 +- fs/squashfs/dir.c | 2 +- fs/sysv/dir.c | 2 +- fs/tracefs/event_inode.c | 2 +- fs/tracefs/inode.c | 12 +- fs/ubifs/debug.c | 57 +- fs/ubifs/dir.c | 2 +- fs/udf/dir.c | 2 +- fs/ufs/dir.c | 2 +- fs/vboxsf/dir.c | 2 +- fs/xfs/scrub/stats.c | 27 +- fs/xfs/xfs_file.c | 2 +- fs/zonefs/super.c | 2 +- include/drm/drm_accel.h | 2 +- include/drm/drm_file.h | 3 +- include/drm/drm_gem.h | 2 +- include/drm/drm_gem_dma_helper.h | 2 +- include/linux/debugfs.h | 55 +- include/linux/fs.h | 48 +- include/linux/ftrace.h | 11 +- include/linux/kstrtox.h | 33 +- include/linux/nsc_gpio.h | 8 +- include/linux/seq_file.h | 8 +- include/linux/string.h | 4 + include/linux/string_helpers.h | 3 +- include/linux/uio.h | 3 + include/linux/user_namespace.h | 10 +- include/misc/cxl.h | 3 +- include/net/cfg80211.h | 24 +- io_uring/rw.c | 70 --- ipc/mqueue.c | 10 +- kernel/bpf/bpf_iter.c | 14 +- kernel/bpf/inode.c | 2 +- kernel/bpf/syscall.c | 18 +- kernel/dma/debug.c | 15 +- kernel/events/core.c | 3 +- kernel/fail_function.c | 10 +- kernel/gcov/fs.c | 23 +- kernel/irq/debugfs.c | 12 +- kernel/kcsan/debugfs.c | 10 +- kernel/kprobes.c | 15 +- kernel/locking/lock_events.c | 18 +- kernel/locking/lock_events.h | 4 +- kernel/locking/qspinlock_stat.h | 7 +- kernel/module/stats.c | 8 +- kernel/module/tracking.c | 2 +- kernel/power/qos.c | 21 +- kernel/power/user.c | 28 +- kernel/printk/printk.c | 12 +- kernel/relay.c | 20 +- kernel/sched/debug.c | 53 +- kernel/time/posix-clock.c | 3 +- kernel/time/test_udelay.c | 10 +- kernel/trace/blktrace.c | 19 +- kernel/trace/ftrace.c | 68 ++- kernel/trace/rv/rv.c | 58 +- kernel/trace/rv/rv_reactors.c | 32 +- kernel/trace/trace.c | 386 ++++++-------- kernel/trace/trace_dynevent.c | 5 +- kernel/trace/trace_events.c | 116 ++-- kernel/trace/trace_events_hist.c | 4 +- kernel/trace/trace_events_inject.c | 19 +- kernel/trace/trace_events_synth.c | 5 +- kernel/trace/trace_events_trigger.c | 22 +- kernel/trace/trace_events_user.c | 17 +- kernel/trace/trace_functions_graph.c | 20 +- kernel/trace/trace_hwlat.c | 20 +- kernel/trace/trace_kprobe.c | 7 +- kernel/trace/trace_osnoise.c | 42 +- kernel/trace/trace_printk.c | 2 +- kernel/trace/trace_recursion_record.c | 10 +- kernel/trace/trace_sched_switch.c | 21 +- kernel/trace/trace_stack.c | 27 +- kernel/trace/trace_stat.c | 2 +- kernel/trace/trace_uprobe.c | 7 +- kernel/user_namespace.c | 39 +- lib/dynamic_debug.c | 5 +- lib/kstrtox.c | 46 +- lib/kunit/debugfs.c | 13 +- lib/string_helpers.c | 14 +- lib/test_firmware.c | 10 +- lib/xz/xz_dec_test.c | 9 +- mm/damon/dbgfs.c | 84 +-- mm/huge_memory.c | 10 +- mm/kmemleak.c | 5 +- mm/page_owner.c | 5 +- mm/shrinker_debug.c | 12 +- mm/slub.c | 2 +- mm/util.c | 57 ++ mm/vmscan.c | 14 +- net/6lowpan/debugfs.c | 14 +- net/bluetooth/6lowpan.c | 12 +- net/bluetooth/hci_debugfs.c | 150 +++--- net/bluetooth/selftest.c | 9 +- net/bluetooth/smp.c | 9 +- net/core/datagram.c | 10 +- net/l2tp/l2tp_debugfs.c | 2 +- net/mac80211/debugfs.c | 185 +++---- net/mac80211/debugfs.h | 4 +- net/mac80211/debugfs_key.c | 81 ++- net/mac80211/debugfs_netdev.c | 126 ++--- net/mac80211/debugfs_sta.c | 146 +++-- net/mac80211/rate.c | 10 +- net/mac80211/rc80211_minstrel_ht_debugfs.c | 11 +- net/rfkill/core.c | 22 +- net/sunrpc/cache.c | 14 +- net/sunrpc/debugfs.c | 4 +- net/sunrpc/rpc_pipe.c | 8 +- net/wireless/debugfs.c | 57 +- samples/vfio-mdev/mtty.c | 30 +- security/apparmor/apparmorfs.c | 55 +- security/inode.c | 9 +- security/integrity/evm/evm_secfs.c | 60 +-- security/integrity/ima/ima_fs.c | 41 +- security/landlock/syscalls.c | 15 +- security/lockdown/lockdown.c | 10 +- security/safesetid/securityfs.c | 14 +- security/selinux/selinuxfs.c | 168 +++--- security/smack/smackfs.c | 281 +++++----- security/tomoyo/securityfs_if.c | 21 +- sound/core/compress_offload.c | 7 +- sound/core/control.c | 14 +- sound/core/hwdep.c | 6 +- sound/core/init.c | 10 +- sound/core/jack.c | 83 ++- sound/core/oss/pcm_oss.c | 6 +- sound/core/pcm_native.c | 22 +- sound/core/rawmidi.c | 6 +- sound/core/seq/oss/seq_oss.c | 11 +- sound/core/seq/seq_clientmgr.c | 8 +- sound/core/timer.c | 23 +- sound/drivers/pcmtest.c | 36 +- sound/oss/dmasound/dmasound_core.c | 8 +- sound/soc/fsl/imx-audmux.c | 11 +- sound/soc/intel/avs/debugfs.c | 69 +-- sound/soc/intel/avs/pcm.c | 9 +- sound/soc/intel/skylake/skl-debug.c | 19 +- sound/soc/soc-dapm.c | 21 +- sound/soc/soc-pcm.c | 10 +- sound/soc/sof/debug.c | 34 +- sound/soc/sof/ipc3-dtrace.c | 17 +- sound/soc/sof/ipc4-mtrace.c | 17 +- sound/soc/sof/ipc4-telemetry.c | 14 +- sound/soc/sof/sof-client-ipc-flood-test.c | 19 +- .../soc/sof/sof-client-ipc-kernel-injector.c | 15 +- sound/soc/sof/sof-client-ipc-msg-injector.c | 67 ++- sound/soc/sof/sof-client-probes.c | 31 +- virt/kvm/kvm_main.c | 10 +- 859 files changed, 11379 insertions(+), 12492 deletions(-)
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerPATCH 1/437 fs: split do_loop_readv_writev() into separate read/write side helpers
No functional changes, just in preparation for using these separately.
--- fs/read_write.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-)
fs/read_write.c +33 -10
@@ -746,8 +746,10 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, }/* Do it by hand, with file-ops */ -static ssize_t do_loop_readv_writev (struct file *filp,struct iov_iter *iter, -loff_t *ppos,int type,rwf_t flags) +static ssize_t do_loop_readv (struct file *file,struct iov_iter *iter, +loff_t *ppos,rwf_t flags, +ssize_t (*read)(struct file *,char __user *, +size_t ,loff_t *)) {ssize_t ret =0 ;
@@ -757,14 +759,35 @@ static ssize_t do_loop_readv_writev(struct file *filp, struct iov_iter *iter,while (iov_iter_count (iter)) {ssize_t nr; -if (type ==READ ) { - nr = filp->f_op->read (filp,iter_iov_addr (iter), -iter_iov_len (iter), ppos); - }else { - nr = filp->f_op->write (filp,iter_iov_addr (iter), -iter_iov_len (iter), ppos); + nr =read (file,iter_iov_addr (iter),iter_iov_len (iter), ppos); +if (nr <0 ) { +if (!ret) + ret = nr; +break ; } + ret += nr; +if (nr !=iter_iov_len (iter)) +break ; +iov_iter_advance (iter, nr); + } + +return ret; +} + +static ssize_t do_loop_writev (struct file *file,struct iov_iter *iter, +loff_t *ppos,rwf_t flags, +ssize_t (*write)(struct file *,const char __user *, +size_t ,loff_t *)) +{ +ssize_t ret =0 ; + +if (flags & ~RWF_HIPRI ) +return -EOPNOTSUPP ; + +while (iov_iter_count (iter)) { +ssize_t nr; + nr =write (file,iter_iov_addr (iter),iter_iov_len (iter), ppos);if (nr <0 ) {if (!ret) ret = nr;
@@ -931,7 +954,7 @@ static ssize_t vfs_readv(struct file *file, const struct iovec __user *vec,if (file->f_op->read_iter) ret =do_iter_readv_writev (file, &iter, pos,READ , flags);else - ret =do_loop_readv_writev (file, &iter, pos,READ , flags); + ret =do_loop_readv (file, &iter, pos, flags, file->f_op->read); out:if (ret >=0 )fsnotify_access (file);
@@ -970,7 +993,7 @@ static ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,if (file->f_op->write_iter) ret =do_iter_readv_writev (file, &iter, pos,WRITE , flags);else - ret =do_loop_readv_writev (file, &iter, pos,WRITE , flags); + ret =do_loop_writev (file, &iter, pos, flags, file->f_op->write);if (ret >0 )fsnotify_modify (file);file_end_write (file);
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 2/437 fs: add generic read/write iterator helpers
In reply to Jens AxboeWe already do this internally for vfs_readv() and vfs_writev(), which need to check what method to use. Add generic helpers for this so that drivers can do this themselves, if they haven't converted to using the read/write iterator file_operations hooks just yet.
--- fs/read_write.c | 18 ++++++++++++++++++ include/linux/fs.h | 6 ++++++ 2 files changed, 24 insertions(+)
fs/read_write.c +18 -0
@@ -802,6 +802,24 @@ static ssize_t do_loop_writev(struct file *file, struct iov_iter *iter,return ret; } +/* generic read side helper for drivers converting to ->read_iter() */ +ssize_t vfs_read_iter (struct kiocb *iocb,struct iov_iter *to, +ssize_t (*read)(struct file *,char __user *, +size_t ,loff_t *)) +{ +return do_loop_readv (iocb->ki_filp, to, &iocb->ki_pos,0 , read); +} +EXPORT_SYMBOL (vfs_read_iter); + +/* generic write side helper for drivers converting to ->write_iter() */ +ssize_t vfs_write_iter (struct kiocb *iocb,struct iov_iter *from, +ssize_t (*write)(struct file *,const char __user *, +size_t ,loff_t *)) +{ +return do_loop_writev (iocb->ki_filp, from, &iocb->ki_pos,0 , write); +} +EXPORT_SYMBOL (vfs_write_iter); +ssize_t vfs_iocb_iter_read (struct file *file,struct kiocb *iocb,struct iov_iter *iter) {
include/linux/fs.h +6 -0
@@ -2119,6 +2119,12 @@ extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);extern ssize_t vfs_write (struct file *,const char __user *,size_t ,loff_t *);extern ssize_t vfs_copy_file_range (struct file *,loff_t ,struct file *,loff_t ,size_t ,unsigned int ); +ssize_t vfs_write_iter (struct kiocb *iocb,struct iov_iter *from, +ssize_t (*write)(struct file *,const char __user *, +size_t ,loff_t *)); +ssize_t vfs_read_iter (struct kiocb *iocb,struct iov_iter *to, +ssize_t (*read)(struct file *,char __user *, +size_t ,loff_t *)); int __generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, loff_t *len, unsigned int remap_flags,
Signature · 1 line
2.43.0
Al Viro
maintainerRe: [PATCH 002/437] fs: add generic read/write iterator helpers
Quoted 7 lines · Jens Axboe
fs/read_write.c +7
-0+/* generic read side helper for drivers converting to ->read_iter() */ +ssize_t vfs_read_iter (struct kiocb *iocb,struct iov_iter *to, +ssize_t (*read)(struct file *,char __user *, +size_t ,loff_t *)) +{ +return do_loop_readv (iocb->ki_filp, to, &iocb->ki_pos,0 , read); +}
fs/read_write.c static ssize_t do_loop_writev(struct file *file, struct iov_iter *iter, · line 821
Quoted 10 lines
fs/read_write.c +10
-0+EXPORT_SYMBOL (vfs_read_iter); + +/* generic write side helper for drivers converting to ->write_iter() */ +ssize_t vfs_write_iter (struct kiocb *iocb,struct iov_iter *from, +ssize_t (*write)(struct file *,const char __user *, +size_t ,loff_t *)) +{ +return do_loop_writev (iocb->ki_filp, from, &iocb->ki_pos,0 , write); +} +EXPORT_SYMBOL (vfs_write_iter);
Wait a minute; just what do you expect to happen if that ever gets called for ITER_BVEC or ITER_XARRAY?
Jens Axboe
maintainerRe: [PATCH 002/437] fs: add generic read/write iterator helpers
Quoted 14 lines · Al Viro
Quoted 12 lines · Jens Axboe
fs/read_write.c +12
-0+/* generic read side helper for drivers converting to ->read_iter() */ +ssize_t vfs_read_iter (struct kiocb *iocb,struct iov_iter *to, +ssize_t (*read)(struct file *,char __user *, +size_t ,loff_t *)) +{ +return do_loop_readv (iocb->ki_filp, to, &iocb->ki_pos,0 , read); +} +EXPORT_SYMBOL (vfs_read_iter); + +/* generic write side helper for drivers converting to ->write_iter() */ +ssize_t vfs_write_iter(struct kiocb *iocb, struct iov_iter *from, + ssize_t (*write)(struct file *, const char __user *,
Quoted 8 lines
fs/read_write.c static ssize_t do_loop_writev(struct file *file, struct iov_iter *iter, · line 821
Quoted 5 lines
fs/read_write.c +5
-0+ size_t, loff_t *)) +{ +return do_loop_writev (iocb->ki_filp, from, &iocb->ki_pos,0 , write); +} +EXPORT_SYMBOL (vfs_write_iter);Wait a minute; just what do you expect to happen if that ever gets called for
ITER_BVECorITER_XARRAY?
do_loop_{readv,writev} need to look like the one io_uring had, which was just an augmented version of the fs/ version. At least for handling anything that is IOVEC/UBUF/BVEC. Outside of that, should not be callable for eg ITER_XARRAY, who would do that? We should probably add a check at the top of each just to vet the iter type and -EINVAL if it's not one of the supported ones. With a WARN_ON_ONCE(), I suspect.
I'll be posting the first patches separately again, I've made some local tweaks, with some drivers that can support it as-is. Just haven't gotten around to doing this weeks iteration on it yet.
Signature · 1 line
Jens Axboe
Al Viro
maintainerRe: [PATCH 002/437] fs: add generic read/write iterator helpers
Quoted 3 lines · Jens Axboe
do_loop_{readv,writev} need to look like the one
io_uringhad, which was just an augmented version of thefs/version. At least for handling anything that is IOVEC/UBUF/BVEC.
IOVEC and UBUF: pointer will be __user one; copy_from_user() works.
KVEC: kernel pointer. Try copy_from_user() on that on x86 with SMAP (or on e.g. sparc64, etc.) and you'll get an oops.
BVEC: page + offset, page quite possibly not mapped anywhere in kernel page tables. And "just kmap() around the call of your callback" is not a good idea either, for even more reason that for KVEC.
Jens Axboe
maintainerRe: [PATCH 002/437] fs: add generic read/write iterator helpers
Quoted 6 lines · Al Viro
Quoted 3 lines · Jens Axboe
do_loop_{readv,writev} need to look like the one
io_uringhad, which was just an augmented version of thefs/version. At least for handling anything that is IOVEC/UBUF/BVEC.
Quoted 6 lines
IOVEC and UBUF: pointer will be
__userone;copy_from_user()works.
KVEC: kernel pointer. Trycopy_from_user()on that on x86 with SMAP (or on e.g. sparc64, etc.) and you'll get an oops.
BVEC: page + offset, page quite possibly not mapped anywhere in kernel page tables. And "justkmap()around the call of your callback" is not a good idea either, for even more reason that for KVEC.
The old read/write path only handled user pointers, with the exception being bvecs mapped on the io_uring side (which the io_uring version dealt with) which also originally came from user pointers. So just user memory. Why would we need to expand that now? Who would be doing ->read_iter() or ->write_iter() with something that isn't either UBUF or IOVEC? Because that would break horrible as it is in the current kernel.
Signature · 1 line
Jens Axboe
Al Viro
maintainerRe: [PATCH 002/437] fs: add generic read/write iterator helpers
Quoted 6 lines · Jens Axboe
The old read/write path only handled user pointers, with the exception being bvecs mapped on the
io_uringside (which theio_uringversion dealt with) which also originally came from user pointers. So just user memory. Why would we need to expand that now? Who would be doing ->read_iter() or ->write_iter() with something that isn't either UBUF or IOVEC? Because that would break horrible as it is in the current kernel.
No, it will not. And yes, it does happen. Look, for example, at fs/coredump.c:dump_emit_page(). ->write_iter() (regular file or pipe one) is called. On ITER_BVEC.
It happens, and not only there. Look at how /dev/loop works, for crying out loud! You get a struct request; the backing pages might very well have _never_ been mapped to any userland address (e.g. when it's something like a directory block). And you hit this:
static int lo_write_simple(struct loop_device *lo, struct request *rq,
loff_t pos)
{
struct bio_vec bvec;
struct req_iterator iter;
int ret = 0;
rq_for_each_segment(bvec, rq, iter) {
ret = lo_write_bvec(lo->lo_backing_file, &bvec, &pos);
if (ret < 0)
break;
cond_resched();
}
return ret;
}with lo_write_bvec() being
static int lo_write_bvec(struct file *file, struct bio_vec *bvec, loff_t *ppos)
{
struct iov_iter i;
ssize_t bw;
iov_iter_bvec(&i, ITER_SOURCE, bvec, 1, bvec->bv_len);
bw = vfs_iter_write(file, &i, ppos, 0);
if (likely(bw == bvec->bv_len))
return 0;
printk_ratelimited(KERN_ERR
"loop: Write error at byte offset %llu, length %i.\n",
(unsigned long long)*ppos, bvec->bv_len);
if (bw >= 0)
bw = -EIO;
return bw;
}Neither ->read_iter() nor ->write_iter() can make an assumption that it will be used with userland buffer. And yes, it works...
RE: [PATCH 002/437] fs: add generic read/write iterator helpers
In reply to Al ViroFrom: Al Viro
Quoted 16 lines
Sent: 15 April 2024 20:55
Quoted 12 lines · Jens Axboe
fs/read_write.c +12
-0+/* generic read side helper for drivers converting to ->read_iter() */ +ssize_t vfs_read_iter (struct kiocb *iocb,struct iov_iter *to, +ssize_t (*read)(struct file *,char __user *, +size_t ,loff_t *)) +{ +return do_loop_readv (iocb->ki_filp, to, &iocb->ki_pos,0 , read); +} +EXPORT_SYMBOL (vfs_read_iter); + +/* generic write side helper for drivers converting to ->write_iter() */ +ssize_t vfs_write_iter(struct kiocb *iocb, struct iov_iter *from, + ssize_t (*write)(struct file *, const char __user *,
Quoted 8 lines
fs/read_write.c static ssize_t do_loop_writev(struct file *file, struct iov_iter *iter, · line 821
Quoted 5 lines
fs/read_write.c +5
-0+ size_t, loff_t *)) +{ +return do_loop_writev (iocb->ki_filp, from, &iocb->ki_pos,0 , write); +} +EXPORT_SYMBOL (vfs_write_iter);Wait a minute; just what do you expect to happen if that ever gets called for
ITER_BVECorITER_XARRAY?
The extra indirect call is also going to be noticeable. You need a code loop with a direct call.
That probably requires the loop to be a #define.
I was also thinking about drivers that only handle 'user' buffers and where there really isn't a requirement to do anything else.
I've a driver that basically does:
if (!access_ok(....))
return -EFAULT;
for (off = 0; off < len; off += 8) {
if (__put_user(readq(io_addr + off), uaddr + off))
return -EFAULT;
}Any non-trivial change requires a function that return the first/only user buffer address/length and an error for a non-user address.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Jens Axboe
maintainerPATCH 3/437 fs: add helpers for defining read/write iterator helpers
In reply to Jens AxboeTo ease conversion for drivers, add helpers that allow a driver to simply wrap their existing read/write file_operations hook and turn it into one that is appropriate for ->read_iter() or ->write_iter().
--- include/linux/fs.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
include/linux/fs.h +16 -0
@@ -2141,6 +2141,22 @@ extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, struct file *dst_file, loff_t dst_pos, loff_t len, unsigned int remap_flags); +/* +* Drivers can use these to ease transition to using ->read_iter() instead +* of ->read(), and ->write_iter() instead of ->write(). Ideally these will +* go away one day. +*/ +#define FOPS_READ_ITER_HELPER (name) \ +static ssize_t name## _iter(struct kiocb *iocb, struct iov_iter *to) \ +{ \ + return vfs_read_iter(iocb, to, name); \ +} +#define FOPS_WRITE_ITER_HELPER (name) \ +static ssize_t name## _iter(struct kiocb *iocb, struct iov_iter *from) \ +{ \ + return vfs_write_iter(iocb, from, name); \ +} +/** * enum freeze_holder - holder of the freeze * @FREEZE_HOLDER_KERNEL: kernel wants to freeze or thaw filesystem
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 4/437 fs: add simple_copy_{to,from}_iter() helpers
In reply to Jens AxboeWhile doing so, rename the networking helper that has the same name.
--- fs/libfs.c | 73 ++++++++++++++++++++++++++++++++++++++++++++- include/linux/fs.h | 5 ++++ net/core/datagram.c | 10 +++---- 3 files changed, 82 insertions(+), 6 deletions(-)
fs/libfs.c +72 -1
@@ -1102,13 +1102,84 @@ ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,if (count > available - pos) count = available - pos; res =copy_from_user (to + pos, from, count); +if (res <0 ) +return res; + count -= res; + *ppos = pos + count; +return count; +} +EXPORT_SYMBOL (simple_write_to_buffer); + +/** +* simple_copy_to_iter - copy data userspace to iter +* @from: the buffer to read from +* @ppos: the current position in the buffer +* @count: the maximum number of bytes to copy +* @to: the iov_iter to copy to +* +* The simple_copy_to_iter() function reads up to @count bytes from the +* buffer @from at offset @ppos into the user space address starting at @to. +* +* On success, the number of bytes copied is returned, or negative value is +* returned on error. +**/ +ssize_t simple_copy_to_iter (const void *from,loff_t *ppos,size_t count, +struct iov_iter *to) +{ +size_t available =iov_iter_count (to); +loff_t pos = *ppos; +size_t ret; + +if (pos <0 ) +return -EINVAL ; +if (pos >= available || !count) +return 0 ; +if (count > available - pos) + count = available - pos; + ret =copy_to_iter (from + pos, count, to); +if (ret <0 ) +return ret; + count -= ret; + *ppos = pos + count; +return count; +} +EXPORT_SYMBOL (simple_copy_to_iter); + +/** +* simple_copy_from_iter - copy data from iter to user space buffer +* @to: the buffer to write to +* @available: the size of the buffer +* @ppos: the current position in the buffer +* @from: the user space buffer to read from +* @count: the maximum number of bytes to read +* +* The simple_write_to_buffer() function reads up to @count bytes from the user +* space address starting at @from into the buffer @to at offset @ppos. +* +* On success, the number of bytes written is returned and the offset @ppos is +* advanced by this number, or negative value is returned on error. +**/ +ssize_t simple_copy_from_iter (void *to,loff_t *ppos,size_t count, +struct iov_iter *from) +{ +size_t available =iov_iter_count (to); +loff_t pos = *ppos; +size_t res; + +if (pos <0 ) +return -EINVAL ; +if (pos >= available || !count) +return 0 ; +if (count > available - pos) + count = available - pos; + res =copy_from_iter (to + pos, count, from);if (res == count)return -EFAULT ; count -= res; *ppos = pos + count;return count; } -EXPORT_SYMBOL (simple_write_to_buffer); +EXPORT_SYMBOL (simple_copy_from_iter);/** * memory_read_from_buffer - copy data from the buffer
include/linux/fs.h +5 -0
@@ -3353,6 +3353,11 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count,extern ssize_t simple_write_to_buffer (void *to,size_t available,loff_t *ppos,const void __user *from,size_t count); +ssize_t simple_copy_to_iter (const void *from,loff_t *ppos,size_t count, +struct iov_iter *to); +ssize_t simple_copy_from_iter (void *to,loff_t *ppos,size_t count, +struct iov_iter *from); +struct offset_ctx {struct maple_tree mt;unsigned long next_offset;
net/core/datagram.c +5 -5
@@ -399,7 +399,7 @@ int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags) }EXPORT_SYMBOL (skb_kill_datagram); -INDIRECT_CALLABLE_DECLARE(static size_t simple_copy_to_iter(const void *addr, +INDIRECT_CALLABLE_DECLARE(static size_t __simple_copy_to_iter(const void *addr,size_t bytes,void *data__always_unused ,struct iov_iter *i));
@@ -417,7 +417,7 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,if (copy >0 ) {if (copy > len) copy = len; - n =INDIRECT_CALL_1 (cb, simple_copy_to_iter, + n =INDIRECT_CALL_1 (cb, __simple_copy_to_iter, skb->data + offset, copy, data, to); offset += n;if (n != copy)
@@ -440,7 +440,7 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,if (copy > len) copy = len; - n =INDIRECT_CALL_1 (cb, simple_copy_to_iter, + n =INDIRECT_CALL_1 (cb, __simple_copy_to_iter, vaddr +skb_frag_off (frag) + offset - start, copy, data, to);kunmap (page);
@@ -526,7 +526,7 @@ int skb_copy_and_hash_datagram_iter(const struct sk_buff *skb, int offset, }EXPORT_SYMBOL (skb_copy_and_hash_datagram_iter); -static size_t simple_copy_to_iter (const void *addr,size_t bytes, +static size_t __simple_copy_to_iter (const void *addr,size_t bytes,void *data__always_unused ,struct iov_iter *i) {return copy_to_iter (addr, bytes, i);
@@ -544,7 +544,7 @@ int skb_copy_datagram_iter(const struct sk_buff *skb, int offset, {trace_skb_copy_datagram_iovec (skb, len);return __skb_datagram_iter (skb, offset, to, len, false, - simple_copy_to_iter,NULL ); + __simple_copy_to_iter,NULL ); }EXPORT_SYMBOL (skb_copy_datagram_iter);
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 5/437 uio: add get/put_iter helpers
In reply to Jens AxboeFor users that currently do put_user(val, uaddr) or get_user(val, uaddr), add iterator versions that do the same thing.
--- include/linux/uio.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/uio.h +3 -0
@@ -215,6 +215,9 @@ bool copy_to_iter_full(const void *addr, size_t bytes, struct iov_iter *i)return false; } +#define put_iter (val, to) !copy_to_iter_full(&(val), sizeof((val)), to) +#define get_iter (val, from) !copy_from_iter_full(&(val), sizeof((val)), from) +static __always_inline __must_check bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i) {
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 6/437 fs: add uio.h to fs.h
In reply to Jens AxboeMost conversions will end up pulling in fs.h already, but not uio.h. As the fs iterators will need that, just include it from fs.h rather than need to add it everywhere. It's pretty natural to need user copy helpers for read/write operators anyway.
--- include/linux/fs.h | 1 + 1 file changed, 1 insertion(+)
include/linux/fs.h +1 -0
@@ -45,6 +45,7 @@#include <linux/slab.h> #include <linux/maple_tree.h> #include <linux/rw_hint.h> +#include <linux/uio.h> #include <asm/byteorder.h> #include <uapi/linux/fs.h>
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 7/437 mm/util: add iterdup_nul() and iterdup() helpers
In reply to Jens AxboeThis is identical to the memdup variants, except it operates on a struct iov_iter rather than a direct user pointer.
--- include/linux/string.h | 4 +++ mm/util.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+)
include/linux/string.h +4 -0
@@ -18,6 +18,10 @@ extern void *memdup_user(const void __user *, size_t);extern void *vmemdup_user (const void __user *,size_t );extern void *memdup_user_nul (const void __user *,size_t ); +struct iov_iter ; +void *iterdup_nul (struct iov_iter *,size_t ); +void *iterdup (struct iov_iter *,size_t ); +/** * memdup_array_user - duplicate array from user space * @src: source address in user space
mm/util.c +57 -0
69 lines not on this page · raw message
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 8/437 kstrtox: add iov_iter versions of the string conversion helpers
In reply to Jens Axboe--- include/linux/kstrtox.h | 25 +++++++++++++++++++++++++ lib/kstrtox.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+)
include/linux/kstrtox.h +25 -0
@@ -109,11 +109,26 @@ int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsignedint __must_check kstrtos8_from_user (const char __user *s,size_t count,unsigned int base,s8 *res);int __must_check kstrtobool_from_user (const char __user *s,size_t count,bool *res); +struct iov_iter ; +int __must_check kstrtoull_from_iter (struct iov_iter *s,size_t count,unsigned int base,unsigned long long *res); +int __must_check kstrtoul_from_iter (struct iov_iter *s,size_t count,unsigned int base,unsigned long *res); +int __must_check kstrtol_from_iter (struct iov_iter *s,size_t count,unsigned int base,long *res); +int __must_check kstrtouint_from_iter (struct iov_iter *s,size_t count,unsigned int base,unsigned int *res); +int __must_check kstrtoint_from_iter (struct iov_iter *s,size_t count,unsigned int base,int *res); +int __must_check kstrtou16_from_iter (struct iov_iter *s,size_t count,unsigned int base,u16 *res); +int __must_check kstrtou8_from_iter (struct iov_iter *s,size_t count,unsigned int base,u8 *res); +int __must_check kstrtobool_from_iter (struct iov_iter *src,size_t count,bool *res); +static inline int __must_check kstrtou64_from_user (const char __user *s,size_t count,unsigned int base,u64 *res) {return kstrtoull_from_user (s, count, base, res); } +static inline int __must_check kstrtou64_from_iter (struct iov_iter *src,size_t count,unsigned int base,u64 *res) +{ +return kstrtoull_from_iter (src, count, base, res); +} +static inline int __must_check kstrtos64_from_user (const char __user *s,size_t count,unsigned int base,s64 *res) {return kstrtoll_from_user (s, count, base, res);
@@ -124,11 +139,21 @@ static inline int __must_check kstrtou32_from_user(const char __user *s, size_treturn kstrtouint_from_user (s, count, base, res); } +static inline int __must_check kstrtou32_from_iter (struct iov_iter *src,size_t count,unsigned int base,u32 *res) +{ +return kstrtouint_from_iter (src, count, base, res); +} +static inline int __must_check kstrtos32_from_user (const char __user *s,size_t count,unsigned int base,s32 *res) {return kstrtoint_from_user (s, count, base, res); } +static inline int __must_check kstrtos32_from_iter (struct iov_iter *src,size_t count,unsigned int base,s32 *res) +{ +return kstrtoint_from_iter (src, count, base, res); +} +/* * Use kstrto<foo> instead. *
lib/kstrtox.c +40 -0
@@ -19,6 +19,7 @@#include <linux/math64.h> #include <linux/types.h> #include <linux/uaccess.h> +#include <linux/uio.h> #include "kstrtox.h"
@@ -405,6 +406,23 @@ int kstrtobool_from_user(const char __user *s, size_t count, bool *res) }EXPORT_SYMBOL (kstrtobool_from_user); +/* +* Like kstrtobool_from_user(), but takes a source iov_iter rather than a +* buffer. +*/ +int kstrtobool_from_iter (struct iov_iter *src,size_t count,bool *res) +{ +/* Longest string needed to differentiate, newline, terminator */ +char buf[4 ]; + + count =min (count,sizeof (buf) -1 ); +if (!copy_from_iter_full (buf, count, src)) +return -EFAULT ; + buf[count] ='\0' ; +return kstrtobool (buf, res); +} +EXPORT_SYMBOL (kstrtobool_from_iter); +#define kstrto_from_user (f, g, type) \ int f(const char __user *s, size_t count, unsigned int base, type *res) \ { \
@@ -429,3 +447,25 @@ kstrto_from_user(kstrtou16_from_user, kstrtou16, u16);kstrto_from_user (kstrtos16_from_user, kstrtos16, s16);kstrto_from_user (kstrtou8_from_user, kstrtou8, u8);kstrto_from_user (kstrtos8_from_user, kstrtos8, s8); + +#define kstrto_from_iter (f, g, type) \ +int f(struct iov_iter *s, size_t count, unsigned int base, type *res) \ +{ \ +/* sign, base 2 representation, newline, terminator */ \ +char buf[1 +sizeof (type) *8 +1 +1 ]; \ + \ + count =min (count,sizeof (buf) -1 ); \ +if (!copy_from_iter_full (buf, count, s)) \ +return -EFAULT ; \ + buf[count] ='\0' ; \ +return g (buf, base, res); \ +} \ +EXPORT_SYMBOL (f) + +kstrto_from_iter (kstrtoull_from_iter, kstrtoull,unsigned long long ); +kstrto_from_iter(kstrtoul_from_iter, kstrtoul, unsigned long); +kstrto_from_iter (kstrtol_from_iter, kstrtol, long); +kstrto_from_iter(kstrtouint_from_iter, kstrtouint, unsigned int); +kstrto_from_iter (kstrtoint_from_iter, kstrtoint, int); +kstrto_from_iter (kstrtou16_from_iter, kstrtou16, u16); +kstrto_from_iter (kstrtou8_from_iter, kstrtou8, u8);
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 9/437 lib/string_helpers: split __parse_int_array() into a helper
In reply to Jens AxboeNo functional changes, just in preparation for providing an iter based version.
--- lib/string_helpers.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-)
lib/string_helpers.c +25 -19
@@ -138,29 +138,11 @@ int string_get_size(u64 size, u64 blk_size, const enum string_size_units units, }EXPORT_SYMBOL (string_get_size); -/** -* parse_int_array_user - Split string into a sequence of integers -* @from: The user space buffer to read from -* @count: The maximum number of bytes to read -* @array: Returned pointer to sequence of integers -* -* On success @array is allocated and initialized with a sequence of -* integers extracted from the @from plus an additional element that -* begins the sequence and specifies the integers count. -* -* Caller takes responsibility for freeing @array when it is no longer -* needed. -*/ -int parse_int_array_user (const char __user *from,size_t count,int **array) +static int __parse_int_array (char *buf,int **array) {int *ints, nints; -char *buf;int ret =0 ; - buf =memdup_user_nul (from, count); -if (IS_ERR (buf)) -return PTR_ERR (buf); -get_options (buf,0 , &nints);if (!nints) { ret = -ENOENT ;
@@ -180,6 +162,30 @@ int parse_int_array_user(const char __user *from, size_t count, int **array)kfree (buf);return ret; } + +/** +* parse_int_array_user - Split string into a sequence of integers +* @from: The user space buffer to read from +* @count: The maximum number of bytes to read +* @array: Returned pointer to sequence of integers +* +* On success @array is allocated and initialized with a sequence of +* integers extracted from the @from plus an additional element that +* begins the sequence and specifies the integers count. +* +* Caller takes responsibility for freeing @array when it is no longer +* needed. +*/ +int parse_int_array_user (const char __user *from,size_t count,int **array) +{ +char *buf; + + buf =memdup_user_nul (from, count); +if (IS_ERR (buf)) +return PTR_ERR (buf); + +return __parse_int_array (buf, array); +}EXPORT_SYMBOL (parse_int_array_user);static bool unescape_space (char **src,char **dst)
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 10/437 lib/string_helpers: add parse_int_array_iter()
In reply to Jens AxboeWorks just like parse_int_array_user(), except it takes and iov_iter instead of a ubuf + length.
--- include/linux/string_helpers.h | 2 ++ lib/string_helpers.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+)
include/linux/string_helpers.h +2 -0
@@ -11,6 +11,7 @@struct device ;struct file ;struct task_struct ; +struct iov_iter ;static inline bool string_is_terminated (const char *s,int len) {
@@ -32,6 +33,7 @@ int string_get_size(u64 size, u64 blk_size, const enum string_size_units units, char *buf, int len);int parse_int_array_user (const char __user *from,size_t count,int **array); +int parse_int_array_iter (struct iov_iter *from,int **array);#define UNESCAPE_SPACE BIT(0)#define UNESCAPE_OCTAL BIT(1)
lib/string_helpers.c +19 -0
@@ -188,6 +188,25 @@ int parse_int_array_user(const char __user *from, size_t count, int **array) }EXPORT_SYMBOL (parse_int_array_user); +/** +* parse_int_array_iter - Split string into a sequence of integers +* @from: The iov_iter buffer to read from +* @array: Returned pointer to sequence of integers +* +* See @parse_int_array_user, this is just the iov_iter variant. +*/ +int parse_int_array_iter (struct iov_iter *from,int **array) +{ +char *buf; + + buf =iterdup_nul (from,iov_iter_count (from)); +if (IS_ERR (buf)) +return PTR_ERR (buf); + +return __parse_int_array (buf, array); +} +EXPORT_SYMBOL (parse_int_array_iter); +static bool unescape_space (char **src,char **dst) {char *p = *dst, *q = *src;
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 11/437 virtio_console: convert to read/write iterator helpers
In reply to Jens AxboeAdd stub read/write iterators which just use the VFS helpers, and kill the ->read() and ->write() usage.
--- drivers/char/virtio_console.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/char/virtio_console.c +4 -2
@@ -771,6 +771,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,return fill_readbuf (port, ubuf, count, true); } +FOPS_READ_ITER_HELPER (port_fops_read);static int wait_port_writable (struct port *port,bool nonblock) {
@@ -844,6 +845,7 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, out:return ret; } +FOPS_WRITE_ITER_HELPER (port_fops_write);struct sg_list {unsigned int n;
@@ -1087,8 +1089,8 @@ static int port_fops_fasync(int fd, struct file *filp, int mode)static const struct file_operations port_fops = { .owner =THIS_MODULE , .open = port_fops_open, - .read = port_fops_read, - .write = port_fops_write, + .read_iter = port_fops_read_iter, + .write_iter = port_fops_write_iter, .splice_write = port_fops_splice_write, .poll = port_fops_poll, .release = port_fops_release,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 12/437 char/adi: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/adi.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/char/adi.c +12 -14
@@ -51,10 +51,10 @@ static int read_mcd_tag(unsigned long addr)return ver; } -static ssize_t adi_read (struct file *file,char __user *buf, -size_t count,loff_t *offp) +static ssize_t adi_read (struct kiocb *iocb,struct iov_iter *to) {size_t ver_buf_sz, bytes_read =0 ; +size_t count =iov_iter_count (to);int ver_buf_idx =0 ;loff_t offset;u8 *ver_buf;
@@ -65,7 +65,7 @@ static ssize_t adi_read(struct file *file, char __user *buf,if (!ver_buf)return -ENOMEM ; - offset = (*offp) *adi_blksize (); + offset = iocb->ki_pos *adi_blksize ();while (bytes_read < count) { ret =read_mcd_tag (offset);
@@ -77,8 +77,7 @@ static ssize_t adi_read(struct file *file, char __user *buf, offset +=adi_blksize ();if (ver_buf_idx >= ver_buf_sz) { -if (copy_to_user (buf + bytes_read, ver_buf, - ver_buf_sz)) { +if (!copy_to_iter_full (ver_buf, ver_buf_sz, to)) { ret = -EFAULT ; goto out; }
@@ -91,7 +90,7 @@ static ssize_t adi_read(struct file *file, char __user *buf, } } - (*offp) += bytes_read; + iocb->ki_pos += bytes_read; ret = bytes_read; out:kfree (ver_buf);
@@ -128,10 +127,10 @@ static int set_mcd_tag(unsigned long addr, u8 ver)return ver; } -static ssize_t adi_write (struct file *file,const char __user *buf, -size_t count,loff_t *offp) +static ssize_t adi_write (struct kiocb *iocb,struct iov_iter *from) {size_t ver_buf_sz, bytes_written =0 ; +size_t count =iov_iter_count (from);loff_t offset;u8 *ver_buf;ssize_t ret;
@@ -145,11 +144,10 @@ static ssize_t adi_write(struct file *file, const char __user *buf,if (!ver_buf)return -ENOMEM ; - offset = (*offp) *adi_blksize (); + offset = iocb->ki_pos *adi_blksize (); do { - if (copy_from_user(ver_buf, &buf[bytes_written], - ver_buf_sz)) { + if (!copy_from_iter_full(ver_buf, ver_buf_sz, from)) { ret = -EFAULT; goto out; }
@@ -166,7 +164,7 @@ static ssize_t adi_write(struct file *file, const char __user *buf, ver_buf_sz =min (count - bytes_written, (size_t )MAX_BUF_SZ ); }while (bytes_written < count); - (*offp) += bytes_written; + iocb->ki_pos += bytes_written; ret = bytes_written; out: __asm__ __volatile__("membar #Sync" );
@@ -207,8 +205,8 @@ static const struct file_operations adi_fops = { .owner = THIS_MODULE, .llseek = adi_llseek, .open = adi_open, - .read = adi_read, - .write = adi_write, + .read_iter = adi_read, + .write_iter = adi_write, };static struct miscdevice adi_miscdev = {
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 13/437 char/apm-emulation: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/apm-emulation.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/char/apm-emulation.c +6 -4
@@ -31,6 +31,7 @@#include <linux/completion.h> #include <linux/kthread.h> #include <linux/delay.h> +#include <linux/uio.h> /* * One option can be changed at boot time as follows:
@@ -200,9 +201,11 @@ static void queue_event(apm_event_t event)wake_up_interruptible (&apm_waitqueue); } -static ssize_t apm_read (struct file *fp,char __user *buf,size_t count,loff_t *ppos) +static ssize_t apm_read (struct kiocb *iocb,struct iov_iter *to) { +struct file *fp = iocb->ki_filp;struct apm_user *as = fp->private_data; +size_t count =iov_iter_count (to);apm_event_t event;int i = count, ret =0 ;
@@ -218,7 +221,7 @@ static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t event =queue_get_event (&as->queue); ret = -EFAULT ; -if (copy_to_user (buf, &event,sizeof (event))) +if (!copy_to_iter_full (&event,sizeof (event), to))break ;mutex_lock (&state_lock);
@@ -227,7 +230,6 @@ static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t as->suspend_state =SUSPEND_READ ;mutex_unlock (&state_lock); - buf +=sizeof (event); i -=sizeof (event); }
@@ -379,7 +381,7 @@ static int apm_open(struct inode * inode, struct file * filp)static const struct file_operations apm_bios_fops = { .owner =THIS_MODULE , - .read = apm_read, + .read_iter = apm_read, .poll = apm_poll, .unlocked_ioctl = apm_ioctl, .open = apm_open,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 14/437 char/applicom: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/applicom.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/char/applicom.c +5 -2
@@ -109,11 +109,14 @@ static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *);static long ac_ioctl (struct file *,unsigned int ,unsigned long );static irqreturn_t ac_interrupt (int ,void *); +FOPS_READ_ITER_HELPER (ac_read); +FOPS_WRITE_ITER_HELPER (ac_write); +static const struct file_operations ac_fops = { .owner =THIS_MODULE , .llseek = no_llseek, - .read = ac_read, - .write = ac_write, + .read_iter = ac_read_iter, + .write_iter = ac_write_iter, .unlocked_ioctl = ac_ioctl, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 15/437 char/nsc_gpio: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/nsc_gpio.c | 22 ++++++++++++++++------ include/linux/nsc_gpio.h | 8 ++------ 2 files changed, 18 insertions(+), 12 deletions(-)
drivers/char/nsc_gpio.c +16 -6
@@ -39,8 +39,8 @@ void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index) amp->gpio_get(index), amp->gpio_current(index)); } -ssize_t nsc_gpio_write (struct file *file,const char __user *data, -size_t len,loff_t *ppos) +static ssize_t nsc_gpio_write (struct file *file,const char __user *data, +size_t len,loff_t *ppos) {unsigned m =iminor (file_inode (file));struct nsc_gpio_ops *amp = file->private_data;
@@ -102,8 +102,8 @@ ssize_t nsc_gpio_write(struct file *file, const char __user *data,return len; } -ssize_t nsc_gpio_read (struct file *file,char __user * buf, -size_t len,loff_t * ppos) +static ssize_t nsc_gpio_read (struct file *file,char __user * buf,size_t len, +loff_t * ppos) {unsigned m =iminor (file_inode (file));int value;
@@ -116,9 +116,19 @@ ssize_t nsc_gpio_read(struct file *file, char __user * buf,return 1 ; } +ssize_t nsc_gpio_read_iter (struct kiocb *iocb,struct iov_iter *to) +{ +return vfs_read_iter (iocb, to, nsc_gpio_read); +} +EXPORT_SYMBOL (nsc_gpio_read_iter); + +ssize_t nsc_gpio_write_iter (struct kiocb *iocb,struct iov_iter *from) +{ +return vfs_write_iter (iocb, from, nsc_gpio_write); +} +EXPORT_SYMBOL (nsc_gpio_write_iter); +/* common file-ops routines for both scx200_gpio and pc87360_gpio */ -EXPORT_SYMBOL (nsc_gpio_write); -EXPORT_SYMBOL (nsc_gpio_read);EXPORT_SYMBOL (nsc_gpio_dump);static int __init nsc_gpio_init (void )
include/linux/nsc_gpio.h +2 -6
@@ -31,11 +31,7 @@ struct nsc_gpio_ops {struct device * dev;/* for dev_dbg() support, set in init */ }; -extern ssize_t nsc_gpio_write (struct file *file,const char __user *data, -size_t len,loff_t *ppos); - -extern ssize_t nsc_gpio_read (struct file *file,char __user *buf, -size_t len,loff_t *ppos); - +ssize_t nsc_gpio_write_iter (struct kiocb *iocb,struct iov_iter *from); +ssize_t nsc_gpio_read_iter (struct kiocb *iocb,struct iov_iter *to);extern void nsc_gpio_dump (struct nsc_gpio_ops *amp,unsigned index);
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 16/437 char/dsp1620: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/ds1620.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/char/ds1620.c +3 -4
@@ -216,8 +216,7 @@ static int ds1620_open(struct inode *inode, struct file *file)return stream_open (inode, file); } -static ssize_t -ds1620_read (struct file *file,char __user *buf,size_t count,loff_t *ptr) +static ssize_t ds1620_read (struct kiocb *iocb,struct iov_iter *to) {signed int cur_temp;signed char cur_temp_degF;
@@ -227,7 +226,7 @@ ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)/* convert to Fahrenheit, as per wdt.c */ cur_temp_degF = (cur_temp *9 ) /5 +32 ; -if (copy_to_user (buf, &cur_temp_degF,1 )) +if (!copy_to_iter_full (&cur_temp_degF,1 , to))return -EFAULT ;return 1 ;
@@ -351,7 +350,7 @@ static int ds1620_proc_therm_show(struct seq_file *m, void *v)static const struct file_operations ds1620_fops = { .owner =THIS_MODULE , .open = ds1620_open, - .read = ds1620_read, + .read_iter = ds1620_read, .unlocked_ioctl = ds1620_unlocked_ioctl, .llseek = no_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 17/437 char/dsp56k: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/dsp56k.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/char/dsp56k.c +4 -2
@@ -242,6 +242,7 @@ static ssize_t dsp56k_read(struct file *file, char __user *buf, size_t count,return -ENXIO ; } } +FOPS_READ_ITER_HELPER (dsp56k_read);static ssize_t dsp56k_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos)
@@ -304,6 +305,7 @@ static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t coreturn -ENXIO ; } } +FOPS_WRITE_ITER_HELPER (dsp56k_write);static long dsp56k_ioctl (struct file *file,unsigned int cmd,unsigned long arg)
@@ -480,8 +482,8 @@ static int dsp56k_release(struct inode *inode, struct file *file)static const struct file_operations dsp56k_fops = { .owner =THIS_MODULE , - .read = dsp56k_read, - .write = dsp56k_write, + .read_iter = dsp56k_read_iter, + .write_iter = dsp56k_write_iter, .unlocked_ioctl = dsp56k_ioctl, .open = dsp56k_open, .release = dsp56k_release,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 18/437 char/dtlk: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/dtlk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/char/dtlk.c +4 -2
@@ -101,8 +101,8 @@ static long dtlk_ioctl(struct file *file,static const struct file_operations dtlk_fops = { .owner =THIS_MODULE , - .read = dtlk_read, - .write = dtlk_write, + .read_iter = dtlk_read_iter, + .write_iter = dtlk_write_iter, .poll = dtlk_poll, .unlocked_ioctl = dtlk_ioctl, .open = dtlk_open,
@@ -155,6 +155,7 @@ static ssize_t dtlk_read(struct file *file, char __user *buf,TRACE_RET ;return -EAGAIN ; } +FOPS_READ_ITER_HELPER (dtlk_read);static ssize_t dtlk_write (struct file *file,const char __user *buf,size_t count,loff_t * ppos)
@@ -228,6 +229,7 @@ static ssize_t dtlk_write(struct file *file, const char __user *buf,TRACE_RET ;return -EAGAIN ; } +FOPS_WRITE_ITER_HELPER (dtlk_write);static __poll_t dtlk_poll (struct file *file,poll_table * wait) {
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 19/437 char/hpet: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/hpet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/hpet.c +2 -1
@@ -303,6 +303,7 @@ hpet_read(struct file *file, char __user *buf, size_t count, loff_t * ppos)return retval; } +FOPS_READ_ITER_HELPER (hpet_read);static __poll_t hpet_poll (struct file *file,poll_table * wait) {
@@ -677,7 +678,7 @@ hpet_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)static const struct file_operations hpet_fops = { .owner =THIS_MODULE , .llseek = no_llseek, - .read = hpet_read, + .read_iter = hpet_read_iter, .poll = hpet_poll, .unlocked_ioctl = hpet_ioctl, #ifdef CONFIG_COMPAT
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 20/437 char/hw_random: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/hw_random/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/hw_random/core.c +2 -1
@@ -290,11 +290,12 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,put_rng (rng); goto out; } +FOPS_READ_ITER_HELPER (rng_dev_read);static const struct file_operations rng_chrdev_ops = { .owner =THIS_MODULE , .open = rng_dev_open, - .read = rng_dev_read, + .read_iter = rng_dev_read_iter, .llseek = noop_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 21/437 char/ipmi: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/ipmi/bt-bmc.c | 27 +++++++++++++-------------- drivers/char/ipmi/ipmb_dev_int.c | 19 ++++++++++--------- drivers/char/ipmi/ipmi_watchdog.c | 16 ++++++++-------- drivers/char/ipmi/kcs_bmc_cdev_ipmi.c | 23 ++++++++++++----------- drivers/char/ipmi/ssif_bmc.c | 25 ++++++++++++++----------- 5 files changed, 57 insertions(+), 53 deletions(-)
drivers/char/ipmi/bt-bmc.c +13 -14
@@ -15,6 +15,7 @@#include <linux/poll.h> #include <linux/sched.h> #include <linux/timer.h> +#include <linux/uio.h> /* * This is a BMC device used to communicate to the host
@@ -172,17 +173,17 @@ static int bt_bmc_open(struct inode *inode, struct file *file)* Length NetFn/LUN Seq Cmd Data * */ -static ssize_t bt_bmc_read (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t bt_bmc_read (struct kiocb *iocb,struct iov_iter *to) { -struct bt_bmc *bt_bmc =file_bt_bmc (file); +struct bt_bmc *bt_bmc =file_bt_bmc (iocb->ki_filp); +size_t count =iov_iter_count (to);u8 len;int len_byte =1 ;u8 kbuffer[BT_BMC_BUFFER_SIZE ];ssize_t ret =0 ;ssize_t nread; -WARN_ON (*ppos); +WARN_ON (iocb->ki_pos);if (wait_event_interruptible (bt_bmc->queue,bt_inb (bt_bmc,BT_CTRL ) &BT_CTRL_H2B_ATN ))
@@ -215,12 +216,11 @@ static ssize_t bt_bmc_read(struct file *file, char __user *buf,bt_readn (bt_bmc, kbuffer + len_byte, nread); -if (copy_to_user (buf, kbuffer, nread + len_byte)) { +if (!copy_to_iter_full (kbuffer, nread + len_byte, to)) { ret = -EFAULT ;break ; } len -= nread; - buf += nread + len_byte; ret += nread + len_byte; len_byte =0 ; }
@@ -238,10 +238,10 @@ static ssize_t bt_bmc_read(struct file *file, char __user *buf,* Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6:N * Length NetFn/LUN Seq Cmd Code Data */ -static ssize_t bt_bmc_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t bt_bmc_write (struct kiocb *iocb,struct iov_iter *from) { -struct bt_bmc *bt_bmc =file_bt_bmc (file); +struct bt_bmc *bt_bmc =file_bt_bmc (iocb->ki_filp); +size_t count =iov_iter_count (from);u8 kbuffer[BT_BMC_BUFFER_SIZE ];ssize_t ret =0 ;ssize_t nwritten;
@@ -252,7 +252,7 @@ static ssize_t bt_bmc_write(struct file *file, const char __user *buf,if (count <5 )return -EINVAL ; -WARN_ON (*ppos); +WARN_ON (iocb->ki_pos);/* * There's no interrupt for clearing bmc busy so we have to
@@ -275,7 +275,7 @@ static ssize_t bt_bmc_write(struct file *file, const char __user *buf,while (count) { nwritten =min_t (ssize_t, count,sizeof (kbuffer)); -if (copy_from_user (&kbuffer, buf, nwritten)) { +if (!copy_from_iter_full (&kbuffer, nwritten, from)) { ret = -EFAULT ;break ; }
@@ -283,7 +283,6 @@ static ssize_t bt_bmc_write(struct file *file, const char __user *buf,bt_writen (bt_bmc, kbuffer, nwritten); count -= nwritten; - buf += nwritten; ret += nwritten; }
@@ -338,8 +337,8 @@ static __poll_t bt_bmc_poll(struct file *file, poll_table *wait)static const struct file_operations bt_bmc_fops = { .owner =THIS_MODULE , .open = bt_bmc_open, - .read = bt_bmc_read, - .write = bt_bmc_write, + .read_iter = bt_bmc_read, + .write_iter = bt_bmc_write, .release = bt_bmc_release, .poll = bt_bmc_poll, .unlocked_ioctl = bt_bmc_ioctl,
drivers/char/ipmi/ipmb_dev_int.c +10 -9
@@ -71,11 +71,11 @@ static inline struct ipmb_dev *to_ipmb_dev(struct file *file) return container_of(file->private_data, struct ipmb_dev, miscdev); } -static ssize_t ipmb_read (struct file *file,char __user *buf,size_t count, -loff_t *ppos) +static ssize_t ipmb_read (struct kiocb *iocb,struct iov_iter *to) { -struct ipmb_dev *ipmb_dev =to_ipmb_dev (file); +struct ipmb_dev *ipmb_dev =to_ipmb_dev (iocb->ki_filp);struct ipmb_request_elem *queue_elem; +size_t count =iov_iter_count (to);struct ipmb_msg msg;ssize_t ret =0 ;
@@ -86,7 +86,7 @@ static ssize_t ipmb_read(struct file *file, char __user *buf, size_t count,while (list_empty (&ipmb_dev->request_queue)) {spin_unlock_irq (&ipmb_dev->lock); -if (file->f_flags &O_NONBLOCK ) +if (iocb->ki_filp->f_flags &O_NONBLOCK )return -EAGAIN ; ret = wait_event_interruptible(ipmb_dev->wait_queue,
@@ -107,7 +107,7 @@ static ssize_t ipmb_read(struct file *file, char __user *buf, size_t count,spin_unlock_irq (&ipmb_dev->lock); count =min_t (size_t, count, msg.len +1 ); -if (copy_to_user (buf, &msg, count)) +if (!copy_to_iter_full (&msg, count, to)) ret = -EFAULT ;return ret <0 ? ret : count;
@@ -176,6 +176,7 @@ static ssize_t ipmb_write(struct file *file, const char __user *buf,return ret <0 ? ret : count; } +FOPS_WRITE_ITER_HELPER (ipmb_write);static __poll_t ipmb_poll (struct file *file,poll_table *wait) {
@@ -193,10 +194,10 @@ static __poll_t ipmb_poll(struct file *file, poll_table *wait) }static const struct file_operations ipmb_fops = { - .owner =THIS_MODULE , - .read = ipmb_read, - .write = ipmb_write, - .poll = ipmb_poll, + .owner =THIS_MODULE , + .read_iter = ipmb_read, + .write_iter = ipmb_write_iter, + .poll = ipmb_poll, };/* Called with ipmb_dev->lock held. */
drivers/char/ipmi/ipmi_watchdog.c +8 -8
@@ -37,6 +37,7 @@#include <linux/delay.h> #include <linux/atomic.h> #include <linux/sched/signal.h> +#include <linux/uio.h> #ifdef CONFIG_X86 /*
@@ -777,12 +778,11 @@ static ssize_t ipmi_write(struct file *file, }return len; } +FOPS_WRITE_ITER_HELPER (ipmi_write); -static ssize_t ipmi_read (struct file *file, -char __user *buf, -size_t count, -loff_t *ppos) +static ssize_t ipmi_read (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to);int rv =0 ;wait_queue_entry_t wait;
@@ -795,7 +795,7 @@ static ssize_t ipmi_read(struct file *file,*/ spin_lock_irq (&ipmi_read_lock);if (!data_to_read) { -if (file->f_flags &O_NONBLOCK ) { +if (iocb->ki_filp->f_flags &O_NONBLOCK ) { rv = -EAGAIN ; goto out; }
@@ -821,7 +821,7 @@ static ssize_t ipmi_read(struct file *file,spin_unlock_irq (&ipmi_read_lock);if (rv ==0 ) { -if (copy_to_user (buf, &data_to_read,1 )) +if (!copy_to_iter_full (&data_to_read,1 , to)) rv = -EFAULT ;else rv =1 ;
@@ -895,9 +895,9 @@ static int ipmi_close(struct inode *ino, struct file *filep)static const struct file_operations ipmi_wdog_fops = { .owner =THIS_MODULE , - .read = ipmi_read, + .read_iter = ipmi_read, .poll = ipmi_poll, - .write = ipmi_write, + .write_iter = ipmi_write_iter, .unlocked_ioctl = ipmi_unlocked_ioctl, .compat_ioctl = compat_ptr_ioctl, .open = ipmi_open,
drivers/char/ipmi/kcs_bmc_cdev_ipmi.c +12 -11
@@ -16,6 +16,7 @@#include <linux/poll.h> #include <linux/sched.h> #include <linux/slab.h> +#include <linux/uio.h> #include "kcs_bmc_client.h"
@@ -317,15 +318,15 @@ static __poll_t kcs_bmc_ipmi_poll(struct file *filp, poll_table *wait)return mask; } -static ssize_t kcs_bmc_ipmi_read (struct file *filp,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t kcs_bmc_ipmi_read (struct kiocb *iocb,struct iov_iter *to) { -struct kcs_bmc_ipmi *priv =to_kcs_bmc (filp); +struct kcs_bmc_ipmi *priv =to_kcs_bmc (iocb->ki_filp); +size_t count =iov_iter_count (to);bool data_avail;size_t data_len;ssize_t ret; -if (!(filp->f_flags &O_NONBLOCK )) +if (!(iocb->ki_filp->f_flags &O_NONBLOCK ))wait_event_interruptible (priv->queue, priv->data_in_avail);
@@ -356,7 +357,7 @@ static ssize_t kcs_bmc_ipmi_read(struct file *filp, char __user *buf, goto out_unlock; } -if (copy_to_user (buf, priv->kbuffer, data_len)) { +if (!copy_to_iter_full (priv->kbuffer, data_len, to)) { ret = -EFAULT ; goto out_unlock; }
@@ -379,10 +380,10 @@ static ssize_t kcs_bmc_ipmi_read(struct file *filp, char __user *buf,return ret; } -static ssize_t kcs_bmc_ipmi_write (struct file *filp,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t kcs_bmc_ipmi_write (struct kiocb *iocb,struct iov_iter *from) { -struct kcs_bmc_ipmi *priv =to_kcs_bmc (filp); +struct kcs_bmc_ipmi *priv =to_kcs_bmc (iocb->ki_filp); +size_t count =iov_iter_count (from);ssize_t ret;/* a minimum response size '3' : netfn + cmd + ccode */
@@ -391,7 +392,7 @@ static ssize_t kcs_bmc_ipmi_write(struct file *filp, const char __user *buf,mutex_lock (&priv->mutex); -if (copy_from_user (priv->kbuffer, buf, count)) { +if (!copy_from_iter_full (priv->kbuffer, count, from)) { ret = -EFAULT ; goto out_unlock; }
@@ -459,8 +460,8 @@ static int kcs_bmc_ipmi_release(struct inode *inode, struct file *filp)static const struct file_operations kcs_bmc_ipmi_fops = { .owner =THIS_MODULE , .open = kcs_bmc_ipmi_open, - .read = kcs_bmc_ipmi_read, - .write = kcs_bmc_ipmi_write, + .read_iter = kcs_bmc_ipmi_read, + .write_iter = kcs_bmc_ipmi_write, .release = kcs_bmc_ipmi_release, .poll = kcs_bmc_ipmi_poll, .unlocked_ioctl = kcs_bmc_ipmi_ioctl,
drivers/char/ipmi/ssif_bmc.c +14 -11
@@ -130,9 +130,10 @@ static const char *state_to_string(enum ssif_state state) }/* Handle SSIF message that will be sent to user */ -static ssize_t ssif_bmc_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +static ssize_t ssif_bmc_read (struct kiocb *iocb,struct iov_iter *to) { -struct ssif_bmc_ctx *ssif_bmc =to_ssif_bmc (file); +struct ssif_bmc_ctx *ssif_bmc =to_ssif_bmc (iocb->ki_filp); +size_t count =iov_iter_count (to);struct ipmi_ssif_msg msg;unsigned long flags;ssize_t ret;
@@ -140,7 +141,7 @@ static ssize_t ssif_bmc_read(struct file *file, char __user *buf, size_t count,spin_lock_irqsave (&ssif_bmc->lock, flags);while (!ssif_bmc->request_available) {spin_unlock_irqrestore (&ssif_bmc->lock, flags); -if (file->f_flags &O_NONBLOCK ) +if (iocb->ki_filp->f_flags &O_NONBLOCK )return -EAGAIN ; ret =wait_event_interruptible (ssif_bmc->wait_queue, ssif_bmc->request_available);
@@ -162,17 +163,19 @@ static ssize_t ssif_bmc_read(struct file *file, char __user *buf, size_t count, ssif_bmc->request_available = false;spin_unlock_irqrestore (&ssif_bmc->lock, flags); - ret =copy_to_user (buf, &msg, count); + ret = -EFAULT ; +if (copy_to_iter_full (&msg, count, to)) + ret =0 ; }return (ret <0 ) ? ret : count; }/* Handle SSIF message that is written by user */ -static ssize_t ssif_bmc_write (struct file *file,const char __user *buf,size_t count, -loff_t *ppos) +static ssize_t ssif_bmc_write (struct kiocb *iocb,struct iov_iter *from) { -struct ssif_bmc_ctx *ssif_bmc =to_ssif_bmc (file); +struct ssif_bmc_ctx *ssif_bmc =to_ssif_bmc (iocb->ki_filp); +size_t count =iov_iter_count (from);struct ipmi_ssif_msg msg;unsigned long flags;ssize_t ret;
@@ -180,7 +183,7 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_tif (count >sizeof (struct ipmi_ssif_msg ))return -EINVAL ; -if (copy_from_user (&msg, buf, count)) +if (!copy_from_iter_full (&msg, count, from))return -EFAULT ; if (!msg.len || count < sizeof_field(struct ipmi_ssif_msg, len) + msg.len)
@@ -189,7 +192,7 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_tspin_lock_irqsave (&ssif_bmc->lock, flags);while (ssif_bmc->response_in_progress) {spin_unlock_irqrestore (&ssif_bmc->lock, flags); -if (file->f_flags &O_NONBLOCK ) +if (iocb->ki_filp->f_flags &O_NONBLOCK )return -EAGAIN ; ret =wait_event_interruptible (ssif_bmc->wait_queue, !ssif_bmc->response_in_progress);
@@ -275,8 +278,8 @@ static int ssif_bmc_release(struct inode *inode, struct file *file)static const struct file_operations ssif_bmc_fops = { .owner =THIS_MODULE , .open = ssif_bmc_open, - .read = ssif_bmc_read, - .write = ssif_bmc_write, + .read_iter = ssif_bmc_read, + .write_iter = ssif_bmc_write, .release = ssif_bmc_release, .poll = ssif_bmc_poll, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 22/437 char/tpm: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/tpm/eventlog/common.c | 2 +- drivers/char/tpm/tpm-dev-common.c | 26 +++++++++++++------------- drivers/char/tpm/tpm-dev.c | 4 ++-- drivers/char/tpm/tpm-dev.h | 6 ++---- drivers/char/tpm/tpm_vtpm_proxy.c | 20 ++++++++++---------- drivers/char/tpm/tpmrm-dev.c | 4 ++-- 6 files changed, 30 insertions(+), 32 deletions(-)
drivers/char/tpm/eventlog/common.c +1 -1
@@ -66,7 +66,7 @@ static int tpm_bios_measurements_release(struct inode *inode,static const struct file_operations tpm_bios_measurements_ops = { .owner =THIS_MODULE , .open = tpm_bios_measurements_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = tpm_bios_measurements_release, };
drivers/char/tpm/tpm-dev-common.c +13 -13
@@ -122,10 +122,10 @@ void tpm_common_open(struct file *file, struct tpm_chip *chip, file->private_data = priv; } -ssize_t tpm_common_read (struct file *file,char __user *buf, -size_t size,loff_t *off) +ssize_t tpm_common_read_iter (struct kiocb *iocb,struct iov_iter *to) { -struct file_priv *priv = file->private_data; +struct file_priv *priv = iocb->ki_filp->private_data; +size_t size =iov_iter_count (to);ssize_t ret_size =0 ;int rc;
@@ -140,21 +140,21 @@ ssize_t tpm_common_read(struct file *file, char __user *buf, goto out; } - rc =copy_to_user (buf, priv->data_buffer + *off, ret_size); + rc = !copy_to_iter_full (priv->data_buffer + iocb->ki_pos, ret_size, to);if (rc) {memset (priv->data_buffer,0 ,TPM_BUFSIZE ); priv->response_length =0 ; ret_size = -EFAULT ; }else { -memset (priv->data_buffer + *off,0 , ret_size); +memset (priv->data_buffer + iocb->ki_pos,0 , ret_size); priv->response_length -= ret_size; - *off += ret_size; + iocb->ki_pos += ret_size; } } out:if (!priv->response_length) { - *off =0 ; + iocb->ki_pos =0 ;del_timer_sync (&priv->user_read_timer);flush_work (&priv->timeout_work); }
@@ -162,10 +162,10 @@ ssize_t tpm_common_read(struct file *file, char __user *buf,return ret_size; } -ssize_t tpm_common_write (struct file *file,const char __user *buf, -size_t size,loff_t *off) +ssize_t tpm_common_write_iter (struct kiocb *iocb,struct iov_iter *from) { -struct file_priv *priv = file->private_data; +struct file_priv *priv = iocb->ki_filp->private_data; +size_t size =iov_iter_count (from);int ret =0 ;if (size >TPM_BUFSIZE )
@@ -183,7 +183,7 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf, goto out; } -if (copy_from_user (priv->data_buffer, buf, size)) { +if (!copy_from_iter_full (priv->data_buffer, size, from)) { ret = -EFAULT ; goto out; }
@@ -196,7 +196,7 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf, priv->response_length =0 ; priv->response_read = false; - *off =0 ; + iocb->ki_pos =0 ;/* * If in nonblocking mode schedule an async job to send
@@ -204,7 +204,7 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf,* In case of error the err code will be returned in * the subsequent read call. */ -if (file->f_flags &O_NONBLOCK ) { +if (iocb->ki_filp->f_flags &O_NONBLOCK ) { priv->command_enqueued = true;queue_work (tpm_dev_wq, &priv->async_work);mutex_unlock (&priv->buffer_mutex);
drivers/char/tpm/tpm-dev.c +2 -2
@@ -61,8 +61,8 @@ const struct file_operations tpm_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .open = tpm_open, - .read = tpm_common_read, - .write = tpm_common_write, + .read_iter = tpm_common_read_iter, + .write_iter = tpm_common_write_iter, .poll = tpm_common_poll, .release = tpm_release, };
drivers/char/tpm/tpm-dev.h +2 -4
@@ -23,10 +23,8 @@ struct file_priv {void tpm_common_open (struct file *file,struct tpm_chip *chip,struct file_priv *priv,struct tpm_space *space); -ssize_t tpm_common_read (struct file *file,char __user *buf, -size_t size,loff_t *off); -ssize_t tpm_common_write (struct file *file,const char __user *buf, -size_t size,loff_t *off); +ssize_t tpm_common_read_iter (struct kiocb *iocb,struct iov_iter *to); +ssize_t tpm_common_write_iter (struct kiocb *iocb,struct iov_iter *from);__poll_t tpm_common_poll (struct file *file,poll_table *wait);void tpm_common_release (struct file *file,struct file_priv *priv);
drivers/char/tpm/tpm_vtpm_proxy.c +10 -10
@@ -69,10 +69,10 @@ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev);* Return: * Number of bytes read or negative error code */ -static ssize_t vtpm_proxy_fops_read (struct file *filp,char __user *buf, -size_t count,loff_t *off) +static ssize_t vtpm_proxy_fops_read (struct kiocb *iocb,struct iov_iter *to) { -struct proxy_dev *proxy_dev = filp->private_data; +struct proxy_dev *proxy_dev = iocb->ki_filp->private_data; +size_t count =iov_iter_count (to);size_t len;int sig, rc;
@@ -98,7 +98,7 @@ static ssize_t vtpm_proxy_fops_read(struct file *filp, char __user *buf,return -EIO ; } - rc =copy_to_user (buf, proxy_dev->buffer, len); + rc = !copy_to_iter_full (proxy_dev->buffer, len, to);memset (proxy_dev->buffer,0 , len); proxy_dev->req_len =0 ;
@@ -124,10 +124,10 @@ static ssize_t vtpm_proxy_fops_read(struct file *filp, char __user *buf,* Return: * Number of bytes read or negative error value */ -static ssize_t vtpm_proxy_fops_write (struct file *filp,const char __user *buf, -size_t count,loff_t *off) +static ssize_t vtpm_proxy_fops_write (struct kiocb *iocb,struct iov_iter *from) { -struct proxy_dev *proxy_dev = filp->private_data; +struct proxy_dev *proxy_dev = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);mutex_lock (&proxy_dev->buf_lock);
@@ -146,7 +146,7 @@ static ssize_t vtpm_proxy_fops_write(struct file *filp, const char __user *buf, proxy_dev->req_len =0 ; -if (copy_from_user (proxy_dev->buffer, buf, count)) { +if (!copy_from_iter_full (proxy_dev->buffer, count, from)) {mutex_unlock (&proxy_dev->buf_lock);return -EFAULT ; }
@@ -244,8 +244,8 @@ static int vtpm_proxy_fops_release(struct inode *inode, struct file *filp)static const struct file_operations vtpm_proxy_fops = { .owner =THIS_MODULE , .llseek = no_llseek, - .read = vtpm_proxy_fops_read, - .write = vtpm_proxy_fops_write, + .read_iter = vtpm_proxy_fops_read, + .write_iter = vtpm_proxy_fops_write, .poll = vtpm_proxy_fops_poll, .release = vtpm_proxy_fops_release, };
drivers/char/tpm/tpmrm-dev.c +2 -2
@@ -48,8 +48,8 @@ const struct file_operations tpmrm_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .open = tpmrm_open, - .read = tpm_common_read, - .write = tpm_common_write, + .read_iter = tpm_common_read_iter, + .write_iter = tpm_common_write_iter, .poll = tpm_common_poll, .release = tpmrm_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 23/437 char/lp: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/lp.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/char/lp.c +11 -10
@@ -298,10 +298,11 @@ static int lp_wait_ready(int minor, int nonblock)return error; } -static ssize_t lp_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t lp_write (struct kiocb *iocb,struct iov_iter *from) { +struct file *file = iocb->ki_filp;unsigned int minor =iminor (file_inode (file)); +size_t count =iov_iter_count (from);struct parport *port = lp_table[minor].dev->port;char *kbuf = lp_table[minor].lp_buffer;ssize_t retv =0 ;
@@ -324,7 +325,7 @@ static ssize_t lp_write(struct file *file, const char __user *buf,if (mutex_lock_interruptible (&lp_table[minor].port_mutex))return -EINTR ; -if (copy_from_user (kbuf, buf, copy_size)) { +if (!copy_from_iter_full (kbuf, copy_size, from)) { retv = -EFAULT ; goto out_unlock; }
@@ -347,7 +348,6 @@ static ssize_t lp_write(struct file *file, const char __user *buf,if (written >0 ) { copy_size -= written; count -= written; - buf += written; retv += written; }
@@ -391,7 +391,7 @@ static ssize_t lp_write(struct file *file, const char __user *buf,if (copy_size >LP_BUFFER_SIZE ) copy_size =LP_BUFFER_SIZE ; -if (copy_from_user (kbuf, buf, copy_size)) { +if (!copy_from_iter_full (kbuf, copy_size, from)) {if (retv ==0 ) retv = -EFAULT ;break ;
@@ -416,9 +416,10 @@ static ssize_t lp_write(struct file *file, const char __user *buf,#ifdef CONFIG_PARPORT_1284 /* Status readback conforming to ieee1284 */ -static ssize_t lp_read (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t lp_read (struct kiocb *iocb,struct iov_iter *to) { +struct file *file = iocb->ki_filp; +size_t count =iov_iter_count (to);DEFINE_WAIT (wait);unsigned int minor=iminor (file_inode (file));struct parport *port = lp_table[minor].dev->port;
@@ -485,7 +486,7 @@ static ssize_t lp_read(struct file *file, char __user *buf, out:lp_release_parport (&lp_table[minor]); -if (retval >0 &©_to_user (buf, kbuf, retval)) +if (retval >0 && !copy_to_iter_full (kbuf, retval, to)) retval = -EFAULT ;mutex_unlock (&lp_table[minor].port_mutex);
@@ -785,7 +786,7 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd,static const struct file_operations lp_fops = { .owner =THIS_MODULE , - .write = lp_write, + .write_iter = lp_write, .unlocked_ioctl = lp_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = lp_compat_ioctl,
@@ -793,7 +794,7 @@ static const struct file_operations lp_fops = { .open = lp_open, .release = lp_release, #ifdef CONFIG_PARPORT_1284 - .read = lp_read, + .read_iter = lp_read, #endif .llseek = noop_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 24/437 char/mem: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/mem.c | 106 ++++++++++++--------------------------------- 1 file changed, 27 insertions(+), 79 deletions(-)
drivers/char/mem.c +27 -79
@@ -183,16 +183,17 @@ static ssize_t read_mem(struct file *file, char __user *buf,kfree (bounce);return err; } +FOPS_READ_ITER_HELPER (read_mem); -static ssize_t write_mem (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t write_mem (struct kiocb *iocb,struct iov_iter *from) { -phys_addr_t p = *ppos; +size_t count =iov_iter_count (from); +phys_addr_t p = iocb->ki_pos;ssize_t written, sz;unsigned long copied;void *ptr; -if (p != *ppos) +if (p != iocb->ki_pos)return -EFBIG ;if (!valid_phys_addr_range (p, count))
@@ -235,7 +236,7 @@ static ssize_t write_mem(struct file *file, const char __user *buf,return -EFAULT ; } - copied =copy_from_user (ptr, buf, sz); + copied =copy_from_iter (ptr, sz, from);unxlate_dev_mem_ptr (p, ptr);if (copied) { written += sz - copied;
@@ -245,7 +246,6 @@ static ssize_t write_mem(struct file *file, const char __user *buf, } } - buf += sz; p += sz; count -= sz; written += sz;
@@ -253,7 +253,7 @@ static ssize_t write_mem(struct file *file, const char __user *buf,break ; } - *ppos += written; + iocb->ki_pos += written;return written; }
@@ -383,58 +383,39 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)return 0 ; } -static ssize_t read_port (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t read_port (struct kiocb *iocb,struct iov_iter *to) { -unsigned long i = *ppos; -char __user *tmp = buf; +unsigned long i = iocb->ki_pos, org_i = i; +size_t count =iov_iter_count (to); -if (!access_ok (buf, count)) -return -EFAULT ;while (count-- >0 && i <65536 ) { -if (__put_user (inb (i), tmp) <0 ) +char val =inb (i); +if (put_iter (val, to))return -EFAULT ; i++; - tmp++; } - *ppos = i; -return tmp-buf; + iocb->ki_pos = i; +return i - org_i; } -static ssize_t write_port (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t write_port (struct kiocb *iocb,struct iov_iter *from) { -unsigned long i = *ppos; -const char __user *tmp = buf; +unsigned long i = iocb->ki_pos, org_i = i; +size_t count =iov_iter_count (from); -if (!access_ok (buf, count)) -return -EFAULT ;while (count-- >0 && i <65536 ) {char c; -if (__get_user (c, tmp)) { -if (tmp > buf) +if (get_iter (c, from)) { +if (i != org_i)break ;return -EFAULT ; }outb (c, i); i++; - tmp++; } - *ppos = i; -return tmp-buf; -} - -static ssize_t read_null (struct file *file,char __user *buf, -size_t count,loff_t *ppos) -{ -return 0 ; -} - -static ssize_t write_null (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) -{ -return count; + iocb->ki_pos = i; +return i - org_i; }static ssize_t read_iter_null (struct kiocb *iocb,struct iov_iter *to)
@@ -490,33 +471,6 @@ static ssize_t read_iter_zero(struct kiocb *iocb, struct iov_iter *iter)return written; } -static ssize_t read_zero (struct file *file,char __user *buf, -size_t count,loff_t *ppos) -{ -size_t cleared =0 ; - -while (count) { -size_t chunk =min_t (size_t, count,PAGE_SIZE ); -size_t left; - - left =clear_user (buf + cleared, chunk); -if (unlikely (left)) { - cleared += (chunk - left); -if (!cleared) -return -EFAULT ; -break ; - } - cleared += chunk; - count -= chunk; - -if (signal_pending (current)) -break ; -cond_resched (); - } - -return cleared; -} -static int mmap_zero (struct file *file,struct vm_area_struct *vma) {#ifndef CONFIG_MMU
@@ -550,8 +504,7 @@ static unsigned long get_unmapped_area_zero(struct file *file,#endif } -static ssize_t write_full (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t write_full_iter (struct kiocb *iocb,struct iov_iter *from) {return -ENOSPC ; }
@@ -626,15 +579,14 @@ static int open_port(struct inode *inode, struct file *filp)#define zero_lseek null_lseek#define full_lseek null_lseek -#define write_zero write_null#define write_iter_zero write_iter_null#define splice_write_zero splice_write_null#define open_mem open_portstatic const struct file_operations __maybe_unused mem_fops = { .llseek = memory_lseek, - .read = read_mem, - .write = write_mem, + .read_iter = read_mem_iter, + .write_iter = write_mem, .mmap = mmap_mem, .open = open_mem, #ifndef CONFIG_MMU
@@ -645,8 +597,6 @@ static const struct file_operations __maybe_unused mem_fops = {static const struct file_operations null_fops = { .llseek = null_lseek, - .read = read_null, - .write = write_null, .read_iter = read_iter_null, .write_iter = write_iter_null, .splice_write = splice_write_null,
@@ -655,16 +605,14 @@ static const struct file_operations null_fops = {static const struct file_operations __maybe_unused port_fops = { .llseek = memory_lseek, - .read = read_port, - .write = write_port, + .read_iter = read_port, + .write_iter = write_port, .open = open_port, };static const struct file_operations zero_fops = { .llseek = zero_lseek, - .write = write_zero, .read_iter = read_iter_zero, - .read = read_zero, .write_iter = write_iter_zero, .splice_read = copy_splice_read, .splice_write = splice_write_zero,
@@ -678,7 +626,7 @@ static const struct file_operations zero_fops = {static const struct file_operations full_fops = { .llseek = full_lseek, .read_iter = read_iter_zero, - .write = write_full, + .write_iter = write_full_iter, .splice_read = copy_splice_read, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 25/437 char/mwave: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/mwave/mwavedd.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
drivers/char/mwave/mwavedd.c +4 -15
@@ -411,25 +411,14 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, } -static ssize_t mwave_read (struct file *file,char __user *buf,size_t count, -loff_t * ppos) +static ssize_t mwave_read (struct kiocb *iocb,struct iov_iter *to) { -PRINTK_5 (TRACE_MWAVE , -"mwavedd::mwave_read entry file %p, buf %p, count %zx ppos %p\n" , - file, buf, count, ppos); -return -EINVAL ; } -static ssize_t mwave_write (struct file *file,const char __user *buf, -size_t count,loff_t * ppos) +static ssize_t mwave_write (struct kiocb *iocb,struct iov_iter *from) { -PRINTK_5 (TRACE_MWAVE , -"mwavedd::mwave_write entry file %p, buf %p," -" count %zx ppos %p\n" , - file, buf, count, ppos); -return -EINVAL ; }
@@ -481,8 +470,8 @@ static int register_serial_portandirq(unsigned int port, int irq)static const struct file_operations mwave_fops = { .owner =THIS_MODULE , - .read = mwave_read, - .write = mwave_write, + .read_iter = mwave_read, + .write_iter = mwave_write, .unlocked_ioctl = mwave_ioctl, .open = mwave_open, .release = mwave_close,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 26/437 char/nvram: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/nvram.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/char/nvram.c +10 -9
@@ -225,29 +225,29 @@ static loff_t nvram_misc_llseek(struct file *file, loff_t offset, int origin) nvram_size); } -static ssize_t nvram_misc_read (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t nvram_misc_read (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to);char *tmp;ssize_t ret; -if (*ppos >= nvram_size) +if (iocb->ki_pos >= nvram_size)return 0 ; - count =min_t (size_t, count, nvram_size - *ppos); + count =min_t (size_t, count, nvram_size - iocb->ki_pos); count =min_t (size_t, count,PAGE_SIZE ); tmp =kmalloc (count,GFP_KERNEL );if (!tmp)return -ENOMEM ; - ret =nvram_read (tmp, count, ppos); + ret =nvram_read (tmp, count, &iocb->ki_pos);if (ret <=0 ) goto out; -if (copy_to_user (buf, tmp, ret)) { - *ppos -= ret; +if (!copy_to_iter_full (tmp, ret, to)) { + iocb->ki_pos -= ret; ret = -EFAULT ; }
@@ -276,6 +276,7 @@ static ssize_t nvram_misc_write(struct file *file, const char __user *buf,kfree (tmp);return ret; } +FOPS_WRITE_ITER_HELPER (nvram_misc_write);static long nvram_misc_ioctl (struct file *file,unsigned int cmd,unsigned long arg)
@@ -490,8 +491,8 @@ static int nvram_proc_read(struct seq_file *seq, void *offset)static const struct file_operations nvram_misc_fops = { .owner =THIS_MODULE , .llseek = nvram_misc_llseek, - .read = nvram_misc_read, - .write = nvram_misc_write, + .read_iter = nvram_misc_read, + .write_iter = nvram_misc_write_iter, .unlocked_ioctl = nvram_misc_ioctl, .open = nvram_misc_open, .release = nvram_misc_release,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 27/437 char/nwbutton: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/nwbutton.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/char/nwbutton.c +3 -4
@@ -165,14 +165,13 @@ static irqreturn_t button_handler (int irq, void *dev_id)* device at any one time. */ -static int button_read (struct file *filp,char __user *buffer, -size_t count,loff_t *ppos) +static int button_read (struct kiocb *iocb,struct iov_iter *to) {DEFINE_WAIT (wait);prepare_to_wait (&button_wait_queue, &wait,TASK_INTERRUPTIBLE );schedule ();finish_wait (&button_wait_queue, &wait); -return (copy_to_user (buffer, &button_output_buffer, bcount)) +return (!copy_to_iter_full (&button_output_buffer, bcount, to)) ? -EFAULT : bcount; }
@@ -184,7 +183,7 @@ static int button_read (struct file *filp, char __user *buffer,static const struct file_operations button_fops = { .owner =THIS_MODULE , - .read = button_read, + .read_iter = button_read, .llseek = noop_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 28/437 char/nwflash: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/nwflash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/char/nwflash.c +6 -6
@@ -120,8 +120,7 @@ static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)return 0 ; } -static ssize_t flash_read (struct file *file,char __user *buf,size_t size, -loff_t *ppos) +static ssize_t flash_read (struct kiocb *iocb,struct iov_iter *to) {ssize_t ret;
@@ -134,7 +133,8 @@ static ssize_t flash_read(struct file *file, char __user *buf, size_t size,if (mutex_lock_interruptible (&nwflash_mutex))return -ERESTARTSYS ; - ret =simple_read_from_buffer (buf, size, ppos, (void *)FLASH_BASE , gbFlashSize); + ret =simple_copy_to_iter ((void *)FLASH_BASE , &iocb->ki_pos, + gbFlashSize, to);mutex_unlock (&nwflash_mutex);return ret;
@@ -259,7 +259,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf,return written; } - +FOPS_WRITE_ITER_HELPER (flash_write);/* * The memory devices use the full 32/64 bits of the offset, and so we cannot
@@ -569,8 +569,8 @@ static const struct file_operations flash_fops = { .owner = THIS_MODULE, .llseek = flash_llseek, - .read = flash_read, - .write = flash_write, + .read_iter = flash_read, + .write_iter = flash_write_iter, .unlocked_ioctl = flash_ioctl, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 29/437 char/pc8736x_gpio: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/pc8736x_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/pc8736x_gpio.c +2 -2
@@ -233,8 +233,8 @@ static int pc8736x_gpio_open(struct inode *inode, struct file *file)static const struct file_operations pc8736x_gpio_fileops = { .owner =THIS_MODULE , .open = pc8736x_gpio_open, - .write = nsc_gpio_write, - .read = nsc_gpio_read, + .write_iter = nsc_gpio_write_iter, + .read_iter = nsc_gpio_read_iter, .llseek = no_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 30/437 char/powernv-op-panel: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/powernv-op-panel.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/char/powernv-op-panel.c +11 -14
@@ -40,11 +40,9 @@ static loff_t oppanel_llseek(struct file *filp, loff_t offset, int whence)return fixed_size_llseek (filp, offset, whence, oppanel_size); } -static ssize_t oppanel_read (struct file *filp,char __user *userbuf,size_t len, -loff_t *f_pos) +static ssize_t oppanel_read (struct kiocb *iocb,struct iov_iter *to) { -return simple_read_from_buffer (userbuf, len, f_pos, oppanel_data, - oppanel_size); +return simple_copy_to_iter (oppanel_data, &iocb->ki_pos, oppanel_size, to); }static int __op_panel_update_display (void )
@@ -86,26 +84,25 @@ static int __op_panel_update_display(void)return rc; } -static ssize_t oppanel_write (struct file *filp,const char __user *userbuf, -size_t len,loff_t *f_pos) +static ssize_t oppanel_write (struct kiocb *iocb,struct iov_iter *from) { -loff_t f_pos_prev = *f_pos; +loff_t f_pos_prev = iocb->ki_pos; +size_t len =iov_iter_count (from);ssize_t ret;int rc; -if (!*f_pos) +if (!iocb->ki_pos)memset (oppanel_data,' ' , oppanel_size); -else if (*f_pos >= oppanel_size) +else if (iocb->ki_pos >= oppanel_size)return -EFBIG ; - ret =simple_write_to_buffer (oppanel_data, oppanel_size, f_pos, userbuf, - len); + ret =simple_copy_from_iter (oppanel_data, &iocb->ki_pos, len, from);if (ret >0 ) { rc =__op_panel_update_display ();if (rc !=OPAL_SUCCESS ) {pr_err_ratelimited ("OPAL call failed to write to op panel display [rc=%d]\n" , rc); - *f_pos = f_pos_prev; + iocb->ki_pos = f_pos_prev;return -EIO ; } }
@@ -130,8 +127,8 @@ static int oppanel_release(struct inode *inode, struct file *filp)static const struct file_operations oppanel_fops = { .owner =THIS_MODULE , .llseek = oppanel_llseek, - .read = oppanel_read, - .write = oppanel_write, + .read_iter = oppanel_read, + .write_iter = oppanel_write, .open = oppanel_open, .release = oppanel_release };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 31/437 char/ppdev: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/ppdev.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/char/ppdev.c +10 -8
@@ -112,10 +112,11 @@ static inline void pp_enable_irq(struct pp_struct *pp) port->ops->enable_irq (port); } -static ssize_t pp_read (struct file *file,char __user *buf,size_t count, -loff_t *ppos) +static ssize_t pp_read (struct kiocb *iocb,struct iov_iter *to) { +struct file *file = iocb->ki_filp;unsigned int minor =iminor (file_inode (file)); +size_t count =iov_iter_count (to);struct pp_struct *pp = file->private_data;char *kbuffer;ssize_t bytes_read =0 ;
@@ -182,7 +183,7 @@ static ssize_t pp_read(struct file *file, char __user *buf, size_t count,parport_set_timeout (pp->pdev, pp->default_inactivity); -if (bytes_read >0 &©_to_user (buf, kbuffer, bytes_read)) +if (bytes_read >0 && !copy_to_iter_full (kbuffer, bytes_read, to)) bytes_read = -EFAULT ;kfree (kbuffer);
@@ -190,10 +191,11 @@ static ssize_t pp_read(struct file *file, char __user *buf, size_t count,return bytes_read; } -static ssize_t pp_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t pp_write (struct kiocb *iocb,struct iov_iter *from) { +struct file *file = iocb->ki_filp;unsigned int minor =iminor (file_inode (file)); +size_t count =iov_iter_count (from);struct pp_struct *pp = file->private_data;char *kbuffer;ssize_t bytes_written =0 ;
@@ -222,7 +224,7 @@ static ssize_t pp_write(struct file *file, const char __user *buf,while (bytes_written < count) { ssize_t n = min_t(unsigned long, count - bytes_written, PP_BUFFER_SIZE); -if (copy_from_user (kbuffer, buf + bytes_written, n)) { +if (!copy_from_iter_full (kbuffer, n, from)) { bytes_written = -EFAULT ;break ; }
@@ -780,8 +782,8 @@ static const struct class ppdev_class = {static const struct file_operations pp_fops = { .owner =THIS_MODULE , .llseek = no_llseek, - .read = pp_read, - .write = pp_write, + .read_iter = pp_read, + .write_iter = pp_write, .poll = pp_poll, .unlocked_ioctl = pp_ioctl, .compat_ioctl = compat_ptr_ioctl,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 32/437 char/ps3flash: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/ps3flash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/char/ps3flash.c +4 -2
@@ -239,12 +239,14 @@ static ssize_t ps3flash_user_read(struct file *file, char __user *buf, {return ps3flash_read (buf,NULL , count, pos); } +FOPS_READ_ITER_HELPER (ps3flash_user_read);static ssize_t ps3flash_user_write (struct file *file,const char __user *buf,size_t count,loff_t *pos) {return ps3flash_write (buf,NULL , count, pos); } +FOPS_WRITE_ITER_HELPER (ps3flash_user_write);static ssize_t ps3flash_kernel_read (void *buf,size_t count,loff_t pos) {
@@ -310,8 +312,8 @@ static irqreturn_t ps3flash_interrupt(int irq, void *data)static const struct file_operations ps3flash_fops = { .owner =THIS_MODULE , .llseek = ps3flash_llseek, - .read = ps3flash_user_read, - .write = ps3flash_user_write, + .read_iter = ps3flash_user_read_iter, + .write_iter = ps3flash_user_write_iter, .flush = ps3flash_flush, .fsync = ps3flash_fsync, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 33/437 char/scx200_gpio: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/scx200_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/scx200_gpio.c +2 -2
@@ -64,8 +64,8 @@ static int scx200_gpio_release(struct inode *inode, struct file *file)static const struct file_operations scx200_gpio_fileops = { .owner =THIS_MODULE , - .write = nsc_gpio_write, - .read = nsc_gpio_read, + .write_iter = nsc_gpio_write_iter, + .read_iter = nsc_gpio_read_iter, .open = scx200_gpio_open, .release = scx200_gpio_release, .llseek = no_llseek,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 34/437 char/sonypi: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/sonypi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/sonypi.c +2 -1
@@ -925,6 +925,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,return ret; } +FOPS_READ_ITER_HELPER (sonypi_misc_read);static __poll_t sonypi_misc_poll (struct file *file,poll_table *wait) {
@@ -1048,7 +1049,7 @@ static long sonypi_misc_ioctl(struct file *fp,static const struct file_operations sonypi_misc_fops = { .owner =THIS_MODULE , - .read = sonypi_misc_read, + .read_iter = sonypi_misc_read_iter, .poll = sonypi_misc_poll, .open = sonypi_misc_open, .release = sonypi_misc_release,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 35/437 char/tlclk: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/tlclk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/char/tlclk.c +5 -4
@@ -240,9 +240,10 @@ static int tlclk_release(struct inode *inode, struct file *filp)return 0 ; } -static ssize_t tlclk_read (struct file *filp,char __user *buf,size_t count, -loff_t *f_pos) +static ssize_t tlclk_read (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to); +if (count <sizeof (struct tlclk_alarms ))return -EIO ;if (mutex_lock_interruptible (&tlclk_mutex))
@@ -250,7 +251,7 @@ static ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count,wait_event_interruptible (wq, got_event); -if (copy_to_user (buf, alarm_events,sizeof (struct tlclk_alarms ))) { +if (!copy_to_iter_full (alarm_events,sizeof (struct tlclk_alarms ), to)) {mutex_unlock (&tlclk_mutex);return -EFAULT ; }
@@ -263,7 +264,7 @@ static ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count, }static const struct file_operations tlclk_fops = { - .read = tlclk_read, + .read_iter = tlclk_read, .open = tlclk_open, .release = tlclk_release, .llseek = noop_llseek,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 36/437 char/xilinx_hwicap: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-)
drivers/char/xilinx_hwicap/xilinx_hwicap.c +14 -17
@@ -349,10 +349,10 @@ static int hwicap_initialize_hwicap(struct hwicap_drvdata *drvdata)return 0 ; } -static ssize_t -hwicap_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +static ssize_t hwicap_read (struct kiocb *iocb,struct iov_iter *to) { -struct hwicap_drvdata *drvdata = file->private_data; +struct hwicap_drvdata *drvdata = iocb->ki_filp->private_data; +size_t count =iov_iter_count (to);ssize_t bytes_to_read =0 ;u32 *kbuf;u32 words;
@@ -372,7 +372,7 @@ hwicap_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) drvdata->read_buffer_in_use;/* Return the data currently in the read buffer. */ -if (copy_to_user (buf, drvdata->read_buffer, bytes_to_read)) { +if (!copy_to_iter_full (drvdata->read_buffer, bytes_to_read, to)) { status = -EFAULT ; goto error; }
@@ -417,7 +417,7 @@ hwicap_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) }/* If we fail to return the data to the user, then bail out. */ -if (copy_to_user (buf, kbuf, bytes_to_read)) { +if (!copy_to_iter_full (kbuf, bytes_to_read, to)) {free_page ((unsigned long )kbuf); status = -EFAULT ; goto error;
@@ -434,11 +434,10 @@ hwicap_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)return status; } -static ssize_t -hwicap_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t hwicap_write (struct kiocb *iocb,struct iov_iter *from) { -struct hwicap_drvdata *drvdata = file->private_data; +struct hwicap_drvdata *drvdata = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);ssize_t written =0 ;ssize_t left = count;u32 *kbuf;
@@ -475,16 +474,15 @@ hwicap_write(struct file *file, const char __user *buf,if (drvdata->write_buffer_in_use) {memcpy (kbuf, drvdata->write_buffer, drvdata->write_buffer_in_use); -if (copy_from_user ( +if (!copy_from_iter_full ( (((char *)kbuf) + drvdata->write_buffer_in_use), - buf + written, - len - (drvdata->write_buffer_in_use))) { + len - (drvdata->write_buffer_in_use), from)) {free_page ((unsigned long )kbuf); status = -EFAULT ; goto error; } }else { -if (copy_from_user (kbuf, buf + written, len)) { +if (!copy_from_iter_full (kbuf, len, from)) {free_page ((unsigned long )kbuf); status = -EFAULT ; goto error;
@@ -508,8 +506,7 @@ hwicap_write(struct file *file, const char __user *buf, left -= len; }if ((left >0 ) && (left <4 )) { -if (!copy_from_user (drvdata->write_buffer, - buf + written, left)) { +if (copy_from_iter_full (drvdata->write_buffer, left, from)) { drvdata->write_buffer_in_use = left; written += left; left =0 ;
@@ -589,8 +586,8 @@ static int hwicap_release(struct inode *inode, struct file *file)static const struct file_operations hwicap_fops = { .owner =THIS_MODULE , - .write = hwicap_write, - .read = hwicap_read, + .write_iter = hwicap_write, + .read_iter = hwicap_read, .open = hwicap_open, .release = hwicap_release, .llseek = noop_llseek,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 37/437 char/xillybus: convert to read/write iterators
In reply to Jens Axboe--- drivers/char/xillybus/xillybus_core.c | 36 +++++++++++++-------------- drivers/char/xillybus/xillyusb.c | 6 +++-- 2 files changed, 21 insertions(+), 21 deletions(-)
drivers/char/xillybus/xillybus_core.c +17 -19
@@ -28,6 +28,7 @@#include <linux/delay.h> #include <linux/slab.h> #include <linux/workqueue.h> +#include <linux/uio.h> #include "xillybus.h" #include "xillybus_class.h"
@@ -687,15 +688,15 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint)return 0 ; } -static ssize_t xillybus_read (struct file *filp,char __user *userbuf, -size_t count,loff_t *f_pos) +static ssize_t xillybus_read (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to);ssize_t rc;unsigned long flags;int bytes_done =0 ;int no_time_left =0 ;long deadline, left_to_sleep; -struct xilly_channel *channel = filp->private_data; +struct xilly_channel *channel = iocb->ki_filp->private_data;int empty, reached_eof, exhausted, ready;/* Initializations are there only to silence warnings */
@@ -775,13 +776,11 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, channel->wr_buf_size, DMA_FROM_DEVICE); -if (copy_to_user ( - userbuf, +if (!copy_to_iter_full ( channel->wr_buffers[bufidx]->addr - + bufpos, howmany)) + + bufpos, howmany, to)) rc = -EFAULT ; - userbuf += howmany; bytes_done += howmany;if (bufferdone) {
@@ -831,7 +830,7 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf,* nonblocking mode, but only for a very short time. */ -if (!no_time_left && (filp->f_flags &O_NONBLOCK )) { +if (!no_time_left && (iocb->ki_filp->f_flags &O_NONBLOCK )) {if (bytes_done >0 )break ;
@@ -933,7 +932,7 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf,return -EIO ;if (bytes_done)return bytes_done; -if (filp->f_flags &O_NONBLOCK ) +if (iocb->ki_filp->f_flags &O_NONBLOCK )return -EAGAIN ;/* Don't admit snoozing */ return -EINTR ; }
@@ -1199,13 +1198,13 @@ static void xillybus_autoflush(struct work_struct *work) "Autoflush failed under weird circumstances.\n"); } -static ssize_t xillybus_write (struct file *filp,const char __user *userbuf, -size_t count,loff_t *f_pos) +static ssize_t xillybus_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);ssize_t rc;unsigned long flags;int bytes_done =0 ; -struct xilly_channel *channel = filp->private_data; +struct xilly_channel *channel = iocb->ki_filp->private_data;int full, exhausted;/* Initializations are there only to silence warnings */
@@ -1319,12 +1318,11 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, channel->rd_leftovers[3 ] =0 ;/* Clear flag */ } -if (copy_from_user ( +if (!copy_from_iter_full ( channel->rd_buffers[bufidx]->addr + bufpos, - userbuf, howmany)) + howmany, from)) rc = -EFAULT ; - userbuf += howmany; bytes_done += howmany;if (bufferdone) {
@@ -1383,7 +1381,7 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf,* sleeps. */ -if (filp->f_flags &O_NONBLOCK ) { +if (iocb->ki_filp->f_flags &O_NONBLOCK ) { rc = -EAGAIN ;break ; }
@@ -1415,7 +1413,7 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf,return rc;if ((channel->rd_synchronous) && (bytes_done >0 )) { - rc =xillybus_myflush (filp->private_data,0 );/* No timeout */ + rc =xillybus_myflush (channel,0 );/* No timeout */ if (rc && (rc != -EINTR ))return rc;
@@ -1793,8 +1791,8 @@ static __poll_t xillybus_poll(struct file *filp, poll_table *wait)static const struct file_operations xillybus_fops = { .owner =THIS_MODULE , - .read = xillybus_read, - .write = xillybus_write, + .read_iter = xillybus_read, + .write_iter = xillybus_write, .open = xillybus_open, .flush = xillybus_flush, .release = xillybus_release,
drivers/char/xillybus/xillyusb.c +4 -2
@@ -1605,6 +1605,7 @@ static ssize_t xillyusb_read(struct file *filp, char __user *userbuf,return rc; } +FOPS_READ_ITER_HELPER (xillyusb_read);static int xillyusb_flush (struct file *filp,fl_owner_t id) {
@@ -1705,6 +1706,7 @@ static ssize_t xillyusb_write(struct file *filp, const char __user *userbuf,return rc; } +FOPS_WRITE_ITER_HELPER (xillyusb_write);static int xillyusb_release (struct inode *inode,struct file *filp) {
@@ -1895,8 +1897,8 @@ static __poll_t xillyusb_poll(struct file *filp, poll_table *wait)static const struct file_operations xillyusb_fops = { .owner =THIS_MODULE , - .read = xillyusb_read, - .write = xillyusb_write, + .read_iter = xillyusb_read_iter, + .write_iter = xillyusb_write_iter, .open = xillyusb_open, .flush = xillyusb_flush, .release = xillyusb_release,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 38/437 debugfs: convert to ->read_iter()
In reply to Jens Axboe--- arch/powerpc/kernel/dawr.c | 10 ++- drivers/base/regmap/regmap-debugfs.c | 32 ++++++--- drivers/misc/mei/debugfs.c | 12 ++-- fs/debugfs/file.c | 104 ++++++++++++++++++--------- include/linux/debugfs.h | 24 +++---- kernel/sched/debug.c | 9 ++- 6 files changed, 114 insertions(+), 77 deletions(-)
arch/powerpc/kernel/dawr.c +4 -6
@@ -59,9 +59,7 @@ static void disable_dawrs_cb(void *info)set_dawr (i, &null_brk); } -static ssize_t dawr_write_file_bool (struct file *file, -const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t dawr_write_file_bool (struct kiocb *iocb,struct iov_iter *from) {struct arch_hw_breakpoint null_brk = {0 };size_t rc;
@@ -72,7 +70,7 @@ static ssize_t dawr_write_file_bool(struct file *file, set_dawr(0, &null_brk) != H_SUCCESS)return -ENODEV ; - rc =debugfs_write_file_bool (file, user_buf, count, ppos); + rc =debugfs_write_file_bool (iocb, from);if (rc)return rc;
@@ -84,8 +82,8 @@ static ssize_t dawr_write_file_bool(struct file *file, }static const struct file_operations dawr_enable_fops = { - .read = debugfs_read_file_bool, - .write = dawr_write_file_bool, + .read_iter = debugfs_read_file_bool, + .write_iter = dawr_write_file_bool, .open = simple_open, .llseek = default_llseek, };
drivers/base/regmap/regmap-debugfs.c +22 -10
@@ -456,9 +456,9 @@ static int regmap_access_show(struct seq_file *s, void *ignored)DEFINE_SHOW_ATTRIBUTE (regmap_access); -static ssize_t regmap_cache_only_write_file (struct file *file, -const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t __regmap_cache_only_write_file (struct file *file, +const char __user *user_buf, +size_t count,loff_t *ppos) {struct regmap *map =container_of (file->private_data, struct regmap, cache_only);
@@ -497,15 +497,21 @@ static ssize_t regmap_cache_only_write_file(struct file *file,return count; } +static ssize_t regmap_cache_only_write_file (struct kiocb *iocb, +struct iov_iter *from) +{ +return vfs_write_iter (iocb, from, __regmap_cache_only_write_file); +} +static const struct file_operations regmap_cache_only_fops = { .open = simple_open, - .read = debugfs_read_file_bool, - .write = regmap_cache_only_write_file, + .read_iter = debugfs_read_file_bool, + .write_iter = regmap_cache_only_write_file, }; -static ssize_t regmap_cache_bypass_write_file (struct file *file, -const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t __regmap_cache_bypass_write_file (struct file *file, +const char __user *user_buf, +size_t count,loff_t *ppos) {struct regmap *map =container_of (file->private_data, struct regmap, cache_bypass);
@@ -537,10 +543,16 @@ static ssize_t regmap_cache_bypass_write_file(struct file *file,return count; } +static ssize_t regmap_cache_bypass_write_file (struct kiocb *iocb, +struct iov_iter *from) +{ +return vfs_write_iter (iocb, from, __regmap_cache_bypass_write_file); +} +static const struct file_operations regmap_cache_bypass_fops = { .open = simple_open, - .read = debugfs_read_file_bool, - .write = regmap_cache_bypass_write_file, + .read_iter = debugfs_read_file_bool, + .write_iter = regmap_cache_bypass_write_file, };void regmap_debugfs_init (struct regmap *map)
drivers/misc/mei/debugfs.c +5 -7
@@ -133,17 +133,15 @@ static int mei_dbgfs_devstate_show(struct seq_file *m, void *unused) }DEFINE_SHOW_ATTRIBUTE (mei_dbgfs_devstate); -static ssize_t mei_dbgfs_write_allow_fa (struct file *file, -const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t mei_dbgfs_write_allow_fa (struct kiocb *iocb,struct iov_iter *from) {struct mei_device *dev;int ret; - dev =container_of (file->private_data, + dev =container_of (iocb->ki_filp->private_data, struct mei_device, allow_fixed_address); - ret =debugfs_write_file_bool (file, user_buf, count, ppos); + ret =debugfs_write_file_bool (iocb, from);if (ret <0 )return ret; dev->override_fixed_address = true;
@@ -152,8 +150,8 @@ static ssize_t mei_dbgfs_write_allow_fa(struct file *file,static const struct file_operations mei_dbgfs_allow_fa_fops = { .open = simple_open, - .read = debugfs_read_file_bool, - .write = mei_dbgfs_write_allow_fa, + .read_iter = debugfs_read_file_bool, + .write_iter = mei_dbgfs_write_allow_fa, .llseek = generic_file_llseek, };
fs/debugfs/file.c +70 -34
225 lines not on this page · raw message
include/linux/debugfs.h +9 -15
@@ -162,14 +162,11 @@ void debugfs_create_devm_seqfile(struct device *dev, const char *name,bool debugfs_initialized (void ); -ssize_t debugfs_read_file_bool (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos); +ssize_t debugfs_read_file_bool (struct kiocb *iocb,struct iov_iter *to); -ssize_t debugfs_write_file_bool (struct file *file,const char __user *user_buf, -size_t count,loff_t *ppos); +ssize_t debugfs_write_file_bool (struct kiocb *iocb,struct iov_iter *from); -ssize_t debugfs_read_file_str (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos); +ssize_t debugfs_read_file_str (struct kiocb *iocb,struct iov_iter *to);/** * struct debugfs_cancellation - cancellation data
@@ -376,23 +373,20 @@ static inline void debugfs_create_devm_seqfile(struct device *dev, { } -static inline ssize_t debugfs_read_file_bool (struct file *file, -char __user *user_buf, -size_t count,loff_t *ppos) +static inline ssize_t debugfs_read_file_bool (struct kiocb *iocb, +struct iov_iter *to) {return -ENODEV ; } -static inline ssize_t debugfs_write_file_bool (struct file *file, -const char __user *user_buf, -size_t count,loff_t *ppos) +static inline ssize_t debugfs_write_file_bool (struct kiocb *iocb, +struct iov_iter *from) {return -ENODEV ; } -static inline ssize_t debugfs_read_file_str (struct file *file, -char __user *user_buf, -size_t count,loff_t *ppos) +static inline ssize_t debugfs_read_file_str (struct kiocb *iocb, +struct iov_iter *to) {return -ENODEV ; }
kernel/sched/debug.c +4 -5
@@ -284,8 +284,7 @@ __read_mostly bool sched_debug_verbose;static struct dentry *sd_dentry; -static ssize_t sched_verbose_write (struct file *filp,const char __user *ubuf, -size_t cnt,loff_t *ppos) +static ssize_t sched_verbose_write (struct kiocb *iocb,struct iov_iter *from) {ssize_t result;bool orig;
@@ -294,7 +293,7 @@ static ssize_t sched_verbose_write(struct file *filp, const char __user *ubuf,mutex_lock (&sched_domains_mutex); orig = sched_debug_verbose; - result =debugfs_write_file_bool (filp, ubuf, cnt, ppos); + result =debugfs_write_file_bool (iocb, from);if (sched_debug_verbose && !orig)update_sched_domain_debugfs ();
@@ -313,8 +312,8 @@ static ssize_t sched_verbose_write(struct file *filp, const char __user *ubuf,#endif static const struct file_operations sched_verbose_fops = { - .read = debugfs_read_file_bool, - .write = sched_verbose_write, + .read_iter = debugfs_read_file_bool, + .write_iter = sched_verbose_write, .open = simple_open, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 39/437 libfs: switch to read iter and add copy helpers
In reply to Jens Axboe--- fs/debugfs/file.c | 44 +++++++++++++++++++++ fs/libfs.c | 87 +++++++++++++++++++++++++++++++++++++++++ include/linux/debugfs.h | 25 +++++++++++- include/linux/fs.h | 7 +++- 4 files changed, 159 insertions(+), 4 deletions(-)
fs/debugfs/file.c +44 -0
@@ -468,6 +468,20 @@ ssize_t debugfs_attr_read(struct file *file, char __user *buf, }EXPORT_SYMBOL_GPL (debugfs_attr_read); +ssize_t debugfs_attr_read_iter (struct kiocb *iocb,struct iov_iter *to) +{ +struct dentry *dentry =F_DENTRY (iocb->ki_filp); +ssize_t ret; + + ret =debugfs_file_get (dentry); +if (unlikely (ret)) +return ret; + ret =simple_attr_read_iter (iocb, to); +debugfs_file_put (dentry); +return ret; +} +EXPORT_SYMBOL_GPL (debugfs_attr_read_iter); +static ssize_t debugfs_attr_write_xsigned (struct file *file,const char __user *buf,size_t len,loff_t *ppos,bool is_signed) {
@@ -499,6 +513,36 @@ ssize_t debugfs_attr_write_signed(struct file *file, const char __user *buf, }EXPORT_SYMBOL_GPL (debugfs_attr_write_signed); +static ssize_t debugfs_attr_write_iter_xsigned (struct kiocb *iocb, +struct iov_iter *from, +bool is_signed) +{ +struct dentry *dentry =F_DENTRY (iocb->ki_filp); +ssize_t ret; + + ret =debugfs_file_get (dentry); +if (unlikely (ret)) +return ret; +if (is_signed) + ret =simple_attr_write_iter_signed (iocb, from); +else + ret =simple_attr_write_iter (iocb, from); +debugfs_file_put (dentry); +return ret; +} + +ssize_t debugfs_attr_write_iter (struct kiocb *iocb,struct iov_iter *from) +{ +return debugfs_attr_write_iter_xsigned (iocb, from, false); +} +EXPORT_SYMBOL_GPL (debugfs_attr_write_iter); + +ssize_t debugfs_attr_write_iter_signed (struct kiocb *iocb,struct iov_iter *from) +{ +return debugfs_attr_write_iter_xsigned (iocb, from, true); +} +EXPORT_SYMBOL_GPL (debugfs_attr_write_iter_signed); + static struct dentry *debugfs_create_mode_unsafe(const char *name, umode_t mode, struct dentry *parent, void *value, const struct file_operations *fops,
fs/libfs.c +87 -0
93 lines not on this page · raw message
include/linux/debugfs.h +23 -2
@@ -55,8 +55,8 @@ static const struct file_operations __fops = { \ .owner = THIS_MODULE, \ .open = __fops ## _open, \ .release = simple_attr_release, \ - .read = debugfs_attr_read, \ - .write = (__is_signed) ? debugfs_attr_write_signed : debugfs_attr_write, \ + .read_iter = debugfs_attr_read_iter, \ + .write_iter= (__is_signed) ? debugfs_attr_write_iter_signed : debugfs_attr_write_iter, \ .llseek = no_llseek, \ }
@@ -106,10 +106,13 @@ void debugfs_file_put(struct dentry *dentry);ssize_t debugfs_attr_read (struct file *file,char __user *buf,size_t len,loff_t *ppos); +ssize_t debugfs_attr_read_iter (struct kiocb *iocb,struct iov_iter *to);ssize_t debugfs_attr_write (struct file *file,const char __user *buf,size_t len,loff_t *ppos); +ssize_t debugfs_attr_write_iter (struct kiocb *iocb,struct iov_iter *from);ssize_t debugfs_attr_write_signed (struct file *file,const char __user *buf,size_t len,loff_t *ppos); +ssize_t debugfs_attr_write_iter_signed (struct kiocb *iocb,struct iov_iter *from);struct dentry *debugfs_rename (struct dentry *old_dir,struct dentry *old_dentry,struct dentry *new_dir,const char *new_name);
@@ -271,6 +274,12 @@ static inline ssize_t debugfs_attr_read(struct file *file, char __user *buf,return -ENODEV ; } +static inline ssize_t debugfs_attr_read_iter (struct kiocb *iocb, +struct iov_iter *to) +{ +return -ENODEV ; +} +static inline ssize_t debugfs_attr_write (struct file *file,const char __user *buf,size_t len,loff_t *ppos)
@@ -278,6 +287,12 @@ static inline ssize_t debugfs_attr_write(struct file *file,return -ENODEV ; } +static inline ssize_t debugfs_attr_write_iter (struct kiocb *iocb, +struct iov_iter *from) +{ +return -ENODEV ; +} +static inline ssize_t debugfs_attr_write_signed (struct file *file,const char __user *buf,size_t len,loff_t *ppos)
@@ -285,6 +300,12 @@ static inline ssize_t debugfs_attr_write_signed(struct file *file,return -ENODEV ; } +static inline ssize_t debugfs_attr_write_iter_signed (struct kiocb *iocb, +struct iov_iter *from) +{ +return -ENODEV ; +} +static inline struct dentry *debugfs_rename (struct dentry *old_dir,struct dentry *old_dentry,struct dentry *new_dir,char *new_name) {
include/linux/fs.h +5 -2
@@ -3528,8 +3528,8 @@ static const struct file_operations __fops = { \ .owner = THIS_MODULE, \ .open = __fops ## _open, \ .release = simple_attr_release, \ - .read = simple_attr_read, \ - .write = (__is_signed) ? simple_attr_write_signed : simple_attr_write, \ + .read_iter = simple_attr_read_iter, \ + .write_iter = (__is_signed) ? simple_attr_write_iter_signed : simple_attr_write_iter, \ .llseek = generic_file_llseek, \ }
@@ -3555,6 +3555,9 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos);ssize_t simple_attr_write_signed (struct file *file,const char __user *buf,size_t len,loff_t *ppos); +ssize_t simple_attr_read_iter (struct kiocb *iocb,struct iov_iter *to); +ssize_t simple_attr_write_iter (struct kiocb *iocb,struct iov_iter *from); +ssize_t simple_attr_write_iter_signed (struct kiocb *iocb,struct iov_iter *from);struct ctl_table ;int __init list_bdev_fs_names (char *buf,size_t size);
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 40/437 fs: convert generic_read_dir() to ->read_iter()
In reply to Jens AxboeNo functional changes here, just a straight forward mechanical conversion.
--- arch/powerpc/platforms/cell/spufs/inode.c | 2 +- fs/9p/vfs_dir.c | 4 ++-- fs/adfs/dir.c | 2 +- fs/affs/dir.c | 2 +- fs/autofs/root.c | 4 ++-- fs/bcachefs/fs.c | 2 +- fs/befs/linuxvfs.c | 2 +- fs/bfs/dir.c | 2 +- fs/btrfs/inode.c | 2 +- fs/coda/dir.c | 2 +- fs/configfs/dir.c | 2 +- fs/cramfs/inode.c | 2 +- fs/ecryptfs/file.c | 2 +- fs/efs/dir.c | 2 +- fs/erofs/dir.c | 2 +- fs/exfat/dir.c | 2 +- fs/ext2/dir.c | 2 +- fs/ext4/dir.c | 2 +- fs/f2fs/dir.c | 2 +- fs/fat/dir.c | 2 +- fs/freevxfs/vxfs_lookup.c | 2 +- fs/fuse/dir.c | 2 +- fs/hfs/dir.c | 2 +- fs/hfsplus/dir.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/dir.c | 2 +- fs/isofs/dir.c | 2 +- fs/jffs2/dir.c | 2 +- fs/jfs/namei.c | 2 +- fs/kernfs/dir.c | 2 +- fs/libfs.c | 8 ++++---- fs/minix/dir.c | 2 +- fs/nfs/dir.c | 2 +- fs/nilfs2/dir.c | 2 +- fs/ntfs3/dir.c | 2 +- fs/ocfs2/file.c | 4 ++-- fs/omfs/dir.c | 2 +- fs/openpromfs/inode.c | 2 +- fs/orangefs/dir.c | 2 +- fs/overlayfs/readdir.c | 2 +- fs/proc/base.c | 12 ++++++------ fs/proc/fd.c | 4 ++-- fs/proc/generic.c | 2 +- fs/proc/namespaces.c | 2 +- fs/proc/proc_net.c | 2 +- fs/proc/proc_sysctl.c | 2 +- fs/proc/root.c | 2 +- fs/qnx4/dir.c | 2 +- fs/qnx6/dir.c | 2 +- fs/reiserfs/dir.c | 2 +- fs/romfs/super.c | 2 +- fs/smb/client/cifsfs.c | 2 +- fs/squashfs/dir.c | 2 +- fs/sysv/dir.c | 2 +- fs/tracefs/event_inode.c | 2 +- fs/ubifs/dir.c | 2 +- fs/udf/dir.c | 2 +- fs/ufs/dir.c | 2 +- fs/vboxsf/dir.c | 2 +- fs/xfs/xfs_file.c | 2 +- fs/zonefs/super.c | 2 +- include/linux/fs.h | 2 +- 62 files changed, 74 insertions(+), 74 deletions(-)
arch/powerpc/platforms/cell/spufs/inode.c +1 -1
@@ -220,7 +220,7 @@ const struct file_operations spufs_context_fops = { .open = dcache_dir_open, .release = spufs_dir_close, .llseek = dcache_dir_lseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = dcache_readdir, .fsync = noop_fsync, };
fs/9p/vfs_dir.c +2 -2
@@ -237,7 +237,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) }const struct file_operations v9fs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .llseek = generic_file_llseek, .iterate_shared = v9fs_dir_readdir, .open = v9fs_file_open,
@@ -245,7 +245,7 @@ const struct file_operations v9fs_dir_operations = { };const struct file_operations v9fs_dir_operations_dotl = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .llseek = generic_file_llseek, .iterate_shared = v9fs_dir_readdir_dotl, .open = v9fs_file_open,
fs/adfs/dir.c +1 -1
@@ -385,7 +385,7 @@ static int adfs_dir_lookup_byname(struct inode *inode, const struct qstr *qstr, }const struct file_operations adfs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .llseek = generic_file_llseek, .iterate_shared = adfs_iterate, .fsync = generic_file_fsync,
fs/affs/dir.c +1 -1
@@ -20,7 +20,7 @@static int affs_readdir (struct file *,struct dir_context *);const struct file_operations affs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .llseek = generic_file_llseek, .iterate_shared = affs_readdir, .fsync = affs_file_fsync,
fs/autofs/root.c +2 -2
@@ -32,7 +32,7 @@ static void autofs_dentry_release(struct dentry *);const struct file_operations autofs_root_operations = { .open = dcache_dir_open, .release = dcache_dir_close, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = dcache_readdir, .llseek = dcache_dir_lseek, .unlocked_ioctl = autofs_root_ioctl,
@@ -44,7 +44,7 @@ const struct file_operations autofs_root_operations = {const struct file_operations autofs_dir_operations = { .open = autofs_dir_open, .release = dcache_dir_close, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = dcache_readdir, .llseek = dcache_dir_lseek, };
fs/bcachefs/fs.c +1 -1
@@ -1156,7 +1156,7 @@ static const struct inode_operations bch_dir_inode_operations = {static const struct file_operations bch_dir_file_operations = { .llseek = bch2_dir_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = bch2_vfs_readdir, .fsync = bch2_fsync, .unlocked_ioctl = bch2_fs_file_ioctl,
fs/befs/linuxvfs.c +1 -1
@@ -77,7 +77,7 @@ static const struct super_operations befs_sops = {static struct kmem_cache *befs_inode_cachep;static const struct file_operations befs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = befs_readdir, .llseek = generic_file_llseek, };
fs/bfs/dir.c +1 -1
@@ -69,7 +69,7 @@ static int bfs_readdir(struct file *f, struct dir_context *ctx) }const struct file_operations bfs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = bfs_readdir, .fsync = generic_file_fsync, .llseek = generic_file_llseek,
fs/btrfs/inode.c +1 -1
@@ -11029,7 +11029,7 @@ static const struct inode_operations btrfs_dir_inode_operations = {static const struct file_operations btrfs_dir_file_operations = { .llseek = btrfs_dir_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = btrfs_real_readdir, .open = btrfs_opendir, .unlocked_ioctl = btrfs_ioctl,
fs/coda/dir.c +1 -1
@@ -581,7 +581,7 @@ const struct inode_operations coda_dir_inode_operations = {WRAP_DIR_ITER (coda_readdir)// FIXME! const struct file_operations coda_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = shared_coda_readdir, .open = coda_open, .release = coda_release,
fs/configfs/dir.c +1 -1
@@ -1706,7 +1706,7 @@ const struct file_operations configfs_dir_operations = { .open = configfs_dir_open, .release = configfs_dir_close, .llseek = configfs_dir_lseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = configfs_readdir, };
fs/cramfs/inode.c +1 -1
@@ -933,7 +933,7 @@ static const struct address_space_operations cramfs_aops = {*/ static const struct file_operations cramfs_directory_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = cramfs_readdir, };
fs/ecryptfs/file.c +1 -1
@@ -414,7 +414,7 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)const struct file_operations ecryptfs_dir_fops = { .iterate_shared = ecryptfs_readdir, - .read = generic_read_dir, + .read_iter = generic_read_dir, .unlocked_ioctl = ecryptfs_unlocked_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ecryptfs_compat_ioctl,
fs/efs/dir.c +1 -1
@@ -12,7 +12,7 @@ static int efs_readdir(struct file *, struct dir_context *);const struct file_operations efs_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = efs_readdir, };
fs/erofs/dir.c +1 -1
@@ -106,6 +106,6 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)const struct file_operations erofs_dir_fops = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = erofs_readdir, };
fs/exfat/dir.c +1 -1
@@ -309,7 +309,7 @@ static int exfat_iterate(struct file *file, struct dir_context *ctx)WRAP_DIR_ITER (exfat_iterate)// FIXME! const struct file_operations exfat_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = shared_exfat_iterate, .unlocked_ioctl = exfat_ioctl, #ifdef CONFIG_COMPAT
fs/ext2/dir.c +1 -1
@@ -706,7 +706,7 @@ int ext2_empty_dir(struct inode *inode)const struct file_operations ext2_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = ext2_readdir, .unlocked_ioctl = ext2_ioctl, #ifdef CONFIG_COMPAT
fs/ext4/dir.c +1 -1
@@ -666,7 +666,7 @@ int ext4_check_all_de(struct inode *dir, struct buffer_head *bh, void *buf,const struct file_operations ext4_dir_operations = { .llseek = ext4_dir_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = ext4_readdir, .unlocked_ioctl = ext4_ioctl, #ifdef CONFIG_COMPAT
fs/f2fs/dir.c +1 -1
@@ -1133,7 +1133,7 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)const struct file_operations f2fs_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = f2fs_readdir, .fsync = f2fs_sync_file, .unlocked_ioctl = f2fs_ioctl,
fs/fat/dir.c +1 -1
@@ -857,7 +857,7 @@ static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd,const struct file_operations fat_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = fat_readdir, .unlocked_ioctl = fat_dir_ioctl, #ifdef CONFIG_COMPAT
fs/freevxfs/vxfs_lookup.c +1 -1
@@ -34,7 +34,7 @@ const struct inode_operations vxfs_dir_inode_ops = {const struct file_operations vxfs_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = vxfs_readdir, };
fs/fuse/dir.c +1 -1
@@ -2149,7 +2149,7 @@ static const struct inode_operations fuse_dir_inode_operations = {static const struct file_operations fuse_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = fuse_readdir, .open = fuse_dir_open, .release = fuse_dir_release,
fs/hfs/dir.c +1 -1
@@ -307,7 +307,7 @@ static int hfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, }const struct file_operations hfs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = hfs_readdir, .llseek = generic_file_llseek, .release = hfs_dir_release,
fs/hfsplus/dir.c +1 -1
@@ -575,7 +575,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {const struct file_operations hfsplus_dir_operations = { .fsync = hfsplus_file_fsync, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = hfsplus_readdir, .unlocked_ioctl = hfsplus_ioctl, .llseek = generic_file_llseek,
fs/hostfs/hostfs_kern.c +1 -1
@@ -390,7 +390,7 @@ static const struct file_operations hostfs_file_fops = {static const struct file_operations hostfs_dir_fops = { .llseek = generic_file_llseek, .iterate_shared = hostfs_readdir, - .read = generic_read_dir, + .read_iter = generic_read_dir, .open = hostfs_open, .fsync = hostfs_fsync, };
fs/hpfs/dir.c +1 -1
@@ -322,7 +322,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned inconst struct file_operations hpfs_dir_ops = { .llseek = hpfs_dir_lseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = hpfs_readdir, .release = hpfs_dir_release, .fsync = hpfs_file_fsync,
fs/isofs/dir.c +1 -1
@@ -268,7 +268,7 @@ static int isofs_readdir(struct file *file, struct dir_context *ctx)const struct file_operations isofs_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = isofs_readdir, };
fs/jffs2/dir.c +1 -1
@@ -43,7 +43,7 @@ static int jffs2_rename (struct mnt_idmap *, struct inode *,const struct file_operations jffs2_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared=jffs2_readdir, .unlocked_ioctl=jffs2_ioctl, .fsync = jffs2_fsync,
fs/jfs/namei.c +1 -1
@@ -1539,7 +1539,7 @@ const struct inode_operations jfs_dir_inode_operations = {WRAP_DIR_ITER (jfs_readdir)// FIXME! const struct file_operations jfs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = shared_jfs_readdir, .fsync = jfs_fsync, .unlocked_ioctl = jfs_ioctl,
fs/kernfs/dir.c +1 -1
@@ -1880,7 +1880,7 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx) }const struct file_operations kernfs_dir_fops = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = kernfs_fop_readdir, .release = kernfs_dir_fop_release, .llseek = generic_file_llseek,
fs/libfs.c +4 -4
@@ -220,7 +220,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx) }EXPORT_SYMBOL (dcache_readdir); -ssize_t generic_read_dir (struct file *filp,char __user *buf,size_t siz,loff_t *ppos) +ssize_t generic_read_dir (struct kiocb *iocb,struct iov_iter *to) {return -EISDIR ; }
@@ -230,7 +230,7 @@ const struct file_operations simple_dir_operations = { .open = dcache_dir_open, .release = dcache_dir_close, .llseek = dcache_dir_lseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = dcache_readdir, .fsync = noop_fsync, };
@@ -527,7 +527,7 @@ static int offset_readdir(struct file *file, struct dir_context *ctx)const struct file_operations simple_offset_dir_operations = { .llseek = offset_dir_llseek, .iterate_shared = offset_readdir, - .read = generic_read_dir, + .read_iter = generic_read_dir, .fsync = noop_fsync, };
@@ -1856,7 +1856,7 @@ static int empty_dir_readdir(struct file *file, struct dir_context *ctx)static const struct file_operations empty_dir_operations = { .llseek = empty_dir_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = empty_dir_readdir, .fsync = noop_fsync, };
fs/minix/dir.c +1 -1
@@ -21,7 +21,7 @@ static int minix_readdir(struct file *, struct dir_context *);const struct file_operations minix_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = minix_readdir, .fsync = generic_file_fsync, };
fs/nfs/dir.c +1 -1
@@ -59,7 +59,7 @@ static void nfs_readdir_clear_array(struct folio *);const struct file_operations nfs_dir_operations = { .llseek = nfs_llseek_dir, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = nfs_readdir, .open = nfs_opendir, .release = nfs_closedir,
fs/nilfs2/dir.c +1 -1
@@ -646,7 +646,7 @@ int nilfs_empty_dir(struct inode *inode)const struct file_operations nilfs_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = nilfs_readdir, .unlocked_ioctl = nilfs_ioctl, #ifdef CONFIG_COMPAT
fs/ntfs3/dir.c +1 -1
@@ -607,7 +607,7 @@ bool dir_is_empty(struct inode *dir)// clang-format off const struct file_operations ntfs_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = ntfs_readdir, .fsync = generic_file_fsync, .open = ntfs_file_open,
fs/ocfs2/file.c +2 -2
@@ -2796,7 +2796,7 @@ const struct file_operations ocfs2_fops = {WRAP_DIR_ITER (ocfs2_readdir)// FIXME! const struct file_operations ocfs2_dops = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = shared_ocfs2_readdir, .fsync = ocfs2_sync_file, .release = ocfs2_dir_release,
@@ -2842,7 +2842,7 @@ const struct file_operations ocfs2_fops_no_plocks = {const struct file_operations ocfs2_dops_no_plocks = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = shared_ocfs2_readdir, .fsync = ocfs2_sync_file, .release = ocfs2_dir_release,
fs/omfs/dir.c +1 -1
@@ -455,7 +455,7 @@ const struct inode_operations omfs_dir_inops = { };const struct file_operations omfs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = omfs_readdir, .llseek = generic_file_llseek, };
fs/openpromfs/inode.c +1 -1
@@ -167,7 +167,7 @@ static const struct file_operations openpromfs_prop_ops = {static int openpromfs_readdir (struct file *,struct dir_context *);static const struct file_operations openprom_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = openpromfs_readdir, .llseek = generic_file_llseek, };
fs/orangefs/dir.c +1 -1
@@ -389,7 +389,7 @@ static int orangefs_dir_release(struct inode *inode, struct file *file)const struct file_operations orangefs_dir_operations = { .llseek = orangefs_dir_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = orangefs_dir_iterate, .open = orangefs_dir_open, .release = orangefs_dir_release
fs/overlayfs/readdir.c +1 -1
@@ -970,7 +970,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file)WRAP_DIR_ITER (ovl_iterate)// FIXME! const struct file_operations ovl_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .open = ovl_dir_open, .iterate_shared = shared_ovl_iterate, .llseek = ovl_dir_llseek,
fs/proc/base.c +6 -6
@@ -2430,7 +2430,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx) }static const struct file_operations proc_map_files_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_map_files_readdir, .llseek = generic_file_llseek, };
@@ -2811,7 +2811,7 @@ static int proc_##LSM##_attr_dir_iterate(struct file *filp, \ } \ \ static const struct file_operations proc_##LSM##_attr_dir_ops = { \ - .read = generic_read_dir, \ + .read_iter = generic_read_dir, \ .iterate_shared = proc_##LSM##_attr_dir_iterate, \ .llseek = default_llseek, \ }; \
@@ -2870,7 +2870,7 @@ static int proc_attr_dir_readdir(struct file *file, struct dir_context *ctx) }static const struct file_operations proc_attr_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_attr_dir_readdir, .llseek = generic_file_llseek, };
@@ -3368,7 +3368,7 @@ static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx) }static const struct file_operations proc_tgid_base_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_tgid_base_readdir, .llseek = generic_file_llseek, };
@@ -3714,7 +3714,7 @@ static struct dentry *proc_tid_base_lookup(struct inode *dir, struct dentry *den }static const struct file_operations proc_tid_base_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_tid_base_readdir, .llseek = generic_file_llseek, };
@@ -3923,7 +3923,7 @@ static const struct inode_operations proc_task_inode_operations = { };static const struct file_operations proc_task_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_task_readdir, .llseek = generic_file_llseek, };
fs/proc/fd.c +2 -2
@@ -314,7 +314,7 @@ static int proc_readfd(struct file *file, struct dir_context *ctx) }const struct file_operations proc_fd_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_readfd, .llseek = generic_file_llseek, };
@@ -424,7 +424,7 @@ const struct inode_operations proc_fdinfo_inode_operations = {const struct file_operations proc_fdinfo_operations = { .open = proc_open_fdinfo, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_readfdinfo, .llseek = generic_file_llseek, };
fs/proc/generic.c +1 -1
@@ -339,7 +339,7 @@ int proc_readdir(struct file *file, struct dir_context *ctx)*/ static const struct file_operations proc_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_readdir, };
fs/proc/namespaces.c +1 -1
@@ -143,7 +143,7 @@ static int proc_ns_dir_readdir(struct file *file, struct dir_context *ctx) }const struct file_operations proc_ns_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_ns_dir_readdir, .llseek = generic_file_llseek, };
fs/proc/proc_net.c +1 -1
@@ -340,7 +340,7 @@ static int proc_tgid_net_readdir(struct file *file, struct dir_context *ctx)const struct file_operations proc_net_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_tgid_net_readdir, };
fs/proc/proc_sysctl.c +1 -1
@@ -860,7 +860,7 @@ static const struct file_operations proc_sys_file_operations = { };static const struct file_operations proc_sys_dir_file_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_sys_readdir, .llseek = generic_file_llseek, };
fs/proc/root.c +1 -1
@@ -346,7 +346,7 @@ static int proc_root_readdir(struct file *file, struct dir_context *ctx)* directory handling functions for that.. */ static const struct file_operations proc_root_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = proc_root_readdir, .llseek = generic_file_llseek, };
fs/qnx4/dir.c +1 -1
@@ -68,7 +68,7 @@ static int qnx4_readdir(struct file *file, struct dir_context *ctx)const struct file_operations qnx4_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = qnx4_readdir, .fsync = generic_file_fsync, };
fs/qnx6/dir.c +1 -1
@@ -272,7 +272,7 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name,const struct file_operations qnx6_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = qnx6_readdir, .fsync = generic_file_fsync, };
fs/reiserfs/dir.c +1 -1
@@ -19,7 +19,7 @@ static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end,const struct file_operations reiserfs_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = reiserfs_readdir, .fsync = reiserfs_dir_fsync, .unlocked_ioctl = reiserfs_ioctl,
fs/romfs/super.c +1 -1
@@ -263,7 +263,7 @@ static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry, }static const struct file_operations romfs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = romfs_readdir, .llseek = generic_file_llseek, };
fs/smb/client/cifsfs.c +1 -1
@@ -1640,7 +1640,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = {const struct file_operations cifs_dir_ops = { .iterate_shared = cifs_readdir, .release = cifs_closedir, - .read = generic_read_dir, + .read_iter = generic_read_dir, .unlocked_ioctl = cifs_ioctl, .copy_file_range = cifs_copy_file_range, .remap_file_range = cifs_remap_file_range,
fs/squashfs/dir.c +1 -1
@@ -217,7 +217,7 @@ static int squashfs_readdir(struct file *file, struct dir_context *ctx)const struct file_operations squashfs_dir_ops = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = squashfs_readdir, .llseek = generic_file_llseek, };
fs/sysv/dir.c +1 -1
@@ -23,7 +23,7 @@ static int sysv_readdir(struct file *, struct dir_context *);const struct file_operations sysv_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = sysv_readdir, .fsync = generic_file_fsync, };
fs/tracefs/event_inode.c +1 -1
@@ -277,7 +277,7 @@ static const struct inode_operations eventfs_file_inode_operations = { };static const struct file_operations eventfs_file_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = eventfs_iterate, .llseek = generic_file_llseek, };
fs/ubifs/dir.c +1 -1
@@ -1719,7 +1719,7 @@ const struct inode_operations ubifs_dir_inode_operations = {const struct file_operations ubifs_dir_operations = { .llseek = generic_file_llseek, .release = ubifs_dir_release, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = ubifs_readdir, .fsync = ubifs_fsync, .unlocked_ioctl = ubifs_ioctl,
fs/udf/dir.c +1 -1
@@ -131,7 +131,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)/* readdir and lookup functions */ const struct file_operations udf_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = udf_readdir, .unlocked_ioctl = udf_ioctl, .fsync = generic_file_fsync,
fs/ufs/dir.c +1 -1
@@ -648,7 +648,7 @@ int ufs_empty_dir(struct inode * inode) }const struct file_operations ufs_dir_operations = { - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = ufs_readdir, .fsync = generic_file_fsync, .llseek = generic_file_llseek,
fs/vboxsf/dir.c +1 -1
@@ -184,7 +184,7 @@ const struct file_operations vboxsf_dir_fops = { .open = vboxsf_dir_open, .iterate_shared = shared_vboxsf_dir_iterate, .release = vboxsf_dir_release, - .read = generic_read_dir, + .read_iter = generic_read_dir, .llseek = generic_file_llseek, };
fs/xfs/xfs_file.c +1 -1
@@ -1502,7 +1502,7 @@ const struct file_operations xfs_file_operations = {const struct file_operations xfs_dir_file_operations = { .open = xfs_dir_open, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = xfs_file_readdir, .llseek = generic_file_llseek, .unlocked_ioctl = xfs_file_ioctl,
fs/zonefs/super.c +1 -1
@@ -838,7 +838,7 @@ const struct inode_operations zonefs_dir_inode_operations = {const struct file_operations zonefs_dir_operations = { .llseek = generic_file_llseek, - .read = generic_read_dir, + .read_iter = generic_read_dir, .iterate_shared = zonefs_readdir, };
include/linux/fs.h +1 -1
@@ -3337,7 +3337,7 @@ extern int simple_nosetlease(struct file *, int, struct file_lease **, void **);extern const struct dentry_operations simple_dentry_operations;extern struct dentry *simple_lookup (struct inode *,struct dentry *,unsigned int flags); -extern ssize_t generic_read_dir (struct file *,char __user *,size_t ,loff_t *); +extern ssize_t generic_read_dir (struct kiocb *,struct iov_iter *);extern const struct file_operations simple_dir_operations;extern const struct inode_operations simple_dir_inode_operations;extern void make_empty_dir_inode (struct inode *inode);
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 41/437 fs: convert any user of fops->read() for seq_read to read_iter
In reply to Jens AxboeThere's a seq_read_iter that can be used, do that.
--- fs/dlm/debug_fs.c | 10 +++++----- fs/gfs2/glock.c | 6 +++--- fs/ocfs2/cluster/netdebug.c | 6 +++--- fs/ocfs2/dlm/dlmdebug.c | 2 +- fs/ocfs2/dlmglue.c | 2 +- fs/orangefs/orangefs-debugfs.c | 2 +- fs/proc/array.c | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-)
fs/dlm/debug_fs.c +5 -5
@@ -774,7 +774,7 @@ static int table_open5(struct inode *inode, struct file *file)static const struct file_operations format1_fops = { .owner =THIS_MODULE , .open = table_open1, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release };
@@ -782,7 +782,7 @@ static const struct file_operations format1_fops = {static const struct file_operations format2_fops = { .owner =THIS_MODULE , .open = table_open2, - .read = seq_read, + .read_iter = seq_read_iter, .write = table_write2, .llseek = seq_lseek, .release = seq_release
@@ -791,7 +791,7 @@ static const struct file_operations format2_fops = {static const struct file_operations format3_fops = { .owner =THIS_MODULE , .open = table_open3, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release };
@@ -799,7 +799,7 @@ static const struct file_operations format3_fops = {static const struct file_operations format4_fops = { .owner =THIS_MODULE , .open = table_open4, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release };
@@ -807,7 +807,7 @@ static const struct file_operations format4_fops = {static const struct file_operations format5_fops = { .owner =THIS_MODULE , .open = table_open5, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release };
fs/gfs2/glock.c +3 -3
@@ -2699,7 +2699,7 @@ static int gfs2_glstats_open(struct inode *inode, struct file *file)static const struct file_operations gfs2_glocks_fops = { .owner =THIS_MODULE , .open = gfs2_glocks_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = gfs2_glocks_release, };
@@ -2707,7 +2707,7 @@ static const struct file_operations gfs2_glocks_fops = {static const struct file_operations gfs2_glstats_fops = { .owner =THIS_MODULE , .open = gfs2_glstats_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = gfs2_glocks_release, };
@@ -2876,7 +2876,7 @@ static int gfs2_glockfd_open(struct inode *inode, struct file *file)static const struct file_operations gfs2_glockfd_fops = { .owner =THIS_MODULE , .open = gfs2_glockfd_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release_private, };
fs/ocfs2/cluster/netdebug.c +3 -3
@@ -184,7 +184,7 @@ static int nst_fop_release(struct inode *inode, struct file *file)static const struct file_operations nst_seq_fops = { .open = nst_fop_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = nst_fop_release, };
@@ -416,7 +416,7 @@ static int stats_fop_open(struct inode *inode, struct file *file)static const struct file_operations stats_seq_fops = { .open = stats_fop_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = sc_fop_release, };
@@ -428,7 +428,7 @@ static int sc_fop_open(struct inode *inode, struct file *file)static const struct file_operations sc_seq_fops = { .open = sc_fop_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = sc_fop_release, };
fs/ocfs2/dlm/dlmdebug.c +1 -1
@@ -651,7 +651,7 @@ static int debug_lockres_release(struct inode *inode, struct file *file)static const struct file_operations debug_lockres_fops = { .open = debug_lockres_open, .release = debug_lockres_release, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, };/* end - debug lockres funcs */
fs/ocfs2/dlmglue.c +1 -1
@@ -3299,7 +3299,7 @@ static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file)static const struct file_operations ocfs2_dlm_debug_fops = { .open = ocfs2_dlm_debug_open, .release = ocfs2_dlm_debug_release, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, };
fs/orangefs/orangefs-debugfs.c +1 -1
@@ -116,7 +116,7 @@ static const struct seq_operations help_debug_ops = {static const struct file_operations debug_help_fops = { .owner =THIS_MODULE , .open = orangefs_debug_help_open, - .read = seq_read, + .read_iter = seq_read_iter, .release = seq_release, .llseek = seq_lseek, };
fs/proc/array.c +1 -1
@@ -815,7 +815,7 @@ static int children_seq_open(struct inode *inode, struct file *file)const struct file_operations proc_tid_children_operations = { .open = children_seq_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 42/437 ceph: convert read_dir handler to read_iter()
In reply to Jens Axboe--- fs/ceph/dir.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
fs/ceph/dir.c +8 -7
@@ -2110,12 +2110,13 @@ static void ceph_d_prune(struct dentry *dentry)* read() on a dir. This weird interface hack only works if mounted * with '-o dirstat'. */ -static ssize_t ceph_read_dir (struct file *file,char __user *buf,size_t size, -loff_t *ppos) +static ssize_t ceph_read_dir (struct kiocb *iocb,struct iov_iter *to) { +struct file *file = iocb->ki_filp;struct ceph_dir_file_info *dfi = file->private_data;struct inode *inode =file_inode (file);struct ceph_inode_info *ci =ceph_inode (inode); +size_t size;int left;const int bufsize =1024 ;
@@ -2147,13 +2148,13 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size, ci->i_rctime.tv_nsec); } -if (*ppos >= dfi->dir_info_len) +if (iocb->ki_pos >= dfi->dir_info_len)return 0 ; - size =min_t (unsigned, size, dfi->dir_info_len-*ppos); - left =copy_to_user (buf, dfi->dir_info + *ppos, size); + size =min_t (unsigned,iov_iter_count (to), dfi->dir_info_len-iocb->ki_pos); + left =copy_to_iter (dfi->dir_info + iocb->ki_pos, size, to);if (left == size)return -EFAULT ; - *ppos += (size - left); + iocb->ki_pos += (size - left);return size - left; }
@@ -2184,7 +2185,7 @@ unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn)WRAP_DIR_ITER (ceph_readdir)// FIXME! const struct file_operations ceph_dir_fops = { - .read = ceph_read_dir, + .read_iter = ceph_read_dir, .iterate_shared = shared_ceph_readdir, .llseek = ceph_dir_llseek, .open = ceph_open,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 43/437 ecryptfs: miscdev: convert to read/write iterators
In reply to Jens Axboe--- fs/ecryptfs/miscdev.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
fs/ecryptfs/miscdev.c +11 -13
@@ -309,6 +309,7 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count,mutex_unlock (&daemon->mux);return rc; } +FOPS_READ_ITER_HELPER (ecryptfs_miscdev_read);/** * ecryptfs_miscdev_response - miscdevess response to message previously sent to daemon
@@ -342,22 +343,20 @@ static int ecryptfs_miscdev_response(struct ecryptfs_daemon *daemon, char *data,/** * ecryptfs_miscdev_write - handle write to daemon miscdev handle -* @file: File for misc dev handle -* @buf: Buffer containing user data -* @count: Amount of data in @buf -* @ppos: Pointer to offset in file (ignored) +* @iocb: Metadata for IO +* @from: Buffer containing user data * * Returns the number of bytes read from @buf */ static ssize_t -ecryptfs_miscdev_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +ecryptfs_miscdev_write (struct kiocb *iocb,struct iov_iter *from) {__be32 counter_nbo;u32 seq;size_t packet_size, packet_size_length;char *data;unsigned char packet_size_peek[ECRYPTFS_MAX_PKT_LEN_SIZE ]; +size_t count =iov_iter_count (from);ssize_t rc;if (count ==0 ) {
@@ -372,8 +371,8 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,return -EINVAL ; } -if (copy_from_user (packet_size_peek, &buf[PKT_LEN_OFFSET ], -sizeof (packet_size_peek))) { +if (!copy_from_iter_full (packet_size_peek,sizeof (packet_size_peek), + from)) {printk (KERN_WARNING "%s: Error while inspecting packet size\n" , __func__);return -EFAULT ;
@@ -395,7 +394,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf, } memdup: - data =memdup_user (buf, count); + data =iterdup (from, count);if (IS_ERR (data)) {printk (KERN_ERR "%s: memdup_user returned error [%ld]\n" , __func__,PTR_ERR (data));
@@ -416,7 +415,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf, }memcpy (&counter_nbo, &data[PKT_CTR_OFFSET ],PKT_CTR_SIZE ); seq =be32_to_cpu (counter_nbo); - rc =ecryptfs_miscdev_response (file->private_data, + rc =ecryptfs_miscdev_response (iocb->ki_filp->private_data, &data[PKT_LEN_OFFSET + packet_size_length], packet_size, seq);if (rc) {
@@ -442,13 +441,12 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,return rc; } -static const struct file_operations ecryptfs_miscdev_fops = { .owner =THIS_MODULE , .open = ecryptfs_miscdev_open, .poll = ecryptfs_miscdev_poll, - .read = ecryptfs_miscdev_read, - .write = ecryptfs_miscdev_write, + .read_iter = ecryptfs_miscdev_read_iter, + .write_iter = ecryptfs_miscdev_write, .release = ecryptfs_miscdev_release, .llseek = noop_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 44/437 ocfs2: convert to read/write iterators
In reply to Jens Axboe--- fs/ocfs2/cluster/heartbeat.c | 15 ++++++++------- fs/ocfs2/dlm/dlmdebug.c | 16 +++++++++------- fs/ocfs2/stack_user.c | 6 ++++-- fs/ocfs2/super.c | 15 ++++++++------- 4 files changed, 29 insertions(+), 23 deletions(-)
fs/ocfs2/cluster/heartbeat.c +8 -7
@@ -1350,12 +1350,14 @@ static int o2hb_debug_release(struct inode *inode, struct file *file) return 0; } -static ssize_t o2hb_debug_read (struct file *file,char __user *buf, -size_t nbytes,loff_t *ppos) +static ssize_t o2hb_debug_read (struct kiocb *iocb,struct iov_iter *to) { -return simple_read_from_buffer (buf, nbytes, ppos, file->private_data, -i_size_read (file->f_mapping->host)); +struct file *file = iocb->ki_filp; + +return simple_copy_to_iter (file->private_data, &iocb->ki_pos, +i_size_read (file->f_mapping->host), to); } +#else static int o2hb_debug_open (struct inode *inode,struct file *file) {
@@ -1365,8 +1367,7 @@ static int o2hb_debug_release(struct inode *inode, struct file *file) {return 0 ; } -static ssize_t o2hb_debug_read (struct file *file,char __user *buf, -size_t nbytes,loff_t *ppos) +static ssize_t o2hb_debug_read (struct kiocb *iocb,struct iov_iter *to) {return 0 ; }
@@ -1375,7 +1376,7 @@ static ssize_t o2hb_debug_read(struct file *file, char __user *buf,static const struct file_operations o2hb_debug_fops = { .open = o2hb_debug_open, .release = o2hb_debug_release, - .read = o2hb_debug_read, + .read_iter = o2hb_debug_read, .llseek = generic_file_llseek, };
fs/ocfs2/dlm/dlmdebug.c +9 -7
@@ -336,12 +336,14 @@ static int debug_release(struct inode *inode, struct file *file)return 0 ; } -static ssize_t debug_read (struct file *file,char __user *buf, -size_t nbytes,loff_t *ppos) +static ssize_t debug_read (struct kiocb *iocb,struct iov_iter *to) { -return simple_read_from_buffer (buf, nbytes, ppos, file->private_data, -i_size_read (file->f_mapping->host)); +struct file *file = iocb->ki_filp; + +return simple_copy_to_iter (file->private_data, &iocb->ki_pos, +i_size_read (file->f_mapping->host), to); } +/* end - util funcs */ /* begin - purge list funcs */
@@ -395,7 +397,7 @@ static int debug_purgelist_open(struct inode *inode, struct file *file)static const struct file_operations debug_purgelist_fops = { .open = debug_purgelist_open, .release = debug_release, - .read = debug_read, + .read_iter = debug_read, .llseek = generic_file_llseek, };/* end - purge list funcs */
@@ -452,7 +454,7 @@ static int debug_mle_open(struct inode *inode, struct file *file)static const struct file_operations debug_mle_fops = { .open = debug_mle_open, .release = debug_release, - .read = debug_read, + .read_iter = debug_read, .llseek = generic_file_llseek, };
@@ -843,7 +845,7 @@ static int debug_state_open(struct inode *inode, struct file *file)static const struct file_operations debug_state_fops = { .open = debug_state_open, .release = debug_release, - .read = debug_read, + .read_iter = debug_read, .llseek = generic_file_llseek, };/* end - debug state funcs */
fs/ocfs2/stack_user.c +4 -2
@@ -534,6 +534,7 @@ static ssize_t ocfs2_control_write(struct file *file,return ret; } +FOPS_WRITE_ITER_HELPER (ocfs2_control_write);/* * This is a naive version. If we ever have a new protocol, we'll expand
@@ -556,6 +557,7 @@ static ssize_t ocfs2_control_read(struct file *file,return ret; } +FOPS_READ_ITER_HELPER (ocfs2_control_read);static int ocfs2_control_release (struct inode *inode,struct file *file) {
@@ -616,8 +618,8 @@ static int ocfs2_control_open(struct inode *inode, struct file *file)static const struct file_operations ocfs2_control_fops = { .open = ocfs2_control_open, .release = ocfs2_control_release, - .read = ocfs2_control_read, - .write = ocfs2_control_write, + .read_iter = ocfs2_control_read_iter, + .write_iter = ocfs2_control_write_iter, .owner =THIS_MODULE , .llseek = default_llseek, };
fs/ocfs2/super.c +8 -7
@@ -360,12 +360,14 @@ static int ocfs2_debug_release(struct inode *inode, struct file *file) return 0; } -static ssize_t ocfs2_debug_read (struct file *file,char __user *buf, -size_t nbytes,loff_t *ppos) +static ssize_t ocfs2_debug_read (struct kiocb *iocb,struct iov_iter *to) { -return simple_read_from_buffer (buf, nbytes, ppos, file->private_data, -i_size_read (file->f_mapping->host)); +struct file *file = iocb->ki_filp; + +return simple_copy_to_iter (file->private_data, &iocb->ki_pos, +i_size_read (file->f_mapping->host), to); } +#else static int ocfs2_osb_debug_open (struct inode *inode,struct file *file) {
@@ -375,8 +377,7 @@ static int ocfs2_debug_release(struct inode *inode, struct file *file) {return 0 ; } -static ssize_t ocfs2_debug_read (struct file *file,char __user *buf, -size_t nbytes,loff_t *ppos) +static ssize_t ocfs2_debug_read (struct kiocb *iocb,struct iov_iter *to) {return 0 ; }
@@ -385,7 +386,7 @@ static ssize_t ocfs2_debug_read(struct file *file, char __user *buf,static const struct file_operations ocfs2_osb_debug_fops = { .open = ocfs2_osb_debug_open, .release = ocfs2_debug_release, - .read = ocfs2_debug_read, + .read_iter = ocfs2_debug_read, .llseek = generic_file_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 45/437 orangefs: convert to read/write iterators
In reply to Jens Axboe--- fs/orangefs/devorangefs-req.c | 23 +++++++++---------- fs/orangefs/orangefs-debugfs.c | 40 ++++++++++++---------------------- 2 files changed, 24 insertions(+), 39 deletions(-)
fs/orangefs/devorangefs-req.c +10 -13
@@ -155,18 +155,18 @@ static int orangefs_devreq_open(struct inode *inode, struct file *file) }/* Function for read() callers into the device */ -static ssize_t orangefs_devreq_read (struct file *file, -char __user *buf, -size_t count,loff_t *offset) +static ssize_t orangefs_devreq_read (struct kiocb *iocb,struct iov_iter *to) {struct orangefs_kernel_op_s *op, *temp;__s32 proto_ver =ORANGEFS_KERNEL_PROTO_VERSION ;static __s32 magic =ORANGEFS_DEVREQ_MAGIC ;struct orangefs_kernel_op_s *cur_op; +size_t count =iov_iter_count (to);unsigned long ret;/* We do not support blocking IO. */ -if (!(file->f_flags &O_NONBLOCK )) { +if (!((iocb->ki_filp->f_flags &O_NONBLOCK ) && + (iocb->ki_flags &IOCB_NOWAIT ))) {gossip_err ("%s: blocking read from client-core.\n" , __func__);return -EINVAL ;
@@ -278,20 +278,17 @@ static ssize_t orangefs_devreq_read(struct file *file,spin_unlock (&cur_op->lock);/* Push the upcall out. */ - ret =copy_to_user (buf, &proto_ver,sizeof (__s32)); + ret = !copy_to_iter_full (&proto_ver,sizeof (__s32), to);if (ret !=0 ) goto error; - ret =copy_to_user (buf +sizeof (__s32), &magic,sizeof (__s32)); + ret = !copy_to_iter_full (&magic,sizeof (__s32), to);if (ret !=0 ) goto error; - ret =copy_to_user (buf +2 *sizeof (__s32), - &cur_op->tag, -sizeof (__u64)); + ret = !copy_to_iter_full (&cur_op->tag,sizeof (__u64), to);if (ret !=0 ) goto error; - ret =copy_to_user (buf +2 *sizeof (__s32) +sizeof (__u64), - &cur_op->upcall, -sizeof (struct orangefs_upcall_s )); + ret = !copy_to_iter_full (&cur_op->upcall, +sizeof (struct orangefs_upcall_s ), to);if (ret !=0 ) goto error;
@@ -768,7 +765,7 @@ static int orangefs_dev_major;static const struct file_operations orangefs_devreq_file_operations = { .owner =THIS_MODULE , - .read = orangefs_devreq_read, + .read_iter = orangefs_devreq_read, .write_iter = orangefs_devreq_write_iter, .open = orangefs_devreq_open, .release = orangefs_devreq_release,
fs/orangefs/orangefs-debugfs.c +14 -26
@@ -74,15 +74,8 @@ static int help_show(struct seq_file *, void *);static int orangefs_debug_open (struct inode *,struct file *); -static ssize_t orangefs_debug_read (struct file *, -char __user *, -size_t , -loff_t *); - -static ssize_t orangefs_debug_write (struct file *, -const char __user *, -size_t , -loff_t *); +static ssize_t orangefs_debug_read (struct kiocb *iocb,struct iov_iter *to); +static ssize_t orangefs_debug_write (struct kiocb *iocb,struct iov_iter *to);static int orangefs_prepare_cdm_array (char *);static void debug_mask_to_string (void *,int );
@@ -124,8 +117,8 @@ static const struct file_operations debug_help_fops = {static const struct file_operations kernel_debug_fops = { .owner =THIS_MODULE , .open = orangefs_debug_open, - .read = orangefs_debug_read, - .write = orangefs_debug_write, + .read_iter = orangefs_debug_read, + .write_iter = orangefs_debug_write, .llseek = generic_file_llseek, };
@@ -338,10 +331,7 @@ static int orangefs_debug_open(struct inode *inode, struct file *file)return rc; } -static ssize_t orangefs_debug_read (struct file *file, -char __user *ubuf, -size_t count, -loff_t *ppos) +static ssize_t orangefs_debug_read (struct kiocb *iocb,struct iov_iter *to) {char *buf;int sprintf_ret;
@@ -354,10 +344,10 @@ static ssize_t orangefs_debug_read(struct file *file, goto out;mutex_lock (&orangefs_debug_lock); - sprintf_ret =sprintf (buf,"%s" , (char *)file->private_data); + sprintf_ret =sprintf (buf,"%s" , (char *)iocb->ki_filp->private_data);mutex_unlock (&orangefs_debug_lock); - read_ret =simple_read_from_buffer (ubuf, count, ppos, buf, sprintf_ret); + read_ret =simple_copy_to_iter (buf, &iocb->ki_pos, sprintf_ret, to);kfree (buf);
@@ -369,11 +359,9 @@ static ssize_t orangefs_debug_read(struct file *file,return read_ret; } -static ssize_t orangefs_debug_write (struct file *file, -const char __user *ubuf, -size_t count, -loff_t *ppos) +static ssize_t orangefs_debug_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);char *buf;int rc = -EFAULT ;size_t silly =0 ;
@@ -384,7 +372,7 @@ static ssize_t orangefs_debug_write(struct file *file,gossip_debug (GOSSIP_DEBUGFS_DEBUG ,"orangefs_debug_write: %pD\n" , - file); + iocb->ki_filp);if (count ==0 )return 0 ;
@@ -402,7 +390,7 @@ static ssize_t orangefs_debug_write(struct file *file,if (!buf) goto out; -if (copy_from_user (buf, ubuf, count -1 )) { +if (!copy_from_iter_full (buf, count -1 , from)) {gossip_debug (GOSSIP_DEBUGFS_DEBUG ,"%s: copy_from_user failed!\n" , __func__);
@@ -418,7 +406,7 @@ static ssize_t orangefs_debug_write(struct file *file,* A service operation is required to set a new client-side * debug mask. */ -if (!strcmp (file->f_path.dentry->d_name.name, +if (!strcmp (iocb->ki_filp->f_path.dentry->d_name.name,ORANGEFS_KMOD_DEBUG_FILE )) {debug_string_to_mask (buf, &orangefs_gossip_debug_mask,0 );debug_mask_to_string (&orangefs_gossip_debug_mask,0 );
@@ -471,12 +459,12 @@ static ssize_t orangefs_debug_write(struct file *file, }mutex_lock (&orangefs_debug_lock); - s =file_inode (file)->i_private; + s =file_inode (iocb->ki_filp)->i_private;memset (s,0 ,ORANGEFS_MAX_DEBUG_STRING_LEN );sprintf (s,"%s\n" , debug_string);mutex_unlock (&orangefs_debug_lock); - *ppos += count; + iocb->ki_pos += count;if (silly) rc = silly;else
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 46/437 dlm: convert to read/write iterators
In reply to Jens Axboe--- fs/dlm/debug_fs.c | 41 +++++++++++++++++++---------------------- fs/dlm/plock.c | 16 ++++++++-------- fs/dlm/user.c | 17 +++++++++-------- 3 files changed, 36 insertions(+), 38 deletions(-)
fs/dlm/debug_fs.c +19 -22
@@ -700,10 +700,10 @@ static int table_open2(struct inode *inode, struct file *file)return 0 ; } -static ssize_t table_write2 (struct file *file,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t table_write2 (struct kiocb *iocb,struct iov_iter *from) { -struct seq_file *seq = file->private_data; +struct seq_file *seq = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);int n, len, lkb_nodeid, lkb_status, error;char name[DLM_RESNAME_MAXLEN +1 ] = {};struct dlm_ls *ls = seq->private;
@@ -711,8 +711,7 @@ static ssize_t table_write2(struct file *file, const char __user *user_buf,char buf[256 ] = {};uint32_t lkb_id; -if (copy_from_user (buf, user_buf, -min_t (size_t,sizeof (buf) -1 , count))) +if (!copy_from_iter_full (buf,min_t (size_t,sizeof (buf) -1 , count), from))return -EFAULT ; n = sscanf(buf, "%x %" __stringify(DLM_RESNAME_MAXLEN) "s %x %d %d",
@@ -783,7 +782,7 @@ static const struct file_operations format2_fops = { .owner = THIS_MODULE, .open = table_open2, .read_iter = seq_read_iter, - .write = table_write2, + .write_iter = table_write2, .llseek = seq_lseek, .release = seq_release };
@@ -815,10 +814,9 @@ static const struct file_operations format5_fops = {/* * dump lkb's on the ls_waiters list */ -static ssize_t waiters_read (struct file *file,char __user *userbuf, -size_t count,loff_t *ppos) +static ssize_t waiters_read (struct kiocb *iocb,struct iov_iter *to) { -struct dlm_ls *ls = file->private_data; +struct dlm_ls *ls = iocb->ki_filp->private_data;struct dlm_lkb *lkb;size_t len =DLM_DEBUG_BUF_LEN , pos =0 , ret, rv;
@@ -836,22 +834,21 @@ static ssize_t waiters_read(struct file *file, char __user *userbuf, }mutex_unlock (&ls->ls_waiters_mutex); - rv =simple_read_from_buffer (userbuf, count, ppos, debug_buf, pos); + rv =simple_copy_to_iter (debug_buf, &iocb->ki_pos, pos, to);mutex_unlock (&debug_buf_lock);return rv; } -static ssize_t waiters_write (struct file *file,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t waiters_write (struct kiocb *iocb,struct iov_iter *from) { -struct dlm_ls *ls = file->private_data; +struct dlm_ls *ls = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);int mstype, to_nodeid;char buf[128 ] = {};uint32_t lkb_id;int n, error; -if (copy_from_user (buf, user_buf, -min_t (size_t,sizeof (buf) -1 , count))) +if (!copy_from_iter_full (buf,min_t (size_t,sizeof (buf) -1 , count), from))return -EFAULT ; n =sscanf (buf,"%x %d %d" , &lkb_id, &mstype, &to_nodeid);
@@ -868,8 +865,8 @@ static ssize_t waiters_write(struct file *file, const char __user *user_buf,static const struct file_operations waiters_fops = { .owner =THIS_MODULE , .open = simple_open, - .read = waiters_read, - .write = waiters_write, + .read_iter = waiters_read, + .write_iter = waiters_write, .llseek = default_llseek, };
@@ -911,9 +908,9 @@ static int dlm_version_show(struct seq_file *file, void *offset) }DEFINE_SHOW_ATTRIBUTE (dlm_version); -static ssize_t dlm_rawmsg_write (struct file *fp,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t dlm_rawmsg_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);void *buf;int ret;
@@ -924,12 +921,12 @@ static ssize_t dlm_rawmsg_write(struct file *fp, const char __user *user_buf,if (!buf)return -ENOMEM ; -if (copy_from_user (buf, user_buf, count)) { +if (!copy_from_iter_full (buf, count, from)) { ret = -EFAULT ; goto out; } - ret =dlm_midcomms_rawmsg_send (fp->private_data, buf, count); + ret =dlm_midcomms_rawmsg_send (iocb->ki_filp->private_data, buf, count);if (ret) goto out;
@@ -943,7 +940,7 @@ static ssize_t dlm_rawmsg_write(struct file *fp, const char __user *user_buf,static const struct file_operations dlm_rawmsg_fops = { .open = simple_open, - .write = dlm_rawmsg_write, + .write_iter = dlm_rawmsg_write, .llseek = no_llseek, };
fs/dlm/plock.c +8 -8
@@ -478,9 +478,9 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,EXPORT_SYMBOL_GPL (dlm_posix_get);/* a read copies out one plock request from the send list */ -static ssize_t dev_read (struct file *file,char __user *u,size_t count, -loff_t *ppos) +static ssize_t dev_read (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to);struct dlm_plock_info info;struct plock_op *op =NULL ;
@@ -510,16 +510,16 @@ static ssize_t dev_read(struct file *file, char __user *u, size_t count,if (op->info.flags &DLM_PLOCK_FL_CLOSE )dlm_release_plock_op (op); -if (copy_to_user (u, &info,sizeof (info))) +if (!copy_to_iter_full (&info,sizeof (info), to))return -EFAULT ;return sizeof (info); }/* a write copies in one plock result that should match a plock_op on the recv list */ -static ssize_t dev_write (struct file *file,const char __user *u,size_t count, -loff_t *ppos) +static ssize_t dev_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);struct plock_op *op =NULL , *iter;struct dlm_plock_info info;int do_callback =0 ;
@@ -527,7 +527,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,if (count !=sizeof (info))return -EINVAL ; -if (copy_from_user (&info, u,sizeof (info))) +if (!copy_from_iter_full (&info,sizeof (info), from))return -EFAULT ;trace_dlm_plock_write (&info);
@@ -598,8 +598,8 @@ static __poll_t dev_poll(struct file *file, poll_table *wait) }static const struct file_operations dev_fops = { - .read = dev_read, - .write = dev_write, + .read_iter = dev_read, + .write_iter = dev_write, .poll = dev_poll, .owner =THIS_MODULE , .llseek = noop_llseek,
fs/dlm/user.c +9 -8
@@ -524,10 +524,10 @@ static int check_version(struct dlm_write_request *req)/* a write to a lockspace device is a lock or unlock request, a write to the control device is to create/remove a lockspace */ -static ssize_t device_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t device_write (struct kiocb *iocb,struct iov_iter *from) { -struct dlm_user_proc *proc = file->private_data; +struct dlm_user_proc *proc = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);struct dlm_write_request *kbuf;int error;
@@ -545,7 +545,7 @@ static ssize_t device_write(struct file *file, const char __user *buf,if (count >sizeof (struct dlm_write_request ) +DLM_RESNAME_MAXLEN )return -EINVAL ; - kbuf =memdup_user_nul (buf, count); + kbuf =iterdup_nul (from, count);if (IS_ERR (kbuf))return PTR_ERR (kbuf);
@@ -918,6 +918,7 @@ static ssize_t device_read(struct file *file, char __user *buf, size_t count,return ret; } +FOPS_READ_ITER_HELPER (device_read);static __poll_t device_poll (struct file *file,poll_table *wait) {
@@ -982,8 +983,8 @@ static int monitor_device_close(struct inode *inode, struct file *file)static const struct file_operations device_fops = { .open = device_open, .release = device_close, - .read = device_read, - .write = device_write, + .read_iter = device_read_iter, + .write_iter = device_write, .poll = device_poll, .owner =THIS_MODULE , .llseek = noop_llseek,
@@ -992,8 +993,8 @@ static const struct file_operations device_fops = {static const struct file_operations ctl_device_fops = { .open = ctl_device_open, .release = ctl_device_close, - .read = device_read, - .write = device_write, + .read_iter = device_read_iter, + .write_iter = device_write, .owner =THIS_MODULE , .llseek = noop_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 47/437 tracefs: convert to read/write iterators
In reply to Jens Axboe--- fs/tracefs/inode.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
fs/tracefs/inode.c +5 -7
@@ -46,21 +46,19 @@ static void tracefs_free_inode(struct inode *inode)kmem_cache_free (tracefs_inode_cachep,get_tracefs (inode)); } -static ssize_t default_read_file (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t default_read_file_iter (struct kiocb *iocb,struct iov_iter *to) {return 0 ; } -static ssize_t default_write_file (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t default_write_file_iter (struct kiocb *iocb,struct iov_iter *from) { -return count; +return iov_iter_count (from); }static const struct file_operations tracefs_file_operations = { - .read = default_read_file, - .write = default_write_file, + .read_iter = default_read_file_iter, + .write_iter = default_write_file_iter, .open = simple_open, .llseek = noop_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 48/437 ubifs: convert to read/write iterators
In reply to Jens Axboe--- fs/ubifs/debug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ubifs/debug.c +4 -2
@@ -2728,6 +2728,7 @@ static ssize_t dfs_file_read(struct file *file, char __user *u, size_t count,return provide_user_output (val, u, count, ppos); } +FOPS_READ_ITER_HELPER (dfs_file_read);/** * interpret_user_input - interpret user debugfs file input.
@@ -2801,11 +2802,12 @@ static ssize_t dfs_file_write(struct file *file, const char __user *u,return count; } +FOPS_WRITE_ITER_HELPER (dfs_file_write);static const struct file_operations dfs_fops = { .open = dfs_file_open, - .read = dfs_file_read, - .write = dfs_file_write, + .read_iter = dfs_file_read_iter, + .write_iter = dfs_file_write_iter, .owner =THIS_MODULE , .llseek = no_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 49/437 fuse: convert to read/write iterators
In reply to Jens Axboe--- fs/fuse/control.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)
fs/fuse/control.c +18 -16
@@ -31,37 +31,36 @@ static struct fuse_conn *fuse_ctl_file_conn_get(struct file *file)return fc; } -static ssize_t fuse_conn_abort_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t fuse_conn_abort_write (struct kiocb *iocb,struct iov_iter *from) { -struct fuse_conn *fc =fuse_ctl_file_conn_get (file); +struct fuse_conn *fc =fuse_ctl_file_conn_get (iocb->ki_filp);if (fc) {if (fc->abort_err) fc->aborted = true;fuse_abort_conn (fc);fuse_conn_put (fc); } -return count; +return iov_iter_count (from); } -static ssize_t fuse_conn_waiting_read (struct file *file,char __user *buf, -size_t len,loff_t *ppos) +static ssize_t fuse_conn_waiting_read_iter (struct kiocb *iocb, +struct iov_iter *to) {char tmp[32 ];size_t size; -if (!*ppos) { +if (!iocb->ki_pos) {long value; -struct fuse_conn *fc =fuse_ctl_file_conn_get (file); +struct fuse_conn *fc =fuse_ctl_file_conn_get (iocb->ki_filp);if (!fc)return 0 ; value =atomic_read (&fc->num_waiting); - file->private_data = (void *)value; + iocb->ki_filp->private_data = (void *)value;fuse_conn_put (fc); } - size =sprintf (tmp,"%ld\n" , (long )file->private_data); -return simple_read_from_buffer (buf, len, ppos, tmp, size); + size =sprintf (tmp,"%ld\n" , (long )iocb->ki_filp->private_data); +return simple_copy_to_iter (tmp, &iocb->ki_pos, size, to); } static ssize_t fuse_conn_limit_read(struct file *file, char __user *buf,
@@ -115,6 +114,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file,return fuse_conn_limit_read (file, buf, len, ppos, val); } +FOPS_READ_ITER_HELPER (fuse_conn_max_background_read); static ssize_t fuse_conn_max_background_write(struct file *file, const char __user *buf,
@@ -140,6 +140,7 @@ static ssize_t fuse_conn_max_background_write(struct file *file,return ret; } +FOPS_WRITE_ITER_HELPER (fuse_conn_max_background_write); static ssize_t fuse_conn_congestion_threshold_read(struct file *file, char __user *buf, size_t len,
@@ -179,30 +180,31 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file, out:return ret; } +FOPS_WRITE_ITER_HELPER (fuse_conn_congestion_threshold_write);static const struct file_operations fuse_ctl_abort_ops = { .open = nonseekable_open, - .write = fuse_conn_abort_write, + .write_iter = fuse_conn_abort_write, .llseek = no_llseek, };static const struct file_operations fuse_ctl_waiting_ops = { .open = nonseekable_open, - .read = fuse_conn_waiting_read, + .read_iter = fuse_conn_waiting_read_iter, .llseek = no_llseek, };static const struct file_operations fuse_conn_max_background_ops = { .open = nonseekable_open, - .read = fuse_conn_max_background_read, - .write = fuse_conn_max_background_write, + .read_iter = fuse_conn_max_background_read_iter, + .write_iter = fuse_conn_max_background_write_iter, .llseek = no_llseek, };static const struct file_operations fuse_conn_congestion_threshold_ops = { .open = nonseekable_open, .read = fuse_conn_congestion_threshold_read, - .write = fuse_conn_congestion_threshold_write, + .write_iter = fuse_conn_congestion_threshold_write_iter, .llseek = no_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 50/437 staging: convert drivers to read/write iterators
In reply to Jens Axboe--- drivers/staging/axis-fifo/axis-fifo.c | 22 ++++++++++------------ drivers/staging/pi433/pi433_if.c | 13 +++++++------ drivers/staging/vme_user/vme_user.c | 6 ++++-- 3 files changed, 21 insertions(+), 20 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +10 -12
@@ -345,10 +345,10 @@ static void reset_ip_core(struct axis_fifo *fifo)* Returns the number of bytes read from the device or negative error code * on failure. */ -static ssize_t axis_fifo_read (struct file *f,char __user *buf, -size_t len,loff_t *off) +static ssize_t axis_fifo_read (struct kiocb *iocb,struct iov_iter *to) { -struct axis_fifo *fifo = (struct axis_fifo *)f->private_data; +struct axis_fifo *fifo = iocb->ki_filp->private_data; +size_t len =iov_iter_count (to);size_t bytes_available;unsigned int words_available;unsigned int copied;
@@ -431,8 +431,7 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf, XLLF_RDFD_OFFSET); } -if (copy_to_user (buf + copied *sizeof (u32), tmp_buf, - copy *sizeof (u32))) { +if (!copy_to_iter_full (tmp_buf, copy *sizeof (u32), to)) {reset_ip_core (fifo); ret = -EFAULT ; goto end_unlock;
@@ -465,10 +464,10 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,* Returns the number of bytes written to the device or negative error code * on failure. */ -static ssize_t axis_fifo_write (struct file *f,const char __user *buf, -size_t len,loff_t *off) +static ssize_t axis_fifo_write (struct kiocb *iocb,struct iov_iter *from) { -struct axis_fifo *fifo = (struct axis_fifo *)f->private_data; +struct axis_fifo *fifo = iocb->ki_filp->private_data; +size_t len =iov_iter_count (from);unsigned int words_to_write;unsigned int copied;unsigned int copy;
@@ -540,8 +539,7 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,while (words_to_write >0 ) { copy =min (words_to_write,WRITE_BUF_SIZE ); -if (copy_from_user (tmp_buf, buf + copied *sizeof (u32), - copy *sizeof (u32))) { +if (!copy_from_iter_full (tmp_buf, copy *sizeof (u32), from)) {reset_ip_core (fifo); ret = -EFAULT ; goto end_unlock;
@@ -712,8 +710,8 @@ static const struct file_operations fops = { .owner = THIS_MODULE, .open = axis_fifo_open, .release = axis_fifo_close, - .read = axis_fifo_read, - .write = axis_fifo_write + .read_iter = axis_fifo_read, + .write_iter = axis_fifo_write, };/* read named property from the device tree */
drivers/staging/pi433/pi433_if.c +7 -6
@@ -765,11 +765,11 @@ static int pi433_tx_thread(void *data)/*-------------------------------------------------------------------------*/ -static ssize_t -pi433_read (struct file *filp,char __user *buf,size_t size,loff_t *f_pos) +static ssize_t pi433_read (struct kiocb *iocb,struct iov_iter *to) {struct pi433_instance *instance;struct pi433_device *device; +size_t size =iov_iter_count (to);int bytes_received;ssize_t retval;
@@ -777,7 +777,7 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos)if (size >MAX_MSG_SIZE )return -EMSGSIZE ; - instance = filp->private_data; + instance = iocb->ki_filp->private_data; device = instance->device;/* just one read request at a time */
@@ -802,7 +802,7 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos)/* if read was successful copy to user space*/ if (bytes_received >0 ) { - retval =copy_to_user (buf, device->rx_buffer, bytes_received); + retval = !copy_to_iter_full (device->rx_buffer, bytes_received, to);if (retval)return -EFAULT ; }
@@ -883,6 +883,7 @@ pi433_write(struct file *filp, const char __user *buf,mutex_unlock (&device->tx_fifo_lock);return -EAGAIN ; } +FOPS_WRITE_ITER_HELPER (pi433_write);static long pi433_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {
@@ -1094,8 +1095,8 @@ static const struct file_operations pi433_fops = {* gets more complete API coverage. It'll simplify things * too, except for the locking. */ - .write = pi433_write, - .read = pi433_read, + .write_iter = pi433_write_iter, + .read_iter = pi433_read, .unlocked_ioctl = pi433_ioctl, .compat_ioctl = compat_ptr_ioctl, .open = pi433_open,
drivers/staging/vme_user/vme_user.c +4 -2
@@ -216,6 +216,7 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count,return retval; } +FOPS_READ_ITER_HELPER (vme_user_read);static ssize_t vme_user_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos)
@@ -259,6 +260,7 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf,return retval; } +FOPS_WRITE_ITER_HELPER (vme_user_write);static loff_t vme_user_llseek (struct file *file,loff_t off,int whence) {
@@ -492,8 +494,8 @@ static int vme_user_mmap(struct file *file, struct vm_area_struct *vma) }static const struct file_operations vme_user_fops = { - .read = vme_user_read, - .write = vme_user_write, + .read_iter = vme_user_read_iter, + .write_iter = vme_user_write_iter, .llseek = vme_user_llseek, .unlocked_ioctl = vme_user_unlocked_ioctl, .compat_ioctl = compat_ptr_ioctl,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 51/437 Bluetooth: convert to read/write iterators
In reply to Jens Axboe--- net/bluetooth/6lowpan.c | 12 ++- net/bluetooth/hci_debugfs.c | 150 ++++++++++++++++-------------------- net/bluetooth/selftest.c | 9 +-- net/bluetooth/smp.c | 9 +-- 4 files changed, 80 insertions(+), 100 deletions(-)
net/bluetooth/6lowpan.c +5 -7
@@ -1079,19 +1079,17 @@ static int lowpan_enable_get(void *data, u64 *val)DEFINE_DEBUGFS_ATTRIBUTE (lowpan_enable_fops, lowpan_enable_get, lowpan_enable_set,"%llu\n" ); -static ssize_t lowpan_control_write (struct file *fp, -const char __user *user_buffer, -size_t count, -loff_t *position) +static ssize_t lowpan_control_write (struct kiocb *iocb,struct iov_iter *from) {char buf[32 ]; +size_t count =iov_iter_count (from);size_t buf_size =min (count,sizeof (buf) -1 );int ret;bdaddr_t addr;u8 addr_type;struct l2cap_conn *conn =NULL ; -if (copy_from_user (buf, user_buffer, buf_size)) +if (!copy_to_iter_full (buf, buf_size, from))return -EFAULT ; buf[buf_size] ='\0' ;
@@ -1173,8 +1171,8 @@ static int lowpan_control_open(struct inode *inode, struct file *file)static const struct file_operations lowpan_control_fops = { .open = lowpan_control_open, - .read = seq_read, - .write = lowpan_control_write, + .read_iter = seq_read_iter, + .write_iter = lowpan_control_write, .llseek = seq_lseek, .release = single_release, };
net/bluetooth/hci_debugfs.c +67 -83
346 lines not on this page · raw message
net/bluetooth/selftest.c +4 -5
@@ -183,16 +183,15 @@ static int __init test_ecdh_sample(struct crypto_kpp *tfm, const u8 priv_a[32],static char test_ecdh_buffer[32 ]; -static ssize_t test_ecdh_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t test_ecdh_read (struct kiocb *iocb,struct iov_iter *to) { -return simple_read_from_buffer (user_buf, count, ppos, test_ecdh_buffer, -strlen (test_ecdh_buffer)); +return simple_copy_to_iter (test_ecdh_buffer, &iocb->ki_pos, +strlen (test_ecdh_buffer), to); }static const struct file_operations test_ecdh_fops = { .open = simple_open, - .read = test_ecdh_read, + .read_iter = test_ecdh_read, .llseek = default_llseek, };
net/bluetooth/smp.c +4 -5
@@ -3729,16 +3729,15 @@ static int __init test_h6(struct crypto_shash *tfm_cmac)static char test_smp_buffer[32 ]; -static ssize_t test_smp_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t test_smp_read (struct kiocb *iocb,struct iov_iter *to) { -return simple_read_from_buffer (user_buf, count, ppos, test_smp_buffer, -strlen (test_smp_buffer)); +return simple_copy_to_iter (test_smp_buffer, &iocb->ki_pos, +strlen (test_smp_buffer), to); }static const struct file_operations test_smp_fops = { .open = simple_open, - .read = test_smp_read, + .read_iter = test_smp_read, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 52/437 net: mac80211: convert to read/write iterators
In reply to Jens Axboe--- include/net/cfg80211.h | 24 +-- net/mac80211/debugfs.c | 185 +++++++++------------ net/mac80211/debugfs.h | 4 +- net/mac80211/debugfs_key.c | 81 ++++----- net/mac80211/debugfs_netdev.c | 126 ++++++-------- net/mac80211/debugfs_sta.c | 146 +++++++--------- net/mac80211/rate.c | 10 +- net/mac80211/rc80211_minstrel_ht_debugfs.c | 11 +- net/wireless/debugfs.c | 36 ++-- 9 files changed, 260 insertions(+), 363 deletions(-)
include/net/cfg80211.h +9 -15
@@ -9469,21 +9469,17 @@ void cfg80211_schedule_channels_check(struct wireless_dev *wdev);/** * wiphy_locked_debugfs_read - do a locked read in debugfs * @wiphy: the wiphy to use -* @file: the file being read +* @iocb: metadata for the IO * @buf: the buffer to fill and then read from * @bufsize: size of the buffer -* @userbuf: the user buffer to copy to -* @count: read count -* @ppos: read position +* @to: the user buffer to copy to * @handler: the read handler to call (under wiphy lock) * @data: additional data to pass to the read handler */ -ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file, +ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct kiocb *iocb, char *buf, size_t bufsize, - char __user *userbuf, size_t count, - loff_t *ppos, + struct iov_iter *to, ssize_t (*handler)(struct wiphy *wiphy, - struct file *file, char *buf, size_t bufsize, void *data),
@@ -9492,21 +9488,19 @@ ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,/** * wiphy_locked_debugfs_write - do a locked write in debugfs * @wiphy: the wiphy to use -* @file: the file being written to +* @iocb: metadata for the IO * @buf: the buffer to copy the user data to * @bufsize: size of the buffer -* @userbuf: the user buffer to copy from -* @count: read count +* @from: the user buffer to copy from * @handler: the write handler to call (under wiphy lock) * @data: additional data to pass to the write handler */ -ssize_t wiphy_locked_debugfs_write (struct wiphy *wiphy,struct file *file, +ssize_t wiphy_locked_debugfs_write (struct wiphy *wiphy,struct kiocb *iocb,char *buf,size_t bufsize, -const char __user *userbuf,size_t count, +struct iov_iter *from,ssize_t (*handler)(struct wiphy *wiphy, -struct file *file,char *buf, -size_t count, +size_t bufsize,void *data),void *data);#endif
net/mac80211/debugfs.c +75 -110
418 lines not on this page · raw message
net/mac80211/debugfs.h +2 -2
@@ -6,8 +6,8 @@ #ifdef CONFIG_MAC80211_DEBUGFS void debugfs_hw_add(struct ieee80211_local *local); -int __printf(4, 5) mac80211_format_buffer(char __user *userbuf, size_t count, - loff_t *ppos, char *fmt, ...); +int __printf(3, 4) mac80211_format_buffer(struct kiocb *iocb, + struct iov_iter *to, char *fmt, ...); #else static inline void debugfs_hw_add(struct ieee80211_local *local) {
net/mac80211/debugfs_key.c +36 -45
192 lines not on this page · raw message
net/mac80211/debugfs_netdev.c +51 -75
278 lines not on this page · raw message
net/mac80211/debugfs_sta.c +64 -82
359 lines not on this page · raw message
net/mac80211/rate.c +4 -6
@@ -219,18 +219,16 @@ ieee80211_rate_control_ops_get(const char *name) }#ifdef CONFIG_MAC80211_DEBUGFS -static ssize_t rcname_read (struct file *file,char __user *userbuf, -size_t count,loff_t *ppos) +static ssize_t rcname_read (struct kiocb *iocb,struct iov_iter *to) { -struct rate_control_ref *ref = file->private_data; +struct rate_control_ref *ref = iocb->ki_filp->private_data;int len =strlen (ref->ops->name); -return simple_read_from_buffer (userbuf, count, ppos, - ref->ops->name, len); +return simple_copy_to_iter (ref->ops->name, &iocb->ki_pos, len, to); }const struct file_operations rcname_ops = { - .read = rcname_read, + .read_iter = rcname_read, .open = simple_open, .llseek = default_llseek, };
net/mac80211/rc80211_minstrel_ht_debugfs.c +5 -6
@@ -16,13 +16,12 @@ struct minstrel_debugfs_info {char buf[]; }; -static ssize_t -minstrel_stats_read (struct file *file,char __user *buf,size_t len,loff_t *ppos) +static ssize_t minstrel_stats_read (struct kiocb *iocb,struct iov_iter *to) {struct minstrel_debugfs_info *ms; - ms = file->private_data; -return simple_read_from_buffer (buf, len, ppos, ms->buf, ms->len); + ms = iocb->ki_filp->private_data; +return simple_copy_to_iter (ms->buf, &iocb->ki_pos, ms->len, to); } static int
@@ -185,7 +184,7 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file)static const struct file_operations minstrel_ht_stat_fops = { .owner =THIS_MODULE , .open = minstrel_ht_stats_open, - .read = minstrel_stats_read, + .read_iter = minstrel_stats_read, .release = minstrel_stats_release, .llseek = no_llseek, };
@@ -321,7 +320,7 @@ minstrel_ht_stats_csv_open(struct inode *inode, struct file *file)static const struct file_operations minstrel_ht_stat_csv_fops = { .owner =THIS_MODULE , .open = minstrel_ht_stats_csv_open, - .read = minstrel_stats_read, + .read_iter = minstrel_stats_read, .release = minstrel_stats_release, .llseek = no_llseek, };
net/wireless/debugfs.c +14 -22
@@ -114,12 +114,10 @@ void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev)struct debugfs_read_work {struct wiphy_work work;ssize_t (*handler)(struct wiphy *wiphy, -struct file *file,char *buf,size_t count,void *data);struct wiphy *wiphy; -struct file *file;char *buf;size_t bufsize;void *data;
@@ -132,7 +130,7 @@ static void wiphy_locked_debugfs_read_work(struct wiphy *wiphy, {struct debugfs_read_work *w =container_of (work,typeof (*w), work); - w->ret = w->handler (w->wiphy, w->file, w->buf, w->bufsize, w->data); + w->ret = w->handler (w->wiphy, w->buf, w->bufsize, w->data);complete (&w->completion); }
@@ -145,12 +143,10 @@ static void wiphy_locked_debugfs_read_cancel(struct dentry *dentry,complete (&w->completion); } -ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file, +ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct kiocb *iocb, char *buf, size_t bufsize, - char __user *userbuf, size_t count, - loff_t *ppos, + struct iov_iter *to, ssize_t (*handler)(struct wiphy *wiphy, - struct file *file, char *buf, size_t bufsize, void *data),
@@ -159,7 +155,6 @@ ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,struct debugfs_read_work work = { .handler = handler, .wiphy = wiphy, - .file = file, .buf = buf, .bufsize = bufsize, .data = data,
@@ -177,9 +172,9 @@ ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,wiphy_work_init (&work.work, wiphy_locked_debugfs_read_work);wiphy_work_queue (wiphy, &work.work); -debugfs_enter_cancellation (file, &cancellation); +debugfs_enter_cancellation (iocb->ki_filp, &cancellation);wait_for_completion (&work.completion); -debugfs_leave_cancellation (file, &cancellation); +debugfs_leave_cancellation (iocb->ki_filp, &cancellation);if (work.ret <0 )return work.ret;
@@ -187,19 +182,17 @@ ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,if (WARN_ON (work.ret > bufsize))return -EINVAL ; -return simple_read_from_buffer (userbuf, count, ppos, buf, work.ret); +return simple_copy_to_iter (buf, &iocb->ki_pos, work.ret, to); }EXPORT_SYMBOL_GPL (wiphy_locked_debugfs_read);struct debugfs_write_work {struct wiphy_work work;ssize_t (*handler)(struct wiphy *wiphy, -struct file *file,char *buf,size_t count,void *data);struct wiphy *wiphy; -struct file *file;char *buf;size_t count;void *data;
@@ -212,7 +205,7 @@ static void wiphy_locked_debugfs_write_work(struct wiphy *wiphy, {struct debugfs_write_work *w =container_of (work,typeof (*w), work); - w->ret = w->handler (w->wiphy, w->file, w->buf, w->count, w->data); + w->ret = w->handler (w->wiphy, w->buf, w->count, w->data);complete (&w->completion); }
@@ -226,10 +219,9 @@ static void wiphy_locked_debugfs_write_cancel(struct dentry *dentry, } ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, - struct file *file, char *buf, size_t bufsize, - const char __user *userbuf, size_t count, + struct kiocb *iocb, char *buf, size_t bufsize, + struct iov_iter *from, ssize_t (*handler)(struct wiphy *wiphy, - struct file *file, char *buf, size_t count, void *data),
@@ -238,9 +230,8 @@ ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy,struct debugfs_write_work work = { .handler = handler, .wiphy = wiphy, - .file = file, .buf = buf, - .count = count, + .count = bufsize, .data = data, .ret = -ENODEV , .completion =COMPLETION_INITIALIZER_ONSTACK (work.completion),
@@ -249,6 +240,7 @@ ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, .cancel = wiphy_locked_debugfs_write_cancel, .cancel_data = &work, }; +size_t count =iov_iter_count (from);/* mostly used for strings so enforce NUL-termination for safety */ if (count >= bufsize)
@@ -256,15 +248,15 @@ ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy,memset (buf,0 , bufsize); -if (copy_from_user (buf, userbuf, count)) +if (!copy_from_iter_full (buf, count, from))return -EFAULT ;wiphy_work_init (&work.work, wiphy_locked_debugfs_write_work);wiphy_work_queue (wiphy, &work.work); -debugfs_enter_cancellation (file, &cancellation); +debugfs_enter_cancellation (iocb->ki_filp, &cancellation);wait_for_completion (&work.completion); -debugfs_leave_cancellation (file, &cancellation); +debugfs_leave_cancellation (iocb->ki_filp, &cancellation);return work.ret; }
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 53/437 net: 6lowpan: convert debugfs to read/write iterators
In reply to Jens Axboe--- net/6lowpan/debugfs.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/6lowpan/debugfs.c +6 -8
@@ -120,20 +120,18 @@ static int lowpan_ctx_pfx_open(struct inode *inode, struct file *file)return single_open (file, lowpan_ctx_pfx_show, inode->i_private); } -static ssize_t lowpan_ctx_pfx_write (struct file *fp, -const char __user *user_buf,size_t count, -loff_t *ppos) +static ssize_t lowpan_ctx_pfx_write (struct kiocb *iocb,struct iov_iter *from) {char buf[128 ] = {}; -struct seq_file *file = fp->private_data; +struct seq_file *file = iocb->ki_filp->private_data;struct lowpan_iphc_ctx *ctx = file->private;struct lowpan_iphc_ctx_table *t = container_of(ctx, struct lowpan_iphc_ctx_table, table[ctx->id]); +size_t count =iov_iter_count (from);int status = count, n, i;unsigned int addr[8 ]; -if (copy_from_user (&buf, user_buf,min_t (size_t,sizeof (buf) -1 , - count))) { +if (!copy_from_iter_full (&buf, count, from)) { status = -EFAULT ; goto out; }
@@ -157,8 +155,8 @@ static ssize_t lowpan_ctx_pfx_write(struct file *fp,static const struct file_operations lowpan_ctx_pfx_fops = { .open = lowpan_ctx_pfx_open, - .read = seq_read, - .write = lowpan_ctx_pfx_write, + .read_iter = seq_read_iter, + .write_iter = lowpan_ctx_pfx_write, .llseek = seq_lseek, .release = single_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 54/437 net: sunrpc: convert to read/write iterators
In reply to Jens Axboe--- net/sunrpc/cache.c | 14 +++++++++----- net/sunrpc/debugfs.c | 4 ++-- net/sunrpc/rpc_pipe.c | 8 +++++--- 3 files changed, 16 insertions(+), 10 deletions(-)
net/sunrpc/cache.c +9 -5
@@ -1774,6 +1774,7 @@ static ssize_t cache_read_pipefs(struct file *filp, char __user *buf,return cache_read (filp, buf, count, ppos, cd); } +FOPS_READ_ITER_HELPER (cache_read_pipefs);static ssize_t cache_write_pipefs (struct file *filp,const char __user *buf,size_t count,loff_t *ppos)
@@ -1782,6 +1783,7 @@ static ssize_t cache_write_pipefs(struct file *filp, const char __user *buf,return cache_write (filp, buf, count, ppos, cd); } +FOPS_WRITE_ITER_HELPER (cache_write_pipefs);static __poll_t cache_poll_pipefs (struct file *filp,poll_table *wait) {
@@ -1816,8 +1818,8 @@ static int cache_release_pipefs(struct inode *inode, struct file *filp)const struct file_operations cache_file_operations_pipefs = { .owner =THIS_MODULE , .llseek = no_llseek, - .read = cache_read_pipefs, - .write = cache_write_pipefs, + .read_iter = cache_read_pipefs_iter, + .write_iter = cache_write_pipefs_iter, .poll = cache_poll_pipefs, .unlocked_ioctl = cache_ioctl_pipefs,/* for FIONREAD */ .open = cache_open_pipefs,
@@ -1840,7 +1842,7 @@ static int content_release_pipefs(struct inode *inode, struct file *filp)const struct file_operations content_file_operations_pipefs = { .open = content_open_pipefs, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = content_release_pipefs, };
@@ -1866,6 +1868,7 @@ static ssize_t read_flush_pipefs(struct file *filp, char __user *buf,return read_flush (filp, buf, count, ppos, cd); } +FOPS_READ_ITER_HELPER (read_flush_pipefs); static ssize_t write_flush_pipefs(struct file *filp, const char __user *buf,
@@ -1875,11 +1878,12 @@ static ssize_t write_flush_pipefs(struct file *filp,return write_flush (filp, buf, count, ppos, cd); } +FOPS_WRITE_ITER_HELPER (write_flush_pipefs);const struct file_operations cache_flush_operations_pipefs = { .open = open_flush_pipefs, - .read = read_flush_pipefs, - .write = write_flush_pipefs, + .read_iter = read_flush_pipefs_iter, + .write_iter = write_flush_pipefs_iter, .release = release_flush_pipefs, .llseek = no_llseek, };
net/sunrpc/debugfs.c +2 -2
@@ -112,7 +112,7 @@ tasks_release(struct inode *inode, struct file *filp)static const struct file_operations tasks_fops = { .owner =THIS_MODULE , .open = tasks_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = tasks_release, };
@@ -211,7 +211,7 @@ xprt_info_release(struct inode *inode, struct file *filp)static const struct file_operations xprt_info_fops = { .owner =THIS_MODULE , .open = xprt_info_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = xprt_info_release, };
net/sunrpc/rpc_pipe.c +5 -3
@@ -320,6 +320,7 @@ rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset)inode_unlock (inode);return res; } +FOPS_READ_ITER_HELPER (rpc_pipe_read);static ssize_t rpc_pipe_write (struct file *filp,const char __user *buf,size_t len,loff_t *offset)
@@ -334,6 +335,7 @@ rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *ofinode_unlock (inode);return res; } +FOPS_WRITE_ITER_HELPER (rpc_pipe_write);static __poll_t rpc_pipe_poll (struct file *filp,struct poll_table_struct *wait)
@@ -386,8 +388,8 @@ rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)static const struct file_operations rpc_pipe_fops = { .owner =THIS_MODULE , .llseek = no_llseek, - .read = rpc_pipe_read, - .write = rpc_pipe_write, + .read_iter = rpc_pipe_read_iter, + .write_iter = rpc_pipe_write_iter, .poll = rpc_pipe_poll, .unlocked_ioctl = rpc_pipe_ioctl, .open = rpc_pipe_open,
@@ -449,7 +451,7 @@ rpc_info_release(struct inode *inode, struct file *file)static const struct file_operations rpc_info_operations = { .owner =THIS_MODULE , .open = rpc_info_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = rpc_info_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 55/437 net: wireless: convert to read/write iterators
In reply to Jens Axboe--- net/wireless/debugfs.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
net/wireless/debugfs.c +8 -13
@@ -12,19 +12,18 @@#include "debugfs.h" #define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ -static ssize_t name## _read(struct file *file, char __user *userbuf, \ - size_t count, loff_t *ppos) \ +static ssize_t name## _read(struct kiocb *iocb, struct iov_iter *to) \ { \ - struct wiphy *wiphy = file->private_data; \ + struct wiphy *wiphy = iocb->ki_filp->private_data; \ char buf[buflen]; \ int res; \ \ res = scnprintf(buf, buflen, fmt "\n", ##value); \ - return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ + return simple_copy_to_iter(buf, &iocb->ki_pos, res, to); \ } \ \ static const struct file_operations name## _ops = { \ - .read = name## _read, \ + .read_iter = name## _read, \ .open = simple_open, \ .llseek = generic_file_llseek, \ }
@@ -60,11 +59,9 @@ static int ht_print_chan(struct ieee80211_channel *chan, ' ' : '+'); } -static ssize_t ht40allow_map_read (struct file *file, -char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t ht40allow_map_read_iter (struct kiocb *iocb,struct iov_iter *to) { -struct wiphy *wiphy = file->private_data; +struct wiphy *wiphy = iocb->ki_filp->private_data;char *buf;unsigned int offset =0 , buf_size =PAGE_SIZE , i;enum nl80211_band band;
@@ -84,15 +81,13 @@ static ssize_t ht40allow_map_read(struct file *file, buf, buf_size, offset); } - r =simple_read_from_buffer (user_buf, count, ppos, buf, offset); - + r =simple_copy_to_iter (buf, &iocb->ki_pos, offset, to);kfree (buf); -return r; }static const struct file_operations ht40allow_map_ops = { - .read = ht40allow_map_read, + .read_iter = ht40allow_map_read_iter, .open = simple_open, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 56/437 net: rfkill: convert to read/write iterators
In reply to Jens Axboe--- net/rfkill/core.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
net/rfkill/core.c +11 -11
@@ -1226,10 +1226,10 @@ static __poll_t rfkill_fop_poll(struct file *file, poll_table *wait)return res; } -static ssize_t rfkill_fop_read (struct file *file,char __user *buf, -size_t count,loff_t *pos) +static ssize_t rfkill_fop_read (struct kiocb *iocb,struct iov_iter *to) { -struct rfkill_data *data = file->private_data; +struct rfkill_data *data = iocb->ki_filp->private_data; +size_t count =iov_iter_count (to);struct rfkill_int_event *ev;unsigned long sz;int ret;
@@ -1237,7 +1237,7 @@ static ssize_t rfkill_fop_read(struct file *file, char __user *buf,mutex_lock (&data->mtx);while (list_empty (&data->events)) { -if (file->f_flags &O_NONBLOCK ) { +if (iocb->ki_filp->f_flags &O_NONBLOCK ) { ret = -EAGAIN ; goto out; }
@@ -1259,7 +1259,7 @@ static ssize_t rfkill_fop_read(struct file *file, char __user *buf, sz = min_t(unsigned long, sizeof(ev->ev), count); sz = min_t(unsigned long, sz, data->max_size); ret = sz; -if (copy_to_user (buf, &ev->ev, sz)) +if (!copy_to_iter_full (&ev->ev, sz, to)) ret = -EFAULT ;list_del (&ev->list);
@@ -1269,10 +1269,10 @@ static ssize_t rfkill_fop_read(struct file *file, char __user *buf,return ret; } -static ssize_t rfkill_fop_write (struct file *file,const char __user *buf, -size_t count,loff_t *pos) +static ssize_t rfkill_fop_write (struct kiocb *iocb,struct iov_iter *from) { -struct rfkill_data *data = file->private_data; +struct rfkill_data *data = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);struct rfkill *rfkill;struct rfkill_event_ext ev;int ret;
@@ -1288,7 +1288,7 @@ static ssize_t rfkill_fop_write(struct file *file, const char __user *buf,*/ count =min (count,sizeof (ev)); count =min_t (size_t, count, data->max_size); -if (copy_from_user (&ev, buf, count)) +if (!copy_from_iter_full (&ev, count, from))return -EFAULT ;if (ev.type >=NUM_RFKILL_TYPES )
@@ -1392,8 +1392,8 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,static const struct file_operations rfkill_fops = { .owner =THIS_MODULE , .open = rfkill_fop_open, - .read = rfkill_fop_read, - .write = rfkill_fop_write, + .read_iter = rfkill_fop_read, + .write_iter = rfkill_fop_write, .poll = rfkill_fop_poll, .release = rfkill_fop_release, .unlocked_ioctl = rfkill_fop_ioctl,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 57/437 net: l2tp: convert to read/write iterators
In reply to Jens Axboe--- net/l2tp/l2tp_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_debugfs.c +1 -1
@@ -318,7 +318,7 @@ static int l2tp_dfs_seq_release(struct inode *inode, struct file *file)static const struct file_operations l2tp_dfs_fops = { .owner =THIS_MODULE , .open = l2tp_dfs_seq_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = l2tp_dfs_seq_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 58/437 fs: add IOCB_VECTORED flags
In reply to Jens AxboeThis allows a user of ->read_iter() or ->write_iter() to tell if this request originally came as a readv/writev, or if it was a normal read/write operation.
--- fs/read_write.c | 1 + include/linux/fs.h | 2 ++ 2 files changed, 3 insertions(+)
fs/read_write.c +1 -0
@@ -733,6 +733,7 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, ret =kiocb_set_rw_flags (&kiocb, flags);if (ret)return ret; + kiocb.ki_flags |=IOCB_VECTORED ; kiocb.ki_pos = (ppos ? *ppos :0 );if (type ==READ )
include/linux/fs.h +2 -0
@@ -346,6 +346,8 @@ struct readahead_control;#define IOCB_DIO_CALLER_COMP (1 << 22)/* kiocb is a read or write operation submitted by fs/aio.c. */ #define IOCB_AIO_RW (1 << 23) +/* came from readv/writev */ +#define IOCB_VECTORED (1 << 24)/* for use in trace events */ #define TRACE_IOCB_STRINGS \
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 59/437 ALSA: core: convert to read/write iterators
In reply to Jens Axboe--- sound/core/compress_offload.c | 7 +-- sound/core/control.c | 14 +++--- sound/core/hwdep.c | 6 ++- sound/core/init.c | 10 ++-- sound/core/jack.c | 83 ++++++++++++++-------------------- sound/core/oss/pcm_oss.c | 6 ++- sound/core/pcm_native.c | 22 +++++++-- sound/core/rawmidi.c | 6 ++- sound/core/seq/oss/seq_oss.c | 11 +++-- sound/core/seq/seq_clientmgr.c | 8 ++-- sound/core/timer.c | 23 +++++----- 11 files changed, 100 insertions(+), 96 deletions(-)
sound/core/compress_offload.c +4 -3
@@ -322,7 +322,7 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,return retval; } - +FOPS_WRITE_ITER_HELPER (snd_compr_write);static ssize_t snd_compr_read (struct file *f,char __user *buf,size_t count,loff_t *offset)
@@ -367,6 +367,7 @@ static ssize_t snd_compr_read(struct file *f, char __user *buf,return retval; } +FOPS_READ_ITER_HELPER (snd_compr_read);static int snd_compr_mmap (struct file *f,struct vm_area_struct *vma) {
@@ -1004,8 +1005,8 @@ static const struct file_operations snd_compr_file_ops = { .owner = THIS_MODULE, .open = snd_compr_open, .release = snd_compr_free, - .write = snd_compr_write, - .read = snd_compr_read, + .write_iter = snd_compr_write_iter, + .read_iter = snd_compr_read_iter, .unlocked_ioctl = snd_compr_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = snd_compr_ioctl_compat,
sound/core/control.c +7 -7
@@ -1985,14 +1985,14 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long argreturn -ENOTTY ; } -static ssize_t snd_ctl_read (struct file *file,char __user *buffer, -size_t count,loff_t * offset) +static ssize_t snd_ctl_read (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to);struct snd_ctl_file *ctl;int err =0 ;ssize_t result =0 ; - ctl = file->private_data; + ctl = iocb->ki_filp->private_data;if (snd_BUG_ON (!ctl || !ctl->card))return -ENXIO ;if (!ctl->subscribed)
@@ -2005,7 +2005,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer,struct snd_kctl_event *kev;while (list_empty (&ctl->events)) {wait_queue_entry_t wait; -if ((file->f_flags &O_NONBLOCK ) !=0 || result >0 ) { +if ((iocb->ki_filp->f_flags &O_NONBLOCK ) !=0 || + result >0 ) { err = -EAGAIN ; goto __end_lock; }
@@ -2028,12 +2029,11 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer,list_del (&kev->list);spin_unlock_irq (&ctl->read_lock);kfree (kev); -if (copy_to_user (buffer, &ev,sizeof (struct snd_ctl_event ))) { +if (!copy_to_iter_full (&ev,sizeof (struct snd_ctl_event ), to)) { err = -EFAULT ; goto __end; }spin_lock_irq (&ctl->read_lock); - buffer +=sizeof (struct snd_ctl_event ); count -=sizeof (struct snd_ctl_event ); result +=sizeof (struct snd_ctl_event ); }
@@ -2277,7 +2277,7 @@ EXPORT_SYMBOL_GPL(snd_ctl_disconnect_layer);static const struct file_operations snd_ctl_f_ops = { .owner =THIS_MODULE , - .read = snd_ctl_read, + .read_iter = snd_ctl_read, .open = snd_ctl_open, .release = snd_ctl_release, .llseek = no_llseek,
sound/core/hwdep.c +4 -2
@@ -55,6 +55,7 @@ static ssize_t snd_hwdep_read(struct file * file, char __user *buf,return hw->ops.read (hw, buf, count, offset);return -ENXIO ; } +FOPS_READ_ITER_HELPER (snd_hwdep_read);static ssize_t snd_hwdep_write (struct file * file,const char __user *buf,size_t count,loff_t *offset)
@@ -64,6 +65,7 @@ static ssize_t snd_hwdep_write(struct file * file, const char __user *buf,return hw->ops.write (hw, buf, count, offset);return -ENXIO ; } +FOPS_WRITE_ITER_HELPER (snd_hwdep_write);static int snd_hwdep_open (struct inode *inode,struct file * file) {
@@ -327,8 +329,8 @@ static const struct file_operations snd_hwdep_f_ops = { .owner = THIS_MODULE, .llseek = snd_hwdep_llseek, - .read = snd_hwdep_read, - .write = snd_hwdep_write, + .read_iter = snd_hwdep_read_iter, + .write_iter = snd_hwdep_write_iter, .open = snd_hwdep_open, .release = snd_hwdep_release, .poll = snd_hwdep_poll,
sound/core/init.c +4 -6
@@ -407,14 +407,12 @@ static loff_t snd_disconnect_llseek(struct file *file, loff_t offset, int orig)return -ENODEV ; } -static ssize_t snd_disconnect_read (struct file *file,char __user *buf, -size_t count,loff_t *offset) +static ssize_t snd_disconnect_read (struct kiocb *iocb,struct iov_iter *to) {return -ENODEV ; } -static ssize_t snd_disconnect_write (struct file *file,const char __user *buf, -size_t count,loff_t *offset) +static ssize_t snd_disconnect_write (struct kiocb *iocb,struct iov_iter *from) {return -ENODEV ; }
@@ -467,8 +465,8 @@ static const struct file_operations snd_shutdown_f_ops = { .owner = THIS_MODULE, .llseek = snd_disconnect_llseek, - .read = snd_disconnect_read, - .write = snd_disconnect_write, + .read_iter = snd_disconnect_read, + .write_iter = snd_disconnect_write, .release = snd_disconnect_release, .poll = snd_disconnect_poll, .unlocked_ioctl = snd_disconnect_ioctl,
sound/core/jack.c +33 -50
178 lines not on this page · raw message
sound/core/oss/pcm_oss.c +4 -2
@@ -2781,6 +2781,7 @@ static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t coun }#endif } +FOPS_READ_ITER_HELPER (snd_pcm_oss_read);static ssize_t snd_pcm_oss_write (struct file *file,const char __user *buf,size_t count,loff_t *offset) {
@@ -2800,6 +2801,7 @@ static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size#endif return result; } +FOPS_WRITE_ITER_HELPER (snd_pcm_oss_write);static int snd_pcm_oss_playback_ready (struct snd_pcm_substream *substream) {
@@ -3102,8 +3104,8 @@ static inline void snd_pcm_oss_proc_done(struct snd_pcm *pcm)static const struct file_operations snd_pcm_oss_f_reg = { .owner =THIS_MODULE , - .read = snd_pcm_oss_read, - .write = snd_pcm_oss_write, + .read_iter = snd_pcm_oss_read_iter, + .write_iter = snd_pcm_oss_write_iter, .open = snd_pcm_oss_open, .release = snd_pcm_oss_release, .llseek = no_llseek,
sound/core/pcm_native.c +18 -4
@@ -3577,6 +3577,22 @@ static ssize_t snd_pcm_writev(struct kiocb *iocb, struct iov_iter *from)return result; } +static ssize_t snd_pcm_read_iter (struct kiocb *iocb,struct iov_iter *to) +{ +if (!(iocb->ki_flags &IOCB_VECTORED )) +return vfs_read_iter (iocb, to, snd_pcm_read); + +return snd_pcm_readv (iocb, to); +} + +static ssize_t snd_pcm_write_iter (struct kiocb *iocb,struct iov_iter *from) +{ +if (!(iocb->ki_flags &IOCB_VECTORED )) +return vfs_write_iter (iocb, from, snd_pcm_write); + +return snd_pcm_writev (iocb, from); +} +static __poll_t snd_pcm_poll (struct file *file,poll_table *wait) {struct snd_pcm_file *pcm_file;
@@ -4099,8 +4115,7 @@ static unsigned long snd_pcm_get_unmapped_area(struct file *file,const struct file_operations snd_pcm_f_ops[2 ] = { { .owner =THIS_MODULE , - .write = snd_pcm_write, - .write_iter = snd_pcm_writev, + .write_iter = snd_pcm_write_iter, .open = snd_pcm_playback_open, .release = snd_pcm_release, .llseek = no_llseek,
@@ -4113,8 +4128,7 @@ const struct file_operations snd_pcm_f_ops[2] = { }, { .owner = THIS_MODULE, - .read = snd_pcm_read, - .read_iter = snd_pcm_readv, + .read_iter = snd_pcm_read_iter, .open = snd_pcm_capture_open, .release = snd_pcm_release, .llseek = no_llseek,
sound/core/rawmidi.c +4 -2
@@ -1316,6 +1316,7 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun }return result; } +FOPS_READ_ITER_HELPER (snd_rawmidi_read);/** * snd_rawmidi_transmit_empty - check whether the output buffer is empty
@@ -1652,6 +1653,7 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, }return result; } +FOPS_WRITE_ITER_HELPER (snd_rawmidi_write);static __poll_t snd_rawmidi_poll (struct file *file,poll_table *wait) {
@@ -1780,8 +1782,8 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,static const struct file_operations snd_rawmidi_f_ops = { .owner =THIS_MODULE , - .read = snd_rawmidi_read, - .write = snd_rawmidi_write, + .read_iter = snd_rawmidi_read_iter, + .write_iter = snd_rawmidi_write_iter, .open = snd_rawmidi_open, .release = snd_rawmidi_release, .llseek = no_llseek,
sound/core/seq/oss/seq_oss.c +6 -5
@@ -43,8 +43,8 @@ static inline void unregister_proc(void) {}static int odev_open (struct inode *inode,struct file *file);static int odev_release (struct inode *inode,struct file *file); -static ssize_t odev_read (struct file *file,char __user *buf,size_t count,loff_t *offset); -static ssize_t odev_write (struct file *file,const char __user *buf,size_t count,loff_t *offset); +static ssize_t odev_read_iter (struct kiocb *iocb,struct iov_iter *to); +static ssize_t odev_write_iter (struct kiocb *iocb,struct iov_iter *from);static long odev_ioctl (struct file *file,unsigned int cmd,unsigned long arg);static __poll_t odev_poll (struct file *file,poll_table * wait);
@@ -156,7 +156,7 @@ odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset)return -ENXIO ;return snd_seq_oss_read (dp, buf, count); } - +FOPS_READ_ITER_HELPER (odev_read);static ssize_t odev_write (struct file *file,const char __user *buf,size_t count,loff_t *offset)
@@ -167,6 +167,7 @@ odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offsreturn -ENXIO ;return snd_seq_oss_write (dp, buf, count, file); } +FOPS_WRITE_ITER_HELPER (odev_write);static long odev_ioctl (struct file *file,unsigned int cmd,unsigned long arg)
@@ -214,8 +215,8 @@ odev_poll(struct file *file, poll_table * wait)static const struct file_operations seq_oss_f_ops = { .owner =THIS_MODULE , - .read = odev_read, - .write = odev_write, + .read_iter = odev_read_iter, + .write_iter = odev_write_iter, .open = odev_open, .release = odev_release, .poll = odev_poll,
sound/core/seq/seq_clientmgr.c +4 -4
@@ -511,7 +511,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count,return (err <0 ) ? err : result; } - +FOPS_READ_ITER_HELPER (snd_seq_read);/* * check access permission to the port
@@ -1107,7 +1107,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,mutex_unlock (&client->ioctl_mutex);return written ? written : err; } - +FOPS_WRITE_ITER_HELPER (snd_seq_write);/* * handle polling
@@ -2711,8 +2711,8 @@ void snd_seq_info_clients_read(struct snd_info_entry *entry,static const struct file_operations snd_seq_f_ops = { .owner =THIS_MODULE , - .read = snd_seq_read, - .write = snd_seq_write, + .read_iter = snd_seq_read_iter, + .write_iter = snd_seq_write_iter, .open = snd_seq_open, .release = snd_seq_release, .llseek = no_llseek,
sound/core/timer.c +12 -11
@@ -2066,9 +2066,9 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on)return snd_fasync_helper (fd, file, on, &tu->fasync); } -static ssize_t snd_timer_user_read (struct file *file,char __user *buffer, -size_t count,loff_t *offset) +static ssize_t snd_timer_user_read (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to);struct snd_timer_tread64 *tread;struct snd_timer_tread32 tread32;struct snd_timer_user *tu;
@@ -2076,7 +2076,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,int qhead;int err =0 ; - tu = file->private_data; + tu = iocb->ki_filp->private_data;switch (tu->tread) {case TREAD_FORMAT_TIME64 : unit =sizeof (struct snd_timer_tread64 );
@@ -2098,7 +2098,8 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,while (!tu->qused) {wait_queue_entry_t wait; -if ((file->f_flags &O_NONBLOCK ) !=0 || result >0 ) { +if ((iocb->ki_filp->f_flags &O_NONBLOCK ) !=0 || + result >0 ) { err = -EAGAIN ; goto _error; }
@@ -2134,8 +2135,9 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,switch (tu->tread) {case TREAD_FORMAT_TIME64 : -if (copy_to_user (buffer, tread, -sizeof (struct snd_timer_tread64 ))) +if (!copy_to_iter_full (tread, +sizeof (struct snd_timer_tread64 ), + to)) err = -EFAULT ;break ;case TREAD_FORMAT_TIME32 :
@@ -2147,12 +2149,12 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, .val = tread->val, }; -if (copy_to_user (buffer, &tread32,sizeof (tread32))) +if (!copy_to_iter_full (&tread32,sizeof (tread32), to)) err = -EFAULT ;break ;case TREAD_FORMAT_NONE : -if (copy_to_user (buffer, &tu->queue[qhead], -sizeof (struct snd_timer_read ))) +if (!copy_to_iter_full (&tu->queue[qhead], +sizeof (struct snd_timer_read ), to)) err = -EFAULT ;break ;default :
@@ -2164,7 +2166,6 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,if (err <0 ) goto _error; result += unit; - buffer += unit; } _error:spin_unlock_irq (&tu->qlock);
@@ -2200,7 +2201,7 @@ static __poll_t snd_timer_user_poll(struct file *file, poll_table * wait)static const struct file_operations snd_timer_f_ops = { .owner =THIS_MODULE , - .read = snd_timer_user_read, + .read_iter = snd_timer_user_read, .open = snd_timer_user_open, .release = snd_timer_user_release, .llseek = no_llseek,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 60/437 ASoC: Intel: convert to read/write iterators
In reply to Jens Axboe--- sound/soc/intel/avs/debugfs.c | 69 +++++++++++++++-------------- sound/soc/intel/avs/pcm.c | 9 ++-- sound/soc/intel/skylake/skl-debug.c | 19 ++++---- 3 files changed, 47 insertions(+), 50 deletions(-)
sound/soc/intel/avs/debugfs.c +35 -34
@@ -48,9 +48,9 @@ void avs_dump_fw_log_wakeup(struct avs_dev *adev, const void __iomem *src, unsigwake_up (&adev->trace_waitq); } -static ssize_t fw_regs_read (struct file *file,char __user *to,size_t count,loff_t *ppos) +static ssize_t fw_regs_read (struct kiocb *iocb,struct iov_iter *to) { -struct avs_dev *adev = file->private_data; +struct avs_dev *adev = iocb->ki_filp->private_data;char *buf;int ret;
@@ -60,20 +60,20 @@ static ssize_t fw_regs_read(struct file *file, char __user *to, size_t count, lomemcpy_fromio (buf,avs_sram_addr (adev,AVS_FW_REGS_WINDOW ),AVS_FW_REGS_SIZE ); - ret =simple_read_from_buffer (to, count, ppos, buf,AVS_FW_REGS_SIZE ); + ret =simple_copy_to_iter (buf, &iocb->ki_pos,AVS_FW_REGS_SIZE , to);kfree (buf);return ret; }static const struct file_operations fw_regs_fops = { .open = simple_open, - .read = fw_regs_read, + .read_iter = fw_regs_read, .llseek = no_llseek, }; -static ssize_t debug_window_read (struct file *file,char __user *to,size_t count,loff_t *ppos) +static ssize_t debug_window_read (struct kiocb *iocb,struct iov_iter *to) { -struct avs_dev *adev = file->private_data; +struct avs_dev *adev = iocb->ki_filp->private_data;size_t size;char *buf;int ret;
@@ -85,27 +85,27 @@ static ssize_t debug_window_read(struct file *file, char __user *to, size_t counmemcpy_fromio (buf,avs_sram_addr (adev,AVS_DEBUG_WINDOW ), size); - ret =simple_read_from_buffer (to, count, ppos, buf, size); + ret =simple_copy_to_iter (buf, &iocb->ki_pos, size, to);kfree (buf);return ret; }static const struct file_operations debug_window_fops = { .open = simple_open, - .read = debug_window_read, + .read_iter = debug_window_read, .llseek = no_llseek, }; -static ssize_t probe_points_read (struct file *file,char __user *to,size_t count,loff_t *ppos) +static ssize_t probe_points_read (struct kiocb *iocb,struct iov_iter *to) { -struct avs_dev *adev = file->private_data; +struct avs_dev *adev = iocb->ki_filp->private_data;struct avs_probe_point_desc *desc;size_t num_desc, len =0 ;char *buf;int i, ret;/* Prevent chaining, send and dump IPC value just once. */ -if (*ppos) +if (iocb->ki_pos)return 0 ; buf =kzalloc (PAGE_SIZE ,GFP_KERNEL );
@@ -127,7 +127,7 @@ static ssize_t probe_points_read(struct file *file, char __user *to, size_t coun len += ret; } - ret =simple_read_from_buffer (to, count, ppos, buf, len); + ret =simple_copy_to_iter (buf, &iocb->ki_pos, len, to); free_desc:kfree (desc); exit:
@@ -135,16 +135,16 @@ static ssize_t probe_points_read(struct file *file, char __user *to, size_t counreturn ret; } -static ssize_t probe_points_write (struct file *file,const char __user *from,size_t count, -loff_t *ppos) +static ssize_t probe_points_write (struct kiocb *iocb,struct iov_iter *from) { -struct avs_dev *adev = file->private_data; +struct avs_dev *adev = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);struct avs_probe_point_desc *desc;u32 *array, num_elems;size_t bytes;int ret; - ret =parse_int_array_user (from, count, (int **)&array); + ret =parse_int_array_iter (from, (int **)&array);if (ret <0 )return ret;
@@ -168,21 +168,22 @@ static ssize_t probe_points_write(struct file *file, const char __user *from, sistatic const struct file_operations probe_points_fops = { .open = simple_open, - .read = probe_points_read, - .write = probe_points_write, + .read_iter = probe_points_read, + .write_iter = probe_points_write, .llseek = no_llseek, }; -static ssize_t probe_points_disconnect_write (struct file *file,const char __user *from, -size_t count,loff_t *ppos) +static ssize_t probe_points_disconnect_write (struct kiocb *iocb, +struct iov_iter *from) { -struct avs_dev *adev = file->private_data; +struct avs_dev *adev = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);union avs_probe_point_id *id;u32 *array, num_elems;size_t bytes;int ret; - ret =parse_int_array_user (from, count, (int **)&array); + ret =parse_int_array_iter (from, (int **)&array);if (ret <0 )return ret;
@@ -206,7 +207,7 @@ static ssize_t probe_points_disconnect_write(struct file *file, const char __usestatic const struct file_operations probe_points_disconnect_fops = { .open = simple_open, - .write = probe_points_disconnect_write, + .write_iter = probe_points_disconnect_write, .llseek = default_llseek, };
@@ -230,6 +231,7 @@ static ssize_t strace_read(struct file *file, char __user *to, size_t count, lof *ppos += copied;return copied; } +FOPS_READ_ITER_HELPER (strace_read);static int strace_open (struct inode *inode,struct file *file) {
@@ -279,7 +281,7 @@ static int strace_release(struct inode *inode, struct file *file)static const struct file_operations strace_fops = { .llseek = default_llseek, - .read = strace_read, + .read_iter = strace_read_iter, .open = strace_open, .release = strace_release, };
@@ -351,26 +353,25 @@ static int disable_logs(struct avs_dev *adev, u32 resource_mask)return ret; } -static ssize_t trace_control_read (struct file *file,char __user *to,size_t count,loff_t *ppos) +static ssize_t trace_control_read (struct kiocb *iocb,struct iov_iter *to) { -struct avs_dev *adev = file->private_data; +struct avs_dev *adev = iocb->ki_filp->private_data;char buf[64 ];int len; len =snprintf (buf,sizeof (buf),"0x%08x\n" , adev->logged_resources); - -return simple_read_from_buffer (to, count, ppos, buf, len); +return simple_copy_to_iter (buf, &iocb->ki_pos, len, to); } -static ssize_t trace_control_write (struct file *file,const char __user *from,size_t count, -loff_t *ppos) +static ssize_t trace_control_write (struct kiocb *iocb,struct iov_iter *from) { -struct avs_dev *adev = file->private_data; +struct avs_dev *adev = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);u32 *array, num_elems;u32 resource_mask;int ret; - ret =parse_int_array_user (from, count, (int **)&array); + ret =parse_int_array_iter (from, (int **)&array);if (ret <0 )return ret;
@@ -403,8 +404,8 @@ static ssize_t trace_control_write(struct file *file, const char __user *from, sstatic const struct file_operations trace_control_fops = { .llseek = default_llseek, - .read = trace_control_read, - .write = trace_control_write, + .read_iter = trace_control_read, + .write_iter = trace_control_write, .open = simple_open, };
sound/soc/intel/avs/pcm.c +4 -5
@@ -792,10 +792,9 @@ const struct snd_soc_dai_ops avs_dai_fe_ops = { .trigger = avs_dai_fe_trigger, }; -static ssize_t topology_name_read (struct file *file,char __user *user_buf,size_t count, -loff_t *ppos) +static ssize_t topology_name_read (struct kiocb *iocb,struct iov_iter *to) { -struct snd_soc_component *component = file->private_data; +struct snd_soc_component *component = iocb->ki_filp->private_data;struct snd_soc_card *card = component->card;struct snd_soc_acpi_mach *mach =dev_get_platdata (card->dev);char buf[64 ];
@@ -804,12 +803,12 @@ static ssize_t topology_name_read(struct file *file, char __user *user_buf, size len =scnprintf (buf,sizeof (buf),"%s/%s\n" , component->driver->topology_name_prefix, mach->tplg_filename); -return simple_read_from_buffer (user_buf, count, ppos, buf, len); +return simple_copy_to_iter (buf, &iocb->ki_pos, len, to); }static const struct file_operations topology_name_fops = { .open = simple_open, - .read = topology_name_read, + .read_iter = topology_name_read, .llseek = default_llseek, };
sound/soc/intel/skylake/skl-debug.c +8 -11
@@ -64,10 +64,9 @@ static ssize_t skl_print_fmt(struct skl_module_fmt *fmt, char *buf, fmt->ch_map); } -static ssize_t module_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t module_read (struct kiocb *iocb,struct iov_iter *to) { -struct skl_module_cfg *mconfig = file->private_data; +struct skl_module_cfg *mconfig = iocb->ki_filp->private_data;struct skl_module *module = mconfig->module;struct skl_module_res *res = &module->resources[mconfig->res_idx];char *buf;
@@ -149,7 +148,7 @@ static ssize_t module_read(struct file *file, char __user *user_buf, mconfig->dma_id, mconfig->mem_pages, mconfig->m_state, mconfig->m_type); - ret =simple_read_from_buffer (user_buf, count, ppos, buf, ret); + ret =simple_copy_to_iter (buf, &iocb->ki_pos, ret, to);kfree (buf);return ret;
@@ -157,7 +156,7 @@ static ssize_t module_read(struct file *file, char __user *user_buf,static const struct file_operations mcfg_fops = { .open = simple_open, - .read = module_read, + .read_iter = module_read, .llseek = default_llseek, };
@@ -170,10 +169,9 @@ void skl_debug_init_module(struct skl_debug *d, &mcfg_fops); } -static ssize_t fw_softreg_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t fw_softreg_read (struct kiocb *iocb,struct iov_iter *to) { -struct skl_debug *d = file->private_data; +struct skl_debug *d = iocb->ki_filp->private_data;struct sst_dsp *sst = d->skl->dsp;size_t w0_stat_sz = sst->addr.w0_stat_sz;void __iomem *in_base = sst->mailbox.in_base;
@@ -203,15 +201,14 @@ static ssize_t fw_softreg_read(struct file *file, char __user *user_buf, tmp[ret++] ='\n' ; } - ret =simple_read_from_buffer (user_buf, count, ppos, tmp, ret); + ret =simple_copy_to_iter (tmp, &iocb->ki_pos, ret, to);kfree (tmp); -return ret; }static const struct file_operations soft_regs_ctrl_fops = { .open = simple_open, - .read = fw_softreg_read, + .read_iter = fw_softreg_read, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 61/437 ASoC: fsl: convert to read/write iterators
In reply to Jens Axboe--- sound/soc/fsl/imx-audmux.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/fsl/imx-audmux.c +4 -7
@@ -53,12 +53,11 @@ static const char *audmux_port_string(int port) } } -static ssize_t audmux_read_file (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t audmux_read_file (struct kiocb *iocb,struct iov_iter *to) {ssize_t ret;char *buf; -uintptr_t port = (uintptr_t )file->private_data; +uintptr_t port = (uintptr_t )iocb->ki_filp->private_data;u32 pdcr, ptcr; ret =clk_prepare_enable (audmux_clk);
@@ -119,16 +118,14 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,"\nData received from %s\n" , audmux_port_string((pdcr >> 13) & 0x7)); - ret =simple_read_from_buffer (user_buf, count, ppos, buf, ret); - + ret =simple_copy_to_iter (buf, &iocb->ki_pos, ret, to);kfree (buf); -return ret; }static const struct file_operations audmux_debugfs_fops = { .open = simple_open, - .read = audmux_read_file, + .read_iter = audmux_read_file, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 62/437 ALSA: pcmtest: convert to read/write iterators
In reply to Jens Axboe--- sound/drivers/pcmtest.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
sound/drivers/pcmtest.c +18 -18
@@ -646,48 +646,48 @@ static struct platform_driver pcmtst_pdrv = { }, }; -static ssize_t pattern_write (struct file *file,const char __user *u_buff,size_t len,loff_t *off) +static ssize_t pattern_write (struct kiocb *iocb,struct iov_iter *from) { -struct pattern_buf *patt_buf = file->f_inode->i_private; -ssize_t to_write = len; +struct pattern_buf *patt_buf = iocb->ki_filp->f_inode->i_private; +ssize_t to_write =iov_iter_count (from); -if (*off + to_write >MAX_PATTERN_LEN ) - to_write =MAX_PATTERN_LEN - *off; +if (iocb->ki_pos + to_write >MAX_PATTERN_LEN ) + to_write =MAX_PATTERN_LEN - iocb->ki_pos;// Crop silently everything over the buffer if (to_write <=0 ) -return len; +return iov_iter_count (from); -if (copy_from_user (patt_buf->buf + *off, u_buff, to_write)) +if (!copy_from_iter_full (patt_buf->buf + iocb->ki_pos, to_write, from))return -EFAULT ; - patt_buf->len = *off + to_write; - *off += to_write; + patt_buf->len = iocb->ki_pos + to_write; + iocb->ki_pos += to_write;return to_write; } -static ssize_t pattern_read (struct file *file,char __user *u_buff,size_t len,loff_t *off) +static ssize_t pattern_read (struct kiocb *iocb,struct iov_iter *to) { -struct pattern_buf *patt_buf = file->f_inode->i_private; -ssize_t to_read = len; +struct pattern_buf *patt_buf = iocb->ki_filp->f_inode->i_private; +ssize_t to_read =iov_iter_count (to); -if (*off + to_read >=MAX_PATTERN_LEN ) - to_read =MAX_PATTERN_LEN - *off; +if (iocb->ki_pos + to_read >=MAX_PATTERN_LEN ) + to_read =MAX_PATTERN_LEN - iocb->ki_pos;if (to_read <=0 )return 0 ; -if (copy_to_user (u_buff, patt_buf->buf + *off, to_read)) +if (!copy_to_iter_full (patt_buf->buf + iocb->ki_pos, to_read, to)) to_read =0 ;else - *off += to_read; + iocb->ki_pos += to_read;return to_read; }static const struct file_operations fill_pattern_fops = { - .read = pattern_read, - .write = pattern_write, + .read_iter = pattern_read, + .write_iter = pattern_write, };static int setup_patt_bufs (void )
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 63/437 sound/oss/dmasound: convert to read/write iterators
In reply to Jens Axboe--- sound/oss/dmasound/dmasound_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/oss/dmasound/dmasound_core.c +4 -4
@@ -1334,15 +1334,15 @@ static int state_release(struct inode *inode, struct file *file)return 0 ; } -static ssize_t state_read (struct file *file,char __user *buf,size_t count, -loff_t *ppos) +static ssize_t state_read (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to);int n = state.len - state.ptr;if (n > count) n = count;if (n <=0 )return 0 ; -if (copy_to_user (buf, &state.buf[state.ptr], n)) +if (!copy_to_iter_full (&state.buf[state.ptr], n, to))return -EFAULT ; state.ptr += n;return n;
@@ -1351,7 +1351,7 @@ static ssize_t state_read(struct file *file, char __user *buf, size_t count,static const struct file_operations state_fops = { .owner =THIS_MODULE , .llseek = no_llseek, - .read = state_read, + .read_iter = state_read, .open = state_open, .release = state_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 64/437 ASoC: SOF: icp3-dtrace: convert to read/write iterators
In reply to Jens Axboe--- sound/soc/sof/ipc3-dtrace.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
sound/soc/sof/ipc3-dtrace.c +9 -8
@@ -217,10 +217,11 @@ static ssize_t dfsentry_trace_filter_write(struct file *file, const char __userkfree (elems);return ret; } +FOPS_WRITE_ITER_HELPER (dfsentry_trace_filter_write);static const struct file_operations sof_dfs_trace_filter_fops = { .open = simple_open, - .write = dfsentry_trace_filter_write, + .write_iter = dfsentry_trace_filter_write_iter, .llseek = default_llseek, };
@@ -313,14 +314,14 @@ static size_t sof_wait_dtrace_avail(struct snd_sof_dev *sdev, loff_t pos,return sof_dtrace_avail (sdev, pos, buffer_size); } -static ssize_t dfsentry_dtrace_read (struct file *file,char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t dfsentry_dtrace_read (struct kiocb *iocb,struct iov_iter *to) { -struct snd_sof_dfsentry *dfse = file->private_data; +struct snd_sof_dfsentry *dfse = iocb->ki_filp->private_data; +size_t count =iov_iter_count (to);struct snd_sof_dev *sdev = dfse->sdev;struct sof_dtrace_priv *priv = sdev->fw_trace_data;unsigned long rem; -loff_t lpos = *ppos; +loff_t lpos = iocb->ki_pos;size_t avail, buffer_size = dfse->size;u64 lpos_64;
@@ -360,11 +361,11 @@ static ssize_t dfsentry_dtrace_read(struct file *file, char __user *buffer,*/ snd_dma_buffer_sync (&priv->dmatb,SNDRV_DMA_SYNC_CPU );/* copy available trace data to debugfs */ - rem =copy_to_user (buffer, ((u8 *)(dfse->buf) + lpos), count); + rem = !copy_to_iter_full (((u8 *)(dfse->buf) + lpos), count, to);if (rem)return -EFAULT ; - *ppos += count; + iocb->ki_pos += count;/* move debugfs reading position */ return count;
@@ -385,7 +386,7 @@ static int dfsentry_dtrace_release(struct inode *inode, struct file *file)static const struct file_operations sof_dfs_dtrace_fops = { .open = simple_open, - .read = dfsentry_dtrace_read, + .read_iter = dfsentry_dtrace_read, .llseek = default_llseek, .release = dfsentry_dtrace_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 65/437 SoC: SOF: icp4: convert to read/write iterators
In reply to Jens Axboe--- sound/soc/sof/ipc4-mtrace.c | 17 +++++++++-------- sound/soc/sof/ipc4-telemetry.c | 14 +++++++------- 2 files changed, 16 insertions(+), 15 deletions(-)
sound/soc/sof/ipc4-mtrace.c +9 -8
@@ -274,6 +274,7 @@ static ssize_t sof_ipc4_mtrace_dfs_read(struct file *file, char __user *buffer,return count; } +FOPS_READ_ITER_HELPER (sof_ipc4_mtrace_dfs_read);static int sof_ipc4_mtrace_dfs_release (struct inode *inode,struct file *file) {
@@ -291,17 +292,17 @@ static int sof_ipc4_mtrace_dfs_release(struct inode *inode, struct file *file)static const struct file_operations sof_dfs_mtrace_fops = { .open = sof_ipc4_mtrace_dfs_open, - .read = sof_ipc4_mtrace_dfs_read, + .read_iter = sof_ipc4_mtrace_dfs_read_iter, .llseek = default_llseek, .release = sof_ipc4_mtrace_dfs_release, .owner =THIS_MODULE , }; -static ssize_t sof_ipc4_priority_mask_dfs_read (struct file *file,char __user *to, -size_t count,loff_t *ppos) +static ssize_t sof_ipc4_priority_mask_dfs_read (struct kiocb *iocb, +struct iov_iter *to) { -struct sof_mtrace_priv *priv = file->private_data; +struct sof_mtrace_priv *priv = iocb->ki_filp->private_data;int i, ret, offset, remaining;char *buf;
@@ -322,8 +323,7 @@ static ssize_t sof_ipc4_priority_mask_dfs_read(struct file *file, char __user *t priv->state_info.logs_priorities_mask[i]); } - ret =simple_read_from_buffer (to, count, ppos, buf,strlen (buf)); - + ret =simple_copy_to_iter (buf, &iocb->ki_pos,strlen (buf), to);kfree (buf);return ret; }
@@ -368,11 +368,12 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,kfree (buf);return ret; } +FOPS_WRITE_ITER_HELPER (sof_ipc4_priority_mask_dfs_write);static const struct file_operations sof_dfs_priority_mask_fops = { .open = simple_open, - .read = sof_ipc4_priority_mask_dfs_read, - .write = sof_ipc4_priority_mask_dfs_write, + .read_iter = sof_ipc4_priority_mask_dfs_read, + .write_iter = sof_ipc4_priority_mask_dfs_write_iter, .llseek = default_llseek, .owner =THIS_MODULE ,
sound/soc/sof/ipc4-telemetry.c +7 -7
@@ -32,13 +32,13 @@ static void __iomem *sof_ipc4_query_exception_address(struct snd_sof_dev *sdev)return sdev->bar[sdev->mailbox_bar] + offset; } -static ssize_t sof_telemetry_entry_read (struct file *file,char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t sof_telemetry_entry_read (struct kiocb *iocb,struct iov_iter *to) { -struct snd_sof_dfsentry *dfse = file->private_data; +struct snd_sof_dfsentry *dfse = iocb->ki_filp->private_data;struct snd_sof_dev *sdev = dfse->sdev; +size_t count =iov_iter_count (to);void __iomem *io_addr; -loff_t pos = *ppos; +loff_t pos = iocb->ki_pos;size_t size_ret;u8 *buf;
@@ -59,13 +59,13 @@ static ssize_t sof_telemetry_entry_read(struct file *file, char __user *buffer,return -ENOMEM ;memcpy_fromio (buf, io_addr,SOF_IPC4_DEBUG_SLOT_SIZE -4 ); - size_ret =copy_to_user (buffer, buf + pos, count); + size_ret = !copy_to_iter_full (buf + pos, count, to);if (size_ret) {kfree (buf);return -EFAULT ; } - *ppos = pos + count; + iocb->ki_pos = pos + count;kfree (buf);return count;
@@ -73,7 +73,7 @@ static ssize_t sof_telemetry_entry_read(struct file *file, char __user *buffer,static const struct file_operations sof_telemetry_fops = { .open = simple_open, - .read = sof_telemetry_entry_read, + .read_iter = sof_telemetry_entry_read, };void sof_ipc4_create_exception_debugfs_node (struct snd_sof_dev *sdev)
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 66/437 ASoC: SOF: Core: convert to read/write iterators
In reply to Jens Axboe--- sound/soc/sof/debug.c | 34 +++++----- sound/soc/sof/sof-client-ipc-flood-test.c | 19 +++--- .../soc/sof/sof-client-ipc-kernel-injector.c | 15 +++-- sound/soc/sof/sof-client-ipc-msg-injector.c | 67 +++++++++---------- sound/soc/sof/sof-client-probes.c | 31 +++++---- 5 files changed, 85 insertions(+), 81 deletions(-)
sound/soc/sof/debug.c +19 -15
@@ -19,9 +19,9 @@#include "sof-priv.h" #include "ops.h" -static ssize_t sof_dfsentry_write (struct file *file,const char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t sof_dfsentry_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);size_t size;char *string;int ret;
@@ -30,19 +30,19 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,if (!string)return -ENOMEM ; - size =simple_write_to_buffer (string, count, ppos, buffer, count); + size =simple_copy_from_iter (string, &iocb->ki_pos, count, from); ret = size;kfree (string);return ret; } -static ssize_t sof_dfsentry_read (struct file *file,char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t sof_dfsentry_read (struct kiocb *iocb,struct iov_iter *to) { -struct snd_sof_dfsentry *dfse = file->private_data; +struct snd_sof_dfsentry *dfse = iocb->ki_filp->private_data;struct snd_sof_dev *sdev = dfse->sdev; -loff_t pos = *ppos; +size_t count =iov_iter_count (to); +loff_t pos = iocb->ki_pos;size_t size_ret;int skip =0 ;int size;
@@ -66,8 +66,8 @@ static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer, size =ALIGN (count,4 );/* if start position is unaligned, read extra u32 */ -if (unlikely (pos != *ppos)) { - skip = *ppos - pos; +if (unlikely (pos != iocb->ki_pos)) { + skip = iocb->ki_pos - pos;if (pos + size +4 < dfse->size) size +=4 ; }
@@ -109,7 +109,7 @@ static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer, }/* copy to userspace */ - size_ret =copy_to_user (buffer, buf + skip, count); + size_ret = !copy_to_iter_full (buf + skip, count, to);kfree (buf);
@@ -117,16 +117,15 @@ static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer,if (size_ret)return -EFAULT ; - *ppos = pos + count; - + iocb->ki_pos = pos + count;return count; }static const struct file_operations sof_dfs_fops = { .open = simple_open, - .read = sof_dfsentry_read, + .read_iter = sof_dfsentry_read, .llseek = default_llseek, - .write = sof_dfsentry_write, + .write_iter = sof_dfsentry_write, };/* create FS entry for debug files that can expose DSP memories, registers */
@@ -284,6 +283,11 @@ static ssize_t memory_info_read(struct file *file, char __user *to, size_t countreturn simple_read_from_buffer (to, count, ppos, dfse->buf, dfse->buf_data_size); } +static ssize_t memory_info_read_iter (struct kiocb *iocb,struct iov_iter *to) +{ +return vfs_read_iter (iocb, to, memory_info_read); +} +static int memory_info_open (struct inode *inode,struct file *file) {struct snd_sof_dfsentry *dfse = inode->i_private;
@@ -304,7 +308,7 @@ static int memory_info_open(struct inode *inode, struct file *file)static const struct file_operations memory_info_fops = { .open = memory_info_open, - .read = memory_info_read, + .read_iter = memory_info_read_iter, .llseek = default_llseek, };
sound/soc/sof/sof-client-ipc-flood-test.c +10 -9
@@ -238,29 +238,30 @@ static ssize_t sof_ipc_flood_dfs_write(struct file *file, const char __user *bufkfree (string);return ret; } +FOPS_WRITE_ITER_HELPER (sof_ipc_flood_dfs_write);/* return the result of the last IPC flood test */ -static ssize_t sof_ipc_flood_dfs_read (struct file *file,char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t sof_ipc_flood_dfs_read (struct kiocb *iocb,struct iov_iter *to) { -struct sof_client_dev *cdev = file->private_data; +struct sof_client_dev *cdev = iocb->ki_filp->private_data;struct sof_ipc_flood_priv *priv = cdev->data; +size_t count =iov_iter_count (to);size_t size_ret;struct dentry *dentry; - dentry = file->f_path.dentry; + dentry = iocb->ki_filp->f_path.dentry;if (!strcmp (dentry->d_name.name,DEBUGFS_IPC_FLOOD_COUNT ) || !strcmp (dentry->d_name.name,DEBUGFS_IPC_FLOOD_DURATION )) { -if (*ppos) +if (iocb->ki_pos)return 0 ; count =min_t (size_t, count,strlen (priv->buf)); - size_ret =copy_to_user (buffer, priv->buf, count); + size_ret = !copy_to_iter_full (priv->buf, count, to);if (size_ret)return -EFAULT ; - *ppos += count; + iocb->ki_pos += count;return count; }return count;
@@ -275,9 +276,9 @@ static int sof_ipc_flood_dfs_release(struct inode *inode, struct file *file)static const struct file_operations sof_ipc_flood_fops = { .open = sof_ipc_flood_dfs_open, - .read = sof_ipc_flood_dfs_read, + .read_iter = sof_ipc_flood_dfs_read, .llseek = default_llseek, - .write = sof_ipc_flood_dfs_write, + .write_iter = sof_ipc_flood_dfs_write_iter, .release = sof_ipc_flood_dfs_release, .owner =THIS_MODULE ,
sound/soc/sof/sof-client-ipc-kernel-injector.c +8 -7
@@ -37,21 +37,22 @@ static int sof_msg_inject_dfs_open(struct inode *inode, struct file *file)return ret; } -static ssize_t sof_kernel_msg_inject_dfs_write (struct file *file,const char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t sof_kernel_msg_inject_dfs_write (struct kiocb *iocb, +struct iov_iter *from) { -struct sof_client_dev *cdev = file->private_data; +struct sof_client_dev *cdev = iocb->ki_filp->private_data;struct sof_msg_inject_priv *priv = cdev->data;struct sof_ipc_cmd_hdr *hdr = priv->kernel_buffer;struct device *dev = &cdev->auxdev.dev; +size_t count =iov_iter_count (from);ssize_t size;int ret; -if (*ppos) +if (iocb->ki_pos)return 0 ; - size =simple_write_to_buffer (priv->kernel_buffer, priv->max_msg_size, - ppos, buffer, count); + size =simple_copy_from_iter (priv->kernel_buffer, &iocb->ki_pos, + priv->max_msg_size, from);if (size <0 )return size;if (size != count)
@@ -82,7 +83,7 @@ static int sof_msg_inject_dfs_release(struct inode *inode, struct file *file)static const struct file_operations sof_kernel_msg_inject_fops = { .open = sof_msg_inject_dfs_open, - .write = sof_kernel_msg_inject_dfs_write, + .write_iter = sof_kernel_msg_inject_dfs_write, .release = sof_msg_inject_dfs_release, .owner =THIS_MODULE ,
sound/soc/sof/sof-client-ipc-msg-injector.c +33 -34
158 lines not on this page · raw message
sound/soc/sof/sof-client-probes.c +15 -16
@@ -188,10 +188,10 @@ static const struct snd_compress_ops sof_probes_compressed_ops = { .copy = sof_probes_compr_copy, }; -static ssize_t sof_probes_dfs_points_read (struct file *file,char __user *to, -size_t count,loff_t *ppos) +static ssize_t sof_probes_dfs_points_read (struct kiocb *iocb, +struct iov_iter *to) { -struct sof_client_dev *cdev = file->private_data; +struct sof_client_dev *cdev = iocb->ki_filp->private_data;struct sof_probes_priv *priv = cdev->data;struct device *dev = &cdev->auxdev.dev;struct sof_probe_point_desc *desc;
@@ -233,8 +233,7 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to, } } - ret =simple_read_from_buffer (to, count, ppos, buf,strlen (buf)); - + ret =simple_copy_to_iter (buf, &iocb->ki_pos,strlen (buf), to);kfree (desc); pm_error:
@@ -249,13 +248,13 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to, }static ssize_t -sof_probes_dfs_points_write (struct file *file,const char __user *from, -size_t count,loff_t *ppos) +sof_probes_dfs_points_write (struct kiocb *iocb,struct iov_iter *from) { -struct sof_client_dev *cdev = file->private_data; +struct sof_client_dev *cdev = iocb->ki_filp->private_data;struct sof_probes_priv *priv = cdev->data;const struct sof_probes_ipc_ops *ipc = priv->ipc_ops;struct device *dev = &cdev->auxdev.dev; +size_t count =iov_iter_count (from);struct sof_probe_point_desc *desc;u32 num_elems, *array;size_t bytes;
@@ -266,7 +265,7 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from,return -ENOENT ; } - ret =parse_int_array_user (from, count, (int **)&array); + ret =parse_int_array_iter (from, (int **)&array);if (ret <0 )return ret;
@@ -300,21 +299,21 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from,static const struct file_operations sof_probes_points_fops = { .open = simple_open, - .read = sof_probes_dfs_points_read, - .write = sof_probes_dfs_points_write, + .read_iter = sof_probes_dfs_points_read, + .write_iter = sof_probes_dfs_points_write, .llseek = default_llseek, .owner =THIS_MODULE , };static ssize_t -sof_probes_dfs_points_remove_write (struct file *file,const char __user *from, -size_t count,loff_t *ppos) +sof_probes_dfs_points_remove_write (struct kiocb *iocb,struct iov_iter *from) { -struct sof_client_dev *cdev = file->private_data; +struct sof_client_dev *cdev = iocb->ki_filp->private_data;struct sof_probes_priv *priv = cdev->data;const struct sof_probes_ipc_ops *ipc = priv->ipc_ops;struct device *dev = &cdev->auxdev.dev; +size_t count =iov_iter_count (from);int ret, err;u32 *array;
@@ -323,7 +322,7 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from,return -ENOENT ; } - ret =parse_int_array_user (from, count, (int **)&array); + ret =parse_int_array_iter (from, (int **)&array);if (ret <0 )return ret;
@@ -348,7 +347,7 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from,static const struct file_operations sof_probes_points_remove_fops = { .open = simple_open, - .write = sof_probes_dfs_points_remove_write, + .write_iter = sof_probes_dfs_points_remove_write, .llseek = default_llseek, .owner =THIS_MODULE ,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 67/437 ASoC: SOF: convert to read/write iterators
In reply to Jens Axboe--- sound/soc/soc-dapm.c | 21 ++++++++------------- sound/soc/soc-pcm.c | 10 ++++------ 2 files changed, 12 insertions(+), 19 deletions(-)
sound/soc/soc-dapm.c +8 -13
@@ -2094,11 +2094,9 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event) }#ifdef CONFIG_DEBUG_FS -static ssize_t dapm_widget_power_read_file (struct file *file, -char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t dapm_widget_power_read (struct kiocb *iocb,struct iov_iter *to) { -struct snd_soc_dapm_widget *w = file->private_data; +struct snd_soc_dapm_widget *w = iocb->ki_filp->private_data;enum snd_soc_dapm_direction dir, rdir;char *buf;int in, out;
@@ -2155,22 +2153,20 @@ static ssize_t dapm_widget_power_read_file(struct file *file,snd_soc_dapm_mutex_unlock (w->dapm); - ret =simple_read_from_buffer (user_buf, count, ppos, buf, ret); - + ret =simple_copy_to_iter (buf, &iocb->ki_pos, ret, to);kfree (buf);return ret; }static const struct file_operations dapm_widget_power_fops = { .open = simple_open, - .read = dapm_widget_power_read_file, + .read_iter = dapm_widget_power_read, .llseek = default_llseek, }; -static ssize_t dapm_bias_read_file (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t dapm_bias_read_file (struct kiocb *iocb,struct iov_iter *to) { -struct snd_soc_dapm_context *dapm = file->private_data; +struct snd_soc_dapm_context *dapm = iocb->ki_filp->private_data;char *level;switch (dapm->bias_level) {
@@ -2192,13 +2188,12 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,break ; } -return simple_read_from_buffer (user_buf, count, ppos, level, -strlen (level)); +return simple_copy_to_iter (level, &iocb->ki_pos,strlen (level), to); }static const struct file_operations dapm_bias_fops = { .open = simple_open, - .read = dapm_bias_read_file, + .read_iter = dapm_bias_read_file, .llseek = default_llseek, };
sound/soc/soc-pcm.c +4 -6
@@ -164,10 +164,9 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,return offset; } -static ssize_t dpcm_state_read_file (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t dpcm_state_read (struct kiocb *iocb,struct iov_iter *to) { -struct snd_soc_pcm_runtime *fe = file->private_data; +struct snd_soc_pcm_runtime *fe = iocb->ki_filp->private_data;ssize_t out_count =PAGE_SIZE , offset =0 , ret =0 ;int stream;char *buf;
@@ -190,15 +189,14 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf, out_count - offset);snd_soc_dpcm_mutex_unlock (fe); - ret =simple_read_from_buffer (user_buf, count, ppos, buf, offset); - + ret =simple_copy_to_iter (buf, &iocb->ki_pos, offset, to);kfree (buf);return ret; }static const struct file_operations dpcm_state_fops = { .open = simple_open, - .read = dpcm_state_read_file, + .read_iter = dpcm_state_read, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 68/437 block: convert to read/write iterators
In reply to Jens Axboe--- block/blk-mq-debugfs.c | 20 ++++++++++---------- block/blk-mq-debugfs.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-)
block/blk-mq-debugfs.c +10 -10
@@ -119,9 +119,10 @@ static int queue_state_show(void *data, struct seq_file *m)return 0 ; } -static ssize_t queue_state_write (void *data,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t queue_state_write (void *data,struct kiocb *iocb, +struct iov_iter *from) { +size_t count =iov_iter_count (from);struct request_queue *q = data;char opbuf[16 ] = { }, *op;
@@ -137,7 +138,7 @@ static ssize_t queue_state_write(void *data, const char __user *buf, goto inval; } -if (copy_from_user (opbuf, buf, count)) +if (!copy_from_iter_full (opbuf, count, from))return -EFAULT ; op =strstrip (opbuf);if (strcmp (op,"run" ) ==0 ) {
@@ -540,12 +541,11 @@ static int blk_mq_debugfs_show(struct seq_file *m, void *v)return attr->show (data, m); } -static ssize_t blk_mq_debugfs_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t blk_mq_debugfs_write (struct kiocb *iocb,struct iov_iter *from) { -struct seq_file *m = file->private_data; +struct seq_file *m = iocb->ki_filp->private_data;const struct blk_mq_debugfs_attr *attr = m->private; -void *data =d_inode (file->f_path.dentry->d_parent)->i_private; +void *data =d_inode (iocb->ki_filp->f_path.dentry->d_parent)->i_private;/* * Attributes that only implement .seq_ops are read-only and 'attr' is
@@ -554,7 +554,7 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,if (attr == data || !attr->write)return -EPERM ; -return attr->write (data, buf, count, ppos); +return attr->write (data, iocb, from); }static int blk_mq_debugfs_open (struct inode *inode,struct file *file)
@@ -591,8 +591,8 @@ static int blk_mq_debugfs_release(struct inode *inode, struct file *file)static const struct file_operations blk_mq_debugfs_fops = { .open = blk_mq_debugfs_open, - .read = seq_read, - .write = blk_mq_debugfs_write, + .read_iter = seq_read_iter, + .write_iter = blk_mq_debugfs_write, .llseek = seq_lseek, .release = blk_mq_debugfs_release, };
block/blk-mq-debugfs.h +1 -1
@@ -12,7 +12,7 @@ struct blk_mq_debugfs_attr {const char *name;umode_t mode;int (*show)(void *,struct seq_file *); -ssize_t (*write)(void *,const char __user *,size_t ,loff_t *); +ssize_t (*write)(void *,struct kiocb *,struct iov_iter *);/* Set either .show or .seq_ops. */ const struct seq_operations *seq_ops; };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 69/437 bpf: convert to read/write iterators
In reply to Jens Axboe--- kernel/bpf/bpf_iter.c | 14 +++++++------- kernel/bpf/inode.c | 2 +- kernel/bpf/syscall.c | 18 ++++++++---------- 3 files changed, 16 insertions(+), 18 deletions(-)
kernel/bpf/bpf_iter.c +7 -7
@@ -91,10 +91,10 @@ static bool bpf_iter_support_resched(struct seq_file *seq)* . assuming NULL ->llseek() * . stop() may call bpf program, handling potential overflow there */ -static ssize_t bpf_seq_read (struct file *file,char __user *buf,size_t size, -loff_t *ppos) +static ssize_t bpf_seq_read_iter (struct kiocb *iocb,struct iov_iter *to) { -struct seq_file *seq = file->private_data; +struct seq_file *seq = iocb->ki_filp->private_data; +size_t size =iov_iter_count (to);size_t n, offs, copied =0 ;int err =0 , num_objs =0 ;bool can_resched;
@@ -113,7 +113,7 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size,if (seq->count) { n =min (seq->count, size); - err =copy_to_user (buf, seq->buf + seq->from, n); + err = !copy_to_iter_full (seq->buf + seq->from, n, to);if (err) { err = -EFAULT ; goto done;
@@ -222,7 +222,7 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size, } n =min (seq->count, size); - err =copy_to_user (buf, seq->buf, n); + err = !copy_to_iter_full (seq->buf, n, to);if (err) { err = -EFAULT ; goto done;
@@ -234,7 +234,7 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size,if (!copied) copied = err;else - *ppos += copied; + iocb->ki_pos += copied;mutex_unlock (&seq->lock);return copied; }
@@ -284,7 +284,7 @@ static int iter_release(struct inode *inode, struct file *file)const struct file_operations bpf_iter_fops = { .open = iter_open, .llseek = no_llseek, - .read = bpf_seq_read, + .read_iter = bpf_seq_read_iter, .release = iter_release, };
kernel/bpf/inode.c +1 -1
@@ -313,7 +313,7 @@ static int bpffs_map_release(struct inode *inode, struct file *file)*/ static const struct file_operations bpffs_map_fops = { .open = bpffs_map_open, - .read = seq_read, + .read_iter = seq_read_iter, .release = bpffs_map_release, };
kernel/bpf/syscall.c +8 -10
@@ -872,8 +872,7 @@ static void bpf_map_show_fdinfo(struct seq_file *m, struct file *filp) }#endif -static ssize_t bpf_dummy_read (struct file *filp,char __user *buf,size_t siz, -loff_t *ppos) +static ssize_t bpf_dummy_read (struct kiocb *iocb,struct iov_iter *to) {/* We need this handler such that alloc_file() enables * f_mode with FMODE_CAN_READ.
@@ -881,8 +880,7 @@ static ssize_t bpf_dummy_read(struct file *filp, char __user *buf, size_t siz,return -EINVAL ; } -static ssize_t bpf_dummy_write (struct file *filp,const char __user *buf, -size_t siz,loff_t *ppos) +static ssize_t bpf_dummy_write (struct kiocb *iocb,struct iov_iter *to) {/* We need this handler such that alloc_file() enables * f_mode with FMODE_CAN_WRITE.
@@ -991,8 +989,8 @@ const struct file_operations bpf_map_fops = { .show_fdinfo = bpf_map_show_fdinfo, #endif .release = bpf_map_release, - .read = bpf_dummy_read, - .write = bpf_dummy_write, + .read_iter = bpf_dummy_read, + .write_iter = bpf_dummy_write, .mmap = bpf_map_mmap, .poll = bpf_map_poll, .get_unmapped_area = bpf_get_unmapped_area,
@@ -2378,8 +2376,8 @@ const struct file_operations bpf_prog_fops = { .show_fdinfo = bpf_prog_show_fdinfo, #endif .release = bpf_prog_release, - .read = bpf_dummy_read, - .write = bpf_dummy_write, + .read_iter = bpf_dummy_read, + .write_iter = bpf_dummy_write, };int bpf_prog_new_fd (struct bpf_prog *prog)
@@ -3142,8 +3140,8 @@ static const struct file_operations bpf_link_fops = { .show_fdinfo = bpf_link_show_fdinfo, #endif .release = bpf_link_release, - .read = bpf_dummy_read, - .write = bpf_dummy_write, + .read_iter = bpf_dummy_read, + .write_iter = bpf_dummy_write, };static int bpf_link_alloc_id (struct bpf_link *link)
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 70/437 perf: convert events to read/write iterators
In reply to Jens Axboe--- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +2 -1
@@ -5688,6 +5688,7 @@ perf_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)return ret; } +FOPS_READ_ITER_HELPER (perf_read);static __poll_t perf_poll (struct file *file,poll_table *wait) {
@@ -6669,7 +6670,7 @@ static int perf_fasync(int fd, struct file *filp, int on)static const struct file_operations perf_fops = { .llseek = no_llseek, .release = perf_release, - .read = perf_read, + .read_iter = perf_read_iter, .poll = perf_poll, .unlocked_ioctl = perf_ioctl, .compat_ioctl = perf_compat_ioctl,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 71/437 dma-debug: convert to read/write iterators
In reply to Jens Axboe--- kernel/dma/debug.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
kernel/dma/debug.c +7 -8
@@ -717,8 +717,7 @@ static void dma_entry_free(struct dma_debug_entry *entry)* 2. Preallocate a given number of dma_debug_entry structs */ -static ssize_t filter_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t filter_read (struct kiocb *iocb,struct iov_iter *to) {char buf[NAME_MAX_LEN +1 ];unsigned long flags;
@@ -736,12 +735,12 @@ static ssize_t filter_read(struct file *file, char __user *user_buf, len =scnprintf (buf,NAME_MAX_LEN +1 ,"%s\n" , current_driver_name);read_unlock_irqrestore (&driver_name_lock, flags); -return simple_read_from_buffer (user_buf, count, ppos, buf, len); +return simple_copy_to_iter (buf, &iocb->ki_pos, len, to); } -static ssize_t filter_write (struct file *file,const char __user *userbuf, -size_t count,loff_t *ppos) +static ssize_t filter_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);char buf[NAME_MAX_LEN ];unsigned long flags;size_t len;
@@ -754,7 +753,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,* need to copy to temporary buffer first */ len =min (count, (size_t )(NAME_MAX_LEN -1 )); -if (copy_from_user (buf, userbuf, len)) +if (!copy_from_iter_full (buf, len, from))return -EFAULT ; buf[len] =0 ;
@@ -804,8 +803,8 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf, }static const struct file_operations filter_fops = { - .read = filter_read, - .write = filter_write, + .read_iter = filter_read, + .write_iter = filter_write, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 72/437 kernel/fail_function: convert to read/write iterators
In reply to Jens Axboe--- kernel/fail_function.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/fail_function.c +5 -5
@@ -233,9 +233,9 @@ static void fei_attr_remove_all(void) } } -static ssize_t fei_write (struct file *file,const char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t fei_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);struct fei_attr *attr;unsigned long addr;char *buf, *sym;
@@ -245,7 +245,7 @@ static ssize_t fei_write(struct file *file, const char __user *buffer,if (count >KSYM_NAME_LEN ) count =KSYM_NAME_LEN ; - buf =memdup_user_nul (buffer, count); + buf =iterdup_nul (from, count);if (IS_ERR (buf))return PTR_ERR (buf);
@@ -306,8 +306,8 @@ static ssize_t fei_write(struct file *file, const char __user *buffer,static const struct file_operations fei_ops = { .open = fei_open, - .read = seq_read, - .write = fei_write, + .read_iter = seq_read_iter, + .write_iter = fei_write, .llseek = seq_lseek, .release = seq_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 73/437 kcsan: convert to read/write iterators
In reply to Jens Axboe--- kernel/kcsan/debugfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/kcsan/debugfs.c +5 -5
@@ -220,14 +220,14 @@ static int debugfs_open(struct inode *inode, struct file *file)return single_open (file, show_info,NULL ); } -static ssize_t -debugfs_write (struct file *file,const char __user *buf,size_t count,loff_t *off) +static ssize_t debugfs_write (struct kiocb *iocb,struct iov_iter *from) {char kbuf[KSYM_NAME_LEN ];char *arg; +size_t count =iov_iter_count (from);int read_len = count < (sizeof (kbuf) -1 ) ? count : (sizeof (kbuf) -1 ); -if (copy_from_user (kbuf, buf, read_len)) +if (!copy_from_iter_full (kbuf, read_len, from))return -EFAULT ; kbuf[read_len] ='\0' ; arg =strstrip (kbuf);
@@ -260,9 +260,9 @@ debugfs_write(struct file *file, const char __user *buf, size_t count, loff_t *ostatic const struct file_operations debugfs_ops = { - .read = seq_read, + .read_iter = seq_read_iter, .open = debugfs_open, - .write = debugfs_write, + .write_iter = debugfs_write, .release = single_release };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 74/437 module: convert to read/write iterators
In reply to Jens Axboe--- kernel/module/stats.c | 8 ++++---- kernel/module/tracking.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
kernel/module/stats.c +4 -4
@@ -270,8 +270,7 @@ int try_add_failed_module(const char *name, enum fail_dup_mod_reason reason)#define MAX_PREAMBLE 1024#define MAX_FAILED_MOD_PRINT 112#define MAX_BYTES_PER_MOD 64 -static ssize_t read_file_mod_stats (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t read_file_mod_stats (struct kiocb *iocb,struct iov_iter *to) {struct mod_fail_load *mod_fail;unsigned int len, size, count_failed =0 ;
@@ -391,16 +390,17 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf, out_unlock:mutex_unlock (&module_mutex); out: - ret =simple_read_from_buffer (user_buf, count, ppos, buf, len); + ret =simple_copy_to_iter (buf, &iocb->ki_pos, len, to);kfree (buf);return ret; } +#undef MAX_PREAMBLE#undef MAX_FAILED_MOD_PRINT#undef MAX_BYTES_PER_MODstatic const struct file_operations fops_mod_stats = { - .read = read_file_mod_stats, + .read_iter = read_file_mod_stats, .open = simple_open, .owner =THIS_MODULE , .llseek = default_llseek,
kernel/module/tracking.c +1 -1
@@ -114,7 +114,7 @@ static int unloaded_tainted_modules_open(struct inode *inode, struct file *file)static const struct file_operations unloaded_tainted_modules_fops = { .open = unloaded_tainted_modules_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 75/437 kernel/power: convert to read/write iterators
In reply to Jens Axboe--- kernel/power/qos.c | 21 ++++++++++----------- kernel/power/user.c | 28 ++++++++++++---------------- 2 files changed, 22 insertions(+), 27 deletions(-)
kernel/power/qos.c +10 -11
@@ -363,10 +363,9 @@ static int cpu_latency_qos_release(struct inode *inode, struct file *filp)return 0 ; } -static ssize_t cpu_latency_qos_read (struct file *filp,char __user *buf, -size_t count,loff_t *f_pos) +static ssize_t cpu_latency_qos_read (struct kiocb *iocb,struct iov_iter *to) { -struct pm_qos_request *req = filp->private_data; +struct pm_qos_request *req = iocb->ki_filp->private_data;unsigned long flags;s32 value;
@@ -377,33 +376,33 @@ static ssize_t cpu_latency_qos_read(struct file *filp, char __user *buf, value =pm_qos_get_value (&cpu_latency_constraints);spin_unlock_irqrestore (&pm_qos_lock, flags); -return simple_read_from_buffer (buf, count, f_pos, &value,sizeof (s32)); +return simple_copy_to_iter (&value, &iocb->ki_pos,sizeof (s32), to); } -static ssize_t cpu_latency_qos_write (struct file *filp,const char __user *buf, -size_t count,loff_t *f_pos) +static ssize_t cpu_latency_qos_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);s32 value;if (count ==sizeof (s32)) { -if (copy_from_user (&value, buf,sizeof (s32))) +if (!copy_from_iter_full (&value,sizeof (s32), from))return -EFAULT ; }else {int ret; - ret =kstrtos32_from_user (buf, count,16 , &value); + ret =kstrtos32_from_iter (from, count,16 , &value);if (ret)return ret; } -cpu_latency_qos_update_request (filp->private_data, value); +cpu_latency_qos_update_request (iocb->ki_filp->private_data, value);return count; }static const struct file_operations cpu_latency_qos_fops = { - .write = cpu_latency_qos_write, - .read = cpu_latency_qos_read, + .write_iter = cpu_latency_qos_write, + .read_iter = cpu_latency_qos_read, .open = cpu_latency_qos_open, .release = cpu_latency_qos_release, .llseek = noop_llseek,
kernel/power/user.c +12 -16
@@ -131,17 +131,16 @@ static int snapshot_release(struct inode *inode, struct file *filp)return 0 ; } -static ssize_t snapshot_read (struct file *filp,char __user *buf, -size_t count,loff_t *offp) +static ssize_t snapshot_read (struct kiocb *iocb,struct iov_iter *to) { -loff_t pg_offp = *offp & ~PAGE_MASK ; +loff_t pg_offp = iocb->ki_pos & ~PAGE_MASK ;struct snapshot_data *data;unsigned int sleep_flags;ssize_t res; sleep_flags =lock_system_sleep (); - data = filp->private_data; + data = iocb->ki_filp->private_data;if (!data->ready) { res = -ENODATA ; goto Unlock;
@@ -154,10 +153,9 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf, res =PAGE_SIZE - pg_offp; } - res =simple_read_from_buffer (buf, count, &pg_offp, -data_of (data->handle), res); + res =simple_copy_to_iter (data_of (data->handle), &iocb->ki_pos, res, to);if (res >0 ) - *offp += res; + iocb->ki_pos += res; Unlock:unlock_system_sleep (sleep_flags);
@@ -165,10 +163,9 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,return res; } -static ssize_t snapshot_write (struct file *filp,const char __user *buf, -size_t count,loff_t *offp) +static ssize_t snapshot_write (struct kiocb *iocb,struct iov_iter *from) { -loff_t pg_offp = *offp & ~PAGE_MASK ; +loff_t pg_offp = iocb->ki_pos & ~PAGE_MASK ;struct snapshot_data *data;unsigned long sleep_flags;ssize_t res;
@@ -180,7 +177,7 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf, sleep_flags =lock_system_sleep (); - data = filp->private_data; + data = iocb->ki_filp->private_data;if (!pg_offp) { res =snapshot_write_next (&data->handle);
@@ -195,10 +192,9 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf, goto unlock; } - res =simple_write_to_buffer (data_of (data->handle), res, &pg_offp, - buf, count); + res =simple_copy_from_iter (data_of (data->handle), &iocb->ki_pos, res, from);if (res >0 ) - *offp += res; + iocb->ki_pos += res; unlock:unlock_system_sleep (sleep_flags);
@@ -445,8 +441,8 @@ snapshot_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)static const struct file_operations snapshot_fops = { .open = snapshot_open, .release = snapshot_release, - .read = snapshot_read, - .write = snapshot_write, + .read_iter = snapshot_read, + .write_iter = snapshot_write, .llseek = no_llseek, .unlocked_ioctl = snapshot_ioctl, #ifdef CONFIG_COMPAT
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 76/437 printk: convert to read/write iterators
In reply to Jens Axboe--- kernel/printk/printk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/printk/printk.c +6 -6
@@ -787,11 +787,11 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)return ret; } -static ssize_t devkmsg_read (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t devkmsg_read (struct kiocb *iocb,struct iov_iter *to) { -struct devkmsg_user *user = file->private_data; +struct devkmsg_user *user = iocb->ki_filp->private_data;char *outbuf = &user->pbufs.outbuf[0 ]; +size_t count =iov_iter_count (to);struct printk_message pmsg = { .pbufs = &user->pbufs, };
@@ -802,7 +802,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,return ret;if (!printk_get_next_message (&pmsg,atomic64_read (&user->seq), true, false)) { -if (file->f_flags &O_NONBLOCK ) { +if (iocb->ki_filp->f_flags &O_NONBLOCK ) { ret = -EAGAIN ; goto out; }
@@ -838,7 +838,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, goto out; } -if (copy_to_user (buf, outbuf, pmsg.outbuf_len)) { +if (!copy_to_iter_full (outbuf, pmsg.outbuf_len, to)) { ret = -EFAULT ; goto out; }
@@ -950,7 +950,7 @@ static int devkmsg_release(struct inode *inode, struct file *file)const struct file_operations kmsg_fops = { .open = devkmsg_open, - .read = devkmsg_read, + .read_iter = devkmsg_read, .write_iter = devkmsg_write, .llseek = devkmsg_llseek, .poll = devkmsg_poll,
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 77/437 relay: convert to read/write iterators
In reply to Jens Axboe--- kernel/relay.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
kernel/relay.c +8 -12
@@ -1030,12 +1030,10 @@ static size_t relay_file_read_end_pos(struct rchan_buf *buf,return end_pos; } -static ssize_t relay_file_read (struct file *filp, -char __user *buffer, -size_t count, -loff_t *ppos) +static ssize_t relay_file_read (struct kiocb *iocb,struct iov_iter *to) { -struct rchan_buf *buf = filp->private_data; +struct rchan_buf *buf = iocb->ki_filp->private_data; +size_t count =iov_iter_count (to);size_t read_start, avail;size_t written =0 ;int ret;
@@ -1043,7 +1041,7 @@ static ssize_t relay_file_read(struct file *filp,if (!count)return 0 ; -inode_lock (file_inode (filp)); +inode_lock (file_inode (iocb->ki_filp)); do { void *from;
@@ -1058,27 +1056,25 @@ static ssize_t relay_file_read(struct file *filp, avail =min (count, avail); from = buf->start + read_start; ret = avail; -if (copy_to_user (buffer, from, avail)) +if (!copy_to_iter_full (from, avail, to))break ; - buffer += ret; written += ret; count -= ret;relay_file_read_consume (buf, read_start, ret); - *ppos =relay_file_read_end_pos (buf, read_start, ret); + iocb->ki_pos =relay_file_read_end_pos (buf, read_start, ret); }while (count); -inode_unlock (file_inode (filp)); +inode_unlock (file_inode (iocb->ki_filp));return written; } -const struct file_operations relay_file_operations = { .open = relay_file_open, .poll = relay_file_poll, .mmap = relay_file_mmap, - .read = relay_file_read, + .read_iter = relay_file_read, .llseek = no_llseek, .release = relay_file_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 78/437 kernel/time: convert to read/write iterators
In reply to Jens Axboe--- kernel/time/posix-clock.c | 3 ++- kernel/time/test_udelay.c | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-)
kernel/time/posix-clock.c +2 -1
@@ -54,6 +54,7 @@ static ssize_t posix_clock_read(struct file *fp, char __user *buf,return err; } +FOPS_READ_ITER_HELPER (posix_clock_read);static __poll_t posix_clock_poll (struct file *fp,poll_table *wait) {
@@ -169,7 +170,7 @@ static int posix_clock_release(struct inode *inode, struct file *fp)static const struct file_operations posix_clock_file_operations = { .owner =THIS_MODULE , .llseek = no_llseek, - .read = posix_clock_read, + .read_iter = posix_clock_read_iter, .poll = posix_clock_poll, .unlocked_ioctl = posix_clock_ioctl, .open = posix_clock_open,
kernel/time/test_udelay.c +5 -5
@@ -96,9 +96,9 @@ static int udelay_test_open(struct inode *inode, struct file *file)return single_open (file, udelay_test_show, inode->i_private); } -static ssize_t udelay_test_write (struct file *file,const char __user *buf, -size_t count,loff_t *pos) +static ssize_t udelay_test_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);char lbuf[32 ];int ret;int usecs;
@@ -107,7 +107,7 @@ static ssize_t udelay_test_write(struct file *file, const char __user *buf,if (count >=sizeof (lbuf))return -EINVAL ; -if (copy_from_user (lbuf, buf, count)) +if (!copy_from_iter_full (lbuf, count, from))return -EFAULT ; lbuf[count] ='\0' ;
@@ -128,8 +128,8 @@ static ssize_t udelay_test_write(struct file *file, const char __user *buf,static const struct file_operations udelay_test_debugfs_ops = { .owner =THIS_MODULE , .open = udelay_test_open, - .read = seq_read, - .write = udelay_test_write, + .read_iter = seq_read_iter, + .write_iter = udelay_test_write, .llseek = seq_lseek, .release = single_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 79/437 convert to read/write iterators
In reply to Jens Axboe--- kernel/trace/rv/rv.c | 58 +++++++++++++++++------------------ kernel/trace/rv/rv_reactors.c | 32 +++++++++---------- 2 files changed, 44 insertions(+), 46 deletions(-)
kernel/trace/rv/rv.c +29 -29
@@ -209,15 +209,14 @@ void rv_put_task_monitor_slot(int slot)/* * This section collects the monitor/ files and folders. */ -static ssize_t monitor_enable_read_data (struct file *filp,char __user *user_buf,size_t count, -loff_t *ppos) +static ssize_t monitor_enable_read_data (struct kiocb *iocb,struct iov_iter *to) { -struct rv_monitor_def *mdef = filp->private_data; +struct rv_monitor_def *mdef = iocb->ki_filp->private_data;const char *buff; buff = mdef->monitor->enabled ?"1\n" :"0\n" ; -return simple_read_from_buffer (user_buf, count, ppos, buff,strlen (buff)+1 ); +return simple_copy_to_iter (buff, &iocb->ki_pos,strlen (buff)+1 , to); }/*
@@ -279,14 +278,15 @@ int rv_enable_monitor(struct rv_monitor_def *mdef)/* * interface for enabling/disabling a monitor. */ -static ssize_t monitor_enable_write_data (struct file *filp,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t monitor_enable_write_data (struct kiocb *iocb, +struct iov_iter *from) { -struct rv_monitor_def *mdef = filp->private_data; +struct rv_monitor_def *mdef = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);int retval;bool val; - retval =kstrtobool_from_user (user_buf, count, &val); + retval =kstrtobool_from_iter (from, count, &val);if (retval)return retval;
@@ -305,30 +305,29 @@ static ssize_t monitor_enable_write_data(struct file *filp, const char __user *ustatic const struct file_operations interface_enable_fops = { .open = simple_open, .llseek = no_llseek, - .write = monitor_enable_write_data, - .read = monitor_enable_read_data, + .write_iter = monitor_enable_write_data, + .read_iter = monitor_enable_read_data, };/* * Interface to read monitors description. */ -static ssize_t monitor_desc_read_data (struct file *filp,char __user *user_buf,size_t count, -loff_t *ppos) +static ssize_t monitor_desc_read_data (struct kiocb *iocb,struct iov_iter *to) { -struct rv_monitor_def *mdef = filp->private_data; +struct rv_monitor_def *mdef = iocb->ki_filp->private_data;char buff[256 ];memset (buff,0 ,sizeof (buff));snprintf (buff,sizeof (buff),"%s\n" , mdef->monitor->description); -return simple_read_from_buffer (user_buf, count, ppos, buff,strlen (buff) +1 ); +return simple_copy_to_iter (buff, &iocb->ki_pos,strlen (buff) +1 , to); }static const struct file_operations interface_desc_fops = { .open = simple_open, .llseek = no_llseek, - .read = monitor_desc_read_data, + .read_iter = monitor_desc_read_data, };/*
@@ -469,7 +468,7 @@ static int available_monitors_open(struct inode *inode, struct file *file)static const struct file_operations available_monitors_ops = { .open = available_monitors_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release };
@@ -507,10 +506,10 @@ static int enabled_monitors_open(struct inode *inode, struct file *file)return seq_open (file, &enabled_monitors_seq_ops); }; -static ssize_t enabled_monitors_write (struct file *filp,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t enabled_monitors_write (struct kiocb *iocb,struct iov_iter *from) {char buff[MAX_RV_MONITOR_NAME_SIZE +2 ]; +size_t count =iov_iter_count (from);struct rv_monitor_def *mdef;int retval = -EINVAL ;bool enable = true;
@@ -522,7 +521,8 @@ static ssize_t enabled_monitors_write(struct file *filp, const char __user *usermemset (buff,0 ,sizeof (buff)); - retval =simple_write_to_buffer (buff,sizeof (buff) -1 , ppos, user_buf, count); + retval =simple_copy_from_iter (buff, &iocb->ki_pos,sizeof (buff) -1 , + from);if (retval <0 )return -EFAULT ;
@@ -565,8 +565,8 @@ static ssize_t enabled_monitors_write(struct file *filp, const char __user *userstatic const struct file_operations enabled_monitors_ops = { .open = enabled_monitors_open, - .read = seq_read, - .write = enabled_monitors_write, + .read_iter = seq_read_iter, + .write_iter = enabled_monitors_write, .llseek = seq_lseek, .release = seq_release, };
@@ -591,14 +591,13 @@ bool rv_monitoring_on(void)/* * monitoring_on general switcher. */ -static ssize_t monitoring_on_read_data (struct file *filp,char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t monitoring_on_read_data (struct kiocb *iocb,struct iov_iter *to) {const char *buff; buff =rv_monitoring_on () ?"1\n" :"0\n" ; -return simple_read_from_buffer (user_buf, count, ppos, buff,strlen (buff) +1 ); +return simple_copy_to_iter (buff, &iocb->ki_pos,strlen (buff) +1 , to); }static void turn_monitoring_off (void )
@@ -642,13 +641,14 @@ static void turn_monitoring_on_with_reset(void)turn_monitoring_on (); } -static ssize_t monitoring_on_write_data (struct file *filp,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t monitoring_on_write_data (struct kiocb *iocb, +struct iov_iter *from) { +size_t count =iov_iter_count (from);int retval;bool val; - retval =kstrtobool_from_user (user_buf, count, &val); + retval =kstrtobool_from_iter (from, count, &val);if (retval)return retval;
@@ -673,8 +673,8 @@ static ssize_t monitoring_on_write_data(struct file *filp, const char __user *usstatic const struct file_operations monitoring_on_fops = { .open = simple_open, .llseek = no_llseek, - .write = monitoring_on_write_data, - .read = monitoring_on_read_data, + .write_iter = monitoring_on_write_data, + .read_iter = monitoring_on_read_data, };static void destroy_monitor_dir (struct rv_monitor_def *mdef)
kernel/trace/rv/rv_reactors.c +15 -17
@@ -128,7 +128,7 @@ static int available_reactors_open(struct inode *inode, struct file *file)static const struct file_operations available_reactors_ops = { .open = available_reactors_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release };
@@ -183,11 +183,10 @@ static void monitor_swap_reactors(struct rv_monitor_def *mdef, struct rv_reactorrv_enable_monitor (mdef); } -static ssize_t -monitor_reactors_write (struct file *file,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t monitor_reactors_write (struct kiocb *iocb,struct iov_iter *from) {char buff[MAX_RV_REACTOR_NAME_SIZE +2 ]; +size_t count =iov_iter_count (from);struct rv_monitor_def *mdef;struct rv_reactor_def *rdef;struct seq_file *seq_f;
@@ -201,7 +200,8 @@ monitor_reactors_write(struct file *file, const char __user *user_buf,memset (buff,0 ,sizeof (buff)); - retval =simple_write_to_buffer (buff,sizeof (buff) -1 , ppos, user_buf, count); + retval =simple_copy_from_iter (buff, &iocb->ki_pos,sizeof (buff) -1 , + from);if (retval <0 )return -EFAULT ;
@@ -214,7 +214,7 @@ monitor_reactors_write(struct file *file, const char __user *user_buf,/* * See monitor_reactors_open() */ - seq_f = file->private_data; + seq_f = iocb->ki_filp->private_data; mdef = seq_f->private;mutex_lock (&rv_interface_lock);
@@ -269,10 +269,10 @@ static int monitor_reactors_open(struct inode *inode, struct file *file)static const struct file_operations monitor_reactors_ops = { .open = monitor_reactors_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, - .write = monitor_reactors_write + .write_iter = monitor_reactors_write };static int __rv_register_reactor (struct rv_reactor *reactor)
@@ -371,15 +371,13 @@ bool rv_reacting_on(void)return READ_ONCE (reacting_on); } -static ssize_t reacting_on_read_data (struct file *filp, -char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t reacting_on_read_data (struct kiocb *iocb,struct iov_iter *to) {char *buff; buff =rv_reacting_on () ?"1\n" :"0\n" ; -return simple_read_from_buffer (user_buf, count, ppos, buff,strlen (buff)+1 ); +return simple_copy_to_iter (buff, &iocb->ki_pos,strlen (buff)+1 , to); }static void turn_reacting_off (void )
@@ -396,13 +394,13 @@ static void turn_reacting_on(void)smp_wmb (); } -static ssize_t reacting_on_write_data (struct file *filp,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t reacting_on_write_data (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);int retval;bool val; - retval =kstrtobool_from_user (user_buf, count, &val); + retval =kstrtobool_from_iter (from, count, &val);if (retval)return retval;
@@ -427,8 +425,8 @@ static ssize_t reacting_on_write_data(struct file *filp, const char __user *userstatic const struct file_operations reacting_on_fops = { .open = simple_open, .llseek = no_llseek, - .write = reacting_on_write_data, - .read = reacting_on_read_data, + .write_iter = reacting_on_write_data, + .read_iter = reacting_on_read_data, };/**
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 80/437 tracing: convert to read/write iterators
In reply to Jens Axboe--- include/linux/ftrace.h | 11 +- kernel/trace/blktrace.c | 19 +- kernel/trace/ftrace.c | 68 +++-- kernel/trace/trace.c | 386 ++++++++++++-------------- kernel/trace/trace_dynevent.c | 5 +- kernel/trace/trace_events.c | 116 ++++---- kernel/trace/trace_events_hist.c | 4 +- kernel/trace/trace_events_inject.c | 19 +- kernel/trace/trace_events_synth.c | 5 +- kernel/trace/trace_events_trigger.c | 22 +- kernel/trace/trace_events_user.c | 17 +- kernel/trace/trace_functions_graph.c | 20 +- kernel/trace/trace_hwlat.c | 20 +- kernel/trace/trace_kprobe.c | 7 +- kernel/trace/trace_osnoise.c | 42 ++- kernel/trace/trace_printk.c | 2 +- kernel/trace/trace_recursion_record.c | 10 +- kernel/trace/trace_sched_switch.c | 21 +- kernel/trace/trace_stack.c | 27 +- kernel/trace/trace_stat.c | 2 +- kernel/trace/trace_uprobe.c | 7 +- 21 files changed, 378 insertions(+), 452 deletions(-)
include/linux/ftrace.h +5 -6
@@ -674,10 +674,8 @@ extern ftrace_func_t ftrace_trace_function;int ftrace_regex_open (struct ftrace_ops *ops,int flag,struct inode *inode,struct file *file); -ssize_t ftrace_filter_write (struct file *file,const char __user *ubuf, -size_t cnt,loff_t *ppos); -ssize_t ftrace_notrace_write (struct file *file,const char __user *ubuf, -size_t cnt,loff_t *ppos); +ssize_t ftrace_filter_write_iter (struct kiocb *iocb,struct iov_iter *from); +ssize_t ftrace_notrace_write_iter (struct kiocb *iocb,struct iov_iter *from);int ftrace_regex_release (struct inode *inode,struct file *file);void __init
@@ -890,8 +888,9 @@ static inline unsigned long ftrace_location(unsigned long ip)#define ftrace_free_filter (ops) do { } while (0)#define ftrace_ops_set_global_filter (ops) do { } while (0) -static inline ssize_t ftrace_filter_write (struct file *file,const char __user *ubuf, -size_t cnt,loff_t *ppos) {return -ENODEV ; } +static inline ssize_t ftrace_filter_write_iter (struct kiocb *iocb, +struct iov_iter *from) +{return -ENODEV ; }static inline ssize_t ftrace_notrace_write (struct file *file,const char __user *ubuf,size_t cnt,loff_t *ppos) {return -ENODEV ; } static inline int
kernel/trace/blktrace.c +9 -10
@@ -411,38 +411,37 @@ int blk_trace_remove(struct request_queue *q) }EXPORT_SYMBOL_GPL (blk_trace_remove); -static ssize_t blk_dropped_read (struct file *filp,char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t blk_dropped_read (struct kiocb *iocb,struct iov_iter *to) { -struct blk_trace *bt = filp->private_data; +struct blk_trace *bt = iocb->ki_filp->private_data;char buf[16 ];snprintf (buf,sizeof (buf),"%u\n" ,atomic_read (&bt->dropped)); -return simple_read_from_buffer (buffer, count, ppos, buf,strlen (buf)); +return simple_copy_to_iter (buf, &iocb->ki_pos,strlen (buf), to); }static const struct file_operations blk_dropped_fops = { .owner =THIS_MODULE , .open = simple_open, - .read = blk_dropped_read, + .read_iter = blk_dropped_read, .llseek = default_llseek, }; -static ssize_t blk_msg_write (struct file *filp,const char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t blk_msg_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);char *msg;struct blk_trace *bt;if (count >=BLK_TN_MAX_MSG )return -EINVAL ; - msg =memdup_user_nul (buffer, count); + msg =iterdup_nul (from, count);if (IS_ERR (msg))return PTR_ERR (msg); - bt = filp->private_data; + bt = iocb->ki_filp->private_data;__blk_trace_note_message (bt,NULL ,"%s" , msg);kfree (msg);
@@ -452,7 +451,7 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer,static const struct file_operations blk_msg_fops = { .owner =THIS_MODULE , .open = simple_open, - .write = blk_msg_write, + .write_iter = blk_msg_write, .llseek = noop_llseek, };
kernel/trace/ftrace.c +39 -29
190 lines not on this page · raw message
kernel/trace/trace.c +175 -211
1,000 lines not on this page · raw message
kernel/trace/trace_dynevent.c +3 -2
@@ -244,14 +244,15 @@ static ssize_t dyn_event_write(struct file *file, const char __user *buffer,return trace_parse_run_command (file, buffer, count, ppos, create_dyn_event); } +FOPS_WRITE_ITER_HELPER (dyn_event_write);static const struct file_operations dynamic_events_ops = { .owner =THIS_MODULE , .open = dyn_event_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, - .write = dyn_event_write, + .write_iter = dyn_event_write_iter, };/* Make a tracefs interface for controlling dynamic events */
kernel/trace/trace_events.c +53 -63
342 lines not on this page · raw message
kernel/trace/trace_events_hist.c +2 -2
@@ -5633,7 +5633,7 @@ static int event_hist_open(struct inode *inode, struct file *file)const struct file_operations event_hist_fops = { .open = event_hist_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = tracing_single_release_file_tr, };
@@ -5912,7 +5912,7 @@ static int event_hist_debug_open(struct inode *inode, struct file *file)const struct file_operations event_hist_debug_fops = { .open = event_hist_debug_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = tracing_single_release_file_tr, };
kernel/trace/trace_events_inject.c +8 -11
@@ -280,10 +280,9 @@ static int parse_entry(char *str, struct trace_event_call *call, void **pentry)return entry_size; } -static ssize_t -event_inject_write (struct file *filp,const char __user *ubuf,size_t cnt, -loff_t *ppos) +static ssize_t event_inject_write (struct kiocb *iocb,struct iov_iter *from) { +size_t cnt =iov_iter_count (from);struct trace_event_call *call;struct trace_event_file *file;int err = -ENODEV , size;
@@ -293,13 +292,13 @@ event_inject_write(struct file *filp, const char __user *ubuf, size_t cnt,if (cnt >=PAGE_SIZE )return -EINVAL ; - buf =memdup_user_nul (ubuf, cnt); + buf =iterdup_nul (from, cnt);if (IS_ERR (buf))return PTR_ERR (buf);strim (buf);mutex_lock (&event_mutex); - file =event_file_data (filp); + file =event_file_data (iocb->ki_filp);if (file) { call = file->event_call; size =parse_entry (buf, call, &entry);
@@ -316,20 +315,18 @@ event_inject_write(struct file *filp, const char __user *ubuf, size_t cnt,if (err <0 )return err; - *ppos += err; + iocb->ki_pos += err;return cnt; } -static ssize_t -event_inject_read (struct file *file,char __user *buf,size_t size, -loff_t *ppos) +static ssize_t event_inject_read (struct kiocb *iocb,struct iov_iter *to) {return -EPERM ; }const struct file_operations event_inject_fops = { .open = tracing_open_file_tr, - .read = event_inject_read, - .write = event_inject_write, + .read_iter = event_inject_read, + .write_iter = event_inject_write, .release = tracing_release_file_tr, };
kernel/trace/trace_events_synth.c +3 -2
@@ -2286,11 +2286,12 @@ static ssize_t synth_events_write(struct file *file,return trace_parse_run_command (file, buffer, count, ppos, create_or_delete_synth_event); } +FOPS_WRITE_ITER_HELPER (synth_events_write);static const struct file_operations synth_events_fops = { .open = synth_events_open, - .write = synth_events_write, - .read = seq_read, + .write_iter = synth_events_write_iter, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
kernel/trace/trace_events_trigger.c +10 -12
@@ -272,11 +272,11 @@ int trigger_process_regex(struct trace_event_file *file, char *buff)return ret; } -static ssize_t event_trigger_regex_write (struct file *file, -const char __user *ubuf, -size_t cnt,loff_t *ppos) +static ssize_t event_trigger_regex_write (struct kiocb *iocb, +struct iov_iter *from) {struct trace_event_file *event_file; +size_t cnt =iov_iter_count (from);ssize_t ret;char *buf;
@@ -286,14 +286,14 @@ static ssize_t event_trigger_regex_write(struct file *file,if (cnt >=PAGE_SIZE )return -EINVAL ; - buf =memdup_user_nul (ubuf, cnt); + buf =iterdup_nul (from, cnt);if (IS_ERR (buf))return PTR_ERR (buf);strim (buf);mutex_lock (&event_mutex); - event_file =event_file_data (file); + event_file =event_file_data (iocb->ki_filp);if (unlikely (!event_file)) {mutex_unlock (&event_mutex);kfree (buf);
@@ -306,7 +306,7 @@ static ssize_t event_trigger_regex_write(struct file *file,if (ret <0 ) goto out; - *ppos += cnt; + iocb->ki_pos += cnt; ret = cnt; out:return ret;
@@ -324,11 +324,9 @@ static int event_trigger_regex_release(struct inode *inode, struct file *file)return 0 ; } -static ssize_t -event_trigger_write (struct file *filp,const char __user *ubuf, -size_t cnt,loff_t *ppos) +static ssize_t event_trigger_write (struct kiocb *iocb,struct iov_iter *from) { -return event_trigger_regex_write (filp, ubuf, cnt, ppos); +return event_trigger_regex_write (iocb, from); } static int
@@ -346,8 +344,8 @@ event_trigger_release(struct inode *inode, struct file *file)const struct file_operations event_trigger_fops = { .open = event_trigger_open, - .read = seq_read, - .write = event_trigger_write, + .read_iter = seq_read_iter, + .write_iter = event_trigger_write, .llseek = tracing_lseek, .release = event_trigger_release, };
kernel/trace/trace_events_user.c +1 -16
@@ -2263,20 +2263,6 @@ static int user_events_open(struct inode *node, struct file *file)return 0 ; } -static ssize_t user_events_write (struct file *file,const char __user *ubuf, -size_t count,loff_t *ppos) -{ -struct iov_iter i; - -if (unlikely (*ppos !=0 )) -return -EFAULT ; - -if (unlikely (import_ubuf (ITER_SOURCE , (char __user *)ubuf, count, &i))) -return -EFAULT ; - -return user_events_write_core (file, &i); -} -static ssize_t user_events_write_iter (struct kiocb *kp,struct iov_iter *i) {return user_events_write_core (kp->ki_filp, i);
@@ -2678,7 +2664,6 @@ static int user_events_release(struct inode *node, struct file *file)static const struct file_operations user_data_fops = { .open = user_events_open, - .write = user_events_write, .write_iter = user_events_write_iter, .unlocked_ioctl = user_events_ioctl, .release = user_events_release,
@@ -2777,7 +2762,7 @@ static int user_status_open(struct inode *node, struct file *file)static const struct file_operations user_status_fops = { .open = user_status_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
kernel/trace/trace_functions_graph.c +8 -12
@@ -1368,40 +1368,36 @@ static struct tracer graph_trace __tracer_data = { }; -static ssize_t -graph_depth_write (struct file *filp,const char __user *ubuf,size_t cnt, -loff_t *ppos) +static ssize_t graph_depth_write (struct kiocb *iocb,struct iov_iter *from) { +size_t cnt =iov_iter_count (from);unsigned long val;int ret; - ret =kstrtoul_from_user (ubuf, cnt,10 , &val); + ret =kstrtoul_from_iter (from, cnt,10 , &val);if (ret)return ret; fgraph_max_depth = val; - *ppos += cnt; + iocb->ki_pos += cnt;return cnt; } -static ssize_t -graph_depth_read (struct file *filp,char __user *ubuf,size_t cnt, -loff_t *ppos) +static ssize_t graph_depth_read (struct kiocb *iocb,struct iov_iter *to) {char buf[15 ];/* More than enough to hold UINT_MAX + "\n"*/ int n; n =sprintf (buf,"%d\n" , fgraph_max_depth); - -return simple_read_from_buffer (ubuf, cnt, ppos, buf, n); +return simple_copy_to_iter (buf, &iocb->ki_pos, n, to); }static const struct file_operations graph_depth_fops = { .open = tracing_open_generic, - .write = graph_depth_write, - .read = graph_depth_read, + .write_iter = graph_depth_write, + .read_iter = graph_depth_read, .llseek = generic_file_llseek, };
kernel/trace/trace_hwlat.c +8 -12
@@ -664,10 +664,8 @@ static void hwlat_tracer_stop(struct trace_array *tr);/** * hwlat_mode_write - Write function for "mode" entry -* @filp: The active open file structure -* @ubuf: The user buffer that contains the value to write -* @cnt: The maximum number of bytes to write to "file" -* @ppos: The current position in @file +* @iocb: Metadata for IO +* @from: The user buffer that contains the value to write * * This function provides a write implementation for the "mode" interface * to the hardware latency detector. hwlatd has different operation modes.
@@ -677,10 +675,10 @@ static void hwlat_tracer_stop(struct trace_array *tr);* among the allowed CPUs in a round-robin fashion. The "per-cpu" mode * creates one hwlatd thread per allowed CPU. */ -static ssize_t hwlat_mode_write (struct file *filp,const char __user *ubuf, -size_t cnt,loff_t *ppos) +static ssize_t hwlat_mode_write (struct kiocb *iocb,struct iov_iter *from) {struct trace_array *tr = hwlat_trace; +size_t cnt =iov_iter_count (from);const char *mode;char buf[64 ];int ret, i;
@@ -688,7 +686,7 @@ static ssize_t hwlat_mode_write(struct file *filp, const char __user *ubuf,if (cnt >=sizeof (buf))return -EINVAL ; -if (copy_from_user (buf, ubuf, cnt)) +if (!copy_from_iter_full (buf, cnt, from))return -EFAULT ; buf[cnt] =0 ;
@@ -720,9 +718,7 @@ static ssize_t hwlat_mode_write(struct file *filp, const char __user *ubuf,hwlat_tracer_start (tr);mutex_unlock (&trace_types_lock); - *ppos += cnt; - - + iocb->ki_pos += cnt;return ret; }
@@ -753,10 +749,10 @@ static struct trace_min_max_param hwlat_window = {static const struct file_operations thread_mode_fops = { .open = hwlat_mode_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, - .write = hwlat_mode_write + .write_iter = hwlat_mode_write };/** * init_tracefs - A function to initialize the tracefs interface files
kernel/trace/trace_kprobe.c +4 -3
@@ -1247,14 +1247,15 @@ static ssize_t probes_write(struct file *file, const char __user *buffer,return trace_parse_run_command (file, buffer, count, ppos, create_or_delete_trace_kprobe); } +FOPS_WRITE_ITER_HELPER (probes_write);static const struct file_operations kprobe_events_ops = { .owner =THIS_MODULE , .open = probes_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, - .write = probes_write, + .write_iter = probes_write_iter, };static unsigned long trace_kprobe_missed (struct trace_kprobe *tk)
@@ -1304,7 +1305,7 @@ static int profile_open(struct inode *inode, struct file *file)static const struct file_operations kprobe_profile_ops = { .owner =THIS_MODULE , .open = profile_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
kernel/trace/trace_osnoise.c +18 -24
114 lines not on this page · raw message
kernel/trace/trace_printk.c +1 -1
@@ -371,7 +371,7 @@ ftrace_formats_open(struct inode *inode, struct file *file)static const struct file_operations ftrace_formats_fops = { .open = ftrace_formats_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
kernel/trace/trace_recursion_record.c +4 -6
@@ -200,11 +200,9 @@ static int recursed_function_open(struct inode *inode, struct file *file)return ret; } -static ssize_t recursed_function_write (struct file *file, -const char __user *buffer, -size_t count,loff_t *ppos) +static ssize_t recursed_function_write (struct kiocb *iocb,struct iov_iter *from) { -return count; +return iov_iter_count (from); }static int recursed_function_release (struct inode *inode,struct file *file)
@@ -216,8 +214,8 @@ static int recursed_function_release(struct inode *inode, struct file *file)static const struct file_operations recursed_functions_fops = { .open = recursed_function_open, - .write = recursed_function_write, - .read = seq_read, + .write_iter = recursed_function_write, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = recursed_function_release, };
kernel/trace/trace_sched_switch.c +10 -11
@@ -510,7 +510,7 @@ static int tracing_saved_tgids_open(struct inode *inode, struct file *filp)const struct file_operations tracing_saved_tgids_fops = { .open = tracing_saved_tgids_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
@@ -589,14 +589,13 @@ static int tracing_saved_cmdlines_open(struct inode *inode, struct file *filp)const struct file_operations tracing_saved_cmdlines_fops = { .open = tracing_saved_cmdlines_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };static ssize_t -tracing_saved_cmdlines_size_read (struct file *filp,char __user *ubuf, -size_t cnt,loff_t *ppos) +tracing_saved_cmdlines_size_read (struct kiocb *iocb,struct iov_iter *to) {char buf[64 ];int r;
@@ -607,7 +606,7 @@ tracing_saved_cmdlines_size_read(struct file *filp, char __user *ubuf,arch_spin_unlock (&trace_cmdline_lock);preempt_enable (); -return simple_read_from_buffer (ubuf, cnt, ppos, buf, r); +return simple_copy_to_iter (buf, &iocb->ki_pos, r, to); }void trace_free_saved_cmdlines_buffer (void )
@@ -635,13 +634,13 @@ static int tracing_resize_saved_cmdlines(unsigned int val) }static ssize_t -tracing_saved_cmdlines_size_write (struct file *filp,const char __user *ubuf, -size_t cnt,loff_t *ppos) +tracing_saved_cmdlines_size_write (struct kiocb *iocb,struct iov_iter *from) { +size_t cnt =iov_iter_count (from);unsigned long val;int ret; - ret =kstrtoul_from_user (ubuf, cnt,10 , &val); + ret =kstrtoul_from_iter (from, cnt,10 , &val);if (ret)return ret;
@@ -653,13 +652,13 @@ tracing_saved_cmdlines_size_write(struct file *filp, const char __user *ubuf,if (ret <0 )return ret; - *ppos += cnt; + iocb->ki_pos += cnt;return cnt; }const struct file_operations tracing_saved_cmdlines_size_fops = { .open = tracing_open_generic, - .read = tracing_saved_cmdlines_size_read, - .write = tracing_saved_cmdlines_size_write, + .read_iter = tracing_saved_cmdlines_size_read, + .write_iter = tracing_saved_cmdlines_size_write, };
kernel/trace/trace_stack.c +12 -15
@@ -320,29 +320,26 @@ static struct ftrace_ops trace_ops __read_mostly = .func = stack_trace_call, }; -static ssize_t -stack_max_size_read (struct file *filp,char __user *ubuf, -size_t count,loff_t *ppos) +static ssize_t stack_max_size_read (struct kiocb *iocb,struct iov_iter *to) { -unsigned long *ptr = filp->private_data; +unsigned long *ptr = iocb->ki_filp->private_data;char buf[64 ];int r; r =snprintf (buf,sizeof (buf),"%ld\n" , *ptr);if (r >sizeof (buf)) r =sizeof (buf); -return simple_read_from_buffer (ubuf, count, ppos, buf, r); +return simple_copy_to_iter (buf, &iocb->ki_pos, r, to); } -static ssize_t -stack_max_size_write (struct file *filp,const char __user *ubuf, -size_t count,loff_t *ppos) +static ssize_t stack_max_size_write (struct kiocb *iocb,struct iov_iter *from) { -long *ptr = filp->private_data; +long *ptr = iocb->ki_filp->private_data; +size_t count =iov_iter_count (from);unsigned long val, flags;int ret; - ret =kstrtoul_from_user (ubuf, count,10 , &val); + ret =kstrtoul_from_iter (from, count,10 , &val);if (ret)return ret;
@@ -367,8 +364,8 @@ stack_max_size_write(struct file *filp, const char __user *ubuf,static const struct file_operations stack_max_size_fops = { .open = tracing_open_generic, - .read = stack_max_size_read, - .write = stack_max_size_write, + .read_iter = stack_max_size_read, + .write_iter = stack_max_size_write, .llseek = default_llseek, };
@@ -486,7 +483,7 @@ static int stack_trace_open(struct inode *inode, struct file *file)static const struct file_operations stack_trace_fops = { .open = stack_trace_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
@@ -505,8 +502,8 @@ stack_trace_filter_open(struct inode *inode, struct file *file)static const struct file_operations stack_trace_filter_fops = { .open = stack_trace_filter_open, - .read = seq_read, - .write = ftrace_filter_write, + .read_iter = seq_read_iter, + .write_iter = ftrace_filter_write_iter, .llseek = tracing_lseek, .release = ftrace_regex_release, };
kernel/trace/trace_stat.c +1 -1
@@ -269,7 +269,7 @@ static int tracing_stat_release(struct inode *i, struct file *f)static const struct file_operations tracing_stat_fops = { .open = tracing_stat_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = tracing_stat_release };
kernel/trace/trace_uprobe.c +4 -3
@@ -800,14 +800,15 @@ static ssize_t probes_write(struct file *file, const char __user *buffer,return trace_parse_run_command (file, buffer, count, ppos, create_or_delete_trace_uprobe); } +FOPS_WRITE_ITER_HELPER (probes_write);static const struct file_operations uprobe_events_ops = { .owner =THIS_MODULE , .open = probes_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, - .write = probes_write, + .write_iter = probes_write_iter, };/* Probes profiling interfaces */
@@ -846,7 +847,7 @@ static int profile_open(struct inode *inode, struct file *file)static const struct file_operations uprobe_profile_ops = { .owner =THIS_MODULE , .open = profile_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 81/437 gcov: convert to read/write iterators
In reply to Jens Axboe--- kernel/gcov/fs.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
kernel/gcov/fs.c +10 -13
@@ -379,14 +379,13 @@ static void remove_node(struct gcov_node *node);* corresponding file. If all associated object files have been unloaded, * remove the debug fs node as well. */ -static ssize_t gcov_seq_write (struct file *file,const char __user *addr, -size_t len,loff_t *pos) +static ssize_t gcov_seq_write (struct kiocb *iocb,struct iov_iter *from) {struct seq_file *seq;struct gcov_info *info;struct gcov_node *node; - seq = file->private_data; + seq = iocb->ki_filp->private_data; info =gcov_iter_get_info (seq->private);mutex_lock (&node_lock); node =get_node_by_name (gcov_info_filename (info));
@@ -401,7 +400,7 @@ static ssize_t gcov_seq_write(struct file *file, const char __user *addr,gcov_info_reset (info);mutex_unlock (&node_lock); -return len; +return iov_iter_count (from); }/*
@@ -511,9 +510,9 @@ static void add_links(struct gcov_node *node, struct dentry *parent)static const struct file_operations gcov_data_fops = { .open = gcov_seq_open, .release = gcov_seq_release, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = gcov_seq_write, + .write_iter = gcov_seq_write, };/* Basic initialization of a new node. */
@@ -632,8 +631,7 @@ static struct gcov_node *get_child_by_name(struct gcov_node *parent,* write() implementation for reset file. Reset all profiling data to zero * and remove nodes for which all associated object files are unloaded. */ -static ssize_t reset_write (struct file *file,const char __user *addr, -size_t len,loff_t *pos) +static ssize_t reset_write (struct kiocb *iocb,struct iov_iter *from) {struct gcov_node *node;
@@ -650,20 +648,19 @@ static ssize_t reset_write(struct file *file, const char __user *addr, }mutex_unlock (&node_lock); -return len; +return iov_iter_count (from); }/* read() implementation for reset file. Unused. */ -static ssize_t reset_read (struct file *file,char __user *addr,size_t len, -loff_t *pos) +static ssize_t reset_read (struct kiocb *iocb,struct iov_iter *to) {/* Allow read operation so that a recursive copy won't fail. */ return 0 ; }static const struct file_operations gcov_reset_fops = { - .write = reset_write, - .read = reset_read, + .write_iter = reset_write, + .read_iter = reset_read, .llseek = noop_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 82/437 sched/debug: convert to read/write iterators
In reply to Jens Axboe--- kernel/sched/debug.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-)
kernel/sched/debug.c +22 -22
@@ -120,26 +120,25 @@ static int sched_feat_set(char *cmp)return 0 ; } -static ssize_t -sched_feat_write (struct file *filp,const char __user *ubuf, -size_t cnt,loff_t *ppos) +static ssize_t sched_feat_write_iter (struct kiocb *iocb,struct iov_iter *from) {char buf[64 ];char *cmp;int ret;struct inode *inode; +size_t cnt =iov_iter_count (from);if (cnt >63 ) cnt =63 ; -if (copy_from_user (&buf, ubuf, cnt)) +if (!copy_from_iter_full (&buf, cnt, from))return -EFAULT ; buf[cnt] =0 ; cmp =strstrip (buf);/* Ensure the static_key remains in a consistent state */ - inode =file_inode (filp); + inode =file_inode (iocb->ki_filp);cpus_read_lock ();inode_lock (inode); ret =sched_feat_set (cmp);
@@ -148,7 +147,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,if (ret <0 )return ret; - *ppos += cnt; + iocb->ki_pos += cnt;return cnt; }
@@ -160,24 +159,25 @@ static int sched_feat_open(struct inode *inode, struct file *filp)static const struct file_operations sched_feat_fops = { .open = sched_feat_open, - .write = sched_feat_write, - .read = seq_read, + .write_iter = sched_feat_write_iter, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = single_release, };#ifdef CONFIG_SMP -static ssize_t sched_scaling_write (struct file *filp,const char __user *ubuf, -size_t cnt,loff_t *ppos) +static ssize_t sched_scaling_write_iter (struct kiocb *iocb, +struct iov_iter *from) { +size_t cnt =iov_iter_count (from);char buf[16 ];unsigned int scaling;if (cnt >15 ) cnt =15 ; -if (copy_from_user (&buf, ubuf, cnt)) +if (!copy_from_iter_full (&buf, cnt, from))return -EFAULT ; buf[cnt] ='\0' ;
@@ -191,7 +191,7 @@ static ssize_t sched_scaling_write(struct file *filp, const char __user *ubuf,if (sched_update_scaling ())return -EINVAL ; - *ppos += cnt; + iocb->ki_pos += cnt;return cnt; }
@@ -208,8 +208,8 @@ static int sched_scaling_open(struct inode *inode, struct file *filp)static const struct file_operations sched_scaling_fops = { .open = sched_scaling_open, - .write = sched_scaling_write, - .read = seq_read, + .write_iter = sched_scaling_write_iter, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = single_release, };
@@ -218,16 +218,16 @@ static const struct file_operations sched_scaling_fops = {#ifdef CONFIG_PREEMPT_DYNAMIC -static ssize_t sched_dynamic_write (struct file *filp,const char __user *ubuf, -size_t cnt,loff_t *ppos) +static ssize_t sched_dynamic_write (struct kiocb *iocb,struct iov_iter *from) { +size_t cnt =iov_iter_count (from);char buf[16 ];int mode;if (cnt >15 ) cnt =15 ; -if (copy_from_user (&buf, ubuf, cnt)) +if (!copy_from_iter_full (&buf, cnt, from))return -EFAULT ; buf[cnt] =0 ;
@@ -237,7 +237,7 @@ static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf,sched_dynamic_update (mode); - *ppos += cnt; + iocb->ki_pos += cnt;return cnt; }
@@ -270,8 +270,8 @@ static int sched_dynamic_open(struct inode *inode, struct file *filp)static const struct file_operations sched_dynamic_fops = { .open = sched_dynamic_open, - .write = sched_dynamic_write, - .read = seq_read, + .write_iter = sched_dynamic_write, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = single_release, };
@@ -327,7 +327,7 @@ static int sched_debug_open(struct inode *inode, struct file *filp)static const struct file_operations sched_debug_fops = { .open = sched_debug_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = seq_release, };
@@ -402,7 +402,7 @@ static int sd_flags_open(struct inode *inode, struct file *file)static const struct file_operations sd_flags_fops = { .open = sd_flags_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = single_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 83/437 kernel/irq: convert debugfs helpers to read/write iterators
In reply to Jens Axboe--- kernel/irq/debugfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/irq/debugfs.c +6 -6
@@ -193,15 +193,15 @@ static int irq_debug_open(struct inode *inode, struct file *file)return single_open (file, irq_debug_show, inode->i_private); } -static ssize_t irq_debug_write (struct file *file,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t irq_debug_write (struct kiocb *iocb,struct iov_iter *from) { -struct irq_desc *desc =file_inode (file)->i_private; +struct irq_desc *desc =file_inode (iocb->ki_filp)->i_private; +size_t count =iov_iter_count (from);char buf[8 ] = {0 , };size_t size; size =min (sizeof (buf) -1 , count); -if (copy_from_user (buf, user_buf, size)) +if (!copy_from_iter_full (buf, size, from))return -EFAULT ;if (!strncmp (buf,"trigger" , size)) {
@@ -215,8 +215,8 @@ static ssize_t irq_debug_write(struct file *file, const char __user *user_buf,static const struct file_operations dfs_irq_ops = { .open = irq_debug_open, - .write = irq_debug_write, - .read = seq_read, + .write_iter = irq_debug_write, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = single_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 84/437 locking/lock_events: convert to read/write iterators
In reply to Jens Axboe--- kernel/locking/lock_events.c | 18 +++++++++--------- kernel/locking/lock_events.h | 4 ++-- kernel/locking/qspinlock_stat.h | 7 +++---- 3 files changed, 14 insertions(+), 15 deletions(-)
kernel/locking/lock_events.c +9 -9
@@ -20,6 +20,7 @@#include <linux/sched.h> #include <linux/sched/clock.h> #include <linux/fs.h> +#include <linux/uio.h> #include "lock_events.h"
@@ -58,8 +59,7 @@ DEFINE_PER_CPU(unsigned long, lockevents[lockevent_num]);/* * The lockevent_read() function can be overridden. */ -ssize_t __weak lockevent_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +ssize_t __weak lockevent_read (struct kiocb *iocb,struct iov_iter *to) {char buf[64 ];int cpu, id, len;
@@ -68,7 +68,7 @@ ssize_t __weak lockevent_read(struct file *file, char __user *user_buf,/* * Get the counter ID stored in file->f_inode->i_private */ - id = (long )file_inode (file)->i_private; + id = (long )file_inode (iocb->ki_filp)->i_private;if (id >= lockevent_num)return -EBADF ;
@@ -77,7 +77,7 @@ ssize_t __weak lockevent_read(struct file *file, char __user *user_buf, sum +=per_cpu (lockevents[id], cpu); len =snprintf (buf,sizeof (buf) -1 ,"%llu\n" , sum); -return simple_read_from_buffer (user_buf, count, ppos, buf, len); +return simple_copy_to_iter (buf, &iocb->ki_pos, len, to); }/*
@@ -85,15 +85,15 @@ ssize_t __weak lockevent_read(struct file *file, char __user *user_buf,* * When idx = reset_cnts, reset all the counts. */ -static ssize_t lockevent_write (struct file *file,const char __user *user_buf, -size_t count,loff_t *ppos) +static ssize_t lockevent_write (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);int cpu;/* * Get the counter ID stored in file->f_inode->i_private */ -if ((long )file_inode (file)->i_private != LOCKEVENT_reset_cnts) +if ((long )file_inode (iocb->ki_filp)->i_private != LOCKEVENT_reset_cnts)return count;for_each_possible_cpu (cpu) {
@@ -110,8 +110,8 @@ static ssize_t lockevent_write(struct file *file, const char __user *user_buf,* Debugfs data structures */ static const struct file_operations fops_lockevent = { - .read = lockevent_read, - .write = lockevent_write, + .read_iter = lockevent_read, + .write_iter = lockevent_write, .llseek = default_llseek, };
kernel/locking/lock_events.h +2 -2
@@ -58,7 +58,7 @@ static inline void __lockevent_add(enum lock_events event, int inc)#endif /* CONFIG_LOCK_EVENT_COUNTS */ -ssize_t lockevent_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos); +struct kiocb ; +ssize_t lockevent_read (struct kiocb *iocb,struct iov_iter *to);#endif /* __LOCKING_LOCK_EVENTS_H */
kernel/locking/qspinlock_stat.h +3 -4
@@ -33,8 +33,7 @@ static DEFINE_PER_CPU(u64, pv_kick_time);* 3. pv_hash_hops * Average hops/hash = pv_hash_hops/pv_kick_unlock */ -ssize_t lockevent_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) +ssize_t lockevent_read (struct kiocb *iocb,struct iov_iter *to) {char buf[64 ];int cpu, id, len;
@@ -43,7 +42,7 @@ ssize_t lockevent_read(struct file *file, char __user *user_buf,/* * Get the counter ID stored in file->f_inode->i_private */ - id = (long )file_inode (file)->i_private; + id = (long )file_inode (iocb->ki_filp)->i_private;if (id >= lockevent_num)return -EBADF ;
@@ -91,7 +90,7 @@ ssize_t lockevent_read(struct file *file, char __user *user_buf, len =snprintf (buf,sizeof (buf) -1 ,"%llu\n" , sum); } -return simple_read_from_buffer (user_buf, count, ppos, buf, len); +return simple_copy_to_iter (buf, &iocb->ki_pos, len, to); }/*
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 85/437 kprobes: convert to read/write iterators
In reply to Jens Axboe--- kernel/kprobes.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
kernel/kprobes.c +7 -8
@@ -2971,8 +2971,7 @@ static int disarm_all_kprobes(void)* when the bool state is switched. We can reuse that facility when * available */ -static ssize_t read_enabled_file_bool (struct file *file, -char __user *user_buf,size_t count,loff_t *ppos) +static ssize_t read_enabled_file_bool (struct kiocb *iocb,struct iov_iter *to) {char buf[3 ];
@@ -2982,16 +2981,16 @@ static ssize_t read_enabled_file_bool(struct file *file, buf[0 ] ='0' ; buf[1 ] ='\n' ; buf[2 ] =0x00 ; -return simple_read_from_buffer (user_buf, count, ppos, buf,2 ); +return simple_copy_to_iter (buf, &iocb->ki_pos,2 , to); } -static ssize_t write_enabled_file_bool (struct file *file, -const char __user *user_buf,size_t count,loff_t *ppos) +static ssize_t write_enabled_file_bool (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);bool enable;int ret; - ret =kstrtobool_from_user (user_buf, count, &enable); + ret =kstrtobool_from_iter (from, count, &enable);if (ret)return ret;
@@ -3003,8 +3002,8 @@ static ssize_t write_enabled_file_bool(struct file *file, }static const struct file_operations fops_kp = { - .read = read_enabled_file_bool, - .write = write_enabled_file_bool, + .read_iter = read_enabled_file_bool, + .write_iter = write_enabled_file_bool, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 86/437 fs: add iterator based version of simple_transaction_read()
In reply to Jens Axboe--- fs/libfs.c | 10 ++++++++++ include/linux/fs.h | 1 + 2 files changed, 11 insertions(+)
fs/libfs.c +10 -0
@@ -1277,6 +1277,16 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf, size_t size }EXPORT_SYMBOL (simple_transaction_read); +ssize_t simple_transaction_read_iter (struct kiocb *iocb,struct iov_iter *to) +{ +struct simple_transaction_argresp *ar = iocb->ki_filp->private_data; + +if (!ar) +return 0 ; +return simple_copy_to_iter (ar->data, &iocb->ki_pos, ar->size, to); +} +EXPORT_SYMBOL (simple_transaction_read_iter); +int simple_transaction_release (struct inode *inode,struct file *file) {free_page ((unsigned long )file->private_data);
include/linux/fs.h +1 -0
@@ -3500,6 +3500,7 @@ char *simple_transaction_get(struct file *file, const char __user *buf, size_t size);ssize_t simple_transaction_read (struct file *file,char __user *buf,size_t size,loff_t *pos); +ssize_t simple_transaction_read_iter (struct kiocb *iocb,struct iov_iter *to);int simple_transaction_release (struct inode *inode,struct file *file);void simple_transaction_set (struct file *file,size_t n);
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 87/437 tomoyo: convert to read/write iterators
In reply to Jens Axboe--- security/tomoyo/securityfs_if.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
security/tomoyo/securityfs_if.c +12 -9
@@ -86,6 +86,7 @@ static ssize_t tomoyo_write_self(struct file *file, const char __user *buf,kfree (data);return error ? error : count; } +FOPS_WRITE_ITER_HELPER (tomoyo_write_self);/** * tomoyo_read_self - read() for /sys/kernel/security/tomoyo/self_domain interface.
@@ -97,28 +98,28 @@ static ssize_t tomoyo_write_self(struct file *file, const char __user *buf,* * Returns read size on success, negative value otherwise. */ -static ssize_t tomoyo_read_self (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t tomoyo_read_self (struct kiocb *iocb,struct iov_iter *to) {const char *domain =tomoyo_domain ()->domainname->name; +size_t count =iov_iter_count (to);loff_t len =strlen (domain); -loff_t pos = *ppos; +loff_t pos = iocb->ki_pos;if (pos >= len || !count)return 0 ; len -= pos;if (count < len) len = count; -if (copy_to_user (buf, domain + pos, len)) +if (copy_to_iter (domain + pos, len, to))return -EFAULT ; - *ppos += len; + iocb->ki_pos += len;return len; }/* Operations for /sys/kernel/security/tomoyo/self_domain interface. */ static const struct file_operations tomoyo_self_operations = { - .write = tomoyo_write_self, - .read = tomoyo_read_self, + .write_iter = tomoyo_write_self_iter, + .read_iter = tomoyo_read_self, };/**
@@ -178,6 +179,7 @@ static ssize_t tomoyo_read(struct file *file, char __user *buf, size_t count, {return tomoyo_read_control (file->private_data, buf, count); } +FOPS_READ_ITER_HELPER (tomoyo_read);/** * tomoyo_write - write() for /sys/kernel/security/tomoyo/ interface.
@@ -194,6 +196,7 @@ static ssize_t tomoyo_write(struct file *file, const char __user *buf, {return tomoyo_write_control (file->private_data, buf, count); } +FOPS_WRITE_ITER_HELPER (tomoyo_write);/* * tomoyo_operations is a "struct file_operations" which is used for handling
@@ -206,8 +209,8 @@ static const struct file_operations tomoyo_operations = { .open = tomoyo_open, .release = tomoyo_release, .poll = tomoyo_poll, - .read = tomoyo_read, - .write = tomoyo_write, + .read_iter = tomoyo_read_iter, + .write_iter = tomoyo_write_iter, .llseek = noop_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 88/437 smack: convert to read/write iterators
In reply to Jens Axboe--- security/smack/smackfs.c | 281 ++++++++++++++++++--------------------- 1 file changed, 132 insertions(+), 149 deletions(-)
security/smack/smackfs.c +132 -149
@@ -669,12 +669,13 @@ static ssize_t smk_write_load(struct file *file, const char __user *buf,return smk_write_rules_list (file, buf, count, ppos,NULL ,NULL ,SMK_FIXED24_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_load);static const struct file_operations smk_load_ops = { .open = smk_open_load, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_load, + .write_iter = smk_write_load_iter, .release = seq_release, };
@@ -964,12 +965,13 @@ static ssize_t smk_write_cipso(struct file *file, const char __user *buf, {return smk_set_cipso (file, buf, count, ppos,SMK_FIXED24_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_cipso);static const struct file_operations smk_cipso_ops = { .open = smk_open_cipso, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_cipso, + .write_iter = smk_write_cipso_iter, .release = seq_release, };
@@ -1038,12 +1040,13 @@ static ssize_t smk_write_cipso2(struct file *file, const char __user *buf, {return smk_set_cipso (file, buf, count, ppos,SMK_LONG_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_cipso2);static const struct file_operations smk_cipso2_ops = { .open = smk_open_cipso2, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_cipso2, + .write_iter = smk_write_cipso2_iter, .release = seq_release, };
@@ -1302,12 +1305,13 @@ static ssize_t smk_write_net4addr(struct file *file, const char __user *buf,return rc; } +FOPS_WRITE_ITER_HELPER (smk_write_net4addr);static const struct file_operations smk_net4addr_ops = { .open = smk_open_net4addr, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_net4addr, + .write_iter = smk_write_net4addr_iter, .release = seq_release, };
@@ -1559,52 +1563,48 @@ static ssize_t smk_write_net6addr(struct file *file, const char __user *buf,return rc; } +FOPS_WRITE_ITER_HELPER (smk_write_net6addr);static const struct file_operations smk_net6addr_ops = { .open = smk_open_net6addr, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_net6addr, + .write_iter = smk_write_net6addr_iter, .release = seq_release, };#endif /* CONFIG_IPV6 */ /** * smk_read_doi - read() for /smack/doi -* @filp: file pointer, not actually used -* @buf: where to put the result -* @count: maximum to send along -* @ppos: where to start +* @iocb: metadata for IO +* @to: where to put the result * * Returns number of bytes read or error code, as appropriate */ -static ssize_t smk_read_doi (struct file *filp,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_read_doi (struct kiocb *iocb,struct iov_iter *to) {char temp[80 ];ssize_t rc; -if (*ppos !=0 ) +if (iocb->ki_pos !=0 )return 0 ;sprintf (temp,"%d" , smk_cipso_doi_value); - rc =simple_read_from_buffer (buf, count, ppos, temp,strlen (temp)); + rc =simple_copy_to_iter (temp, &iocb->ki_pos,strlen (temp), to);return rc; }/** * smk_write_doi - write() for /smack/doi -* @file: file pointer, not actually used -* @buf: where to get the data from -* @count: bytes sent -* @ppos: where to start +* @iocb: metadata for IO +* @from: where to get the data from * * Returns number of bytes written or error code, as appropriate */ -static ssize_t smk_write_doi (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_write_doi (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);char temp[80 ];int i;
@@ -1614,7 +1614,7 @@ static ssize_t smk_write_doi(struct file *file, const char __user *buf,if (count >=sizeof (temp) || count ==0 )return -EINVAL ; -if (copy_from_user (temp, buf, count) !=0 ) +if (!copy_from_iter (temp, count, from))return -EFAULT ; temp[count] ='\0' ;
@@ -1630,47 +1630,42 @@ static ssize_t smk_write_doi(struct file *file, const char __user *buf, }static const struct file_operations smk_doi_ops = { - .read = smk_read_doi, - .write = smk_write_doi, + .read_iter = smk_read_doi, + .write_iter = smk_write_doi, .llseek = default_llseek, };/** * smk_read_direct - read() for /smack/direct -* @filp: file pointer, not actually used -* @buf: where to put the result -* @count: maximum to send along -* @ppos: where to start +* @iocb: metadata for IO +* @to: where to put the result * * Returns number of bytes read or error code, as appropriate */ -static ssize_t smk_read_direct (struct file *filp,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_read_direct (struct kiocb *iocb,struct iov_iter *to) {char temp[80 ];ssize_t rc; -if (*ppos !=0 ) +if (iocb->ki_pos !=0 )return 0 ;sprintf (temp,"%d" , smack_cipso_direct); - rc =simple_read_from_buffer (buf, count, ppos, temp,strlen (temp)); + rc =simple_copy_to_iter (temp, &iocb->ki_pos,strlen (temp), to);return rc; }/** * smk_write_direct - write() for /smack/direct -* @file: file pointer, not actually used -* @buf: where to get the data from -* @count: bytes sent -* @ppos: where to start +* @iocb: metadata for IO +* @from: where to get the data from * * Returns number of bytes written or error code, as appropriate */ -static ssize_t smk_write_direct (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_write_direct (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);struct smack_known *skp;char temp[80 ];int i;
@@ -1681,7 +1676,7 @@ static ssize_t smk_write_direct(struct file *file, const char __user *buf,if (count >=sizeof (temp) || count ==0 )return -EINVAL ; -if (copy_from_user (temp, buf, count) !=0 ) +if (!copy_from_iter (temp, count, from))return -EFAULT ; temp[count] ='\0' ;
@@ -1708,47 +1703,42 @@ static ssize_t smk_write_direct(struct file *file, const char __user *buf, }static const struct file_operations smk_direct_ops = { - .read = smk_read_direct, - .write = smk_write_direct, + .read_iter = smk_read_direct, + .write_iter = smk_write_direct, .llseek = default_llseek, };/** * smk_read_mapped - read() for /smack/mapped -* @filp: file pointer, not actually used -* @buf: where to put the result -* @count: maximum to send along -* @ppos: where to start +* @iocb: metadata for IO +* @to: where to put the result * * Returns number of bytes read or error code, as appropriate */ -static ssize_t smk_read_mapped (struct file *filp,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_read_mapped (struct kiocb *iocb,struct iov_iter *to) {char temp[80 ];ssize_t rc; -if (*ppos !=0 ) +if (iocb->ki_pos !=0 )return 0 ;sprintf (temp,"%d" , smack_cipso_mapped); - rc =simple_read_from_buffer (buf, count, ppos, temp,strlen (temp)); + rc =simple_copy_to_iter (temp, &iocb->ki_pos,strlen (temp), to);return rc; }/** * smk_write_mapped - write() for /smack/mapped -* @file: file pointer, not actually used -* @buf: where to get the data from -* @count: bytes sent -* @ppos: where to start +* @iocb: metadata for IO +* @from: where to get the data from * * Returns number of bytes written or error code, as appropriate */ -static ssize_t smk_write_mapped (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_write_mapped (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);struct smack_known *skp;char temp[80 ];int i;
@@ -1759,7 +1749,7 @@ static ssize_t smk_write_mapped(struct file *file, const char __user *buf,if (count >=sizeof (temp) || count ==0 )return -EINVAL ; -if (copy_from_user (temp, buf, count) !=0 ) +if (!copy_from_iter (temp, count, from))return -EFAULT ; temp[count] ='\0' ;
@@ -1786,27 +1776,25 @@ static ssize_t smk_write_mapped(struct file *file, const char __user *buf, }static const struct file_operations smk_mapped_ops = { - .read = smk_read_mapped, - .write = smk_write_mapped, + .read_iter = smk_read_mapped, + .write_iter = smk_write_mapped, .llseek = default_llseek, };/** * smk_read_ambient - read() for /smack/ambient -* @filp: file pointer, not actually used -* @buf: where to put the result -* @cn: maximum to send along -* @ppos: where to start +* @iocb: metadata for IO +* @to: where to put the result * * Returns number of bytes read or error code, as appropriate */ -static ssize_t smk_read_ambient (struct file *filp,char __user *buf, -size_t cn,loff_t *ppos) +static ssize_t smk_read_ambient (struct kiocb *iocb,struct iov_iter *to) { +size_t cn =iov_iter_count (to);ssize_t rc;int asize; -if (*ppos !=0 ) +if (iocb->ki_pos !=0 )return 0 ;/* * Being careful to avoid a problem in the case where
@@ -1817,9 +1805,8 @@ static ssize_t smk_read_ambient(struct file *filp, char __user *buf, asize =strlen (smack_net_ambient->smk_known) +1 ;if (cn >= asize) - rc =simple_read_from_buffer (buf, cn, ppos, - smack_net_ambient->smk_known, - asize); + rc =simple_copy_to_iter (smack_net_ambient->smk_known, + &iocb->ki_pos, asize, to);else rc = -EINVAL ;
@@ -1874,10 +1861,11 @@ static ssize_t smk_write_ambient(struct file *file, const char __user *buf,kfree (data);return rc; } +FOPS_WRITE_ITER_HELPER (smk_write_ambient);static const struct file_operations smk_ambient_ops = { - .read = smk_read_ambient, - .write = smk_write_ambient, + .read_iter = smk_read_ambient, + .write_iter = smk_write_ambient_iter, .llseek = default_llseek, };
@@ -2054,11 +2042,12 @@ static ssize_t smk_write_onlycap(struct file *file, const char __user *buf,return rc; } +FOPS_WRITE_ITER_HELPER (smk_write_onlycap);static const struct file_operations smk_onlycap_ops = { .open = smk_open_onlycap, - .read = seq_read, - .write = smk_write_onlycap, + .read_iter = seq_read_iter, + .write_iter = smk_write_onlycap_iter, .llseek = seq_lseek, .release = seq_release, };
@@ -2066,21 +2055,19 @@ static const struct file_operations smk_onlycap_ops = {#ifdef CONFIG_SECURITY_SMACK_BRINGUP /** * smk_read_unconfined - read() for smackfs/unconfined -* @filp: file pointer, not actually used -* @buf: where to put the result -* @cn: maximum to send along -* @ppos: where to start +* @iocb: metadata for IO +* @to: where to put the result * * Returns number of bytes read or error code, as appropriate */ -static ssize_t smk_read_unconfined (struct file *filp,char __user *buf, -size_t cn,loff_t *ppos) +static ssize_t smk_read_unconfined (struct kiocb *iocb,struct iov_iter *to) { +size_t cn =iov_iter_count (to);char *smack ="" ;ssize_t rc = -EINVAL ;int asize; -if (*ppos !=0 ) +if (iocb->ki_pos !=0 )return 0 ;if (smack_unconfined !=NULL )
@@ -2089,7 +2076,7 @@ static ssize_t smk_read_unconfined(struct file *filp, char __user *buf, asize =strlen (smack) +1 ;if (cn >= asize) - rc =simple_read_from_buffer (buf, cn, ppos, smack, asize); + rc =simple_copy_to_iter (smack, &iocb->ki_pos, asize, to);return rc; }
@@ -2143,49 +2130,45 @@ static ssize_t smk_write_unconfined(struct file *file, const char __user *buf,kfree (data);return rc; } +FOPS_WRITE_ITER_HELPER (smk_write_unconfined);static const struct file_operations smk_unconfined_ops = { - .read = smk_read_unconfined, - .write = smk_write_unconfined, + .read_iter = smk_read_unconfined, + .write_iter = smk_write_unconfined_iter, .llseek = default_llseek, };#endif /* CONFIG_SECURITY_SMACK_BRINGUP */ /** * smk_read_logging - read() for /smack/logging -* @filp: file pointer, not actually used -* @buf: where to put the result -* @count: maximum to send along -* @ppos: where to start +* @iocb: metadata for IO +* @to: where to put the result * * Returns number of bytes read or error code, as appropriate */ -static ssize_t smk_read_logging (struct file *filp,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_read_logging (struct kiocb *iocb,struct iov_iter *to) {char temp[32 ];ssize_t rc; -if (*ppos !=0 ) +if (iocb->ki_pos !=0 )return 0 ;sprintf (temp,"%d\n" , log_policy); - rc =simple_read_from_buffer (buf, count, ppos, temp,strlen (temp)); + rc =simple_copy_to_iter (temp, &iocb->ki_pos,strlen (temp), to);return rc; }/** * smk_write_logging - write() for /smack/logging -* @file: file pointer, not actually used -* @buf: where to get the data from -* @count: bytes sent -* @ppos: where to start +* @iocb: metadata for IO +* @from: where to get the data from * * Returns number of bytes written or error code, as appropriate */ -static ssize_t smk_write_logging (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_write_logging (struct kiocb *iocb,struct iov_iter *from) { +size_t count =iov_iter_count (from);char temp[32 ];int i;
@@ -2195,7 +2178,7 @@ static ssize_t smk_write_logging(struct file *file, const char __user *buf,if (count >=sizeof (temp) || count ==0 )return -EINVAL ; -if (copy_from_user (temp, buf, count) !=0 ) +if (!copy_from_iter (temp, count, from))return -EFAULT ; temp[count] ='\0' ;
@@ -2208,11 +2191,9 @@ static ssize_t smk_write_logging(struct file *file, const char __user *buf,return count; } - -static const struct file_operations smk_logging_ops = { - .read = smk_read_logging, - .write = smk_write_logging, + .read_iter = smk_read_logging, + .write_iter = smk_write_logging, .llseek = default_llseek, };
@@ -2281,12 +2262,13 @@ static ssize_t smk_write_load_self(struct file *file, const char __user *buf,return smk_write_rules_list (file, buf, count, ppos, &tsp->smk_rules, &tsp->smk_rules_lock,SMK_FIXED24_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_load_self);static const struct file_operations smk_load_self_ops = { .open = smk_open_load_self, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_load_self, + .write_iter = smk_write_load_self_iter, .release = seq_release, };
@@ -2351,10 +2333,11 @@ static ssize_t smk_write_access(struct file *file, const char __user *buf, {return smk_user_access (file, buf, count, ppos,SMK_FIXED24_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_access);static const struct file_operations smk_access_ops = { - .write = smk_write_access, - .read = simple_transaction_read, + .write_iter = smk_write_access_iter, + .read_iter = simple_transaction_read_iter, .release = simple_transaction_release, .llseek = generic_file_llseek, };
@@ -2416,12 +2399,13 @@ static ssize_t smk_write_load2(struct file *file, const char __user *buf,return smk_write_rules_list (file, buf, count, ppos,NULL ,NULL ,SMK_LONG_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_load2);static const struct file_operations smk_load2_ops = { .open = smk_open_load2, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_load2, + .write_iter = smk_write_load2_iter, .release = seq_release, };
@@ -2489,12 +2473,13 @@ static ssize_t smk_write_load_self2(struct file *file, const char __user *buf,return smk_write_rules_list (file, buf, count, ppos, &tsp->smk_rules, &tsp->smk_rules_lock,SMK_LONG_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_load_self2);static const struct file_operations smk_load_self2_ops = { .open = smk_open_load_self2, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_load_self2, + .write_iter = smk_write_load_self2_iter, .release = seq_release, };
@@ -2510,10 +2495,11 @@ static ssize_t smk_write_access2(struct file *file, const char __user *buf, {return smk_user_access (file, buf, count, ppos,SMK_LONG_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_access2);static const struct file_operations smk_access2_ops = { - .write = smk_write_access2, - .read = simple_transaction_read, + .write_iter = smk_write_access2_iter, + .read_iter = simple_transaction_read_iter, .release = simple_transaction_release, .llseek = generic_file_llseek, };
@@ -2576,10 +2562,11 @@ static ssize_t smk_write_revoke_subj(struct file *file, const char __user *buf,return rc; } +FOPS_WRITE_ITER_HELPER (smk_write_revoke_subj);static const struct file_operations smk_revoke_subj_ops = { - .write = smk_write_revoke_subj, - .read = simple_transaction_read, + .write_iter = smk_write_revoke_subj_iter, + .read_iter = simple_transaction_read_iter, .release = simple_transaction_release, .llseek = generic_file_llseek, };
@@ -2612,31 +2599,30 @@ static ssize_t smk_write_change_rule(struct file *file, const char __user *buf,return smk_write_rules_list (file, buf, count, ppos,NULL ,NULL ,SMK_CHANGE_FMT ); } +FOPS_WRITE_ITER_HELPER (smk_write_change_rule);static const struct file_operations smk_change_rule_ops = { - .write = smk_write_change_rule, - .read = simple_transaction_read, + .write_iter = smk_write_change_rule_iter, + .read_iter = simple_transaction_read_iter, .release = simple_transaction_release, .llseek = generic_file_llseek, };/** * smk_read_syslog - read() for smackfs/syslog -* @filp: file pointer, not actually used -* @buf: where to put the result -* @cn: maximum to send along -* @ppos: where to start +* @iocb: metadata for IO +* @to: where to put the result * * Returns number of bytes read or error code, as appropriate */ -static ssize_t smk_read_syslog (struct file *filp,char __user *buf, -size_t cn,loff_t *ppos) +static ssize_t smk_read_syslog (struct kiocb *iocb,struct iov_iter *to) { +size_t cn =iov_iter_count (to);struct smack_known *skp;ssize_t rc = -EINVAL ;int asize; -if (*ppos !=0 ) +if (iocb->ki_pos !=0 )return 0 ;if (smack_syslog_label ==NULL )
@@ -2647,8 +2633,8 @@ static ssize_t smk_read_syslog(struct file *filp, char __user *buf, asize =strlen (skp->smk_known) +1 ;if (cn >= asize) - rc =simple_read_from_buffer (buf, cn, ppos, skp->smk_known, - asize); + rc =simple_copy_to_iter (skp->smk_known, &iocb->ki_pos, asize, + to);return rc; }
@@ -2689,10 +2675,11 @@ static ssize_t smk_write_syslog(struct file *file, const char __user *buf,kfree (data);return rc; } +FOPS_WRITE_ITER_HELPER (smk_write_syslog);static const struct file_operations smk_syslog_ops = { - .read = smk_read_syslog, - .write = smk_write_syslog, + .read_iter = smk_read_syslog, + .write_iter = smk_write_syslog_iter, .llseek = default_llseek, };
@@ -2802,58 +2789,54 @@ static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf,smk_destroy_label_list (&list_tmp);return rc; } +FOPS_WRITE_ITER_HELPER (smk_write_relabel_self);static const struct file_operations smk_relabel_self_ops = { .open = smk_open_relabel_self, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, - .write = smk_write_relabel_self, + .write_iter = smk_write_relabel_self_iter, .release = seq_release, };/** * smk_read_ptrace - read() for /smack/ptrace -* @filp: file pointer, not actually used -* @buf: where to put the result -* @count: maximum to send along -* @ppos: where to start +* @iocb: metadata for IO +* @to: where to put the result * * Returns number of bytes read or error code, as appropriate */ -static ssize_t smk_read_ptrace (struct file *filp,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_read_ptrace (struct kiocb *iocb,struct iov_iter *to) {char temp[32 ];ssize_t rc; -if (*ppos !=0 ) +if (iocb->ki_pos !=0 )return 0 ;sprintf (temp,"%d\n" , smack_ptrace_rule); - rc =simple_read_from_buffer (buf, count, ppos, temp,strlen (temp)); + rc =simple_copy_to_iter (temp, &iocb->ki_pos,strlen (temp), to);return rc; }/** * smk_write_ptrace - write() for /smack/ptrace -* @file: file pointer -* @buf: data from user space -* @count: bytes sent -* @ppos: where to start - must be 0 +* @iocb: metadata for IO +* @to: data from user space */ -static ssize_t smk_write_ptrace (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t smk_write_ptrace (struct kiocb *iocb,struct iov_iter *to) { +size_t count =iov_iter_count (to);char temp[32 ];int i;if (!smack_privileged (CAP_MAC_ADMIN ))return -EPERM ; -if (*ppos !=0 || count >=sizeof (temp) || count ==0 ) +if (iocb->ki_pos !=0 || count >=sizeof (temp) || count ==0 )return -EINVAL ; -if (copy_from_user (temp, buf, count) !=0 ) +if (!copy_from_iter (temp, count, to))return -EFAULT ; temp[count] ='\0' ;
@@ -2868,8 +2851,8 @@ static ssize_t smk_write_ptrace(struct file *file, const char __user *buf, }static const struct file_operations smk_ptrace_ops = { - .write = smk_write_ptrace, - .read = smk_read_ptrace, + .write_iter = smk_write_ptrace, + .read_iter = smk_read_ptrace, .llseek = default_llseek, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 89/437 apparmor: convert to read/write iterators
In reply to Jens Axboe--- security/apparmor/apparmorfs.c | 55 ++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 26 deletions(-)
security/apparmor/apparmorfs.c +29 -26
@@ -450,9 +450,10 @@ static ssize_t profile_load(struct file *f, const char __user *buf, size_t size,return error; } +FOPS_WRITE_ITER_HELPER (profile_load);static const struct file_operations aa_fs_profile_load = { - .write = profile_load, + .write_iter = profile_load_iter, .llseek = default_llseek, };
@@ -467,9 +468,10 @@ static ssize_t profile_replace(struct file *f, const char __user *buf,return error; } +FOPS_WRITE_ITER_HELPER (profile_replace);static const struct file_operations aa_fs_profile_replace = { - .write = profile_replace, + .write_iter = profile_replace_iter, .llseek = default_llseek, };
@@ -508,9 +510,10 @@ static ssize_t profile_remove(struct file *f, const char __user *buf,aa_put_ns (ns);return error; } +FOPS_WRITE_ITER_HELPER (profile_remove);static const struct file_operations aa_fs_profile_remove = { - .write = profile_remove, + .write_iter = profile_remove_iter, .llseek = default_llseek, };
@@ -532,10 +535,11 @@ static int ns_revision_release(struct inode *inode, struct file *file)return 0 ; } -static ssize_t ns_revision_read (struct file *file,char __user *buf, -size_t size,loff_t *ppos) +static ssize_t ns_revision_read (struct kiocb *iocb,struct iov_iter *to) { +struct file *file = iocb->ki_filp;struct aa_revision *rev = file->private_data; +size_t size =iov_iter_count (to);char buffer[32 ];long last_read;int avail;
@@ -554,13 +558,13 @@ static ssize_t ns_revision_read(struct file *file, char __user *buf, } avail =sprintf (buffer,"%ld\n" , rev->ns->revision); -if (*ppos + size > avail) { +if (iocb->ki_pos + size > avail) { rev->last_read = rev->ns->revision; - *ppos =0 ; + iocb->ki_pos =0 ; }mutex_unlock (&rev->ns->lock); -return simple_read_from_buffer (buf, size, ppos, buffer, avail); +return simple_copy_to_iter (buffer, &iocb->ki_pos, avail, to); }static int ns_revision_open (struct inode *inode,struct file *file)
@@ -604,7 +608,7 @@ static const struct file_operations aa_fs_ns_revision_fops = { .owner = THIS_MODULE, .open = ns_revision_open, .poll = ns_revision_poll, - .read = ns_revision_read, + .read_iter = ns_revision_read, .llseek = generic_file_llseek, .release = ns_revision_release, };
@@ -878,9 +882,9 @@ static struct multi_transaction *multi_transaction_new(struct file *file,return t; } -static ssize_t multi_transaction_read (struct file *file,char __user *buf, -size_t size,loff_t *pos) +static ssize_t multi_transaction_read (struct kiocb *iocb,struct iov_iter *to) { +struct file *file = iocb->ki_filp;struct multi_transaction *t;ssize_t ret;
@@ -891,7 +895,7 @@ static ssize_t multi_transaction_read(struct file *file, char __user *buf,if (!t)return 0 ; - ret =simple_read_from_buffer (buf, size, pos, t->data, t->size); + ret =simple_copy_to_iter (t->data, &iocb->ki_pos, t->size, to);put_multi_transaction (t);return ret;
@@ -980,10 +984,11 @@ static ssize_t aa_write_access(struct file *file, const char __user *ubuf,return count; } +FOPS_WRITE_ITER_HELPER (aa_write_access);static const struct file_operations aa_sfs_access = { - .write = aa_write_access, - .read = multi_transaction_read, + .write_iter = aa_write_access_iter, + .read_iter = multi_transaction_read, .release = multi_transaction_release, .llseek = generic_file_llseek, };
@@ -1021,7 +1026,7 @@ static int aa_sfs_seq_open(struct inode *inode, struct file *file)const struct file_operations aa_sfs_seq_file_ops = { .owner =THIS_MODULE , .open = aa_sfs_seq_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = single_release, };
@@ -1040,7 +1045,7 @@ static int seq_profile_ ##NAME ##_open(struct inode *inode, struct file *file)\ static const struct file_operations seq_profile_ ##NAME ##_fops = { \ .owner = THIS_MODULE, \ .open = seq_profile_ ##NAME ##_open, \ - .read = seq_read, \ + .read_iter = seq_read_iter, \ .llseek = seq_lseek, \ .release = seq_profile_release, \ } \
@@ -1142,7 +1147,7 @@ static int seq_ns_ ##NAME ##_open(struct inode *inode, struct file *file) \ static const struct file_operations seq_ns_ ##NAME ##_fops = { \ .owner = THIS_MODULE, \ .open = seq_ns_ ##NAME ##_open, \ - .read = seq_read, \ + .read_iter = seq_read_iter, \ .llseek = seq_lseek, \ .release = single_release, \ } \
@@ -1232,7 +1237,7 @@ static int seq_rawdata_ ##NAME ##_open(struct inode *inode, struct file *file)\ static const struct file_operations seq_rawdata_ ##NAME ##_fops = { \ .owner = THIS_MODULE, \ .open = seq_rawdata_ ##NAME ##_open, \ - .read = seq_read, \ + .read_iter = seq_read_iter, \ .llseek = seq_lseek, \ .release = seq_rawdata_release, \ } \
@@ -1348,14 +1353,12 @@ static int decompress_zstd(char *src, size_t slen, char *dst, size_t dlen)return 0 ; } -static ssize_t rawdata_read (struct file *file,char __user *buf,size_t size, -loff_t *ppos) +static ssize_t rawdata_read (struct kiocb *iocb,struct iov_iter *to) { -struct rawdata_f_data *private = file->private_data; +struct rawdata_f_data *private = iocb->ki_filp->private_data; -return simple_read_from_buffer (buf, size, ppos, -RAWDATA_F_DATA_BUF (private), - private->loaddata->size); +return simple_copy_to_iter (RAWDATA_F_DATA_BUF (private), &iocb->ki_pos, + private->loaddata->size, to); }static int rawdata_release (struct inode *inode,struct file *file)
@@ -1407,7 +1410,7 @@ static int rawdata_open(struct inode *inode, struct file *file)static const struct file_operations rawdata_fops = { .open = rawdata_open, - .read = rawdata_read, + .read_iter = rawdata_read, .llseek = generic_file_llseek, .release = rawdata_release, };
@@ -2298,7 +2301,7 @@ static int profiles_release(struct inode *inode, struct file *file)static const struct file_operations aa_sfs_profiles_fops = { .open = profiles_open, - .read = seq_read, + .read_iter = seq_read_iter, .llseek = seq_lseek, .release = profiles_release, };
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 90/437 landlock: convert to read/write iterators
In reply to Jens Axboe--- security/landlock/syscalls.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
security/landlock/syscalls.c +3 -12
@@ -122,21 +122,12 @@ static int fop_ruleset_release(struct inode *const inode,return 0 ; } -static ssize_t fop_dummy_read (struct file *const filp,char __user *const buf, -const size_t size,loff_t *const ppos) +static ssize_t fop_dummy_iter (struct kiocb *iocb,struct iov_iter *iov) {/* Dummy handler to enable FMODE_CAN_READ. */ return -EINVAL ; } -static ssize_t fop_dummy_write (struct file *const filp, -const char __user *const buf,const size_t size, -loff_t *const ppos) -{ -/* Dummy handler to enable FMODE_CAN_WRITE. */ -return -EINVAL ; -} -/* * A ruleset file descriptor enables to build a ruleset by adding (i.e. * writing) rule after rule, without relying on the task's context. This
@@ -145,8 +136,8 @@ static ssize_t fop_dummy_write(struct file *const filp,*/ static const struct file_operations ruleset_fops = { .release = fop_ruleset_release, - .read = fop_dummy_read, - .write = fop_dummy_write, + .read_iter = fop_dummy_iter, + .write_iter = fop_dummy_iter, };#define LANDLOCK_ABI_VERSION 4
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 91/437 lsm: convert to read/write iterators
In reply to Jens Axboe--- security/safesetid/securityfs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
security/safesetid/securityfs.c +8 -6
@@ -245,6 +245,7 @@ static ssize_t safesetid_uid_file_write(struct file *file,return handle_policy_update (file, buf, len,UID ); } +FOPS_WRITE_ITER_HELPER (safesetid_uid_file_write); static ssize_t safesetid_gid_file_write(struct file *file, const char __user *buf,
@@ -259,6 +260,7 @@ static ssize_t safesetid_gid_file_write(struct file *file,return handle_policy_update (file, buf, len,GID ); } +FOPS_WRITE_ITER_HELPER (safesetid_gid_file_write);static ssize_t safesetid_file_read (struct file *file,char __user *buf,size_t len,loff_t *ppos,struct mutex *policy_update_lock,struct __rcu setid_ruleset * ruleset)
@@ -285,6 +287,7 @@ static ssize_t safesetid_uid_file_read(struct file *file, char __user *buf,return safesetid_file_read (file, buf, len, ppos, &uid_policy_update_lock, safesetid_setuid_rules); } +FOPS_READ_ITER_HELPER (safesetid_uid_file_read);static ssize_t safesetid_gid_file_read (struct file *file,char __user *buf,size_t len,loff_t *ppos)
@@ -292,17 +295,16 @@ static ssize_t safesetid_gid_file_read(struct file *file, char __user *buf,return safesetid_file_read (file, buf, len, ppos, &gid_policy_update_lock, safesetid_setgid_rules); } - - +FOPS_READ_ITER_HELPER (safesetid_gid_file_read);static const struct file_operations safesetid_uid_file_fops = { - .read = safesetid_uid_file_read, - .write = safesetid_uid_file_write, + .read_iter = safesetid_uid_file_read_iter, + .write_iter = safesetid_uid_file_write_iter, };static const struct file_operations safesetid_gid_file_fops = { - .read = safesetid_gid_file_read, - .write = safesetid_gid_file_write, + .read_iter = safesetid_gid_file_read_iter, + .write_iter = safesetid_gid_file_write_iter, };static int __init safesetid_init_securityfs (void )
Signature · 1 line
2.43.0