mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 00:29:35 +08:00
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
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
use super::{NullBlkDevice, THIS_MODULE};
|
||||
use kernel::{
|
||||
block::mq::gen_disk::{GenDisk, GenDiskBuilder},
|
||||
c_str,
|
||||
configfs::{self, AttributeOperations},
|
||||
configfs_attrs,
|
||||
fmt::{self, Write as _},
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
//!
|
||||
//! ```ignore
|
||||
//! use kernel::alloc::flags;
|
||||
//! use kernel::c_str;
|
||||
//! use kernel::configfs_attrs;
|
||||
//! use kernel::configfs;
|
||||
//! use kernel::new_mutex;
|
||||
@@ -50,7 +49,7 @@
|
||||
//!
|
||||
//! try_pin_init!(Self {
|
||||
//! config <- configfs::Subsystem::new(
|
||||
//! c_str!("rust_configfs"), item_type, Configuration::new()
|
||||
//! c"rust_configfs", item_type, Configuration::new()
|
||||
//! ),
|
||||
//! })
|
||||
//! }
|
||||
@@ -66,7 +65,7 @@
|
||||
//! impl Configuration {
|
||||
//! fn new() -> impl PinInit<Self, Error> {
|
||||
//! try_pin_init!(Self {
|
||||
//! message: c_str!("Hello World\n"),
|
||||
//! message: c"Hello World\n",
|
||||
//! bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)),
|
||||
//! })
|
||||
//! }
|
||||
@@ -1000,7 +999,9 @@ macro_rules! configfs_attrs {
|
||||
static [< $data:upper _ $name:upper _ATTR >]:
|
||||
$crate::configfs::Attribute<$attr, $data, $data> =
|
||||
unsafe {
|
||||
$crate::configfs::Attribute::new(c_str!(::core::stringify!($name)))
|
||||
$crate::configfs::Attribute::new(
|
||||
$crate::c_str!(::core::stringify!($name)),
|
||||
)
|
||||
};
|
||||
)*
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ static void simple_child_release(struct config_item *item)
|
||||
kfree(to_simple_child(item));
|
||||
}
|
||||
|
||||
static struct configfs_item_operations simple_child_item_ops = {
|
||||
static const struct configfs_item_operations simple_child_item_ops = {
|
||||
.release = simple_child_release,
|
||||
};
|
||||
|
||||
@@ -215,7 +215,7 @@ static void simple_children_release(struct config_item *item)
|
||||
kfree(to_simple_children(item));
|
||||
}
|
||||
|
||||
static struct configfs_item_operations simple_children_item_ops = {
|
||||
static const struct configfs_item_operations simple_children_item_ops = {
|
||||
.release = simple_children_release,
|
||||
};
|
||||
|
||||
@@ -223,7 +223,7 @@ static struct configfs_item_operations simple_children_item_ops = {
|
||||
* Note that, since no extra work is required on ->drop_item(),
|
||||
* no ->drop_item() is provided.
|
||||
*/
|
||||
static struct configfs_group_operations simple_children_group_ops = {
|
||||
static const struct configfs_group_operations simple_children_group_ops = {
|
||||
.make_item = simple_children_make_item,
|
||||
};
|
||||
|
||||
@@ -292,7 +292,7 @@ static struct configfs_attribute *group_children_attrs[] = {
|
||||
* Note that, since no extra work is required on ->drop_item(),
|
||||
* no ->drop_item() is provided.
|
||||
*/
|
||||
static struct configfs_group_operations group_children_group_ops = {
|
||||
static const struct configfs_group_operations group_children_group_ops = {
|
||||
.make_group = group_children_make_group,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
//! Rust configfs sample.
|
||||
|
||||
use kernel::alloc::flags;
|
||||
use kernel::c_str;
|
||||
use kernel::configfs;
|
||||
use kernel::configfs::configfs_attrs;
|
||||
use kernel::new_mutex;
|
||||
@@ -35,7 +34,7 @@ struct Configuration {
|
||||
impl Configuration {
|
||||
fn new() -> impl PinInit<Self, Error> {
|
||||
try_pin_init!(Self {
|
||||
message: c_str!("Hello World\n"),
|
||||
message: c"Hello World\n",
|
||||
bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)),
|
||||
})
|
||||
}
|
||||
@@ -61,7 +60,7 @@ impl kernel::InPlaceModule for RustConfigfs {
|
||||
|
||||
try_pin_init!(Self {
|
||||
config <- configfs::Subsystem::new(
|
||||
c_str!("rust_configfs"), item_type, Configuration::new()
|
||||
c"rust_configfs", item_type, Configuration::new()
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user