[PATCH] Handle OpenZFS ioctls
Dmitry V. Levin
ldv at altlinux.org
Tue Dec 29 22:03:49 UTC 2020
On Fri, Dec 25, 2020 at 02:26:01AM +0100, наб wrote:
> Before/after of strace zfs list:
> -ioctl(3, _IOC(_IOC_NONE, 0x5a, 0x4, 0), 0x7ffe7f41e3b0) = 0
> -ioctl(3, _IOC(_IOC_NONE, 0x5a, 0x12, 0), 0x7ffe7f41e3c0) = 0
> -ioctl(3, _IOC(_IOC_NONE, 0x5a, 0x5, 0), 0x7ffe7f41ad30) = 0
> -ioctl(3, _IOC(_IOC_NONE, 0x5a, 0x27, 0), 0x7ffe7f41e320) = 0
> -ioctl(3, _IOC(_IOC_NONE, 0x5a, 0x14, 0), 0x7ffe7f41e370) = 0
> -ioctl(3, _IOC(_IOC_NONE, 0x5a, 0x14, 0), 0x7ffe7f41ad30) = -1 ESRCH (No such process)
> +ioctl(3, ZFS_IOC_POOL_CONFIGS, 0x7ffffae160c0) = 0
> +ioctl(3, ZFS_IOC_OBJSET_STATS, 0x7ffffae160d0) = 0
> +ioctl(3, ZFS_IOC_POOL_STATS, 0x7ffffae12a40) = 0
> +ioctl(3, ZFS_IOC_POOL_GET_PROPS, 0x7ffffae16030) = 0
> +ioctl(3, ZFS_IOC_DATASET_LIST_NEXT, 0x7ffffae16080) = 0
> +ioctl(3, ZFS_IOC_DATASET_LIST_NEXT, 0x7ffffae12a40) = -1 ESRCH (No such process)
> -ioctl(3, _IOC(_IOC_NONE, 0x5a, 0x3f, 0), 0x7ffe7f41e5b0) = -1 EPERM (Operation not permitted)
> +ioctl(3, ZFS_IOC_LOG_HISTORY, 0x7ffffae162c0) = -1 EPERM (Operation not permitted)
>
> Before/after of strace zfs/cmd/zvol_id/zvol_id /dev/zd0:
> -ioctl(3, _IOC(_IOC_READ, 0x12, 0x7d, 0x100), 0x7fffa7776e20) = 0
> +ioctl(3, BLKZNAME, 0x7ffe02f435b0) = 0
>
> * extract_zfs.sh: New file.
> * ioctls_zfs.h: New file.
> * ioctlsort.c: Always include ioctls_zfs.h,
> as it's personality-independent
> ---
> extract_zfs.sh | 70 ++++++++++++++++++++++++++++++++++
> ioctls_zfs.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++++
> ioctlsort.c | 2 +
> 3 files changed, 173 insertions(+)
> create mode 100755 extract_zfs.sh
> create mode 100644 ioctls_zfs.h
Thanks for the patch. Unfortunately, I don't see any changes
to the test suite in this series. How did you test these changes?
> diff --git a/extract_zfs.sh b/extract_zfs.sh
> new file mode 100755
> index 00000000..a1e2768e
> --- /dev/null
> +++ b/extract_zfs.sh
This should go to maint/ directory along with other scripts of that
nature.
> @@ -0,0 +1,70 @@
> +#!/bin/sh -e
> +#
> +# Scrape out ioctls from an OpenZFS tree.
> +# This should only be needed for getting new definitions,
> +# since OpenZFS is committed to this ABI.
> +#
> +# Copyright (c) 2020 The strace developers.
> +# All rights reserved
> +#
> +# SPDX-License-Identifier: LGPL-2.1-or-later
> +
> +[ -z "$1" ] && {
The idiom is: test assertion || fail.
> + echo "Usage: $0 <path to OpenZFS clone>" 1>&2
Just >&2
> + exit 1
> +}
> +
> +executable="$(mktemp)"
> +ZVER="$(mawk '/Version/ {print $2}' "$1/META")"
Just use awk.
> +export ZVER
> +
> +tail +24 "$0" | { cd "$1"; awk -f "/dev/stdin" include/sys/fs/zfs.h lib/libspl/include/sys/kstat.h | cc -isystem include -xc - -o "$executable"; }
Please don't, just create an awk script and execute it in a regular way.
See also maint/ioctls_sym.sh file.
--
ldv
More information about the Strace-devel
mailing list