Skip to content

Conversation

@mulkieran
Copy link
Member

@mulkieran mulkieran commented Oct 30, 2025

@mulkieran mulkieran added this to the 0.5.3 milestone Oct 30, 2025
@mulkieran mulkieran self-assigned this Oct 30, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Walkthrough

A new 0.5.3 release is introduced with updated Rust toolchain requirements (1.90.0), improved Python development support on Fedora 42, increased minimum Rust version to 1.77.0, direct file descriptor attachment capability via LoopDevice, and raised bindgen lower bound to 0.72.0. Cargo.toml version is bumped to match.

Changes

Cohort / File(s) Summary
Version and Changelog Update
CHANGES.txt, Cargo.toml
Added new 0.5.3 release section documenting Rust toolchain bumps (1.90.0), Python Fedora 42 support, minimum Rust version increase (1.77.0), direct file descriptor attachment feature, and bindgen lower bound raise (0.72.0). Cargo.toml version incremented from 0.5.2 to 0.5.3.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • These are straightforward version updates and changelog documentation with no functional code changes or logic modifications.

Possibly related issues

Possibly related PRs

Poem

🐰 A version hops forth, from two-five to three,
With Rust toolchain climbing, dependencies spree,
Fedora's now dancing, file descriptors gleam,
Bindgen bounds raised—a maintainer's dream! 🚀

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "loopdev-3 v0.5.3" directly and clearly summarizes the main change in the changeset. The primary modifications are a version bump from 0.5.2 to 0.5.3 in Cargo.toml and a corresponding release documentation entry in CHANGES.txt with the associated features and tooling updates for this version. The title is concise, specific, and unambiguous—a reviewer scanning the commit history would immediately understand this is a version release PR. The title avoids vagueness and accurately reflects the core purpose of the changeset.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fecb95d and 64cbd2a.

📒 Files selected for processing (2)
  • CHANGES.txt (1 hunks)
  • Cargo.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: rpm-build:fedora-rawhide-x86_64:copr_pull
  • GitHub Check: rpm-build:fedora-41-x86_64:copr_pull
  • GitHub Check: rpm-build:fedora-42-x86_64:copr_pull
  • GitHub Check: rpm-build:fedora-43-x86_64:copr_pull
  • GitHub Check: rpm-build:fedora-43-x86_64:copr_pull
  • GitHub Check: rpm-build:fedora-41-x86_64:copr_pull
  • GitHub Check: rpm-build:fedora-42-x86_64:copr_pull
  • GitHub Check: rpm-build:fedora-rawhide-x86_64:copr_pull
  • GitHub Check: Check (aarch64-unknown-linux-gnu)
  • GitHub Check: Check (aarch64-linux-android)
  • GitHub Check: Check (aarch64-unknown-linux-musl)
  • GitHub Check: Lints
🔇 Additional comments (2)
Cargo.toml (1)

4-4: Version bump consistent with release notes.

The version is correctly incremented to 0.5.3, and the rust-version (1.77.0) aligns with the lowest supported version stated in CHANGES.txt. Dependencies remain unchanged from 0.5.2.

CHANGES.txt (1)

1-26: Release notes well-structured and consistent with Cargo.toml.

The 0.5.3 release notes clearly document the key changes: increased minimum Rust support (1.77.0), direct FD attachment capability, updated bindgen lower bound (0.72.0), and maintenance improvements. The recommended toolchain version (1.90.0) appropriately exceeds the minimum. All referenced versions align with Cargo.toml.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mulkieran mulkieran moved this to In Progress in 2025October Oct 30, 2025
Signed-off-by: mulhern <amulhern@redhat.com>
@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/stratis-storage-loopdev-3-72-copr_pull
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@mulkieran
Copy link
Member Author

All non-infra changes:

iff --git a/Cargo.toml b/Cargo.toml
index 8d30f6a..d06b658 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,9 @@
 [package]
 name = "loopdev-3"
 description = "Setup and control loop devices"
-version = "0.5.2"
+version = "0.5.3"
 authors = ["Stratis Developers <stratis-devel@lists.fedorahosted.org>", "Michael Daffin <michael@daffin.io>"]
-rust-version = "1.74.0"
+rust-version = "1.77.0"  # LOWEST SUPPORTED RUST TOOLCHAIN
 license = "MIT"
 documentation = "https://docs.rs/loopdev-3"
 repository = "https://github.com/stratis-storage/loopdev-3"
@@ -24,7 +24,7 @@ errno = "0.3.0"
 libc = "0.2.133"
 
 [build-dependencies]
-bindgen = "0.71.0"
+bindgen = "0.72.0"
 
 [dev-dependencies]
 glob = "0.3.0"
diff --git a/Makefile b/Makefile
index 65e0346..2d4c483 100644
--- a/Makefile
+++ b/Makefile
@@ -40,11 +40,15 @@ audit:
 build:
        cargo ${BUILD}
 
+doc-test:
+       cargo test --doc
+
 .PHONY:
        audit
        build
        check-fedora-versions
        clippy
+       doc-test
        fmt
        fmt-ci
        test-compare-fedora-versions
diff --git a/src/lib.rs b/src/lib.rs
index 28f5209..adb4c28 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -118,7 +118,7 @@ impl LoopControl {
                 LOOP_CTL_GET_FREE as IoctlRequest,
             )
         })?;
-        LoopDevice::open(format!("{}{}", LOOP_PREFIX, dev_num))
+        LoopDevice::open(format!("{LOOP_PREFIX}{dev_num}"))
     }
 
     /// Add and opens a new loop device.
@@ -144,7 +144,7 @@ impl LoopControl {
                 n as c_int,
             )
         })?;
-        LoopDevice::open(format!("{}{}", LOOP_PREFIX, dev_num))
+        LoopDevice::open(format!("{LOOP_PREFIX}{dev_num}"))
     }
 }
 
@@ -236,11 +236,7 @@ impl LoopDevice {
     /// for further details) or when calling the ioctl to attach the backing
     /// file to the device.
     pub fn attach_file<P: AsRef<Path>>(&self, backing_file: P) -> io::Result<()> {
-        let info = loop_info64 {
-            ..Default::default()
-        };
-
-        Self::attach_with_loop_info(self, backing_file, info)
+        Self::attach_with_loop_info(self, backing_file, loop_info64::default())
     }
 
     /// Attach the loop device to a file with `loop_info64`.
@@ -260,13 +256,7 @@ impl LoopDevice {
     /// Attach the loop device to a fd with `loop_info`.
     fn attach_fd_with_loop_info(&self, bf: impl AsRawFd, info: loop_info64) -> io::Result<()> {
         // Attach the file
-        ioctl_to_error(unsafe {
-            ioctl(
-                self.device.as_raw_fd() as c_int,
-                LOOP_SET_FD as IoctlRequest,
-                bf.as_raw_fd() as c_int,
-            )
-        })?;
+        self.attach_fd(bf.as_raw_fd())?;
 
         let result = unsafe {
             ioctl(
@@ -285,6 +275,36 @@ impl LoopDevice {
         }
     }
 
+    /// Attach the loop device to a file descriptor of an already opened file
+    /// # Examples
+    ///
+    /// Attach the device to a file descriptor.
+    ///
+    /// ```no_run
+    /// use std::fs::OpenOptions;
+    /// use loopdev::LoopDevice;
+    /// let file = OpenOptions::new().read(true).write(true).open("disk.img").unwrap();
+    /// let mut ld = LoopDevice::open("/dev/loop0").unwrap();
+    /// ld.attach_fd(file).unwrap();
+    /// # ld.detach().unwrap();
+    /// ```
+    ///
+    /// # Errors
+    ///
+    /// This file descriptor needs to be already opened and can fail otherwise
+    /// with an IO error.
+    pub fn attach_fd(&self, fd: impl AsRawFd) -> io::Result<()> {
+        ioctl_to_error(unsafe {
+            ioctl(
+                self.device.as_raw_fd() as c_int,
+                LOOP_SET_FD as IoctlRequest,
+                fd.as_raw_fd() as c_int,
+            )
+        })?;
+
+        Ok(())
+    }
+
     /// Get the path of the loop device.
     pub fn path(&self) -> Option<PathBuf> {
         let mut p = PathBuf::from("/proc/self/fd");
diff --git a/tests/integration_test.rs b/tests/integration_test.rs
index 5d6fb8c..84bd1cc 100644
--- a/tests/integration_test.rs
+++ b/tests/integration_test.rs
@@ -18,7 +18,7 @@ fn get_next_free_device() {
 
     assert_eq!(
         ld0.path(),
-        Some(PathBuf::from(&format!("/dev/loop{}", num_devices_at_start))),
+        Some(PathBuf::from(&format!("/dev/loop{num_devices_at_start}"))),
         "should find the first loopback device"
     );
 }

@mulkieran mulkieran merged commit 22a7608 into stratis-storage:master Oct 31, 2025
14 of 15 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in 2025October Oct 31, 2025
@mulkieran mulkieran deleted the loopdev-3-version-0.5.3 branch October 31, 2025 00:25
@mulkieran mulkieran moved this from Done to Done(3) in 2025October Nov 4, 2025
@mulkieran mulkieran moved this from Done(3) to Done(4) in 2025October Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done(4)

Development

Successfully merging this pull request may close these issues.

1 participant