MOS Source Code
Loading...
Searching...
No Matches
ipc.c File Reference
+ Include dependency graph for ipc.c:

Go to the source code of this file.

Classes

struct  ipc_t
 
struct  ipc_server_t
 

Macros

#define pr_fmt(fmt)
 
#define IPC_SERVER_MAGIC   MOS_FOURCC('I', 'P', 'C', 'S')
 

Functions

 SLAB_AUTOINIT ("ipc_server", ipc_server_slab, ipc_server_t)
 
 SLAB_AUTOINIT ("ipc", ipc_slab, ipc_t)
 
void ipc_server_close (ipc_server_t *server)
 
size_t ipc_client_read (ipc_t *ipc, void *buf, size_t size)
 
size_t ipc_client_write (ipc_t *ipc, const void *buf, size_t size)
 
size_t ipc_server_read (ipc_t *ipc, void *buf, size_t size)
 
size_t ipc_server_write (ipc_t *ipc, const void *buf, size_t size)
 
void ipc_client_close_channel (ipc_t *ipc)
 
void ipc_server_close_channel (ipc_t *ipc)
 
void ipc_init (void)
 
static inode_tipc_sysfs_create_ino (ipc_server_t *ipc_server)
 
ipc_server_tipc_server_create (const char *name, size_t max_pending)
 
ipc_server_tipc_get_server (const char *name)
 
ipc_tipc_server_accept (ipc_server_t *ipc_server)
 
ipc_tipc_connect_to_server (const char *name, size_t buffer_size)
 
static bool ipc_sysfs_servers (sysfs_file_t *f)
 
static void ipc_sysfs_list_ipcs (sysfs_item_t *item, dentry_t *d, vfs_listdir_state_t *state, dentry_iterator_op add_record)
 
static bool ipc_sysfs_lookup_ipc (inode_t *parent_dir, dentry_t *dentry)
 
static bool ipc_sysfs_create_server (inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm)
 
static bool ipc_dump_name_waitlist (uintn key, void *value, void *data)
 
static bool ipc_sysfs_dump_name_waitlist (sysfs_file_t *f)
 
 SYSFS_AUTOREGISTER (ipc, ipc_sysfs_items)
 

Variables

static slab_tipc_server_slab = NULL
 
static slab_tipc_slab = NULL
 
static list_head ipc_servers = LIST_HEAD_INIT(ipc_servers)
 
static hashmap_t name_waitlist
 waitlist for an IPC server, key = name, value = waitlist_t *
 
static spinlock_t ipc_lock = SPINLOCK_INIT
 protects ipc_servers and name_waitlist
 
static sysfs_item_t ipc_sysfs_items []
 

Macro Definition Documentation

◆ pr_fmt

#define pr_fmt ( fmt)
Value:
"ipc: " fmt
u32 const char * fmt
Definition assert.h:36

Definition at line 3 of file ipc.c.

◆ IPC_SERVER_MAGIC

#define IPC_SERVER_MAGIC   MOS_FOURCC('I', 'P', 'C', 'S')

Definition at line 27 of file ipc.c.

Function Documentation

◆ SLAB_AUTOINIT() [1/2]

SLAB_AUTOINIT ( "ipc_server" ,
ipc_server_slab ,
ipc_server_t  )

◆ SLAB_AUTOINIT() [2/2]

SLAB_AUTOINIT ( "ipc" ,
ipc_slab ,
ipc_t  )

◆ ipc_server_close()

void ipc_server_close ( ipc_server_t * server)

Definition at line 73 of file ipc.c.

Referenced by ipc_control_io_close(), and vfs_ipc_file_release().

+ Here is the call graph for this function:

◆ ipc_client_read()

size_t ipc_client_read ( ipc_t * ipc,
void * buf,
size_t size )

Definition at line 120 of file ipc.c.

Referenced by ipc_client_io_read(), and vfs_ipc_file_read().

+ Here is the call graph for this function:

◆ ipc_client_write()

size_t ipc_client_write ( ipc_t * ipc,
const void * buf,
size_t size )

Definition at line 125 of file ipc.c.

Referenced by ipc_client_io_write(), and vfs_ipc_file_write().

+ Here is the call graph for this function:

◆ ipc_server_read()

size_t ipc_server_read ( ipc_t * ipc,
void * buf,
size_t size )

Definition at line 130 of file ipc.c.

Referenced by ipc_server_io_read().

+ Here is the call graph for this function:

◆ ipc_server_write()

size_t ipc_server_write ( ipc_t * ipc,
const void * buf,
size_t size )

Definition at line 135 of file ipc.c.

Referenced by ipc_server_io_write().

+ Here is the call graph for this function:

◆ ipc_client_close_channel()

void ipc_client_close_channel ( ipc_t * ipc)

Definition at line 140 of file ipc.c.

Referenced by ipc_client_io_close(), and vfs_ipc_file_release().

+ Here is the call graph for this function:

◆ ipc_server_close_channel()

void ipc_server_close_channel ( ipc_t * ipc)

Definition at line 155 of file ipc.c.

Referenced by ipc_server_io_close().

+ Here is the call graph for this function:

◆ ipc_init()

void ipc_init ( void )

Definition at line 170 of file ipc.c.

Referenced by mos_start_kernel().

+ Here is the call graph for this function:

◆ ipc_sysfs_create_ino()

static inode_t * ipc_sysfs_create_ino ( ipc_server_t * ipc_server)
static

Definition at line 411 of file ipc.c.

Referenced by ipc_server_create().

+ Here is the call graph for this function:

◆ ipc_server_create()

ipc_server_t * ipc_server_create ( const char * name,
size_t max_pending )

Definition at line 177 of file ipc.c.

Referenced by ipc_create(), and ipc_sysfs_create_server().

+ Here is the call graph for this function:

◆ ipc_get_server()

ipc_server_t * ipc_get_server ( const char * name)

Definition at line 220 of file ipc.c.

Referenced by vfs_open_ipc().

+ Here is the call graph for this function:

◆ ipc_server_accept()

ipc_t * ipc_server_accept ( ipc_server_t * ipc_server)

Definition at line 236 of file ipc.c.

Referenced by ipc_accept(), and vfs_ipc_file_read().

+ Here is the call graph for this function:

◆ ipc_connect_to_server()

ipc_t * ipc_connect_to_server ( const char * name,
size_t buffer_size )

Definition at line 291 of file ipc.c.

Referenced by ipc_connect(), and vfs_open_ipc().

+ Here is the call graph for this function:

◆ ipc_sysfs_servers()

static bool ipc_sysfs_servers ( sysfs_file_t * f)
static

Definition at line 400 of file ipc.c.

+ Here is the call graph for this function:

◆ ipc_sysfs_list_ipcs()

static void ipc_sysfs_list_ipcs ( sysfs_item_t * item,
dentry_t * d,
vfs_listdir_state_t * state,
dentry_iterator_op add_record )
static

Definition at line 420 of file ipc.c.

+ Here is the call graph for this function:

◆ ipc_sysfs_lookup_ipc()

static bool ipc_sysfs_lookup_ipc ( inode_t * parent_dir,
dentry_t * dentry )
static

Definition at line 432 of file ipc.c.

+ Here is the call graph for this function:

◆ ipc_sysfs_create_server()

static bool ipc_sysfs_create_server ( inode_t * dir,
dentry_t * dentry,
file_type_t type,
file_perm_t perm )
static

Definition at line 454 of file ipc.c.

+ Here is the call graph for this function:

◆ ipc_dump_name_waitlist()

static bool ipc_dump_name_waitlist ( uintn key,
void * value,
void * data )
static

Definition at line 470 of file ipc.c.

Referenced by ipc_sysfs_dump_name_waitlist().

+ Here is the call graph for this function:

◆ ipc_sysfs_dump_name_waitlist()

static bool ipc_sysfs_dump_name_waitlist ( sysfs_file_t * f)
static

Definition at line 487 of file ipc.c.

+ Here is the call graph for this function:

◆ SYSFS_AUTOREGISTER()

SYSFS_AUTOREGISTER ( ipc ,
ipc_sysfs_items  )

Variable Documentation

◆ ipc_server_slab

slab_t* ipc_server_slab = NULL
static

Definition at line 63 of file ipc.c.

Referenced by ipc_server_create().

◆ ipc_slab

slab_t* ipc_slab = NULL
static

Definition at line 66 of file ipc.c.

Referenced by ipc_connect_to_server().

◆ ipc_servers

◆ name_waitlist

hashmap_t name_waitlist
static

waitlist for an IPC server, key = name, value = waitlist_t *

Definition at line 70 of file ipc.c.

Referenced by ipc_connect_to_server(), ipc_init(), ipc_server_close(), ipc_server_create(), and ipc_sysfs_dump_name_waitlist().

◆ ipc_lock

spinlock_t ipc_lock = SPINLOCK_INIT
static

protects ipc_servers and name_waitlist

Definition at line 71 of file ipc.c.

Referenced by ipc_connect_to_server(), ipc_get_server(), ipc_server_close(), ipc_server_create(), and ipc_sysfs_dump_name_waitlist().

◆ ipc_sysfs_items

sysfs_item_t ipc_sysfs_items[]
static
Initial value:
= {
}
static bool ipc_sysfs_create_server(inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm)
Definition ipc.c:454
static bool ipc_sysfs_dump_name_waitlist(sysfs_file_t *f)
Definition ipc.c:487
static void ipc_sysfs_list_ipcs(sysfs_item_t *item, dentry_t *d, vfs_listdir_state_t *state, dentry_iterator_op add_record)
Definition ipc.c:420
static bool ipc_sysfs_servers(sysfs_file_t *f)
Definition ipc.c:400
static bool ipc_sysfs_lookup_ipc(inode_t *parent_dir, dentry_t *dentry)
Definition ipc.c:432
#define SYSFS_RO_ITEM(_name, _show_fn)
Definition sysfs.h:48
#define SYSFS_DYN_DIR(_name, _iterate_fn, _lookup_fn, _create_fn)
Definition sysfs.h:53

Definition at line 496 of file ipc.c.