Commit df897265 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull vfs rust updates from Christian Brauner:
 "This contains a few minor vfs rust changes:

   - Add the pid namespace Rust wrappers to the correct MAINTAINERS
     entry

   - Use to_result() in the Rust file error handling code

   - Update imports for fs and pid_namespce Rust wrappers"

* tag 'vfs-6.18-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  rust: file: use to_result for error handling
  pid: add Rust files to MAINTAINERS
  rust: fs: update ARef and AlwaysRefCounted imports from sync::aref
  rust: pid_namespace: update AlwaysRefCounted imports from sync::aref
parents e5713721 c37adf34
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19863,6 +19863,7 @@ M: Christian Brauner <christian@brauner.io>
L:	linux-kernel@vger.kernel.org
S:	Maintained
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
F:	rust/kernel/pid_namespace.rs
F:	samples/pidfd/
F:	tools/testing/selftests/clone3/
F:	tools/testing/selftests/pid_namespace/
+5 −5
Original line number Diff line number Diff line
@@ -10,8 +10,9 @@
use crate::{
    bindings,
    cred::Credential,
    error::{code::*, Error, Result},
    types::{ARef, AlwaysRefCounted, NotThreadSafe, Opaque},
    error::{code::*, to_result, Error, Result},
    sync::aref::{ARef, AlwaysRefCounted},
    types::{NotThreadSafe, Opaque},
};
use core::ptr;

@@ -398,9 +399,8 @@ impl FileDescriptorReservation {
    pub fn get_unused_fd_flags(flags: u32) -> Result<Self> {
        // SAFETY: FFI call, there are no safety requirements on `flags`.
        let fd: i32 = unsafe { bindings::get_unused_fd_flags(flags) };
        if fd < 0 {
            return Err(Error::from_errno(fd));
        }
        to_result(fd)?;

        Ok(Self {
            fd: fd as u32,
            _not_send: NotThreadSafe,
+1 −4
Original line number Diff line number Diff line
@@ -7,10 +7,7 @@
//! C header: [`include/linux/pid_namespace.h`](srctree/include/linux/pid_namespace.h) and
//! [`include/linux/pid.h`](srctree/include/linux/pid.h)

use crate::{
    bindings,
    types::{AlwaysRefCounted, Opaque},
};
use crate::{bindings, sync::aref::AlwaysRefCounted, types::Opaque};
use core::ptr;

/// Wraps the kernel's `struct pid_namespace`. Thread safe.