MOS Source Code
Loading...
Searching...
No Matches
sysfs.h File Reference
+ Include dependency graph for sysfs.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sysfs_item_t
 
struct  sysfs_dir_t
 

Macros

#define SYSFS_RO_ITEM(_name, _show_fn)
 
#define SYSFS_RW_ITEM(_name, _show_fn, _store_fn)
 
#define SYSFS_WO_ITEM(_name, _store_fn)
 
#define SYSFS_MEM_ITEM(_name, _mmap_fn, _munmap_fn)
 
#define SYSFS_DYN_ITEMS(_name, _iterate_fn, _lookup_fn)
 
#define SYSFS_DYN_DIR(_name, _iterate_fn, _lookup_fn, _create_fn)
 
#define SYSFS_ITEM_RO_PRINTF(name, fmt, ...)
 
#define SYSFS_ITEM_RO_STRING(name, value)
 
#define SYSFS_DEFINE_DIR(sysfs_name, sysfs_items)
 

Typedefs

typedef struct _sysfs_file sysfs_file_t
 

Enumerations

enum  sysfs_item_type_t {
  _SYSFS_INVALID = 0 , SYSFS_RO , SYSFS_RW , SYSFS_WO ,
  SYSFS_MEM , SYSFS_DYN
}
 

Functions

void sysfs_register (sysfs_dir_t *entry)
 Register a sysfs directory.
 
void sysfs_register_file (sysfs_dir_t *sysfs_dir, sysfs_item_t *item)
 Register an entry in a sysfs directory.
 
should_inline void sysfs_register_root_file (sysfs_item_t *item)
 Register an entry in the sysfs root directory.
 
void sysfs_file_set_data (sysfs_file_t *file, void *data)
 
voidsysfs_file_get_data (sysfs_file_t *file)
 
sysfs_item_tsysfs_file_get_item (sysfs_file_t *file)
 
inode_tsysfs_create_inode (file_type_t type, void *data)
 
ssize_t sysfs_printf (sysfs_file_t *file, const char *fmt,...)
 
ssize_t sysfs_put_data (sysfs_file_t *file, const void *data, size_t count)
 

Macro Definition Documentation

◆ SYSFS_RO_ITEM

#define SYSFS_RO_ITEM ( _name,
_show_fn )
Value:
{ .name = _name, .type = SYSFS_RO, .show = _show_fn }
@ SYSFS_RO
Definition sysfs.h:13

Definition at line 48 of file sysfs.h.

Referenced by MOS_INIT().

◆ SYSFS_RW_ITEM

#define SYSFS_RW_ITEM ( _name,
_show_fn,
_store_fn )
Value:
{ .name = _name, .type = SYSFS_RW, .show = _show_fn, .store = _store_fn }
@ SYSFS_RW
Definition sysfs.h:14

Definition at line 49 of file sysfs.h.

◆ SYSFS_WO_ITEM

#define SYSFS_WO_ITEM ( _name,
_store_fn )
Value:
{ .name = _name, .type = SYSFS_WO, .store = _store_fn }
@ SYSFS_WO
Definition sysfs.h:15

Definition at line 50 of file sysfs.h.

◆ SYSFS_MEM_ITEM

#define SYSFS_MEM_ITEM ( _name,
_mmap_fn,
_munmap_fn )
Value:
{ .name = _name, .type = SYSFS_MEM, .mem.mmap = _mmap_fn, .mem.munmap = _munmap_fn }
@ SYSFS_MEM
memory-backed file
Definition sysfs.h:16

Definition at line 51 of file sysfs.h.

◆ SYSFS_DYN_ITEMS

#define SYSFS_DYN_ITEMS ( _name,
_iterate_fn,
_lookup_fn )
Value:
{ .type = SYSFS_DYN, .dyn.iterate = _iterate_fn, .dyn.lookup = _lookup_fn }
@ SYSFS_DYN
dynamic directory items
Definition sysfs.h:17

Definition at line 52 of file sysfs.h.

◆ SYSFS_DYN_DIR

#define SYSFS_DYN_DIR ( _name,
_iterate_fn,
_lookup_fn,
_create_fn )
Value:
{ .type = SYSFS_DYN, .dyn.iterate = _iterate_fn, .dyn.lookup = _lookup_fn, .dyn.create = _create_fn }

Definition at line 53 of file sysfs.h.

◆ SYSFS_ITEM_RO_PRINTF

#define SYSFS_ITEM_RO_PRINTF ( name,
fmt,
... )
Value:
static bool name(sysfs_file_t *file) \
{ \
sysfs_printf(file, fmt, ##__VA_ARGS__); \
return true; \
}
u32 const char * fmt
Definition assert.h:36
const char * name
Definition slab.c:31

Definition at line 56 of file sysfs.h.

◆ SYSFS_ITEM_RO_STRING

#define SYSFS_ITEM_RO_STRING ( name,
value )
Value:
SYSFS_ITEM_RO_PRINTF(name, "%s\n", value)
#define SYSFS_ITEM_RO_PRINTF(name, fmt,...)
Definition sysfs.h:56

Definition at line 63 of file sysfs.h.

◆ SYSFS_DEFINE_DIR

#define SYSFS_DEFINE_DIR ( sysfs_name,
sysfs_items )
Value:
static sysfs_dir_t __sysfs_##sysfs_name = { \
.list_node = LIST_NODE_INIT(__sysfs_##sysfs_name), \
.name = #sysfs_name, \
.items = sysfs_items, \
.num_items = MOS_ARRAY_SIZE(sysfs_items), \
._dentry = NULL, \
._dynamic_items = LIST_HEAD_INIT(__sysfs_##sysfs_name._dynamic_items), \
}
#define LIST_HEAD_INIT(container)
Definition list.h:38
#define LIST_NODE_INIT(container)
Definition list.h:41
#define MOS_ARRAY_SIZE(x)
Definition mos_global.h:81
#define NULL
Definition pb_syshdr.h:46

Definition at line 65 of file sysfs.h.

Typedef Documentation

◆ sysfs_file_t

typedef struct _sysfs_file sysfs_file_t

Definition at line 8 of file sysfs.h.

Enumeration Type Documentation

◆ sysfs_item_type_t

Enumerator
_SYSFS_INVALID 
SYSFS_RO 
SYSFS_RW 
SYSFS_WO 
SYSFS_MEM 

memory-backed file

SYSFS_DYN 

dynamic directory items

Definition at line 10 of file sysfs.h.

Function Documentation

◆ sysfs_register()

void sysfs_register ( sysfs_dir_t * entry)

Register a sysfs directory.

Parameters
entrythe sysfs directory to register

Definition at line 48 of file sysfs.c.

+ Here is the call graph for this function:

◆ sysfs_register_file()

void sysfs_register_file ( sysfs_dir_t * sysfs_dir,
sysfs_item_t * item )

Register an entry in a sysfs directory.

Parameters
sysfs_dirthe sysfs directory to register the item in
itemthe sysfs item to register

Definition at line 383 of file sysfs.c.

Referenced by register_sysfs_acpi_node(), register_sysfs_acpi_rsdp(), sysfs_do_register(), and sysfs_register_root_file().

+ Here is the call graph for this function:

◆ sysfs_register_root_file()

should_inline void sysfs_register_root_file ( sysfs_item_t * item)

Register an entry in the sysfs root directory.

Parameters
itemthe sysfs item to register

Definition at line 105 of file sysfs.h.

Referenced by mm_sysfs_init(), and MOS_INIT().

+ Here is the call graph for this function:

◆ sysfs_file_set_data()

void sysfs_file_set_data ( sysfs_file_t * file,
void * data )

Definition at line 105 of file sysfs.c.

Referenced by mmstat_sysfs_phyframe_stat_store(), and mmstat_sysfs_store_pid().

◆ sysfs_file_get_data()

void * sysfs_file_get_data ( sysfs_file_t * file)

◆ sysfs_file_get_item()

sysfs_item_t * sysfs_file_get_item ( sysfs_file_t * file)

Definition at line 115 of file sysfs.c.

Referenced by acpi_sysfs_mmap().

◆ sysfs_create_inode()

inode_t * sysfs_create_inode ( file_type_t type,
void * data )

Definition at line 376 of file sysfs.c.

Referenced by ipc_sysfs_create_ino().

+ Here is the call graph for this function:

◆ sysfs_printf()

◆ sysfs_put_data()

ssize_t sysfs_put_data ( sysfs_file_t * file,
const void * data,
size_t count )

Definition at line 93 of file sysfs.c.

+ Here is the call graph for this function: