Commit ebf2b8a7 authored by Valentin Obst's avatar Valentin Obst Committed by Miguel Ojeda

rust: kernel: unify spelling of refcount in docs

Replace instances of 'ref-count[ed]' with 'refcount[ed]' to increase
consistency within the Rust documentation. The latter form is used more
widely in the rest of the kernel:

```console
$ rg '(\*|//).*?\srefcount(|ed)[\s,.]' | wc -l
1605
$ rg '(\*|//).*?\sref-count(|ed)[\s,.]' | wc -l
43
```

(numbers are for commit 052d5343 ("Merge tag 'exfat-for-6.8-rc1'
of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat"))
Signed-off-by: default avatarValentin Obst <kernel@valentinobst.de>
Reviewed-by: default avatarTrevor Gross <tmgross@umich.edu>
Reviewed-by: default avatarMartin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20240131-doc-fixes-v3-v3-7-0c8af94ed7de@valentinobst.de
[ Reworded to use the kernel's commit description style. ]
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent 4c62348d
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
/// b: u32, /// b: u32,
/// } /// }
/// ///
/// // Create a ref-counted instance of `Example`. /// // Create a refcounted instance of `Example`.
/// let obj = Arc::try_new(Example { a: 10, b: 20 })?; /// let obj = Arc::try_new(Example { a: 10, b: 20 })?;
/// ///
/// // Get a new pointer to `obj` and increment the refcount. /// // Get a new pointer to `obj` and increment the refcount.
...@@ -510,7 +510,7 @@ fn deref(&self) -> &Self::Target { ...@@ -510,7 +510,7 @@ fn deref(&self) -> &Self::Target {
/// # test().unwrap(); /// # test().unwrap();
/// ``` /// ```
/// ///
/// In the following example we first allocate memory for a ref-counted `Example` but we don't /// In the following example we first allocate memory for a refcounted `Example` but we don't
/// initialise it on allocation. We do initialise it later with a call to [`UniqueArc::write`], /// initialise it on allocation. We do initialise it later with a call to [`UniqueArc::write`],
/// followed by a conversion to `Arc<Example>`. This is particularly useful when allocation happens /// followed by a conversion to `Arc<Example>`. This is particularly useful when allocation happens
/// in one context (e.g., sleepable) and initialisation in another (e.g., atomic): /// in one context (e.g., sleepable) and initialisation in another (e.g., atomic):
...@@ -560,7 +560,7 @@ impl<T> UniqueArc<T> { ...@@ -560,7 +560,7 @@ impl<T> UniqueArc<T> {
/// Tries to allocate a new [`UniqueArc`] instance. /// Tries to allocate a new [`UniqueArc`] instance.
pub fn try_new(value: T) -> Result<Self, AllocError> { pub fn try_new(value: T) -> Result<Self, AllocError> {
Ok(Self { Ok(Self {
// INVARIANT: The newly-created object has a ref-count of 1. // INVARIANT: The newly-created object has a refcount of 1.
inner: Arc::try_new(value)?, inner: Arc::try_new(value)?,
}) })
} }
...@@ -574,7 +574,7 @@ pub fn try_new_uninit() -> Result<UniqueArc<MaybeUninit<T>>, AllocError> { ...@@ -574,7 +574,7 @@ pub fn try_new_uninit() -> Result<UniqueArc<MaybeUninit<T>>, AllocError> {
data <- init::uninit::<T, AllocError>(), data <- init::uninit::<T, AllocError>(),
}? AllocError))?; }? AllocError))?;
Ok(UniqueArc { Ok(UniqueArc {
// INVARIANT: The newly-created object has a ref-count of 1. // INVARIANT: The newly-created object has a refcount of 1.
// SAFETY: The pointer from the `Box` is valid. // SAFETY: The pointer from the `Box` is valid.
inner: unsafe { Arc::from_inner(Box::leak(inner).into()) }, inner: unsafe { Arc::from_inner(Box::leak(inner).into()) },
}) })
......
...@@ -39,7 +39,7 @@ macro_rules! current { ...@@ -39,7 +39,7 @@ macro_rules! current {
/// ///
/// All instances are valid tasks created by the C portion of the kernel. /// All instances are valid tasks created by the C portion of the kernel.
/// ///
/// Instances of this type are always ref-counted, that is, a call to `get_task_struct` ensures /// Instances of this type are always refcounted, that is, a call to `get_task_struct` ensures
/// that the allocation remains valid at least until the matching call to `put_task_struct`. /// that the allocation remains valid at least until the matching call to `put_task_struct`.
/// ///
/// # Examples /// # Examples
...@@ -163,7 +163,7 @@ pub fn wake_up(&self) { ...@@ -163,7 +163,7 @@ pub fn wake_up(&self) {
} }
} }
// SAFETY: The type invariants guarantee that `Task` is always ref-counted. // SAFETY: The type invariants guarantee that `Task` is always refcounted.
unsafe impl crate::types::AlwaysRefCounted for Task { unsafe impl crate::types::AlwaysRefCounted for Task {
fn inc_ref(&self) { fn inc_ref(&self) {
// SAFETY: The existence of a shared reference means that the refcount is nonzero. // SAFETY: The existence of a shared reference means that the refcount is nonzero.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment