From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C5A31C68C; Tue, 16 Jan 2024 16:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mow4E-1qmZCE25Ne-00qV0H; Tue, 16 Jan 2024 17:02:36 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 01/13] rust: kernel: fix multiple typos in documentation Date: Tue, 16 Jan 2024 17:01:26 +0100 Message-ID: <20240116160141.165951-2-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:5a5kO99YMVZNCl/XnVf1l8Q43RLe84qbmVpAjJJUvblmFHUDQnc d2yrMIVdBjyqZ/ZdLoK+i7NLcTeVnZ+EsNQf5uB3TeVBpr/Tv0zVRId31su0SmtfRxYc3RP qlG1AV32/tSs0SuUPZIHW5hkr+Vyb+j6JS/orrQbASsWPShNVeMZ7IJ0I3BrcTQ/1CleH4G Li+OFgSa4baAGQIwcdt9g== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:U5M+o6PWla4=;xCZsCsV91GvI0tFrcS7Xo1Uz4my ebA6L5c6sqI5O/vBEzw3fxL6z80pNP6X7dKqHFMLI1H2o5x30RAJ4Sw5p/ar1bON01TyBIDCz O8CimUDHvWb7ngLVjZQznQLM/5zGwCe82qZFTNrFZD5pyX8WicIrWccd8iTR8GmCfnFzodEEh iDoCHerH7D7zhK7VWpgMUChY/cCprLf6q/ZU1eeEO/oXev0SVtWX971R1xiDElpD5CWQUPC29 xzAdm+Z3TxcQlQsc6AoYA5AoQSyEaidkn5LDpK8D0oI3MF9rkK7gWZFDeSviJUh/r4w0ATibE Rxi9Tct0hb+FvO7edkatUfVp+7FDB6VW0eY8CxWN/PRO66bAOJ7F0AVg+zgOBGs+CWHdAv0p4 myjbUM/PtRT8Bm2yPHl3cO70LIbSrFbkuxiwiAbgiD3YvgxSXJd26qQp+jEx3Ta7jocwC6Wpv bLxD7gPZOQQJGazRGjdXUDPs8HSjA21pe9lJuCRm3s4T8vyRBExbsrKQPn+HGBKEexLvNq0cn 7WBk1c8+bz855Zr3Op6NEF4/kdzyJ6an5iXbBPY7/xgxhxrreuUhEsrle9XX1ckdDRqaufjMI OdhlZqM/qqbEHBbkwArssfwVUVxN+7jBDYaoenidQBFWQW1R1Rx5c/Y/cO2kG++xczbhN4waK C5IPentpGMurez4JSMGH6N7+XOrXtw4YxaDoB38TO82fxyv+6ybxBEd7P9B775nov1cxSz5nz eRv6qge/dPkEsvHsx1IXx3FbZt03b+2BOYjtAq0TwMuc4y/FEL7sFQZ7pTD3oaKLGGd8qt+Pn qBK8tqrk1cL9heSNGfI68AYS/pybLYx/j0L3NHoU+brs+SFmfikCpxRv8aLxVTV8Il58UpYaI Wk2lE5mpT+7nwDA== Content-Type: text/plain; charset="utf-8" Fixes multiple trivial typos in documentation and comments of the kernel crate. allocator: - Fix a trivial list item alignment issue in the last SAFETY comment of `krealloc_aligned`. init: - Replace 'type' with 'trait' in the doc comments of the `PinInit` and `Init` traits. - Add colons before starting lists. - Add spaces between the type and equal sign to respect the code formatting rules in example code. - End a sentence with a full stop instead of a colon. ioctl: - Replace 'an' with 'a' where appropriate. str: - Replace 'Return' with 'Returns' in the doc comment of `bytes_written` as the text describes what the function does. sync/lock/spinlock: - The code in this module operates on spinlocks, not mutexes. Thus, replace 'mutex' with 'spinlock' in the SAFETY comment of `unlock`. workqueue: - Replace "wont" with "won't" in the doc comment of `__enqueue`. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/allocator.rs | 2 +- rust/kernel/init.rs | 16 ++++++++-------- rust/kernel/ioctl.rs | 4 ++-- rust/kernel/str.rs | 2 +- rust/kernel/sync/lock/spinlock.rs | 2 +- rust/kernel/workqueue.rs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/rust/kernel/allocator.rs b/rust/kernel/allocator.rs index 4b057e837358..01ad139e19bc 100644 --- a/rust/kernel/allocator.rs +++ b/rust/kernel/allocator.rs @@ -35,7 +35,7 @@ unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layo= ut, flags: bindings::gf // - `ptr` is either null or a pointer returned from a previous `k{re}= alloc()` by the // function safety requirement. // - `size` is greater than 0 since it's either a `layout.size()` (whi= ch cannot be zero - // according to the function safety requirement) or a result from `= next_power_of_two()`. + // according to the function safety requirement) or a result from `n= ext_power_of_two()`. unsafe { bindings::krealloc(ptr as *const core::ffi::c_void, size, fla= gs) as *mut u8 } } =20 diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs index 65be9ae57b80..16a99984622c 100644 --- a/rust/kernel/init.rs +++ b/rust/kernel/init.rs @@ -751,10 +751,10 @@ macro_rules! try_init { /// /// # Safety /// -/// When implementing this type you will need to take great care. Also the= re are probably very few +/// When implementing this trait you will need to take great care. Also th= ere are probably very few /// cases where a manual implementation is necessary. Use [`pin_init_from_= closure`] where possible. /// -/// The [`PinInit::__pinned_init`] function +/// The [`PinInit::__pinned_init`] function: /// - returns `Ok(())` if it initialized every field of `slot`, /// - returns `Err(err)` if it encountered an error and then cleaned `slot= `, this means: /// - `slot` can be deallocated without UB occurring, @@ -861,10 +861,10 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result= <(), E> { /// /// # Safety /// -/// When implementing this type you will need to take great care. Also the= re are probably very few +/// When implementing this trait you will need to take great care. Also th= ere are probably very few /// cases where a manual implementation is necessary. Use [`init_from_clos= ure`] where possible. /// -/// The [`Init::__init`] function +/// The [`Init::__init`] function: /// - returns `Ok(())` if it initialized every field of `slot`, /// - returns `Err(err)` if it encountered an error and then cleaned `slot= `, this means: /// - `slot` can be deallocated without UB occurring, @@ -1013,7 +1013,7 @@ pub fn uninit() -> impl Init, E>= { /// /// ```rust /// use kernel::{error::Error, init::init_array_from_fn}; -/// let array: Box<[usize; 1_000]>=3D Box::init::(init_array_from_f= n(|i| i)).unwrap(); +/// let array: Box<[usize; 1_000]> =3D Box::init::(init_array_from_= fn(|i| i)).unwrap(); /// assert_eq!(array.len(), 1_000); /// ``` pub fn init_array_from_fn( @@ -1027,7 +1027,7 @@ pub fn init_array_from_fn( // Counts the number of initialized elements and when dropped drop= s that many elements from // `slot`. let mut init_count =3D ScopeGuard::new_with_data(0, |i| { - // We now free every element that has been initialized before: + // We now free every element that has been initialized before. // SAFETY: The loop initialized exactly the values from 0..i a= nd since we // return `Err` below, the caller will consider the memory at = `slot` as // uninitialized. @@ -1056,7 +1056,7 @@ pub fn init_array_from_fn( /// /// ```rust /// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mut= ex}; -/// let array: Arc<[Mutex; 1_000]>=3D +/// let array: Arc<[Mutex; 1_000]> =3D /// Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i))).unwrap(); /// assert_eq!(array.len(), 1_000); /// ``` @@ -1071,7 +1071,7 @@ pub fn pin_init_array_from_fn( // Counts the number of initialized elements and when dropped drop= s that many elements from // `slot`. let mut init_count =3D ScopeGuard::new_with_data(0, |i| { - // We now free every element that has been initialized before: + // We now free every element that has been initialized before. // SAFETY: The loop initialized exactly the values from 0..i a= nd since we // return `Err` below, the caller will consider the memory at = `slot` as // uninitialized. diff --git a/rust/kernel/ioctl.rs b/rust/kernel/ioctl.rs index f1d42ab69972..59050e5f5a5a 100644 --- a/rust/kernel/ioctl.rs +++ b/rust/kernel/ioctl.rs @@ -28,13 +28,13 @@ pub const fn _IO(ty: u32, nr: u32) -> u32 { _IOC(uapi::_IOC_NONE, ty, nr, 0) } =20 -/// Build an ioctl number for an read-only ioctl. +/// Build an ioctl number for a read-only ioctl. #[inline(always)] pub const fn _IOR(ty: u32, nr: u32) -> u32 { _IOC(uapi::_IOC_READ, ty, nr, core::mem::size_of::()) } =20 -/// Build an ioctl number for an write-only ioctl. +/// Build an ioctl number for a write-only ioctl. #[inline(always)] pub const fn _IOW(ty: u32, nr: u32) -> u32 { _IOC(uapi::_IOC_WRITE, ty, nr, core::mem::size_of::()) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 7d848b83add4..0a8569594fc3 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -449,7 +449,7 @@ pub(crate) fn pos(&self) -> *mut u8 { self.pos as _ } =20 - /// Return the number of bytes written to the formatter. + /// Returns the number of bytes written to the formatter. pub(crate) fn bytes_written(&self) -> usize { self.pos - self.beg } diff --git a/rust/kernel/sync/lock/spinlock.rs b/rust/kernel/sync/lock/spin= lock.rs index 068535ce1b29..e5e0bf621988 100644 --- a/rust/kernel/sync/lock/spinlock.rs +++ b/rust/kernel/sync/lock/spinlock.rs @@ -112,7 +112,7 @@ unsafe fn lock(ptr: *mut Self::State) -> Self::GuardSta= te { =20 unsafe fn unlock(ptr: *mut Self::State, _guard_state: &Self::GuardStat= e) { // SAFETY: The safety requirements of this function ensure that `p= tr` is valid and that the - // caller is the owner of the mutex. + // caller is the owner of the spinlock. unsafe { bindings::spin_unlock(ptr) } } } diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index 498397877376..8775c34d12a5 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -253,7 +253,7 @@ fn run(mut this: Pin>) { /// actual value of the id is not important as long as you use different i= ds for different fields /// of the same struct. (Fields of different structs need not use differen= t ids.) /// -/// Note that the id is used only to select the right method to call durin= g compilation. It wont be +/// Note that the id is used only to select the right method to call durin= g compilation. It won't be /// part of the final executable. /// /// # Safety --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F025C1C686; Tue, 16 Jan 2024 16:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MeToK-1qpL9E40VY-00aWQh; Tue, 16 Jan 2024 17:02:37 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 02/13] rust: error: move unsafe block into function call Date: Tue, 16 Jan 2024 17:01:27 +0100 Message-ID: <20240116160141.165951-3-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:8YpdJM1GEeWDxH67CiH/gY2p2t5FekIWFaebx3JG/FApIvD6c+1 KA1ivQpbnXVGPZeHY18lF7JbGHwSuJRGTYFEfs4t8pO1LTRhw2gArE1+9Nghc4PRRgOns+U IQ+7ns++opvOiuh7FmD9yXxaLBMiDMRoWbO0ri95uXOGonyDeAeDsqBN8Oayq0vJd+rqdf9 Ni4CnrD/TGCtSaogYzKFQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:vfE4pxrJzRA=;T6tpxL0/72IvcsGh63L8yn0ff9A en6NnaOJkZzpWwHGTP1pOi+MM9TVMmCJpOz/NvS6h9DdGFy03ClTT+MorjaXDpdw6NIx4JVlP TOT+8ZY8pu/9PPwvsKOtMvzv72GjDAio2dYXQ4el/F+l1RVOnNbGbpWc5tAD8NpMrdW4+IjIw 98lJzIPkODHjOZ2GC1MflMf+YpcNBQsFQ1ruzzRIAHAC/rLjzXqSXMVCYXtnPeJKaVqIMX6K4 8xB5zdZHCBLm0cwUFufFVtQU1vWxpGUp1xr8a2CUsdVe6D+QqQVZDHupPYPXL/w9DrnKAHk2g eqyque/ZqUQBQ0Q4V26zxjcOW0Ct1nHDrY06SZJ7JhYEKaf7aCE/p9zdxNcywEzXq2p36UKVo ItqQa+MwHZbrG6AZreYne3g4JTtkAaC9M4sWMyiFWpKvXe9y54Ituvw3x29n5QZMtNll3Ezge aJmBY4XulN5wa+76YGhaXeLmsuU6plPyYWycoBgG8u2NuHmjoGBEVQLEzeZllweWrRSA7/BOq WbORVUU/pL461S8YUOrSbwTYqaMEdjPLDLvRQju7qDGf478O8XMC9LW5MPW6/yEJs+I5CuQp1 HJeax00F/Me8wooTp9AG24DEMVjBINVSxZy/Aco90gowOcNwjG/SAh4siOstSjALc98kIbG2h r419+NVaYPMCGcM6nSHcf/5OW59og0kk7HyruPO96KcCyDGy8PKbQIyg0SlDE8K8Fu1ACM5Rp vTTfk9dq2KJYjG/PeBxM3CAKHgOwJC9VWvsvujFS6bcPBZ2e19K3AfwqJBDd14XptY7Oiqinl OcOZS0NE1nLQe3YtVIbn/KkuaGkc7EqApKXYGscg9nzHTFd/FYGLNCo05DCBs5kw64+BGScW3 h6skzvWUQCoZaRPif6kgfLjDRyCZuQU5Jgd0= Content-Type: text/plain; charset="utf-8" The `from_err_ptr` function is safe. There is no need for the call to it to be inside the unsafe block. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/error.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 4f0c1edd63b7..6f6676bc0eb9 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -265,12 +265,7 @@ pub fn to_result(err: core::ffi::c_int) -> Result { /// index: u32, /// ) -> Result<*mut core::ffi::c_void> { /// // SAFETY: FFI call. -/// unsafe { -/// from_err_ptr(bindings::devm_platform_ioremap_resource( -/// pdev.to_ptr(), -/// index, -/// )) -/// } +/// from_err_ptr(unsafe { bindings::devm_platform_ioremap_resource(pde= v.to_ptr(), index) }) /// } /// ``` // TODO: Remove `dead_code` marker once an in-kernel client is available. --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD7EC1C2AF; Tue, 16 Jan 2024 16:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MCbVD-1rGfMM1ilP-009kbA; Tue, 16 Jan 2024 17:02:37 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 03/13] rust: ioctl: end top level module docs with full stop Date: Tue, 16 Jan 2024 17:01:28 +0100 Message-ID: <20240116160141.165951-4-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Vl604ifirTqxSRb0VeZq6n9STXQC2equyytItghMfY5eTvyOnz2 uM88EOQgOFfBZV2pVFZWqVdFt2heBqC3+1onll4HVVvSWl0hq/Sgvj1co03zc4404udJ0XO V0lzfaOqs4OQtaSkc+RqPiTOq/er+938r++R2R/p3ctFexrPFTJyqXphq6FQdvSgGKW5J85 nUvnBocn8ivhaATyEjn9w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:M8ewJpf3SNc=;6DkxcoBATZk9fCkhsgRqI9hD4de 97eMdKprz8PDEy7+1kgGahldajB3zz0kBfU477TFKBiWASXN3YHIczg4ufCS90nUVkTjLDFKD oBaqBowC8P8vESRyK6+q3XF3xdhiqO7eb3X+tBFPsusH/cUzZbAdFYgeu5zUCpcK+bWcduSCQ Gq7FCJ5oLOa6/YNeXKLqKi9n+X49JDuQ2v00ISAqr76zEhJuhNmFqwGbiRI9eYYe0upLuUq4g 1PnlbtQFDQgj98grVp4pGExl+txnDyXCOtayxSmJqUQQas9HyASK0udF0rhKb7DYyEfG+u68j HZCkRXZMZBEL/610uLcZNDzqzRngKWRs1zRakzCaMEWGr9d73UKrWyW4x3qQk8/roAdyUDe6v 1eAv1y5ifzpxO6DjIDjbMWjzSMxT3FeNagV/rIlq7U+xTkEgerrDscSuGkYnnXILzv/8le9Rs tHoee+FN5oCr52YX726iYwTDtb/FUe6Lvarfbv+c+g62CozwGlQbsXWD3vnHjGNqgnJr7Vsvr TTBYhZJwOrex3TyrKrImIAgw8PJS/GTtEUgftDiYXV+/V8ejUj7/bEU4OppS0NKTGpjmrz1ow asiEX25v56sRgxvhcHxiydFfIZDtL3fRo5MQCkOw0I3K/FisbQoTb9GfNvLiEUhApz4viL0V/ xiQuqITQXfFExAhimf53hjod/OAqqk/uS0q/8yyPd6I6n/hXGczCxhk7tDd21faL9OfCHXys5 UneRJXfZs9Qam1u4exGbAWNutykFCEU75MOJviyc85JazhAG9s3hkX6BP9qhBhjzHY8+VSl3b QrgU5B4XQ4cicDDTyF09avY9zhTS9bxMei0LUKY4P/+o5zYQF90tZGVeqNZOb4tvR7IS0AcPo OelptaDa0dTRYsQ== Content-Type: text/plain; charset="utf-8" Every other module ends its first line of documentation with a full stop. Adapt the only outlier. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/ioctl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/ioctl.rs b/rust/kernel/ioctl.rs index 59050e5f5a5a..5987ad6d38a7 100644 --- a/rust/kernel/ioctl.rs +++ b/rust/kernel/ioctl.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 =20 -//! ioctl() number definitions +//! ioctl() number definitions. //! //! C header: [`include/asm-generic/ioctl.h`](srctree/include/asm-generic/= ioctl.h) =20 --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AE7120B02; Tue, 16 Jan 2024 22:05:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.72.192.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442735; cv=none; b=uEttqz2Mv17plhfb5+D+6IkuMQAg4U09vCyfRRxRMApR+rwfv9ZRUd6eTBJX3C8O6jGMLSbfuOJNMKsMvjfC7WdeLzZfH6ABihelpvqDOB61PQZqjAx5MFjNBd9rTD4E4ScTtGMR/+a3ItP9y590NaXxHiFVThksJyoIQoJHrBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442735; c=relaxed/simple; bh=v3W324I3SJN5eST/f93Ey55QMVR0yTzOUMu2onl9OUo=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=QYmLgj2niyxc646i/ZbLp4CdddHgj/Ait9nsV2p7dK75xXvbrmjMNGzvhVAXLiMpmhJ6wn8KD941lDMnJ7dWrBXd6m6mIp6mdbWTDPpimG/4VyPV2JK95OSKjCJLFCkNhS+EbY9v4ivjSDEQ2hJPPcrvcntDyeo4+5A2hpBiROM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=217.72.192.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MTREY-1rZe9L2Zf2-00TjKy; Tue, 16 Jan 2024 23:05:11 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 04/13] rust: kernel: add srctree-relative doclinks Date: Tue, 16 Jan 2024 23:04:10 +0100 Message-ID: <20240116220411.168016-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:0M/3h7s7GfvVM/sxSkwa13j4UXMw4UFVXCpvMlk36g4VyCdY5Av OpuLrkYGR2CTa0uchs9tvp44C5cLONl9yZzzNKwRHjmSOVtWZWANmcrllTypzFRDeC9bYy5 njtvU/C/HW3BH0Qv97g5SubpLt62cTWKHLvOYrsj5G+USM8b5tZ0yZsfH0BPBMmGdTSLApM uc2SC1Dq7y+yHtEsN4IGw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:karToRGKwJs=;uQ8K1v7C/+Wu1/QtFmFaiddcSo0 7aM4nFV9VR1/HqQilEl5s21ew29uEuaIZfn72dP0+1Ql5lZ4O3pzFDwx55RG4hdMMqAMeNJlC pHuad1+d5GhhOdD6OCNEELTmfJ2e8BFceTWDV9IIc0K4ZZ0nV8MpUD4FV9lPVEH1XQBDvJWEt DE/UM2Gva7O2WiTuUkRE9BqHbC1K2PPgA63kCzOA0HX2JYLZglrGZTrF85lBBgKrKxqgHWpXE H7DQymgZoVRNeHTT4L4b5Uu46fFnGF3qRuDLCmCc/sel3RvWXltCilfu/3KziGC+X1mhBS4xZ 4SAMUd47/IWQRD/dJrMX5VvHUDMi6e0mubSrpLiBvvhZlyUmHVYZdqQfEsnxsvx76ydQgF+jc lZ1Khpr7rkdxyJcX5Ovf4j+52OBmADhGHtBgTcBoofLU9R6YzGnkhxAyXZ87EaSB02bgEPMcw /q/eTZv+FFGRqdh6zo517pW5ELsKzsVyLqmO7JqKD9FtpU/4sxDkd/r0hSV25iZYaptT5h/x+ SgBydIBhJ8fWxELgbDU94LtayPlJL3SkRkiiJ3mO4eZrK6CVCP69lXSZlojirpvrko2BrydUV iEMxOLo5kULu3dG5l2umGK0LJQY5bCk0Na+nF/4bYSP4XMTQGotvC1fQEMKNACRH4jLpKCkNw +jLPiuzsXC9Huq+bocJTiKQAFwpn9LMd3txpda2EgO1i/N20SbicY19TLE5M+FWHKnKxmTr3v PKUephOrwVcWwW8v6gaO+N+oUZy1FoAE1OIDwNWTkAGlOIjV65mb8eC6CF3Cr1CfytNEyL0/P Us/BhLxoyldPeH3Uto60ujLd7TBh45sfxLIGiwePrK2a0zkH8Y9QErSBahAEFDM7ZB+5CwKq+ NAewvcPu8JiJXiQ== Content-Type: text/plain; charset="utf-8" Convert existing references to C header files to make use of Commit bc2e7d5c298a ("rust: support `srctree`-relative links"). Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/lib.rs | 2 +- rust/kernel/sync/condvar.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index e6aff80b521f..0d365c71cae2 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -75,7 +75,7 @@ pub trait Module: Sized + Sync { =20 /// Equivalent to `THIS_MODULE` in the C API. /// -/// C header: `include/linux/export.h` +/// C header: [`include/linux/export.h`](srctree/include/linux/export.h) pub struct ThisModule(*mut bindings::module); =20 // SAFETY: `THIS_MODULE` may be used from all threads within a module. diff --git a/rust/kernel/sync/condvar.rs b/rust/kernel/sync/condvar.rs index f65e19d5a37c..0bb76400efd9 100644 --- a/rust/kernel/sync/condvar.rs +++ b/rust/kernel/sync/condvar.rs @@ -77,6 +77,8 @@ pub struct CondVar { =20 /// A condvar needs to be pinned because it contains a [`struct list_h= ead`] that is /// self-referential, so it cannot be safely moved once it is initiali= sed. + /// + /// [`struct list_head`]: srctree/include/linux/types.h #[pin] _pin: PhantomPinned, } --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED28520B06; Tue, 16 Jan 2024 22:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442763; cv=none; b=k/ilOKYBDnjkICxlvBi2psIWE7JHxjtxOSg9UaIaMQK/2xOsiSZEmbqpYpWlD0w7ydJQQL1qbNDe5PVrQKXcF/Vp5p41TIxi/kA0wDIWlHVEbBZHNE/6OVkyKQ1wGykj22yODixTNwZRzHhqgpehiEaztefbHmV0K/qQo5efLzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442763; c=relaxed/simple; bh=MvyFTKEIKMUi/DveRQH714RaRZQ4hMyEjMvMk9I2Kc4=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=nGyESQEZgCVCMydIQIu4G0Qy/EUmBbQYr0iu5IH+DdFfrfLv0FGJjIPFReRifPep4ECDxEQfsqLygmw42dk2cmkpzMjVKoRUWMzKKTD6z41vZz748EXmj9U1/2DeNzz1OXCeHpDPi7DPNLNqFu+OYCaY/hdCLsByMu/IHTK43KU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.17.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MQ5jC-1rlmA60xtI-00M2Ho; Tue, 16 Jan 2024 23:05:46 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 05/13] rust: str: use `NUL` instead of 0 in doc comments Date: Tue, 16 Jan 2024 23:05:37 +0100 Message-ID: <20240116220537.168057-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:fQ/n+K82znhGVU06WPCL16qfSsnfY7jriAWKz19BeTo/jchs9x2 jj2Cevp5lAEpIIYImIjab/lXFlPzmiQQUHAJZHW1o9INn06euHr+OuxP+pXxtVRpunF3ZVm qHD//ro97BAS9SRU5YNCi7MDgDu9/0ydJehlB4Oahb44L0aHjT9FP330/I/9lu2MXHvtsaB 9K2Y50PZaFM57fB1MjCDw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:v6zN5nHqZvI=;w2vTl94Fb9dj+FV+Lczts64wvK2 3P/qtnHf66kv75rVrJLkpnsDbDy4+rM+dwtc8S3+q9yn0Znzcd2uKsfT6DvTRU9nfDYRizYXR DhEdqYL/BeCiWDmnUpd+uE4Xmz2zkCw7Ky3lyOW+fBXcQDcz+sLNHJyq5c0LNXdvRyvuYkkmM f+18Tu52QFVD26ITkI/fN0pKlv38JmuPPiDvFZQaa3Si4wWYRcTV1IRJ7Sb4uox7bcQHZOb3J sJ0UqIEOqJDuSMZLDiTVnSIPa4GB7qiCx/Ouf/6dGmcK0gaaYqCCIZod48xx6rL0juJZLpAt9 EtxDasdoE8rINUWmjJ8g7wHFCOw8qkEHWQxPeyL+HvGPZpiS/uRMBh4uneyauNb/pGjvntUmk ArIiv6m5ffd6gJaHrbcOmZhKUmlcPnt9MTmmj0IcD2Twk6XTeP8/81bmGnWUDqJk0tKj/8BgY 56gt18Uu02UI662vLN0d3lU5ZT0SEuBlSjmYY78Q75eFVJsTieWPWwGVwGJgTt3aBj0Uar77V m6orRB3WglfXaOVSKovYX/BuslJcU5Qg/LmVVn2IhyKYOocIAIuWi0gyCzKxVc3MYeHWrMJQt 7pmoLWNRddfDOCoNJhfFw5ZW7lZ22yE8NWxrSIUwRR2VA87paKre5wmw8h7Z38/uq9m9U/Hq0 OXDdtnRmY2QPz9jz80yRUEzIxqKj/R1Ogo80K3zd8Db35psnxGjKZ/Do9O+qrxjfcrpnXTSx4 jR2TZshVhcmNDO12InKP6bv6ac0devVSIFsMQGLbU7SaPkybsn2R/U1PsCZ7Q/5YsmRoe5+/E qwYk7w5Y48I2btBYKCrulCPYTU8FTH1gvEjCVaQ43/0/pUDcHKQtDMYTfZjR3sgLKh+ytsIt5 60FBjwlj+lgjjjQ== Content-Type: text/plain; charset="utf-8" Throughout the module, bytes with the value zero are referred to as `NUL` bytes. Adapt the only two outliers. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/str.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 0a8569594fc3..843ffeec9b3e 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -149,13 +149,13 @@ pub const fn as_char_ptr(&self) -> *const core::ffi::= c_char { self.0.as_ptr() as _ } =20 - /// Convert the string to a byte slice without the trailing 0 byte. + /// Convert the string to a byte slice without the trailing `NUL` byte. #[inline] pub fn as_bytes(&self) -> &[u8] { &self.0[..self.len()] } =20 - /// Convert the string to a byte slice containing the trailing 0 byte. + /// Convert the string to a byte slice containing the trailing `NUL` b= yte. #[inline] pub const fn as_bytes_with_nul(&self) -> &[u8] { &self.0 --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6883C482C5; Tue, 16 Jan 2024 22:06:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442798; cv=none; b=ncLpNUDP6rVBA7je8M67ZQTVg8omVdLPoziGLSyX90r/VpwOWxt3s6mqvmgHzhp0h8/RkXKc/57DoI/OWjgTM/t0zLvvt0qDCRVuDXdF2s0xPt0p3BLH/tI8sd5OydaR7/oYC/0Kag4lytsj+VYUOEwh/8vZ8mbt3kJ/cBVFPlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442798; c=relaxed/simple; bh=qk5bZBH+v41bJbF9eA7PUNh+z+ew2nxhcrsQeadaNNY=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding: X-Provags-ID:X-Spam-Flag:UI-OutboundReport; b=HxBuy0+K+r3q8eiBESNUBRDIZ60i7EYGZb4IIUpwsSyDiMDyxH+VUDFWwZU371urm5vaqqC+K2mrmuzZuMCWxNnjGE+plE6rQ8w7OP0PsnjDf0v2zQxaXk9NIdvQiwO8ciGgJXmqVwHBFA3WotFalX6FHkCQe+MEkssbwgrkROI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MTRAS-1rZe8B0H0e-00TkmV; Tue, 16 Jan 2024 23:06:23 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 06/13] rust: str: move SAFETY comment in front of unsafe block Date: Tue, 16 Jan 2024 23:06:08 +0100 Message-ID: <20240116220615.168083-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:92bNKdsjs75qSuvDF2FfcB++cPal267HLhMmtY/xJxJoC3ADGN1 Q0SezTBfAlV6TObTXq/zXit0+qvLYh5/dYlHlk1bPM2kICVcDSNmVON061S5cgGZpoknMuR a2yEumtbq/wshozvCHePnlTDJGeXEJGfhNEevVJRwW1ruSQWCtm32mt7xQq3WCo1NvzPaih rL/R6VUX7Dn8WKCH7eupQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:IDkEWhURD7c=;ReOjbrZ1lRUgApOj8G512ld2rTl aQs7HB5kgSZXS6lHwfPaeXaHxoZ2OpWlmXyb04o8nQo8QtRcdjzvERRCOyv6t2vpknYmWf/Rh z9cjszLazIMHfX4PE5pQssyfLVD5v4XaTzMazV2Voo9juG8U/oOATNg2uwGnvlGjlxo6YUR9K Hb9o53W2yCkumbzLM3gqrtGJZeJVO8cmcwwl28KDQBXh/YEWWWAtiWp41rHq2auHVAlVSyIZo YrHjJpgOa1g7+Qr06o4UMyHj3/SNxEe77QCwCrHy0FTttlRPh3fS1DLmW4P5ai83VHK2IOnRP YoB0iJ1eHGHwfgIvPfqrd/j6EJUm0aKjPlyXdY86kh+YUk6OZhYv7hLvUCoNxbAiDxu8zJeSM SQzQw1wPlP6Ktlpl4eCCw2yAoCk8POJN0lWSlPRFDxldxkzDiCHLXQ/V8Vay6S/kQRWz9mt6e ibwo6WzLSqYg4x4WxPAfZJhMUamd7ige1FWWYijTTUJazH0nJiSTVWfYipaul6+e1wPq/S6rv NUuT+PUF+cAKZlvqx5/pF1uad1auLfgdtawVH+4sAyT6TljbD6aBEJ8Whcbn37FyjjRH0T4XI Z0tjlVKjGzxAnFEClmooSG3Yrosh3gr26aA8nxichmw1Cbd3MppzpmSmZJc1P0mB5RZ4m7rmK JURAwDyOG/0fz/jgwCz6LaU7Op+TqtRNIk9byzpOz2o8eeOGVpECgUaUOIz0ANaLiWWHzRq6S 1pcMfC5HUmvEM/NY2UkCoN9rPpZwFAJ9Yr1E4O1RTClipec0ViW3v7qWABY1vbUSRcitcOx2n wvIt3M4HoHMTJxrcOS+j/f6nbFt1Q5rtZGR9er3yrixeDnKbelUM+SUYtu1z+qPzHV3sMnpqF r50BBcY5rmvXpBw== SAFETY comments should immediately precede the unsafe block they justify. Move assignment to `bar` past comment as it is safe. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/str.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 843ffeec9b3e..fec5c4314758 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -191,9 +191,9 @@ pub fn to_str(&self) -> Result<&str, core::str::Utf8Err= or> { /// ``` /// # use kernel::c_str; /// # use kernel::str::CStr; + /// let bar =3D c_str!("=E3=83=84"); /// // SAFETY: String literals are guaranteed to be valid UTF-8 /// // by the Rust compiler. - /// let bar =3D c_str!("=E3=83=84"); /// assert_eq!(unsafe { bar.as_str_unchecked() }, "=E3=83=84"); /// ``` #[inline] --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A277C50257; Tue, 16 Jan 2024 22:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442820; cv=none; b=Pa2pDR8DIZwPkdeQRtUqNpoCYQEkbN0WZH43+rWD2r7K11ktUNCIvDcABHxokwNjJZSN8uI2qVrc8HSp2GIDbBFK2cSY69FJciwS4yaGgZRqVe5GzLn+ia2Q9TsZTnIsparGPWaXCkwWXs9+WJlEBylVBuIiQC4O3rsjyj5vJmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442820; c=relaxed/simple; bh=j6+7rgEBCA/c/X5mKHo3VbMlssDcyBdbuCJWJNRxt8Y=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=XBc9f+D7lub7wMlqyrAllmU6s/1UEOYCQRR7ozyQu0EG3KYHSoHFS7NFzgrOmBLEtOtSVQHa2bscmiOTC5KFZJDqO72hg91Rku1TZo1pgOjxME8Qpkx0vdLYXVvz5X7vL/T5HO3YL4VjtdzAEbfAAiZ61p10sjB7qhZBeMPLFM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MaIvV-1rc6xa1LD3-00WIzb; Tue, 16 Jan 2024 23:06:43 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 07/13] rust: kernel: unify spelling of refcount in docs Date: Tue, 16 Jan 2024 23:06:34 +0100 Message-ID: <20240116220634.168103-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:LZw9oJjc57o5/lxghWGfTXEHpI9wO52N1Q7vBXUMuSrIikpUuFA /wRPeTCC2FC5I/fWxcg7HujN9BJ+9cfiyDvjerjofCYWK++qkNsZyn95dq7U3woXNxmTGEO I9HM7AYgD+VwsB3weGkdVoiOaZj99wNY/JsAqO3Wb5AmsQIsuznp679kqB5sOzqosRwkfmb X12P/4799wzyUNlPKdcGA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:B7paRzsauwk=;7Zg8OGMbyonRRdQLeSvE8EbvRuH DeuAgOrBxtUqEl++ypVX6kVQ42yPvKWxVh3lkhsKTLG4+5vxbEnD0htObVnBgt36h8eVG3byo n2TadqXG+CErGNXT0FtGoJ9RBDmoWvmcUvLxx5k8vcbhkQA8IsM3pTqDkNoor/LoTQqLVI/lu EJWbunYfwA6XLGkvfgR2KD7V9vz+KCD96d7XzvL6Xg3nOHlcpO0uX9M8oXMzz8xOitzFu3Aro Qw8yMkMjVpkQ9QrGeOoa2FhbJEl+db7cqc7DvoXmg0n/rpo3Y6ktWsKpOwnLh+zCZ2AagYH62 LqMEjwilo5mugSIspBAKutImXdlEJDrD3zYn4xdlpaf0JPsxNghUh5I/NdFRQMOb9b/6ImMXj FuZELfBjJrBxB6OakEpfZa7jO83kWJiVKUyWutSybzCPJKxtErGUvhzIsrVug/0A3tkKtkyJy qwMMLd15SBoskdXmlKgs2KySrFANzkr5IUsb8wgW6jZRBzrgpiszzN2MzhVGMJ6HlKeTV4/YH kklnuK+2JB3Uz4b+FQL+1RwWL0y+4NuFSMlmeRaFRiPqc90CeBXh6ZYWl3fXQNCckdv9VsVfA vTZRaQeJUxoqEffd3LJUG/vZTGlSMXOHy9EtQPpqLu5YKSJTp31hMqoc0AsVWUPfuM+YzrIp9 hNq4uIQliNqQ8SoOaHht2ZhgMbps9P9PTIDsU2dRUtDPw79H9qUxyNcP+EG0P37+7mDUxAkVv unIzN7nSuTm+LXfMClaBN/tY6CCUAFrRxD7QwClEPJ3c8p386XurE6YxeRqWuY8uLwTzxNsYr OX2jpxIiz9Wbw2cqQjlLNmHBqLVvskIoxZ9bh4zLCa4c3Lx2mP9+r+r8Es7vsUMSM5ZfqoOB0 Qrywc77cH789l9Q== Content-Type: text/plain; charset="utf-8" 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 052d534373b7) Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/sync/arc.rs | 8 ++++---- rust/kernel/task.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index 77cdbcf7bd2e..6c46b1affca5 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -56,7 +56,7 @@ /// b: u32, /// } /// -/// // Create a ref-counted instance of `Example`. +/// // Create a refcounted instance of `Example`. /// let obj =3D Arc::try_new(Example { a: 10, b: 20 })?; /// /// // Get a new pointer to `obj` and increment the refcount. @@ -510,7 +510,7 @@ fn deref(&self) -> &Self::Target { /// # test().unwrap(); /// ``` /// -/// In the following example we first allocate memory for a ref-counted `E= xample` but we don't +/// In the following example we first allocate memory for a refcounted `Ex= ample` but we don't /// initialise it on allocation. We do initialise it later with a call to = [`UniqueArc::write`], /// followed by a conversion to `Arc`. This is particularly usefu= l when allocation happens /// in one context (e.g., sleepable) and initialisation in another (e.g., = atomic): @@ -560,7 +560,7 @@ impl UniqueArc { /// Tries to allocate a new [`UniqueArc`] instance. pub fn try_new(value: T) -> Result { 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)?, }) } @@ -574,7 +574,7 @@ pub fn try_new_uninit() -> Result>, AllocError> { data <- init::uninit::(), }? AllocError))?; 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. inner: unsafe { Arc::from_inner(Box::leak(inner).into()) }, }) diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index 9451932d5d86..818ac51b06b6 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -23,7 +23,7 @@ macro_rules! current { /// /// 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`. /// /// # Examples @@ -147,7 +147,7 @@ pub fn wake_up(&self) { } } =20 -// 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 { fn inc_ref(&self) { // SAFETY: The existence of a shared reference means that the refc= ount is nonzero. --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 615AC747C; Tue, 16 Jan 2024 23:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446619; cv=none; b=S2IABM3eNLOPTMOjrOni9aPj/lKBu28mgV/6BiXAyL/LMaM4A1SdVp+guwSfMZcUWLRJVz7A7UNMA9YxBJuPBD/X646yuHxVKw9lJavzcGj/OJ1S/g+G6Oa24+2EapvJ+UzOJIOqstzk+MYJNrKpeLoludvhLG2OxXHnWmowGpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446619; c=relaxed/simple; bh=CZ7nKrqhhNF2pFJNM9siYB8MbfbW8gtSc1B3+Vk9ZE0=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=eAZC1Y1XuNzhHR14sbeQpKimzKgJdZd6SE/adrLpN/BuonSM02SGX5TzhMJ89RVNekRzMtKM9OWGEyD26KKbXC4QTTADCIHvc64REk5eHtvWUlj2agt30cbA7hLuI+2U5IjvOniXriZrv3ayuofD3vP3VZxiBLNPhnpYrrWD/Is= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mw9Dg-1r7Ni60Y9E-00s3Gk; Wed, 17 Jan 2024 00:09:58 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 08/13] rust: kernel: mark code fragments in docs with backticks Date: Wed, 17 Jan 2024 00:09:51 +0100 Message-ID: <20240116230951.168808-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:wsYRVP+9i0BrZ6my14LK0meIR1rCYBN7Lm9fbdVaOsY7zBcTIGO EEFNqthbwPz3ogMXHrVS8MRzcfsxnVkRhe468aOJoxMUd1PtiS5IAZiCMa8UMwdlcXBMz5H sK7qy8DuRGD8kSpw3ZPXgIwEtpD/gS0XzUalEeM4GRcD29oDz0DHd3RJPsvoNpCV9XlJNs1 OcVgL9xGHIi/iCz2q6TNg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:W30ecyRewBo=;wvY9r0144BnswLQcU8dj4le0K03 R5Ny7mbnEZ+eixrRf90+qoXDEoBwnMQ3W7DRtaPl1h4zuyixGJAENMhGplPQXg4aLoLagylmh 1BZmH79O+ILgG2pSQwnVBu8jgDFrClRKThjO/NmbcFwST34CAA2hgOM5//+DZZhp37LXIsm50 MLDtaPYCNfUiUKBUaoq8KycM9vgbSykaW6O/U8n73YDcG9HnhF2Xo+vZWso4rDSguvssUUY7M iXO14mX52V+9QhDBKQzzXhfr0LInsiZTrxFZLaHwihsHR4y8wJkE5xQDgSNE/8a+rKJHpMCLw PhAnSbuXzuWOVv8jOhX5UjE3Yo5BnRPDWW2biQBnA4Cbz/+sCABxDGvZPTyaahOMVdUOqWcLw u0lctsoy/+Bf+y0lbYpieZOh76LaQ1og8v4TaKV+WU8zc4zUjvOCWT/YLV4Nic0kgrke/FBWg relULteLJ++pCQN7vdKA0jXILwCYXxHG+ClV8mVL8HX6V4XwjWsASVJRjrMOd4ZuutPv7m7vW CYyaT3Bd2KfeMk+W+u7RU0x3ORpdoSsKo2I4kyqOIH8jTO1e9ledk6QKJuXnaZhFqtFX0Jh+c hi8EeQDjjoSqADJ4y+UTWJnSa2YpaQK8E5Fe+GvmkkIgHjgq7HbzJAtFDow8S5XTnQFa2Ej8o OnWXvNejIUXpGfkwjVuDpPdI1UJLvzdDqBuu9zCzTtew2GFl5OylxIKEhwszXN1frL/pFpoI0 7unrsr46/CvPqUUw76YJZkJA/Dye3xj4adJzhZDzdNi7tpUt/kF2fwXJNTUAAu2ZHbi7tlMpb ldtJcXj+6mlw9MMdMMvQ/AAIlpsaZmA99FZv6jduo/CJ5Uyk1oO6rL50dCfwmn6WR7YAyIUd7 WtKSDg+2rWStQoA== Content-Type: text/plain; charset="utf-8" Fix places where comments include code fragments that are not enclosed in backticks. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/ioctl.rs | 2 +- rust/kernel/sync/lock.rs | 2 +- rust/kernel/task.rs | 2 +- rust/kernel/workqueue.rs | 9 +++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/rust/kernel/ioctl.rs b/rust/kernel/ioctl.rs index 5987ad6d38a7..cfa7d080b531 100644 --- a/rust/kernel/ioctl.rs +++ b/rust/kernel/ioctl.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 =20 -//! ioctl() number definitions. +//! `ioctl()` number definitions. //! //! C header: [`include/asm-generic/ioctl.h`](srctree/include/asm-generic/= ioctl.h) =20 diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs index f12a684bc957..467249b39f71 100644 --- a/rust/kernel/sync/lock.rs +++ b/rust/kernel/sync/lock.rs @@ -28,7 +28,7 @@ pub unsafe trait Backend { /// The state required by the lock. type State; =20 - /// The state required to be kept between lock and unlock. + /// The state required to be kept between `lock` and `unlock`. type GuardState; =20 /// Initialises the lock. diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index 818ac51b06b6..d4b0d232480d 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -116,7 +116,7 @@ fn deref(&self) -> &Self::Target { /// Returns the group leader of the given task. pub fn group_leader(&self) -> &Task { // SAFETY: By the type invariant, we know that `self.0` is a valid= task. Valid tasks always - // have a valid group_leader. + // have a valid `group_leader`. let ptr =3D unsafe { *ptr::addr_of!((*self.0.get()).group_leader) = }; =20 // SAFETY: The lifetime of the returned task reference is tied to = the lifetime of `self`, diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index 8775c34d12a5..d900dc911149 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -168,7 +168,7 @@ impl Queue { /// # Safety /// /// The caller must ensure that the provided raw pointer is not dangli= ng, that it points at a - /// valid workqueue, and that it remains valid until the end of 'a. + /// valid workqueue, and that it remains valid until the end of `'a`. pub unsafe fn from_raw<'a>(ptr: *const bindings::workqueue_struct) -> = &'a Queue { // SAFETY: The `Queue` type is `#[repr(transparent)]`, so the poin= ter cast is valid. The // caller promises that the pointer is not dangling. @@ -414,8 +414,8 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut binding= s::work_struct { /// /// # Safety /// -/// The [`OFFSET`] constant must be the offset of a field in Self of type = [`Work`]. The methods on -/// this trait must have exactly the behavior that the definitions given b= elow have. +/// The [`OFFSET`] constant must be the offset of a field in `Self` of typ= e [`Work`]. The +/// methods on this trait must have exactly the behavior that the definiti= ons given below have. /// /// [`Work`]: Work /// [`impl_has_work!`]: crate::impl_has_work @@ -428,7 +428,8 @@ pub unsafe trait HasWork { =20 /// Returns the offset of the [`Work`] field. /// - /// This method exists because the [`OFFSET`] constant cannot be acces= sed if the type is not Sized. + /// This method exists because the [`OFFSET`] constant cannot be acces= sed if the type is not + /// `Sized`. /// /// [`Work`]: Work /// [`OFFSET`]: HasWork::OFFSET --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90671154A6; Tue, 16 Jan 2024 23:10:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446660; cv=none; b=rkkkdxT9h7M2JNGsZRPAt9FHmHBG/kMbhO5NM+tlTCfoxGV+PUCSE+nN/xiIIBY0h1BoprVKUlkLGMBHfAN0YeorufIFpeUCr/PZNx4Fl4k64VcCkywQlc/MDc7ntEJ4x46iV/UeIbDxn9wq4l5H5VaClxkzme7HwKyRhPhNT3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446660; c=relaxed/simple; bh=6kMEVkUtpENf3uILfGmx7CwIEW3QhLIKQG8D4rvGCJA=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=YgE3FkzvVPDFHruHXl+UFWB+fOmyWSgqTvP28zJu/QgxUDxjup+8m9upOGDCeOrykZn40ypDaZDyWUUXxXcmWSM2RoGkY9ykPBKwg4WuDM4Q/JTFvQIpkCO4AvvYA0s9SZqr21fXrr7oKzd1zAIyLf5t6qrPitGWyRDfQCFh3kE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MfpGL-1qx9X32FpJ-00gF75; Wed, 17 Jan 2024 00:10:44 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 09/13] rust: kernel: add blank lines in front of code blocks Date: Wed, 17 Jan 2024 00:10:35 +0100 Message-ID: <20240116231035.168838-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:GExkHjC2m4S4YEdTb4SLROcE6xv0Z0T/xFkMhp5M6sKfwUta1y0 1giNkzmUSLAcASxRgRoxVyGEv1FggmrU2BmMeXd5Vfq2Ly6YBRRXTqHtkmXEpcFtYQMze98 02rRZFRDA31TwayVtpH676fkJHqGVtE2P9wnQKZKNJ/qLTwII9DWqs/tN/5Mt6VPyNnxOqO i4ltBknD5pM9WpO5bcRDg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:3227nHjRX/A=;k5khFr9FsqthzRRubZhi++CxcZI jH4DDASQY7CRx9oNVgdSN2l8eXsrZegC/jMq6BwCDHzVGII0P4VEOtsg62d3H/sR6b5Z/lUp6 hQDZm2A/MZDSwpc7sdt42v69jbJFGa9W+A9RiB6vIUs7T0QO6MRqaW1lf5gPAAxK3PC5zKCFN 2A3h39pmnNp4cc1UFIZjWAwCrH5yuV5oJw8dGgSYDQK9F1cclVw2DbxbBPm40QGEVL8sZpXqv VkARNvwCto75dplhtA3QEVVYCIDk6YGPy+05xvQ/jVtYzZivtF7GpWe/82U/i7TUuqnRDJNTA 7oolEiBEw4vObu163oN04U7QUWOBenFlO3eabzMbkvyE0mEjN8KvLA8/d4mSXUIdd0gF7c8ok pfXLw1cmrx4OyHrCcJvW+edZWnVVA004PzrYZmrJsZmZQmxHAAvI8UA87hDDV8WY4ySr0PGGC LxYPrFdwwcjwqpxObP/ly6dW+pok8sLe2tO/1opRI56FuNxgePMJXTW6x/hPgVOjsWxVadi99 BcDHcW7qVF5fzdfe2F5+ZMHaZUmQ+yOEHNHB9EQi1Q6+VE5TbNodByMZ5wmgcVUYd9jCdYdxn NPqWxax8pulkCShmX53JWXoT5TkLiBSWaRZ6n5Ec4QC+eAM+F70J4AqAbV6XMxQ9CU8+mDktX pWZy1OYXe+f5rPjM5Ky6ZD5b1eHSKIjpAQQr0LRFQNDaM6K7H0y31CbMl66Z1HjgEgDL18RFq QAq5O+tGh1xEBG2vCyt0RWnVrZTZfZ9RGBa1D4qEIdnJezbTcEsveFI4PyoPecD95jF2ubKmV U60dcEOoKY3Hsb8AMj7yHVslk0NP2uyjBTtYULObfzg0/R2fhvA3pg7V+4/g91p2oDLcTaVjd 4rqbsgGOkgJm0Og== Content-Type: text/plain; charset="utf-8" Throughout the code base, blank lines are used before starting a code block. Adapt outliers to improve consistency within the kernel crate. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/types.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs index fdb778e65d79..8aabe348b194 100644 --- a/rust/kernel/types.rs +++ b/rust/kernel/types.rs @@ -90,6 +90,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Se= lf {} /// /// In the example below, we have multiple exit paths and we want to log r= egardless of which one is /// taken: +/// /// ``` /// # use kernel::types::ScopeGuard; /// fn example1(arg: bool) { @@ -108,6 +109,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> = Self {} /// /// In the example below, we want to log the same message on all early exi= ts but a different one on /// the main exit path: +/// /// ``` /// # use kernel::types::ScopeGuard; /// fn example2(arg: bool) { @@ -129,6 +131,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> = Self {} /// /// In the example below, we need a mutable object (the vector) to be acce= ssible within the log /// function, so we wrap it in the [`ScopeGuard`]: +/// /// ``` /// # use kernel::types::ScopeGuard; /// fn example3(arg: bool) -> Result { --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A13231CFBF; Tue, 16 Jan 2024 23:11:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446685; cv=none; b=Ncu/BSXxBq2D4wGnPLedFI+omQRjvgJ8gITh2ggCTrmSZKc55h4aiwi+R1ZeJ3K3+rJmP+ywECxPLp2vHXWN8QT4M9YdOnB/4iL3kJQW3mb6RUOSXXOAYwdlFIL98VpNMiAcriCe7FM1n3kzK2t8KGQyxoCDPG/f8JZumo8HjTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446685; c=relaxed/simple; bh=7MiaAc6W5AQRrrlOnAKaPlcWyVIYgzIpHuf2rLOhyAM=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=sUbpgn8NEVcu4dQn5sPrRddv20GrDMluQabpuMsRo/pOCtGt7euZz+i8baXCIvxvyGvXxkdsFmkwkgnxCQYyOHZXvGkKzFyPXneJVPSOTheTrcm4wCvK2Boqxmhes6RsC/DTq0ZDz2WR2AZChqYiqwxkYYmtfvPGV730Iuwh1Ds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mtf39-1r8kba2vOh-00v5AO; Wed, 17 Jan 2024 00:11:09 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 10/13] rust: kernel: add doclinks Date: Wed, 17 Jan 2024 00:11:06 +0100 Message-ID: <20240116231106.168864-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Z1CAg3hR5eUEZFAbmCMyk8n31l1hu3iGDoGIyb2TOJ9BQ6oZ66N xgh7g1pKxzlAf0WUIFDUKP6K/0/NaQU5EdLwvuiu82vHVUx/nWQVi7tTrEjqXbfEavV1qSq HrR7fNDf5NZEFnuJhaCpZnyoeNIhDAKWSzglIR75OwVbgo339n6EqHSswFeEYMbblYfusVm 74H2GunGWWkBY49egjj0A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:JXSp30eQ2Vw=;J/G1TkfLaA88yilc2Ul0f19oerM eaVn2VYzWEyaVDNjswDND3Sg+cPLdiaIvpcHAGh0B0O/0TG3NrFW6pYG7WVLF9pTLsOTEtYul 4Hw+Di5Fx/4HRpJe0f71AnukTzancGUDaRdCOb7cTvJKI1j0GZuA1voIp6mKXunWnoBEOFR1C 9TPfdxc1ye9TTZb1xvbx9ppe4V4X0zan3jFJ2xIl2PxwgDCTL9f6sN81Bi182naEKhQ+qWs5e jj3WiPAsKOfxPInmfGLuihc4tQzGCpxuVrcqzkQoa/dktCSCnM45L0clZQyZKCDCQZISiVYoi h8mGL+tRfuV0z2cNzlq179xNC6C1G/p2MN2ywDR3se14Jiq5R+lGB7biUVlFsy5nCqrsdnsi0 6jCOzPoOF8i9Eu6Epul8OUrwkhTg1KN7NbsXw0pkzTMRl7EVpgXgDL6SxDHV2tMaU90VMYpMd RWdnpeTOGmv137kNwdJF6GK6jWduZEBl8BTmd65z+CA4FCQGVryHPJLK99trx1U3UV4fRNwuu DlvCUq9BeN9CpNjK1S0zlK+iG4LpnWefkshVw/rNSf8hHNGMcgQ3exSbFqwLwWCOadZuBIqcY RPskhAnNRaBr9DHLgWJDg70DoEZfE1JoCV/lqh0akdfvzCZrKuSBLHSakldF8XiyPXejt0skj /ta1coK7kGwz9wAXiVEBtZo+vOgKunEFMZXGBgxwgKHTYdcSQjPfT7EQaGT1330USsvtECsvt P8bJHL/b0EU2c2L6Q4j2KeVm7L9xCq2NuYdtI4UrGVV2PGkuHqp8NZ2J2bEqm/iDGi5xXeHIN hqe6I7kFUUoNMFRKgrRrcNbMDc4iUvsyLfEZUaWgZ1QF7XikFcOlDhLD+kmP4L5TWgsCofrM2 vqZIJquE0icTWfg== Content-Type: text/plain; charset="utf-8" Add doclinks to existing documentation. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/sync/arc.rs | 6 +++--- rust/kernel/sync/lock.rs | 13 +++++++++--- rust/kernel/workqueue.rs | 45 ++++++++++++++++++++++++---------------- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index 6c46b1affca5..936bc549a082 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -365,12 +365,12 @@ fn from(item: Pin>) -> Self { /// A borrowed reference to an [`Arc`] instance. /// /// For cases when one doesn't ever need to increment the refcount on the = allocation, it is simpler -/// to use just `&T`, which we can trivially get from an `Arc` instance. +/// to use just `&T`, which we can trivially get from an [`Arc`] instan= ce. /// /// However, when one may need to increment the refcount, it is preferable= to use an `ArcBorrow` /// over `&Arc` because the latter results in a double-indirection: a p= ointer (shared reference) -/// to a pointer (`Arc`) to the object (`T`). An [`ArcBorrow`] eliminat= es this double -/// indirection while still allowing one to increment the refcount and get= ting an `Arc` when/if +/// to a pointer ([`Arc`]) to the object (`T`). An [`ArcBorrow`] elimin= ates this double +/// indirection while still allowing one to increment the refcount and get= ting an [`Arc`] when/if /// needed. /// /// # Invariants diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs index 467249b39f71..f14179d19d4e 100644 --- a/rust/kernel/sync/lock.rs +++ b/rust/kernel/sync/lock.rs @@ -21,14 +21,21 @@ /// # Safety /// /// - Implementers must ensure that only one thread/CPU may access the pro= tected data once the lock -/// is owned, that is, between calls to `lock` and `unlock`. -/// - Implementers must also ensure that `relock` uses the same locking me= thod as the original +/// is owned, that is, between calls to [`lock`] and [`unlock`]. +/// - Implementers must also ensure that [`relock`] uses the same locking = method as the original /// lock operation. +/// +/// [`lock`]: Backend::lock +/// [`unlock`]: Backend::unlock +/// [`relock`]: Backend::relock pub unsafe trait Backend { /// The state required by the lock. type State; =20 - /// The state required to be kept between `lock` and `unlock`. + /// The state required to be kept between [`lock`] and [`unlock`]. + /// + /// [`lock`]: Backend::lock + /// [`unlock`]: Backend::unlock type GuardState; =20 /// Initialises the lock. diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index d900dc911149..ed3af3491b47 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -12,19 +12,19 @@ //! //! # The raw API //! -//! The raw API consists of the `RawWorkItem` trait, where the work item n= eeds to provide an +//! The raw API consists of the [`RawWorkItem`] trait, where the work item= needs to provide an //! arbitrary function that knows how to enqueue the work item. It should = usually not be used //! directly, but if you want to, you can use it without using the pieces = from the safe API. //! //! # The safe API //! -//! The safe API is used via the `Work` struct and `WorkItem` traits. Furt= hermore, it also includes -//! a trait called `WorkItemPointer`, which is usually not used directly b= y the user. +//! The safe API is used via the [`Work`] struct and [`WorkItem`] traits. = Furthermore, it also +//! includes a trait called [`WorkItemPointer`], which is usually not used= directly by the user. //! -//! * The `Work` struct is the Rust wrapper for the C `work_struct` type. -//! * The `WorkItem` trait is implemented for structs that can be enqueue= d to a workqueue. -//! * The `WorkItemPointer` trait is implemented for the pointer type tha= t points at a something -//! that implements `WorkItem`. +//! * The [`Work`] struct is the Rust wrapper for the C `work_struct` typ= e. +//! * The [`WorkItem`] trait is implemented for structs that can be enque= ued to a workqueue. +//! * The [`WorkItemPointer`] trait is implemented for the pointer type t= hat points at a something +//! that implements [`WorkItem`]. //! //! ## Example //! @@ -218,7 +218,9 @@ pub fn try_spawn(&self, f= unc: T) -> Result<(), All } } =20 -/// A helper type used in `try_spawn`. +/// A helper type used in [`try_spawn`]. +/// +/// [`try_spawn`]: Queue::try_spawn #[pin_data] struct ClosureWork { #[pin] @@ -258,9 +260,11 @@ fn run(mut this: Pin>) { /// /// # Safety /// -/// Implementers must ensure that any pointers passed to a `queue_work_on`= closure by `__enqueue` +/// Implementers must ensure that any pointers passed to a `queue_work_on`= closure by [`__enqueue`] /// remain valid for the duration specified in the guarantees section of t= he documentation for -/// `__enqueue`. +/// [`__enqueue`]. +/// +/// [`__enqueue`]: RawWorkItem::__enqueue pub unsafe trait RawWorkItem { /// The return type of [`Queue::enqueue`]. type EnqueueOutput; @@ -290,10 +294,11 @@ unsafe fn __enqueue(self, queue_work_on: F) -> Sel= f::EnqueueOutput =20 /// Defines the method that should be called directly when a work item is = executed. /// -/// This trait is implemented by `Pin>` and `Arc`, and is mainly= intended to be +/// This trait is implemented by `Pin>` and [`Arc`], and is main= ly intended to be /// implemented for smart pointer types. For your own structs, you would i= mplement [`WorkItem`] -/// instead. The `run` method on this trait will usually just perform the = appropriate -/// `container_of` translation and then call into the `run` method from th= e [`WorkItem`] trait. +/// instead. The [`run`] method on this trait will usually just perform th= e appropriate +/// `container_of` translation and then call into the [`run`][WorkItem::ru= n] method from the +/// [`WorkItem`] trait. /// /// This trait is used when the `work_struct` field is defined using the [= `Work`] helper. /// @@ -309,8 +314,10 @@ pub unsafe trait WorkItemPointer: RawWo= rkItem { /// /// # Safety /// - /// The provided `work_struct` pointer must originate from a previous = call to `__enqueue` where - /// the `queue_work_on` closure returned true, and the pointer must st= ill be valid. + /// The provided `work_struct` pointer must originate from a previous = call to [`__enqueue`] + /// where the `queue_work_on` closure returned true, and the pointer m= ust still be valid. + /// + /// [`__enqueue`]: RawWorkItem::__enqueue unsafe extern "C" fn run(ptr: *mut bindings::work_struct); } =20 @@ -328,12 +335,14 @@ pub trait WorkItem { =20 /// Links for a work item. /// -/// This struct contains a function pointer to the `run` function from the= [`WorkItemPointer`] +/// This struct contains a function pointer to the [`run`] function from t= he [`WorkItemPointer`] /// trait, and defines the linked list pointers necessary to enqueue a wor= k item in a workqueue. /// /// Wraps the kernel's C `struct work_struct`. /// /// This is a helper type used to associate a `work_struct` with the [`Wor= kItem`] that uses it. +/// +/// [`run`]: WorkItemPointer::run #[repr(transparent)] pub struct Work { work: Opaque, @@ -409,7 +418,7 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut binding= s::work_struct { /// } /// ``` /// -/// Note that since the `Work` type is annotated with an id, you can have = several `work_struct` +/// Note that since the [`Work`] type is annotated with an id, you can hav= e several `work_struct` /// fields by using a different id for each one. /// /// # Safety @@ -429,7 +438,7 @@ pub unsafe trait HasWork { /// Returns the offset of the [`Work`] field. /// /// This method exists because the [`OFFSET`] constant cannot be acces= sed if the type is not - /// `Sized`. + /// [`Sized`]. /// /// [`Work`]: Work /// [`OFFSET`]: HasWork::OFFSET --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 965A61DA2C; Tue, 16 Jan 2024 23:11:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446697; cv=none; b=gOpulVKLC9e+wl0plkDFr2CnoZMCulnvR8v+Fa9ULL/NmCv1gd5mA1zyvspYRyVY8WmjWjIA3ERiVWwgwF5VisgKbSvlIqzMVk9xnwT+5UJu8fmt1Jh6IN1ucP9BcF+ENIQUQyBC/T5BC1hKi8uzA1VFpp27DM9XQJhdzqHFjPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446697; c=relaxed/simple; bh=MGssKXKFpJmMR/MBNNgGqevsBNhT1o85Az3TxIhlZAM=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=Nw9WMs2vAMRh//pqLFcRY4rGUe5S/rrgNPZ8W4JY2BSlIIQwVUiOM6jV3oKp0/TKEKK2uesUn2bQdVU5/qOky50cK7N27P3SecB3FbdA6hMUjWVpvUFdh+N8SFtIbgpRVHqW/SeZmHK0LMnVjTaRUsh6tgyEqhOsRP5K3XvAvec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MWAjC-1reqJ90vEo-00XaJ8; Wed, 17 Jan 2024 00:11:21 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 11/13] rust: kernel: add doclinks with html tags Date: Wed, 17 Jan 2024 00:11:18 +0100 Message-ID: <20240116231118.168882-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:7HDVl5ICHcjvu8IpxbaBi4RT96IEY2WzS7HNpagrRLMKzjKGrrp HNDQsDnObQM5UfrcYAKFPKwKCa5nfWzXvBIhcQwMJ9ILV9sF0MGkg7zqBWx5GBG/DFKg4br w6eGrh4MfDydzwKak28EhlPwcRYRAEDzgEpaXfBiZvigBZhg7xTY6oby3zkYbHY8xe5FyRR EZsHCecWfOGzI74G8BReA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:5/VYKVZVSV4=;5l1Im1o2v77FVLbOqnVkHhisSp0 k7AS8oXGuUvRGhQthNOkF/ZLN3ir5LJulRiGMeaQCTZ8BdgQ6/YkrwDFPI4w+e1AWm9BOaata OwdzxKXhi6TEGb6SXsDir/NhL+ssLJIGSCMeDs0Cy1JrZKM+Qm66e1TeY9I5wggc4oHl2fYJa cFCv87mieIxot1SuDI3up88/WIJ8ZMGdHF5VTMTR2uydvg3Nh4zyKpdEyCMW5CSInX6gGUB+Q 0owTLgdWQlMzEzG7XN1S+fSLi3fBSalsGUE68KI3+KAfs566BsmTMHbF0sq4vscw9to+P3oG/ tHyydKRGmstfuTZqjYX9hPSTBb7BZUiXJsIQEnRtnLB4wDob8znUlmqwAaMYxT2d9osf+Dvdm rolqsi7ke/u/R6L5Ni8OC4HPwMoqAgqOgHs6rzxPIUS7drdvwqQRCPUPYoNodytJxSuBWPYzE Tvet71iNl/dLwjI6KmFwlyU6uAJeGy+49vGe9Zyf8tm9EXn2ixIGjpoTtx7vRiS9v32AZuY2d f/c2lCYKh5BqYnWCO+Hv2v3jQiuTaqGidN2N9kFlV4f3zwsttmUVgb+VNkttlMUnCfIwg+3ky gdRVX69LvhRifswlpnEQHDxbF+dKnlp3XefUiCXRDUkJgWkog8W/yAE1NPRrTVstsGDyo3zNH 9eeik+58hxfoJSf7shMMg2+rtDNoum2MQvMYWKHq8b3oEGuP2XNOLgMDUyu1+e+USqehxJBeT dHigE4RXSqu63/wzgmF1N6GY7poSDkVloE0wyzT3W7EkcnP/glVszmjoG0nBAGtK52wfBnuu2 omZd/jRq5030D5HlJxGpHiv3MHJIG5kurtqQZq2QuE2idwkoTJ7noDkiHxDtD/D4vYz11ub+h Gz4TCR8aGjt+yTw9Mq4WffazeSk724w8ufBM= Content-Type: text/plain; charset="utf-8" Add doclinks to existing documentation. Use html 'code' tags to add links to items that cannot be linked with the normal syntax. The use of html tags is a tradeoff between the readability of the documentation's source code and the ergonomics of the generated content. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo --- rust/kernel/str.rs | 7 ++++--- rust/kernel/sync/arc.rs | 24 +++++++++++++----------- rust/kernel/workqueue.rs | 10 +++++----- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index fec5c4314758..f95fd2ba19fb 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -14,7 +14,8 @@ =20 /// Byte string without UTF-8 validity guarantee. /// -/// `BStr` is simply an alias to `[u8]`, but has a more evident semantical= meaning. +/// `BStr` is simply an alias to [[u8]], but has a more evide= nt +/// semantical meaning. pub type BStr =3D [u8]; =20 /// Creates a new [`BStr`] from a string literal. @@ -106,7 +107,7 @@ pub unsafe fn from_char_ptr<'a>(ptr: *const core::ffi::= c_char) -> &'a Self { unsafe { Self::from_bytes_with_nul_unchecked(bytes) } } =20 - /// Creates a [`CStr`] from a `[u8]`. + /// Creates a [`CStr`] from a [[u8]]. /// /// The provided slice must be `NUL`-terminated, does not contain any /// interior `NUL` bytes. @@ -130,7 +131,7 @@ pub const fn from_bytes_with_nul(bytes: &[u8]) -> Resul= t<&Self, CStrConvertError Ok(unsafe { Self::from_bytes_with_nul_unchecked(bytes) }) } =20 - /// Creates a [`CStr`] from a `[u8]` without performing any additional + /// Creates a [`CStr`] from a [[u8]] without performing a= ny additional /// checks. /// /// # Safety diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index 936bc549a082..5fcd4b0fd84b 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -368,10 +368,10 @@ fn from(item: Pin>) -> Self { /// to use just `&T`, which we can trivially get from an [`Arc`] instan= ce. /// /// However, when one may need to increment the refcount, it is preferable= to use an `ArcBorrow` -/// over `&Arc` because the latter results in a double-indirection: a p= ointer (shared reference) -/// to a pointer ([`Arc`]) to the object (`T`). An [`ArcBorrow`] elimin= ates this double -/// indirection while still allowing one to increment the refcount and get= ting an [`Arc`] when/if -/// needed. +/// over &[`Arc`] because the latter results in a double-i= ndirection: a pointer +/// (shared reference) to a pointer ([`Arc`]) to the object (`T`). An [= `ArcBorrow`] eliminates +/// this double indirection while still allowing one to increment the refc= ount and getting an +/// [`Arc`] when/if needed. /// /// # Invariants /// @@ -489,8 +489,8 @@ fn deref(&self) -> &Self::Target { /// # Examples /// /// In the following example, we make changes to the inner object before t= urning it into an -/// `Arc` object (after which point, it cannot be mutated directly).= Note that `x.into()` -/// cannot fail. +/// [Arc]\ object (after which point, it cannot be mut= ated directly). +/// Note that `x.into()` cannot fail. /// /// ``` /// use kernel::sync::{Arc, UniqueArc}; @@ -512,8 +512,9 @@ fn deref(&self) -> &Self::Target { /// /// In the following example we first allocate memory for a refcounted `Ex= ample` but we don't /// initialise it on allocation. We do initialise it later with a call to = [`UniqueArc::write`], -/// followed by a conversion to `Arc`. This is particularly usefu= l when allocation happens -/// in one context (e.g., sleepable) and initialisation in another (e.g., = atomic): +/// followed by a conversion to [Arc]\. This is par= ticularly useful when +/// allocation happens in one context (e.g., sleepable) and initialisation= in another +/// (e.g., atomic): /// /// ``` /// use kernel::sync::{Arc, UniqueArc}; @@ -532,8 +533,8 @@ fn deref(&self) -> &Self::Target { /// ``` /// /// In the last example below, the caller gets a pinned instance of `Examp= le` while converting to -/// `Arc`; this is useful in scenarios where one needs a pinned r= eference during -/// initialisation, for example, when initialising fields that are wrapped= in locks. +/// [Arc]\; this is useful in scenarios where one n= eeds a pinned reference +/// during initialisation, for example, when initialising fields that are = wrapped in locks. /// /// ``` /// use kernel::sync::{Arc, UniqueArc}; @@ -582,7 +583,8 @@ pub fn try_new_uninit() -> Result>, AllocError> { } =20 impl UniqueArc> { - /// Converts a `UniqueArc>` into a `UniqueArc` by wr= iting a value into it. + /// Converts a UniqueArc<[`MaybeUninit`]> into a `Uniq= ueArc` + /// by writing a value into it. pub fn write(mut self, value: T) -> UniqueArc { self.deref_mut().write(value); // SAFETY: We just wrote the value to be initialized. diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index ed3af3491b47..aedf47f258bd 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -294,9 +294,9 @@ unsafe fn __enqueue(self, queue_work_on: F) -> Self:= :EnqueueOutput =20 /// Defines the method that should be called directly when a work item is = executed. /// -/// This trait is implemented by `Pin>` and [`Arc`], and is main= ly intended to be -/// implemented for smart pointer types. For your own structs, you would i= mplement [`WorkItem`] -/// instead. The [`run`] method on this trait will usually just perform th= e appropriate +/// This trait is implemented by [Pin]<[`Box`]> and [`Arc<= T>`], and is mainly +/// intended to be implemented for smart pointer types. For your own struc= ts, you would implement +/// [`WorkItem`] instead. The [`run`] method on this trait will usually ju= st perform the appropriate /// `container_of` translation and then call into the [`run`][WorkItem::ru= n] method from the /// [`WorkItem`] trait. /// @@ -325,8 +325,8 @@ pub unsafe trait WorkItemPointer: RawWor= kItem { /// /// This trait is used when the `work_struct` field is defined using the [= `Work`] helper. pub trait WorkItem { - /// The pointer type that this struct is wrapped in. This will typical= ly be `Arc` or - /// `Pin>`. + /// The pointer type that this struct is wrapped in. This will typical= ly be + /// [Arc]\ or [Pin]<[Box]\>. type Pointer: WorkItemPointer; =20 /// The method that should be called when this work item is executed. --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46C1210EB; Wed, 17 Jan 2024 00:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705450579; cv=none; b=hPKlkagP6CspIGiOf819QTawQBc9kS7/XvmZJtShOnKKkgPAkExysm8w3hW+vdT17r4I9Xva62wJhyZPFDPhLOvFEblfobCSj8aLhruNnoyX0TGteaqZ56z3eBks3pkadEM/jp0znRxaUCmOojzJ7KS9Mksb2om37Cb+HCI7xSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705450579; c=relaxed/simple; bh=29I8vQfcBLV9mwZoRiepEOKD8CS2T7TWmyPwGLAV5PM=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=rf+0Yc6A+iMBpywfkuvvFA0ZMAx0ZVj4N7nWvoovex3D7PNEYEV1fujNTk3tnS17U8jqaGa/pJ7pUmB+q+1ndYDbAJFy6DawodEQHXywTdyKomRRW+Ap4G/ZXuw4ullBl/yUG3TfgQOjfTbTAmUhk7+MxeulXy4+eLIfFlEHBiw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue012 [213.165.67.97]) with ESMTPSA (Nemesis) id 1M8Syu-1rUHJq0QJE-004Wpr; Wed, 17 Jan 2024 01:16:02 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 12/13] rust: kernel: remove unneeded doclink targets Date: Wed, 17 Jan 2024 01:15:49 +0100 Message-ID: <20240117001549.169160-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:vKGsVDD4K4O8G0nQOnjmofp4+nIqOjtImagczD6YhwgfOa9ZS0K rV8quU1oxXtmNfI51VhLGnGngF55lx7+qIxTZLaYsSg3hjPOu4jdtXD3cCoqjNH+406CRDA Wgyvd6R06NJKSDsvdRJmyJReq3nixPvkDwGgwbJrSvOeYDwnM4ld3s1pEzILJH24wIHFAlB D1n2qF/b8uNVv4bKpxiZg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:3OczPoTzmTE=;S9W2oLrRDxGvXikdidPbco6b49/ iSusBm28Kp+2/S9krGAq/FWrQGGIs20nsXeQlDr+QvLPy1tZRtCQ5Yfg5adWgUi+BsVyM1+UH qotwLO6DsBzpuIlpHX7Ah0zYRgEk7H+qseieip9BYHgI7T2jg2T3OGrxXLok3IS+8qpSq6c1a t7oLfGyznK8sBC7we2kIcU9X/dKYmPJjTXstM+IZMvruddlJ2QuVe0IXHXIuKF9E03bMBw3Mv BRRA4TG9ZrbwIxJaZi2xE5zGytxJbw/Lcxvd/AZ+XHPqyoZN8KNnuQe2C/kgs86wUT1yBqBgu D3kDbVyzV38PhJiCvO/HE1+RxH6ONae2YXx1miUdl2UrSBi06jejPskoAhAr+CtlnYP8v9fAs PVdZyhCpdqHn681TZjqsRMAcwxYhD2nPpxGBtHitHa9KWUnwgUQYcWVcbaetJbeH6uDYabLmp 1otc6pYhxA+H6cGBRCGOVqw86hFssHkGUaI3cSpGz2L3qhDLkMZ0DxhLuW+f3MX4fYyfOGt0O eqAbIGmsgFo3/3J99SWk+6X8XU46Ir0F04QADjJgm0ADyrOviWzi/AALS4ObAiK20FxAEPFkV KubovKd639u8kp+sxkd4C3+oBb4XEc+ii5D8V4mIn9abVGdc//vzxaf2joOHtZieV1mH7yDEH lzNsQuRTFNu5DXn0HexkjqjBjy+p2Z57i5tlmi70hSk0O2Rq5HIFYbJU1rm6bCKxqwYFUvQSK V8Sn5s6bNkv8nFpwpgOWdBNTn2Qx7cfWbxMFVJ29MmPIGSZRuaVGg8+bpXDpBEpAiV+OBaaL8 CBZ5Kpp4WVEZSsUJZD3Oz3f/Yj3IFTpNrtVhZjbmfVhBjhbRmQ0c0TQwiV0O1+Q9HE2z5Dj0M /yYE8HCuQPWuAcQ== Content-Type: text/plain; charset="utf-8" Remove explicit targets for doclinks in cases where rustdoc can determine the correct target by itself. The goal is to reduce verbosity in the source code. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/workqueue.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index aedf47f258bd..f63190b563d8 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -426,13 +426,10 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut bindi= ngs::work_struct { /// The [`OFFSET`] constant must be the offset of a field in `Self` of typ= e [`Work`]. The /// methods on this trait must have exactly the behavior that the definiti= ons given below have. /// -/// [`Work`]: Work /// [`impl_has_work!`]: crate::impl_has_work /// [`OFFSET`]: HasWork::OFFSET pub unsafe trait HasWork { /// The offset of the [`Work`] field. - /// - /// [`Work`]: Work const OFFSET: usize; =20 /// Returns the offset of the [`Work`] field. @@ -440,7 +437,6 @@ pub unsafe trait HasWork { /// This method exists because the [`OFFSET`] constant cannot be acces= sed if the type is not /// [`Sized`]. /// - /// [`Work`]: Work /// [`OFFSET`]: HasWork::OFFSET #[inline] fn get_work_offset(&self) -> usize { @@ -452,8 +448,6 @@ fn get_work_offset(&self) -> usize { /// # Safety /// /// The provided pointer must point at a valid struct of type `Self`. - /// - /// [`Work`]: Work #[inline] unsafe fn raw_get_work(ptr: *mut Self) -> *mut Work { // SAFETY: The caller promises that the pointer is valid. @@ -465,8 +459,6 @@ unsafe fn raw_get_work(ptr: *mut Self) -> *mut Work { /// # Safety /// /// The pointer must point at a [`Work`] field in a struct of t= ype `Self`. - /// - /// [`Work`]: Work #[inline] unsafe fn work_container_of(ptr: *mut Work) -> *mut Self where @@ -495,8 +487,6 @@ unsafe fn work_container_of(ptr: *mut Work) -> *= mut Self /// impl HasWork for MyStruct { self.work_field } /// } /// ``` -/// -/// [`HasWork`]: HasWork #[macro_export] macro_rules! impl_has_work { ($(impl$(<$($implarg:ident),*>)? --=20 2.43.0 From nobody Wed Dec 17 08:00:00 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B653B8468; Wed, 17 Jan 2024 00:16:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.72.192.75 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705450606; cv=none; b=c24HrX3yuz4SofgVTMt9E8GhRSSuayoJuicx2GnYfa3kuusn8u0jJNKyydHGxsvJf05cYtXGCS2UdDWpMQGvwA0abf4ldKBqt32uQJ+AoiWeAv3fVPWVY5ZjNn7ao/4h/ysIf85I2cjMky9SdAqtFFKRGYqKp6SNIk5j5AQUl6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705450606; c=relaxed/simple; bh=hvWv/gsA+1XA5/ae14NG4bJ38X5ybqAzDv+NJAAUJFs=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=cwvrSLSkY4nSdNvt7ugnaTLNycZ8DOd6k79Dr/oUEs8cJYzUeCmT0xEAYOfIPFiLn9j3KAPdhAo0GZ1+vHh+HlTWLWf2Qis+VAE9rX/K4qoz9yGz3o4JxPwAB2e+R9y7g73DDT/dtzkmBNaEA4c5hK61LRNWceBfmgPLhpCldRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=217.72.192.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MQdI8-1rkIGR0kJ4-00NlUi; Wed, 17 Jan 2024 01:16:21 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 13/13] rust: locked_by: shorten doclink preview Date: Wed, 17 Jan 2024 01:16:13 +0100 Message-ID: <20240117001613.169177-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:P+Wtzs9yqXIZYrvFo9hsAvAB2lek5+pAfAMb7c47Q2gbxEq9JQw tZqu5SlmeG69/pBfzK+Ywt2boBTUKjUq/8PDGTdyMbiXg7r7cNU6ZlQYUgSA14R7lUTSVu7 hvLtW6AuECZTB4xDT0D01Iln4xKsWVEeEQdehN6p2+XAupqh0LTaHEGs5tUYWCLq95yMFBh Coc/vrsct7Ow/R0/4SM/A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:dsSEASkNAtk=;LD2yuxK41OjMV0sSEd4SU39P4y/ OxIG8uPb5vZNU/rpA/U6b+YJw2QI4njvG3acQ47b3Kl3hidgYYuftWvO8hJoBkLSvzQlSMq9k 27EBcoOAShXtSGuMFynffFK8rNZRX5KYOlmraaO/1J8/YOteBQeHimF7mz9quakj9pD7nGkYN KpQLL/gY5mOXnugxEVfRif3JGdPyZl/TcIfl2ogvURVcRGGBNDRFY9eqCARwoAIlKHtdMxHkb dY/rBbo3o4U+wuMADJT2VS5VWXzXqDL70WMl37D1BBMAjEKuA22vB0rUUsnM85lqrISmQuOaq ML9houAAZMW0il42Zw54SmVRMVtqP2o5qXLv+DbR6mx/GLdDnobhXtCaNzLKrIcUwtS7vZVRp QoG41zntmEaKBgkgt19gukKYKQcM/vphyLpPCi9F9dmbK4ivUGIK5mIGYyTYc7D9QotRtUjEj 49EGuYOVFj107ooTaGyiqmvaUYvUmja82EnryQua2nuIbqWC3gHdoIYeQ3IwCMGUm/y2biEMS gl8jzHy+KSPyPPzb6pjS+BUGNncGzELzItuP7F1yJKcTJXpXIQLcJUzn1YhULqbdeRPn7ZvmF oHtDu6hw5aSK2bB+Sjwm9dlHuCjguH2gEniBoyWC9uhOK6X2fyA1qV3NkjhkKO/vEecOrM/XQ gZ3IReFIBCcnGNzorz8EfgQAcpkj1JUrh3z3sqNEI7mjBXr/i99ErjQoSOs9LA78YlH4tvd22 Lk1SAoFl7BrZZFOrCLgZxZckzNcD64Syma1EAmgRK5KyQKMuVM9xo6oX+4wSkfP1JO9IwJkcl pwP5rt3eo4i1326GkspBxuCDsVFPNzyQ1fW6S4+kl6DIe6eW9FD2aFo6zkWagwlqqZIybHiog 0HYV/lU0w7ra7jA== Content-Type: text/plain; charset="utf-8" Increases readability by removing `super::` from the link preview text. Signed-off-by: Valentin Obst Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Trevor Gross --- rust/kernel/sync/locked_by.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust/kernel/sync/locked_by.rs b/rust/kernel/sync/locked_by.rs index b17ee5cd98f3..22c38993bf63 100644 --- a/rust/kernel/sync/locked_by.rs +++ b/rust/kernel/sync/locked_by.rs @@ -9,7 +9,7 @@ /// Allows access to some data to be serialised by a lock that does not wr= ap it. /// /// In most cases, data protected by a lock is wrapped by the appropriate = lock type, e.g., -/// [`super::Mutex`] or [`super::SpinLock`]. [`LockedBy`] is meant for cas= es when this is not +/// [`Mutex`] or [`SpinLock`]. [`LockedBy`] is meant for cases when this i= s not /// possible. For example, if a container has a lock and some data in the = contained elements needs /// to be protected by the same lock. /// @@ -17,6 +17,9 @@ /// when the caller shows evidence that the 'external' lock is locked. It = panics if the evidence /// refers to the wrong instance of the lock. /// +/// [`Mutex`]: super::Mutex +/// [`SpinLock`]: super::SpinLock +/// /// # Examples /// /// The following is an example for illustrative purposes: `InnerDirectory= ::bytes_used` is an --=20 2.43.0