Re: git: a4e4132fa3bf - main - swapoff(2): replace special device name argument with a structure
- Reply: Konstantin Belousov : "Re: git: a4e4132fa3bf - main - swapoff(2): replace special device name argument with a structure"
- In reply to: Konstantin Belousov : "git: a4e4132fa3bf - main - swapoff(2): replace special device name argument with a structure"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Dec 2021 17:21:24 UTC
On Sat, Dec 04, 2021 at 10:21:07PM +0000, Konstantin Belousov wrote:
> The branch main has been updated by kib:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=a4e4132fa3bfadb6047fc0fa5f399f4640460300
>
> commit a4e4132fa3bfadb6047fc0fa5f399f4640460300
> Author: Konstantin Belousov <kib@FreeBSD.org>
> AuthorDate: 2021-11-29 16:26:31 +0000
> Commit: Konstantin Belousov <kib@FreeBSD.org>
> CommitDate: 2021-12-04 22:20:58 +0000
>
> swapoff(2): replace special device name argument with a structure
>
> For compatibility, add a placeholder pointer to the start of the
> added struct swapoff_new_args, and use it to distinguish old vs. new
> style of syscall invocation.
I agree with Jess that this should be a new syscall. The entry in
sycalls.master now fails to describe the memory footprint of the name
argument. No system call should be created or altered to have a memory
footprint not describable with SAL annotations unless an applicable
standard such as POSIX requires it.
> diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h
> index 395fbc9957c4..469de3e8eaf4 100644
> --- a/sys/vm/swap_pager.h
> +++ b/sys/vm/swap_pager.h
> @@ -69,6 +69,14 @@ struct swdevt {
> #define SW_UNMAPPED 0x01
> #define SW_CLOSING 0x04
>
> +struct swapoff_new_args {
> + const char *name_old_syscall;
> + const char *name;
> + u_int flags;
> + u_int pad0;
> + uintptr_t pad1[8];
> +};
If you're going to attempt to add future-proofing, please pad with the
assumption that pointers are 128-bit sized and aligned. In this
case, that would mean an uint64_t pad before pad1. If there were done
in place, adding the pad and dropping pad1 to 6 elements would be safe.
-- Brooks