]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
copystr(9): Move to deprecate (attempt #2)
authorcem <cem@FreeBSD.org>
Mon, 25 May 2020 16:40:48 +0000 (16:40 +0000)
committercem <cem@FreeBSD.org>
Mon, 25 May 2020 16:40:48 +0000 (16:40 +0000)
commit6aef78af13c3cb5f2bdf0355e2479fd225db0a99
tree789bb0daba41ca856b37f87708652b4cfcc6403a
parent8b7082f045f4d8b207806374488ab2f394551b4c
copystr(9): Move to deprecate (attempt #2)

This reapplies logical r360944 and r360946 (reverting r360955), with fixed
copystr() stand-in replacement macro.  Eventually the goal is to convert
consumers and kill the macro, but for a first step it helps if the macro is
correct.

Prior commit message:

Unlike the other copy*() functions, it does not serve to copy from one
address space to another or protect against potential faults.  It's just
an older incarnation of the now-more-common strlcpy().

Add a coccinelle script to tools/ which can be used to mechanically
convert existing instances where replacement with strlcpy is trivial.
In the two cases which matched, fuse_vfsops.c and union_vfsops.c, the
code was further refactored manually to simplify.

Replace the declaration of copystr() in systm.h with a small macro
wrapper around strlcpy (with correction from brooks@ -- thanks).

Remove N redundant MI implementations of copystr.  For MIPS, this
entailed inlining the assembler copystr into the only consumer,
copyinstr, and making the latter a leaf function.

Reviewed by: jhb (earlier version)
Discussed with: brooks (thanks!)
Differential Revision: https://reviews.freebsd.org/D24672
15 files changed:
sys/amd64/amd64/support.S
sys/arm/arm/copystr.S
sys/arm64/arm64/copystr.c [deleted file]
sys/conf/files.arm64
sys/conf/files.powerpc
sys/conf/files.riscv
sys/fs/fuse/fuse_vfsops.c
sys/fs/unionfs/union_vfsops.c
sys/i386/i386/support.s
sys/kern/subr_csan.c
sys/mips/mips/support.S
sys/powerpc/powerpc/copystr.c [deleted file]
sys/riscv/riscv/copystr.c [deleted file]
sys/sys/systm.h
tools/coccinelle/copystr9.cocci [new file with mode: 0644]