Skip to content

Commit d896492

Browse files
committed
fix puzzlefs_dependencies_v2 branch for 6.6.0-rc4
https://github.com/ariel-miculas/linux/tree/puzzlefs_dependencies_v2
1 parent 3982a6e commit d896492

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

rust/bindings/bindings_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/poll.h>
1919
#include <linux/uio.h>
2020
#include <linux/uaccess.h>
21+
#include <linux/delay.h>
2122

2223
/* `bindgen` gets confused at certain things. */
2324
const size_t BINDINGS_ARCH_SLAB_MINALIGN = ARCH_SLAB_MINALIGN;

rust/kernel/delay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use core::{cmp::min, time::Duration};
1010
const MILLIS_PER_SEC: u64 = 1_000;
1111

1212
fn coarse_sleep_conversion(duration: Duration) -> core::ffi::c_uint {
13-
let milli_as_nanos = Duration::MILLISECOND.subsec_nanos();
13+
let milli_as_nanos = Duration::from_millis(1).subsec_nanos();
1414

1515
// Rounds the nanosecond component of `duration` up to the nearest millisecond.
1616
let nanos_as_millis = duration.subsec_nanos().wrapping_add(milli_as_nanos - 1) / milli_as_nanos;

rust/kernel/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ impl<A: OpenAdapter<T::OpenData>, T: Operations> OperationsVtable<A, T> {
616616
None
617617
},
618618
get_unmapped_area: None,
619-
iterate: None,
620619
iterate_shared: None,
621620
iopoll: None,
622621
lock: None,
@@ -654,6 +653,7 @@ impl<A: OpenAdapter<T::OpenData>, T: Operations> OperationsVtable<A, T> {
654653
} else {
655654
None
656655
},
656+
uring_cmd_iopoll: None,
657657
};
658658

659659
/// Builds an instance of [`struct file_operations`].

rust/kernel/fs.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl<T: Type + ?Sized> Tables<T> {
227227
Super::SingleReconf => unsafe {
228228
// SAFETY: `fc` is valid per the callback contract. `fill_super_callback` also has
229229
// the right type and is a valid callback.
230-
bindings::get_tree_single_reconf(fc, Some(Self::fill_super_callback))
230+
bindings::get_tree_single(fc, Some(Self::fill_super_callback))
231231
},
232232
Super::Independent => unsafe {
233233
// SAFETY: `fc` is valid per the callback contract. `fill_super_callback` also has
@@ -528,7 +528,7 @@ impl Registration {
528528
align_of::<INodeWithData<T::INodeData>>() as _,
529529
bindings::SLAB_RECLAIM_ACCOUNT
530530
| bindings::SLAB_MEM_SPREAD
531-
| bindings::SLAB_ACCOUNT,
531+
| bindings::BINDINGS_SLAB_ACCOUNT,
532532
Some(Self::inode_init_once_callback::<T>),
533533
)
534534
};
@@ -538,7 +538,7 @@ impl Registration {
538538
}
539539
}
540540

541-
let mut fs = this.fs.get();
541+
let fs = this.fs.get();
542542
// SAFETY: `fs` is valid as it points to the `self.fs`.
543543
unsafe {
544544
(*fs).owner = module.0;
@@ -1100,7 +1100,7 @@ impl<T: Type + ?Sized> SuperBlock<T> {
11001100
let time = unsafe { bindings::current_time(&mut outer.inode) };
11011101
outer.inode.i_mtime = time;
11021102
outer.inode.i_atime = time;
1103-
outer.inode.i_ctime = time;
1103+
outer.inode.__i_ctime = time;
11041104

11051105
outer.inode.i_ino = params.ino;
11061106
outer.inode.i_mode = params.mode & 0o777 | mode_type;
@@ -1278,7 +1278,7 @@ pub struct Module<T: Type> {
12781278
}
12791279

12801280
impl<T: Type + Sync> crate::Module for Module<T> {
1281-
fn init(_name: &'static CStr, module: &'static ThisModule) -> Result<Self> {
1281+
fn init(module: &'static ThisModule) -> Result<Self> {
12821282
let mut reg = Pin::from(Box::try_new(Registration::new())?);
12831283
reg.as_mut().register::<T>(module)?;
12841284
Ok(Self {

rust/kernel/types.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ pub trait ForeignOwnable: Sized {
3737
/// which a previous matching [`ForeignOwnable::from_foreign`] hasn't been called yet.
3838
unsafe fn borrow<'a>(ptr: *const core::ffi::c_void) -> Self::Borrowed<'a>;
3939

40+
/// Mutably borrows a foreign-owned object.
41+
///
42+
/// # Safety
43+
///
44+
/// `ptr` must have been returned by a previous call to [`ForeignOwnable::into_foreign`] for
45+
/// which a previous matching [`ForeignOwnable::from_foreign`] hasn't been called yet.
46+
/// Additionally, all instances (if any) of values returned by [`ForeignOwnable::borrow`] and
47+
/// [`ForeignOwnable::borrow_mut`] for this object must have been dropped.
48+
unsafe fn borrow_mut(ptr: *const core::ffi::c_void) -> ScopeGuard<Self, fn(Self)> {
49+
// SAFETY: The safety requirements ensure that `ptr` came from a previous call to
50+
// `into_foreign`.
51+
ScopeGuard::new_with_data(unsafe { Self::from_foreign(ptr) }, |d| {
52+
d.into_foreign();
53+
})
54+
}
55+
4056
/// Converts a foreign-owned object back to a Rust-owned one.
4157
///
4258
/// # Safety

0 commit comments

Comments
 (0)