From ebf92608f5185dbd368c45df58c8d2a7a1ba96a2 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 18 Apr 2023 16:20:33 -0400 Subject: [PATCH] Patch Cargo.toml files to enable nix "ioctl" feature The nix "ioctl" feature is used by both the blkio and virtio-driver crates. Neither of them enables it explicitly and this can lead to a compilation failure: error[E0432]: unresolved imports `nix::ioctl_none`, `nix::ioctl_read`, `nix::ioctl_write_ptr` --> virtio-driver/src/transports/vhost_vdpa/vhost_vdpa_kernel.rs:17:15 | 17 | use nix::{ioctl_none, ioctl_read, ioctl_write_ptr, unistd::write}; | ^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^ no `ioctl_write_ptr` in the root | | | | | no `ioctl_read` in the root | no `ioctl_none` in the root error: cannot determine resolution for the macro `ioctl_read` Fabio Valentini identified the root cause: The "virtio-driver" crate depends on nix v0.24 with "default-features = false", however, the code obviously imports items from "nix" that are only present if the "ioctl" feature is enabled. This used to work "by accident" because some other crate in libblkio's dependency tree used to pull in nix v0.24 with default features enabled. This no longer seems to be the case (hard to tell what changed, since koschei was not enabled). Signed-off-by: Stefan Hajnoczi --- fix-nix-ioctl-feature.patch | 25 +++++++++++++++++++++++++ libblkio.spec | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 fix-nix-ioctl-feature.patch diff --git a/fix-nix-ioctl-feature.patch b/fix-nix-ioctl-feature.patch new file mode 100644 index 0000000..18d41cd --- /dev/null +++ b/fix-nix-ioctl-feature.patch @@ -0,0 +1,25 @@ +diff --git a/blkio/Cargo.toml b/blkio/Cargo.toml +index ca3f24d..4148840 100644 +--- a/blkio/Cargo.toml ++++ b/blkio/Cargo.toml +@@ -28,6 +28,6 @@ concat-idents = "1.1" + const-cstr = "0.3" + io-uring = { version = "0.5.10", optional = true } + lazy_static = "1.1" +-nix = { version = "0.24", default-features = false, features = ["event", "feature", "fs", "mman"] } ++nix = { version = "0.24", default-features = false, features = ["event", "feature", "fs", "ioctl", "mman"] } + pci-driver = { version = "0.1.2", default-features = false, optional = true } + virtio-driver = { path = "../virtio-driver", version = "0.4.1", default-features = false, optional = true } +diff --git a/virtio-driver/Cargo.toml b/virtio-driver/Cargo.toml +index 94c18d3..2ba6f63 100644 +--- a/virtio-driver/Cargo.toml ++++ b/virtio-driver/Cargo.toml +@@ -17,7 +17,7 @@ _unsafe-op-in-unsafe-fn = [] + + [dependencies] + bitflags = "1.2" +-nix = { version = "0.24", default-features = false, features = ["event"] } ++nix = { version = "0.24", default-features = false, features = ["event", "ioctl"] } + memmap2 = { version = ">=0.1, <0.6", optional = true } + pci-driver = { version = "0.1.2", default-features = false, optional = true } + virtio-bindings = { version = "0.1", features = ["virtio-v5_0_0"], optional = true } diff --git a/libblkio.spec b/libblkio.spec index 9c0c4af..ad91f64 100644 --- a/libblkio.spec +++ b/libblkio.spec @@ -5,9 +5,10 @@ Version: 1.2.2 Summary: Block device I/O library Name: libblkio -Release: 4%{?dist} +Release: 5%{?dist} URL: %{forgeurl} Source0: %{forgesource} +Patch0: fix-nix-ioctl-feature.patch License: (Apache-2.0 OR MIT) AND (Apache-2.0 OR BSD-3-Clause) AND MIT AND BSD-3-Clause AND Unicode-DFS-2016 # Basic build requirements.