MOS Source Code
Loading...
Searching...
No Matches
io.c File Reference
#include "mos/mm/mm.h"
#include "mos/platform/platform.h"
#include <mos/io/io.h>
#include <mos/io/io_types.h>
#include <mos/mm/mm_types.h>
#include <mos/mos_global.h>
#include <mos/syslog/printk.h>
#include <mos_stdio.h>
+ Include dependency graph for io.c:

Go to the source code of this file.

Functions

static size_t _null_read (io_t *io, void *buffer, size_t size)
 
static size_t _null_write (io_t *io, const void *buffer, size_t size)
 
void io_init (io_t *io, io_type_t type, io_flags_t flags, const io_op_t *ops)
 
io_tio_ref (io_t *io)
 
io_tio_unref (io_t *io)
 
bool io_valid (const io_t *io)
 
size_t io_read (io_t *io, void *buf, size_t count)
 
size_t io_pread (io_t *io, void *buf, size_t count, off_t offset)
 
size_t io_write (io_t *io, const void *buf, size_t count)
 
off_t io_seek (io_t *io, off_t offset, io_seek_whence_t whence)
 
off_t io_tell (io_t *io)
 
bool io_mmap_perm_check (io_t *io, vm_flags flags, bool is_private)
 
bool io_mmap (io_t *io, vmap_t *vmap, off_t offset)
 
bool io_munmap (io_t *io, vmap_t *vmap, bool *unmapped)
 
void io_get_name (const io_t *io, char *buf, size_t size)
 

Variables

static io_t io_null_impl
 
io_t *const io_null = &io_null_impl
 

Function Documentation

◆ _null_read()

static size_t _null_read ( io_t * io,
void * buffer,
size_t size )
static

Definition at line 13 of file io.c.

+ Here is the call graph for this function:

◆ _null_write()

static size_t _null_write ( io_t * io,
const void * buffer,
size_t size )
static

Definition at line 21 of file io.c.

+ Here is the call graph for this function:

◆ io_init()

void io_init ( io_t * io,
io_type_t type,
io_flags_t flags,
const io_op_t * ops )

◆ io_ref()

◆ io_unref()

◆ io_valid()

bool io_valid ( const io_t * io)

◆ io_read()

size_t io_read ( io_t * io,
void * buf,
size_t count )

Definition at line 132 of file io.c.

Referenced by io_pread().

◆ io_pread()

size_t io_pread ( io_t * io,
void * buf,
size_t count,
off_t offset )

Definition at line 151 of file io.c.

Referenced by elf_read_file().

+ Here is the call graph for this function:

◆ io_write()

size_t io_write ( io_t * io,
const void * buf,
size_t count )

Definition at line 180 of file io.c.

◆ io_seek()

off_t io_seek ( io_t * io,
off_t offset,
io_seek_whence_t whence )

Definition at line 199 of file io.c.

Referenced by io_pread(), and io_tell().

◆ io_tell()

off_t io_tell ( io_t * io)

Definition at line 218 of file io.c.

Referenced by io_pread().

+ Here is the call graph for this function:

◆ io_mmap_perm_check()

bool io_mmap_perm_check ( io_t * io,
vm_flags flags,
bool is_private )

Definition at line 224 of file io.c.

Referenced by io_mmap(), and vm_protect().

◆ io_mmap()

bool io_mmap ( io_t * io,
vmap_t * vmap,
off_t offset )

Definition at line 254 of file io.c.

Referenced by mmap_file().

+ Here is the call graph for this function:

◆ io_munmap()

bool io_munmap ( io_t * io,
vmap_t * vmap,
bool * unmapped )

Definition at line 273 of file io.c.

Referenced by vmap_destroy().

+ Here is the call graph for this function:

◆ io_get_name()

void io_get_name ( const io_t * io,
char * buf,
size_t size )

Definition at line 307 of file io.c.

Referenced by process_sysfs_vmap_stat(), vsnprintf_do_pointer_kernel(), and x86_dump_stack_at().

+ Here is the call graph for this function:

Variable Documentation

◆ io_null_impl

io_t io_null_impl
static
Initial value:
= {
.refcount = 1,
.type = IO_NULL,
.ops =
&(io_op_t){
.read = _null_read,
.write = _null_write,
.seek = NULL,
.close = NULL,
},
}
static size_t _null_read(io_t *io, void *buffer, size_t size)
Definition io.c:13
static size_t _null_write(io_t *io, const void *buffer, size_t size)
Definition io.c:21
@ IO_READABLE
Definition io.h:27
@ IO_WRITABLE
Definition io.h:28
@ IO_NULL
Definition io.h:16
#define NULL
Definition pb_syshdr.h:46
Definition io.h:35

Definition at line 29 of file io.c.

◆ io_null

io_t* const io_null = &io_null_impl

Definition at line 42 of file io.c.

Referenced by process_new().