Skip to content

[Tracking/Asahi] Rust abstractions with rebased dependencies #964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 69 commits into
base: rust-next
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
38717bd
rust: kernel: Mark rust_fmt_argument as extern "C"
sulix Feb 14, 2023
bcfd851
soc: apple: rtkit: Add a private pointer to apple_rtkit_shmem
asahilina Jan 21, 2023
5f9a6ba
soc: apple: rtkit: Export non-devm init/free functions
asahilina Jan 21, 2023
3c3f227
drm/gem-shmem: Fix locking for drm_gem_shmem_get_pages_sgt()
asahilina Sep 7, 2022
a38c023
arm64: rust: Enable Rust support for AArch64
ojeda Jan 25, 2023
135e133
arm64: rust: Enable PAC support for Rust.
JamieCunliffe Jan 25, 2023
3ca7478
arm64: rust: Disable neon and fp target features.
JamieCunliffe Jan 25, 2023
4c9658b
rust: sync: impl {Debug,Display} for {Unique,}Arc
fbq Feb 7, 2023
a0fe4ac
sample: rust: print: Add sampe code for Arc printing
fbq Feb 7, 2023
05228e7
rust: time: New module for timekeeping functions
asahilina Oct 19, 2022
ea1e536
rust: macros: Make expect_punct() return the Punct directly
asahilina Jan 26, 2023
5341cab
rust: concat_idents: Allow :: paths in first argument
asahilina Nov 4, 2022
b41f846
rust: macros: Allow specifying multiple module aliases
asahilina Dec 5, 2022
8f9792c
rust: ioctl: Add ioctl number manipulation functions
asahilina Sep 24, 2022
4c2677a
rust: sync: arc: implement Arc<dyn Any + Send + Sync>::downcast()
asahilina Feb 15, 2023
7402be1
rust: Enable feature new_uninit for the kernel crate
asahilina Feb 11, 2023
b5907a1
rust: sync: arc: Add UniqueArc<MaybeUninit<T>::assume_init()
asahilina Nov 11, 2022
d898a36
rust: error: Add Error::to_ptr()
asahilina Sep 7, 2022
8b14bb1
rust: error: Add Error::from_kernel_errno()
asahilina Feb 5, 2023
86dcd64
rust: error: Add to_result() helper
asahilina Feb 5, 2023
b376b28
rust: error: Add a helper to convert a C ERR_PTR to a `Result`
May 13, 2021
f325dc8
rust: error: Add from_kernel_result!() macro
asahilina Feb 16, 2023
834ba12
rust: Import upstream `alloc::vec::set_len_on_drop` module
asahilina Feb 16, 2023
25c7313
rust: Import upstream `alloc::vec::spec_extend` module
asahilina Feb 16, 2023
bdeae64
rust: alloc: vec: Add some try_* methods we need
ojeda Feb 16, 2023
9a99c88
rust: xarray: Add an abstraction for XArray
asahilina Jan 11, 2023
3a1cbaa
rust: Add a Sealed trait
asahilina Feb 5, 2023
8d62ad9
rust: device: Add an abstraction for devices
wedsonaf Nov 18, 2021
6f5b56e
rust: io_pgtable: Add io_pgtable abstraction
asahilina Sep 7, 2022
07df4ec
rust: soc: apple: rtkit: Add Apple RTKit abstraction
asahilina Aug 17, 2022
45ac60a
rust: Add `container_of` and `offset_of` macros
wedsonaf Apr 1, 2021
0a8027a
Merge branch 'gpu/rust-for-next' into gpu/rust-for-next-merged
asahilina Feb 16, 2023
2adeb84
rust: sync: Add LockClassKey
asahilina Feb 11, 2023
7027dcc
*RFL import: kernel::types::Bool
asahilina Feb 11, 2023
795cb5a
*RFL import: sync::{NeedsLockClass, init_with_lockdep}
asahilina Feb 11, 2023
d15b9a8
*RFL import: kernel::sync::guard
asahilina Feb 11, 2023
07da528
*RFL import: kernel::sync::revocable
asahilina Feb 11, 2023
34fdf36
*RFL import: kernel::sync::mutex
asahilina Feb 11, 2023
016856e
*RFL import: kernel::sync::condvar
asahilina Feb 11, 2023
b1c6823
*RFL import: kernel::io_buffer
asahilina Feb 16, 2023
08177ac
*RFL import: kernel::user_ptr
asahilina Feb 16, 2023
d16349a
MISSING SIGNOFFS: rust: Add PAGE_SIZE constant to kernel crate
asahilina Feb 16, 2023
4629538
rust: Enable const_mut_refs feature for the kernel crate
asahilina Feb 16, 2023
22baf01
*RFL import: kernel::module_param
asahilina Feb 16, 2023
a6ee5e4
rust: upgrade to Rust 1.66.0
ojeda Dec 24, 2022
ea8a2f3
*RFL import: kernel::sync::rcu
asahilina Feb 16, 2023
78b035f
*RFL import: kernel::revocable
asahilina Feb 16, 2023
655b626
rust: Add `name` argument to Module::init()
asahilina Feb 16, 2023
902093b
*RFL import: kernel::driver
asahilina Feb 16, 2023
ec02e27
*RFL import: The rest of kernel::device (minus clk stuff)
asahilina Feb 16, 2023
de5c754
*RFL import: kernel::io_mem
asahilina Feb 16, 2023
39c35af
*RFL import: kernel::of
asahilina Feb 16, 2023
3377089
*RFL import: kernel::platform
asahilina Feb 16, 2023
34ec403
*RFL import: kernel::delay
asahilina Feb 16, 2023
e4ba141
rust: of: Add OF node abstraction
asahilina Oct 21, 2022
7b95ca3
rust: driver,of: Support passing ID tables to modpost for alias gener…
asahilina Dec 8, 2022
e51694e
rust: platform: add `ioremap_resource` and `get_resource` methods
Feb 8, 2022
397a8e5
rust: kernel: platform: Add Device.set_dma_masks()
asahilina Sep 7, 2022
f3abda2
rust: Add ioremap_np support to io_mem & friends
asahilina Sep 21, 2022
be407a2
*RFL import: macros::module params functionality & deps
asahilina Feb 16, 2023
0114070
*RFL import: Rest of kernel::error::code::*
asahilina Feb 16, 2023
a4e674e
rust: bindings: Add resource_size wrapper
asahilina Sep 7, 2022
e4cde92
rust: Allow feature new_uninit
asahilina Sep 8, 2022
46ada3b
rust: Allow feature allocator_api
asahilina Feb 16, 2023
191e859
*RFL import: kernel::KParamGuard & friends
asahilina Feb 16, 2023
b58c395
*RFL import: kernel::error::Error Debug impl & dependencies
asahilina Feb 16, 2023
bbff966
*RFL import: kernel::sync::smutex
asahilina Feb 16, 2023
eb5fa47
iommu/io-pgtable: Add Apple UAT variant format
asahilina Aug 17, 2022
c8f9f69
rust: io_pgtable: Add the Apple UAT format abstraction
asahilina Feb 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rust: sync: arc: Add UniqueArc<MaybeUninit<T>::assume_init()
Signed-off-by: Asahi Lina <[email protected]>
  • Loading branch information
asahilina committed Feb 16, 2023
commit b5907a17475738a6ddf74b50f73f3cf13625d423
8 changes: 8 additions & 0 deletions rust/kernel/sync/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@ impl<T> UniqueArc<MaybeUninit<T>> {
/// Converts a `UniqueArc<MaybeUninit<T>>` into a `UniqueArc<T>` by writing a value into it.
pub fn write(mut self, value: T) -> UniqueArc<T> {
self.deref_mut().write(value);
unsafe { self.assume_init() }
}

/// Returns a UniqueArc<T>, assuming the MaybeUninit<T> has already been initialized.
///
/// # Safety
/// The contents of the UniqueArc must have already been fully initialized.
pub unsafe fn assume_init(self) -> UniqueArc<T> {
let inner = ManuallyDrop::new(self).inner.ptr;
UniqueArc {
// SAFETY: The new `Arc` is taking over `ptr` from `self.inner` (which won't be
Expand Down