Lines Matching +full:embedded +full:- +full:sync

1 // SPDX-License-Identifier: GPL-2.0
3 //! configfs interface: Userspace-driven Kernel Object Configuration
5 //! configfs is an in-memory pseudo file system for configuration of kernel
11 //! - Items. All group children are groups.
12 //! - Symlink support.
13 //! - `disconnect_notify` hook.
14 //! - Default groups.
29 //! use kernel::sync::Mutex;
39 //! fn init(_module: &'static ThisModule) -> impl PinInit<Self, Error> {
52 //! config <- configfs::Subsystem::new(
67 //! fn new() -> impl PinInit<Self, Error> {
70 //! bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)),
79 //! fn show(container: &Configuration, page: &mut [u8; PAGE_SIZE]) -> Result<usize> {
91 //! fn show(container: &Configuration, page: &mut [u8; PAGE_SIZE]) -> Result<usize> {
100 //! fn store(container: &Configuration, page: &[u8]) -> Result {
118 use crate::sync::Arc;
119 use crate::sync::ArcBorrow;
137 unsafe impl<Data> Sync for Subsystem<Data> {}
152 ) -> impl PinInit<Self, Error> {
154 subsystem <- pin_init::init_zeroed().chain(
176 data <- data,
204 /// - Implementers of this trait must embed a `bindings::config_group`.
205 /// - Methods must be implemented according to method documentation.
207 /// Return the address of the `bindings::config_group` embedded in [`Self`].
211 /// - `this` must be a valid allocation of at least the size of [`Self`].
212 unsafe fn group(this: *const Self) -> *const bindings::config_group;
214 /// Return the address of the [`Self`] that `group` is embedded in.
218 /// - `group` must point to the `bindings::config_group` that is embedded in
220 unsafe fn container_of(group: *const bindings::config_group) -> *const Self;
226 unsafe fn group(this: *const Self) -> *const bindings::config_group {
231 unsafe fn container_of(group: *const bindings::config_group) -> *const Self {
262 ) -> impl PinInit<Self, Error> {
264 group <- pin_init::init_zeroed().chain(|v: &mut Opaque<bindings::config_group>| {
273 data <- data,
281 unsafe fn group(this: *const Self) -> *const bindings::config_group {
289 unsafe fn container_of(group: *const bindings::config_group) -> *const Self {
302 /// `this` must be a pointer to a `bindings::config_group` embedded in a
306 /// is embedded in a `bindings::configfs_subsystem` that is embedded in a
308 unsafe fn get_group_data<'a, Parent>(this: *mut bindings::config_group) -> &'a Parent {
314 // `make_group`. The pointer is known to be embedded within a
336 /// `this` must be a pointer to a `bindings::config_group` embedded in a
340 /// is embedded in a `bindings::configfs_subsystem` that is embedded in a
347 ) -> *mut bindings::config_group {
381 /// `this` must be a pointer to a `bindings::config_group` embedded in a
385 /// is embedded in a `bindings::configfs_subsystem` that is embedded in a
398 // SAFETY: By function safety requirements, `item` is embedded in a
402 // embedded within a `Group<Child>`.
428 const fn vtable_ptr() -> *const bindings::configfs_group_operations {
441 /// `this` must be a pointer to a `bindings::config_group` embedded in a
447 // SAFETY: By function safety requirements, `this` is embedded in a
451 // embedded within a `Group<Data>`.
466 const fn vtable_ptr() -> *const bindings::configfs_item_operations {
478 const fn vtable_ptr() -> *const bindings::configfs_item_operations {
502 fn make_group(&self, name: &CStr) -> Result<impl PinInit<Group<Self::Child>, Error>>;
530 unsafe impl<const ID: u64, O, Data> Sync for Attribute<ID, O, Data> {}
541 /// `item` must be embedded in a `bindings::config_group`.
544 /// the group must be embedded in a `Group<Data>`.
546 /// Otherwise, the group must be a embedded in a
547 /// `bindings::configfs_subsystem` that is embedded in a `Subsystem<Data>`.
553 ) -> isize {
555 // SAFETY: By function safety requirements, `item` is embedded in a
574 /// `item` must be embedded in a `bindings::config_group`.
577 /// the group must be embedded in a `Group<Data>`.
579 /// Otherwise, the group must be a embedded in a
580 /// `bindings::configfs_subsystem` that is embedded in a `Subsystem<Data>`.
587 ) -> isize {
589 // SAFETY: By function safety requirements, `item` is embedded in a
613 pub const fn new(name: &'static CStr) -> Self {
655 fn show(data: &Self::Data, page: &mut [u8; PAGE_SIZE]) -> Result<usize>;
663 fn store(_data: &Self::Data, _page: &[u8]) -> Result {
692 unsafe impl<const N: usize, Data> Sync for AttributeList<N, Data> {}
700 pub const unsafe fn new() -> Self {
716 const { assert!(I < N - 1, "Invalid attribute index") };
738 unsafe impl<Container, Data> Sync for ItemType<Container, Data> {}
750 ) -> Self
771 ) -> Self {
791 fn as_ptr(&self) -> *const bindings::config_item_type {