Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'configfs-for-v7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux

Pull configfs updates from Andreas Hindborg:

- Switch the configfs rust bindings to use c string literals provided
by the compiler, rather than a macro

- A follow up on constifying `configfs_item_operations`, applying the
change to the configfs sample

* tag 'configfs-for-v7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux:
samples: configfs: Constify struct configfs_item_operations and configfs_group_operations
rust: configfs: replace `kernel::c_str!` with C-Strings

+11 -12
-1
drivers/block/rnull/configfs.rs
··· 3 3 use super::{NullBlkDevice, THIS_MODULE}; 4 4 use kernel::{ 5 5 block::mq::gen_disk::{GenDisk, GenDiskBuilder}, 6 - c_str, 7 6 configfs::{self, AttributeOperations}, 8 7 configfs_attrs, 9 8 fmt::{self, Write as _},
+5 -4
rust/kernel/configfs.rs
··· 21 21 //! 22 22 //! ```ignore 23 23 //! use kernel::alloc::flags; 24 - //! use kernel::c_str; 25 24 //! use kernel::configfs_attrs; 26 25 //! use kernel::configfs; 27 26 //! use kernel::new_mutex; ··· 49 50 //! 50 51 //! try_pin_init!(Self { 51 52 //! config <- configfs::Subsystem::new( 52 - //! c_str!("rust_configfs"), item_type, Configuration::new() 53 + //! c"rust_configfs", item_type, Configuration::new() 53 54 //! ), 54 55 //! }) 55 56 //! } ··· 65 66 //! impl Configuration { 66 67 //! fn new() -> impl PinInit<Self, Error> { 67 68 //! try_pin_init!(Self { 68 - //! message: c_str!("Hello World\n"), 69 + //! message: c"Hello World\n", 69 70 //! bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)), 70 71 //! }) 71 72 //! } ··· 999 1000 static [< $data:upper _ $name:upper _ATTR >]: 1000 1001 $crate::configfs::Attribute<$attr, $data, $data> = 1001 1002 unsafe { 1002 - $crate::configfs::Attribute::new(c_str!(::core::stringify!($name))) 1003 + $crate::configfs::Attribute::new( 1004 + $crate::c_str!(::core::stringify!($name)), 1005 + ) 1003 1006 }; 1004 1007 )* 1005 1008
+4 -4
samples/configfs/configfs_sample.c
··· 158 158 kfree(to_simple_child(item)); 159 159 } 160 160 161 - static struct configfs_item_operations simple_child_item_ops = { 161 + static const struct configfs_item_operations simple_child_item_ops = { 162 162 .release = simple_child_release, 163 163 }; 164 164 ··· 215 215 kfree(to_simple_children(item)); 216 216 } 217 217 218 - static struct configfs_item_operations simple_children_item_ops = { 218 + static const struct configfs_item_operations simple_children_item_ops = { 219 219 .release = simple_children_release, 220 220 }; 221 221 ··· 223 223 * Note that, since no extra work is required on ->drop_item(), 224 224 * no ->drop_item() is provided. 225 225 */ 226 - static struct configfs_group_operations simple_children_group_ops = { 226 + static const struct configfs_group_operations simple_children_group_ops = { 227 227 .make_item = simple_children_make_item, 228 228 }; 229 229 ··· 292 292 * Note that, since no extra work is required on ->drop_item(), 293 293 * no ->drop_item() is provided. 294 294 */ 295 - static struct configfs_group_operations group_children_group_ops = { 295 + static const struct configfs_group_operations group_children_group_ops = { 296 296 .make_group = group_children_make_group, 297 297 }; 298 298
+2 -3
samples/rust/rust_configfs.rs
··· 3 3 //! Rust configfs sample. 4 4 5 5 use kernel::alloc::flags; 6 - use kernel::c_str; 7 6 use kernel::configfs; 8 7 use kernel::configfs::configfs_attrs; 9 8 use kernel::new_mutex; ··· 34 35 impl Configuration { 35 36 fn new() -> impl PinInit<Self, Error> { 36 37 try_pin_init!(Self { 37 - message: c_str!("Hello World\n"), 38 + message: c"Hello World\n", 38 39 bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)), 39 40 }) 40 41 } ··· 60 61 61 62 try_pin_init!(Self { 62 63 config <- configfs::Subsystem::new( 63 - c_str!("rust_configfs"), item_type, Configuration::new() 64 + c"rust_configfs", item_type, Configuration::new() 64 65 ), 65 66 }) 66 67 }