mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	 210b81578e
			
		
	
	
		210b81578e
		
	
	
	
	
		
			
			`XArray` is an efficient sparse array of pointers. Add a Rust abstraction for this type. This implementation bounds the element type on `ForeignOwnable` and requires explicit locking for all operations. Future work may leverage RCU to enable lockless operation. Inspired-by: MaĆra Canal <mcanal@igalia.com> Inspired-by: Asahi Lina <lina@asahilina.net> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Tamir Duberstein <tamird@gmail.com> Link: https://lore.kernel.org/r/20250423-rust-xarray-bindings-v19-2-83cdcf11c114@gmail.com Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			448 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			448 B
		
	
	
	
		
			C
		
	
	
	
	
	
| // SPDX-License-Identifier: GPL-2.0
 | |
| 
 | |
| #include <linux/xarray.h>
 | |
| 
 | |
| int rust_helper_xa_err(void *entry)
 | |
| {
 | |
| 	return xa_err(entry);
 | |
| }
 | |
| 
 | |
| void rust_helper_xa_init_flags(struct xarray *xa, gfp_t flags)
 | |
| {
 | |
| 	return xa_init_flags(xa, flags);
 | |
| }
 | |
| 
 | |
| int rust_helper_xa_trylock(struct xarray *xa)
 | |
| {
 | |
| 	return xa_trylock(xa);
 | |
| }
 | |
| 
 | |
| void rust_helper_xa_lock(struct xarray *xa)
 | |
| {
 | |
| 	return xa_lock(xa);
 | |
| }
 | |
| 
 | |
| void rust_helper_xa_unlock(struct xarray *xa)
 | |
| {
 | |
| 	return xa_unlock(xa);
 | |
| }
 |