openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.45k stars 1.73k forks source link

struct dmu_replay_record required to utilize some libzfs_core functions, but not defined in any installed header #11333

Open codyps opened 3 years ago

codyps commented 3 years ago

Some libzfs_core.h functions (lzc_receive_with_header(), lzc_receive_one(), lzc_receive_with_cmdprops()) take struct dmu_replay_record as an argument (only required for lzc_receive_with_header()), which is expected to have been read out of the fd.

In libzfs_core.h, struct dmu_replay_record is forward declared, and never defined within libzfs_core.h (or it's transitive includes). The definition for struct dmu_replay_record instead lives in include/sys/zfs_ioctl.h. zfs_ioctl.h defines a large number of other items that probably aren't meant to be part of the libzfs_core API (and it's includes declare functions that aren't included in libzfs_core). But even if we try to use zfs_ioctl.h, it isn't installed (it's marked as a KERNEL_H in the relevant makefile).

Internal userspace commands aren't affected by this because they include zfs_ioctl.h directly from the source tree. The python bindings for lzc include a minimized copy of the dmu_replay_record definition instead of using any provided headers.

System information

Type Version/Name
Distribution Name Arch
Distribution Version N/A
Linux Kernel 5.9.13
Architecture x86_64
ZFS Version 2.0.0-1
SPL Version 2.0.0-1

Describe the problem you're observing

No definition of struct dmu_replay_record exists in libzfs_core.h or other installed headers

Describe how to reproduce the problem

Try to call lzc_receive_with_header() from a program that isn't part of the zfs source tree.

This is somewhat related, but as an opposite of #11236

stale[bot] commented 2 years ago

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.