Skip to content

Commit df89726

Browse files
committed
Merge tag 'vfs-6.18-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
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
2 parents e571372 + c37adf3 commit df89726

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19863,6 +19863,7 @@ M: Christian Brauner <christian@brauner.io>
1986319863
L: linux-kernel@vger.kernel.org
1986419864
S: Maintained
1986519865
T: git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
19866+
F: rust/kernel/pid_namespace.rs
1986619867
F: samples/pidfd/
1986719868
F: tools/testing/selftests/clone3/
1986819869
F: tools/testing/selftests/pid_namespace/

rust/kernel/fs/file.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
use crate::{
1111
bindings,
1212
cred::Credential,
13-
error::{code::*, Error, Result},
14-
types::{ARef, AlwaysRefCounted, NotThreadSafe, Opaque},
13+
error::{code::*, to_result, Error, Result},
14+
sync::aref::{ARef, AlwaysRefCounted},
15+
types::{NotThreadSafe, Opaque},
1516
};
1617
use core::ptr;
1718

@@ -398,9 +399,8 @@ impl FileDescriptorReservation {
398399
pub fn get_unused_fd_flags(flags: u32) -> Result<Self> {
399400
// SAFETY: FFI call, there are no safety requirements on `flags`.
400401
let fd: i32 = unsafe { bindings::get_unused_fd_flags(flags) };
401-
if fd < 0 {
402-
return Err(Error::from_errno(fd));
403-
}
402+
to_result(fd)?;
403+
404404
Ok(Self {
405405
fd: fd as u32,
406406
_not_send: NotThreadSafe,

rust/kernel/pid_namespace.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
//! C header: [`include/linux/pid_namespace.h`](srctree/include/linux/pid_namespace.h) and
88
//! [`include/linux/pid.h`](srctree/include/linux/pid.h)
99
10-
use crate::{
11-
bindings,
12-
types::{AlwaysRefCounted, Opaque},
13-
};
10+
use crate::{bindings, sync::aref::AlwaysRefCounted, types::Opaque};
1411
use core::ptr;
1512

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

0 commit comments

Comments
 (0)