PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
iomanX.c File Reference
#include <string.h>
#include <types.h>
#include <intrman.h>
#include <stdio.h>
#include <iomanX.h>
#include <errno.h>
#include <stdarg.h>
+ Include dependency graph for iomanX.c:

Go to the source code of this file.

Macros

#define index   strchr
 
#define Kprintf   printf
 
#define MAX_DEVICES   16
 
#define MAX_FILES   32
 
#define isnum(c)   ((c) >= '0' && (c) <= '9')
 
#define EUNSUP   48
 
#define HANDLE_RESULT_CLEAR_INFO   1
 
#define HANDLE_RESULT_CLEAR_INFO_ON_ERROR   2
 
#define HANDLE_RESULT_RETURN_ZERO   4
 
#define HANDLE_RESULT_RETURN_FD   8
 
#define IOMANX_ENTRYPOINT   iomanX_start
 
#define IOMANX_CLEANUP   shutdown
 

Functions

void iomanX_StdioInit (int mode)
 
static int open_tty_handles (const char *tty_name)
 
static int xx_stat (int op, const char *name, iox_stat_t *stat, unsigned int statmask)
 
static int xx_rename (int op, const char *oldname, const char *newname)
 
static int xx_dir (int op, const char *name, int mode)
 
static int _ioabort (const char *str1, const char *str2)
 
static iomanX_iop_file_tnew_iob (void)
 
static iomanX_iop_file_tget_iob (int fd)
 
static iomanX_iop_device_tlookup_dev (const char *name, int show_unkdev_msg)
 
static const char * parsefile (const char *path, iomanX_iop_device_t **p_device, int *p_unit)
 
static int tty_noop (void)
 
unsigned int iomanX_GetDevType (int fd)
 
static void ShowDrv (void)
 
static void register_tty (void)
 
static void register_dummytty (void)
 
 IOMANX_RETURN_VALUE_IMPL (0)
 
static void write_str_to_stdout (const char *in_str)
 
static int set_errno (int in_errno)
 
static void handle_result_pre (int in_result, iomanX_iop_file_t *f, int op)
 
static int handle_result (int in_result, iomanX_iop_file_t *f, int op)
 
static s64 handle_result64 (s64 in_result, iomanX_iop_file_t *f, int op)
 
int IOMANX_ENTRYPOINT (int ac, char **av)
 
int IOMANX_CLEANUP (int arg)
 
int iomanX_open (const char *name, int flags,...)
 
int iomanX_lseek (int fd, int offset, int mode)
 
s64 iomanX_lseek64 (int fd, s64 offset, int whence)
 
int iomanX_read (int fd, void *ptr, int size)
 
int iomanX_write (int fd, void *ptr, int size)
 
int iomanX_close (int fd)
 
int iomanX_ioctl (int fd, int cmd, void *param)
 
int iomanX_ioctl2 (int fd, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen)
 
int iomanX_dopen (const char *path)
 
int iomanX_dread (int fd, iox_dirent_t *buf)
 
int iomanX_remove (const char *name)
 
int iomanX_mkdir (const char *path, int mode)
 
int iomanX_rmdir (const char *path)
 
int iomanX_getstat (const char *name, iox_stat_t *stat)
 
int iomanX_chstat (const char *name, iox_stat_t *stat, unsigned int statmask)
 
int iomanX_format (const char *dev, const char *blockdev, void *arg, int arglen)
 
int iomanX_rename (const char *oldname, const char *newname)
 
int iomanX_symlink (const char *oldname, const char *newname)
 
int iomanX_chdir (const char *name)
 
int iomanX_sync (const char *dev, int flag)
 
int iomanX_mount (const char *fsname, const char *devname, int flag, void *arg, int arglen)
 
int iomanX_umount (const char *fsname)
 
int iomanX_devctl (const char *name, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen)
 
int iomanX_readlink (const char *path, char *buf, unsigned int buflen)
 
int iomanX_AddDrv (iomanX_iop_device_t *device)
 
int iomanX_DelDrv (const char *name)
 

Variables

static int showdrvflag = 1
 
static iomanX_iop_device_ops_t dev_tty_dev_operations
 
static iomanX_iop_device_t dev_tty
 
static iomanX_iop_device_t dev_dummytty
 
static int adddeldrv_in_process
 
static iomanX_iop_file_t file_table [MAX_FILES]
 
static iomanX_iop_device_tdevice_table [MAX_DEVICES]
 

Detailed Description

Advanced I/O library.

Definition in file iomanX.c.

Macro Definition Documentation

◆ index

#define index   strchr

Definition at line 21 of file iomanX.c.

◆ Kprintf

#define Kprintf   printf

Definition at line 24 of file iomanX.c.

◆ MAX_DEVICES

#define MAX_DEVICES   16

Definition at line 51 of file iomanX.c.

◆ MAX_FILES

#define MAX_FILES   32

Definition at line 52 of file iomanX.c.

◆ isnum

#define isnum (   c)    ((c) >= '0' && (c) <= '9')

Definition at line 153 of file iomanX.c.

◆ EUNSUP

#define EUNSUP   48

Definition at line 160 of file iomanX.c.

◆ HANDLE_RESULT_CLEAR_INFO

#define HANDLE_RESULT_CLEAR_INFO   1

Definition at line 164 of file iomanX.c.

◆ HANDLE_RESULT_CLEAR_INFO_ON_ERROR

#define HANDLE_RESULT_CLEAR_INFO_ON_ERROR   2

Definition at line 165 of file iomanX.c.

◆ HANDLE_RESULT_RETURN_ZERO

#define HANDLE_RESULT_RETURN_ZERO   4

Definition at line 166 of file iomanX.c.

◆ HANDLE_RESULT_RETURN_FD

#define HANDLE_RESULT_RETURN_FD   8

Definition at line 167 of file iomanX.c.

◆ IOMANX_ENTRYPOINT

#define IOMANX_ENTRYPOINT   iomanX_start

Definition at line 234 of file iomanX.c.

◆ IOMANX_CLEANUP

#define IOMANX_CLEANUP   shutdown

Definition at line 239 of file iomanX.c.

Function Documentation

◆ iomanX_StdioInit()

void iomanX_StdioInit ( int  mode)

Definition at line 382 of file iomanX.c.

◆ open_tty_handles()

static int open_tty_handles ( const char *  tty_name)
static

Definition at line 429 of file iomanX.c.

◆ xx_stat()

static int xx_stat ( int  op,
const char *  name,
iox_stat_t stat,
unsigned int  statmask 
)
static

Definition at line 640 of file iomanX.c.

◆ xx_rename()

static int xx_rename ( int  op,
const char *  oldname,
const char *  newname 
)
static

Definition at line 740 of file iomanX.c.

◆ xx_dir()

static int xx_dir ( int  op,
const char *  name,
int  mode 
)
static

Definition at line 811 of file iomanX.c.

◆ _ioabort()

static int _ioabort ( const char *  str1,
const char *  str2 
)
static

Definition at line 958 of file iomanX.c.

◆ new_iob()

static iomanX_iop_file_t * new_iob ( void  )
static

Definition at line 963 of file iomanX.c.

◆ get_iob()

static iomanX_iop_file_t * get_iob ( int  fd)
static

Definition at line 990 of file iomanX.c.

◆ lookup_dev()

static iomanX_iop_device_t * lookup_dev ( const char *  name,
int  show_unkdev_msg 
)
static

Definition at line 997 of file iomanX.c.

◆ parsefile()

static const char * parsefile ( const char *  path,
iomanX_iop_device_t **  p_device,
int *  p_unit 
)
static

Definition at line 1041 of file iomanX.c.

◆ iomanX_GetDevType()

unsigned int iomanX_GetDevType ( int  fd)

Definition at line 1216 of file iomanX.c.

◆ ShowDrv()

static void ShowDrv ( void  )
static

Definition at line 1227 of file iomanX.c.

◆ register_tty()

static void register_tty ( void  )
static

Definition at line 1251 of file iomanX.c.

◆ register_dummytty()

static void register_dummytty ( void  )
static

Definition at line 1257 of file iomanX.c.

◆ write_str_to_stdout()

static void write_str_to_stdout ( const char *  in_str)
inlinestatic

Definition at line 169 of file iomanX.c.

◆ set_errno()

static int set_errno ( int  in_errno)
inlinestatic

Definition at line 174 of file iomanX.c.

◆ handle_result_pre()

static void handle_result_pre ( int  in_result,
iomanX_iop_file_t f,
int  op 
)
inlinestatic

Definition at line 182 of file iomanX.c.

◆ handle_result()

static int handle_result ( int  in_result,
iomanX_iop_file_t f,
int  op 
)
inlinestatic

Definition at line 201 of file iomanX.c.

◆ handle_result64()

static s64 handle_result64 ( s64  in_result,
iomanX_iop_file_t f,
int  op 
)
inlinestatic

Definition at line 213 of file iomanX.c.

◆ IOMANX_ENTRYPOINT()

int IOMANX_ENTRYPOINT ( int  ac,
char **  av 
)

Definition at line 242 of file iomanX.c.

◆ IOMANX_CLEANUP()

int IOMANX_CLEANUP ( int  arg)

Definition at line 290 of file iomanX.c.

◆ iomanX_open()

int iomanX_open ( const char *  name,
int  flags,
  ... 
)

Definition at line 437 of file iomanX.c.

◆ iomanX_lseek()

int iomanX_lseek ( int  fd,
int  offset,
int  mode 
)

Definition at line 460 of file iomanX.c.

◆ iomanX_lseek64()

s64 iomanX_lseek64 ( int  fd,
s64  offset,
int  whence 
)

Definition at line 479 of file iomanX.c.

◆ iomanX_read()

int iomanX_read ( int  fd,
void *  ptr,
int  size 
)

Definition at line 500 of file iomanX.c.

◆ iomanX_write()

int iomanX_write ( int  fd,
void *  ptr,
int  size 
)

Definition at line 510 of file iomanX.c.

◆ iomanX_close()

int iomanX_close ( int  fd)

Definition at line 520 of file iomanX.c.

◆ iomanX_ioctl()

int iomanX_ioctl ( int  fd,
int  cmd,
void *  param 
)

Definition at line 533 of file iomanX.c.

◆ iomanX_ioctl2()

int iomanX_ioctl2 ( int  fd,
int  cmd,
void *  arg,
unsigned int  arglen,
void *  buf,
unsigned int  buflen 
)

Definition at line 543 of file iomanX.c.

◆ iomanX_dopen()

int iomanX_dopen ( const char *  path)

Definition at line 556 of file iomanX.c.

◆ iomanX_dread()

int iomanX_dread ( int  fd,
iox_dirent_t buf 
)

Definition at line 572 of file iomanX.c.

◆ iomanX_remove()

int iomanX_remove ( const char *  name)

Definition at line 608 of file iomanX.c.

◆ iomanX_mkdir()

int iomanX_mkdir ( const char *  path,
int  mode 
)

Definition at line 630 of file iomanX.c.

◆ iomanX_rmdir()

int iomanX_rmdir ( const char *  path)

Definition at line 635 of file iomanX.c.

◆ iomanX_getstat()

int iomanX_getstat ( const char *  name,
iox_stat_t stat 
)

Definition at line 706 of file iomanX.c.

◆ iomanX_chstat()

int iomanX_chstat ( const char *  name,
iox_stat_t stat,
unsigned int  statmask 
)

Definition at line 711 of file iomanX.c.

◆ iomanX_format()

int iomanX_format ( const char *  dev,
const char *  blockdev,
void *  arg,
int  arglen 
)

This can take take more than one form.

Definition at line 716 of file iomanX.c.

References _iomanX_iop_file::device, EMFILE, ENODEV, and _iomanX_iop_file::unit.

◆ iomanX_rename()

int iomanX_rename ( const char *  oldname,
const char *  newname 
)

Definition at line 792 of file iomanX.c.

◆ iomanX_symlink()

int iomanX_symlink ( const char *  oldname,
const char *  newname 
)

Definition at line 798 of file iomanX.c.

◆ iomanX_chdir()

int iomanX_chdir ( const char *  name)

Definition at line 803 of file iomanX.c.

◆ iomanX_sync()

int iomanX_sync ( const char *  dev,
int  flag 
)

Definition at line 852 of file iomanX.c.

◆ iomanX_mount()

int iomanX_mount ( const char *  fsname,
const char *  devname,
int  flag,
void *  arg,
int  arglen 
)

Definition at line 857 of file iomanX.c.

◆ iomanX_umount()

int iomanX_umount ( const char *  fsname)

Definition at line 884 of file iomanX.c.

◆ iomanX_devctl()

int iomanX_devctl ( const char *  name,
int  cmd,
void *  arg,
unsigned int  arglen,
void *  buf,
unsigned int  buflen 
)

Definition at line 909 of file iomanX.c.

◆ iomanX_readlink()

int iomanX_readlink ( const char *  path,
char *  buf,
unsigned int  buflen 
)

Definition at line 934 of file iomanX.c.

◆ iomanX_AddDrv()

int iomanX_AddDrv ( iomanX_iop_device_t device)

Definition at line 1087 of file iomanX.c.

◆ iomanX_DelDrv()

int iomanX_DelDrv ( const char *  name)

Definition at line 1158 of file iomanX.c.

Variable Documentation

◆ showdrvflag

int showdrvflag = 1
static

Definition at line 85 of file iomanX.c.

◆ dev_tty_dev_operations

iomanX_iop_device_ops_t dev_tty_dev_operations
static
Initial value:
= {
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE_S64(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
IOMANX_RETURN_VALUE(0),
}

Definition at line 90 of file iomanX.c.

◆ dev_tty

iomanX_iop_device_t dev_tty
static
Initial value:
= {
"tty",
IOP_DT_CHAR,
1,
"CONSOLE",
&dev_tty_dev_operations,
}

Definition at line 119 of file iomanX.c.

◆ dev_dummytty

iomanX_iop_device_t dev_dummytty
static
Initial value:
= {
"dummytty",
IOP_DT_CHAR,
1,
"CONSOLE",
&dev_tty_dev_operations,
}

Definition at line 126 of file iomanX.c.

◆ adddeldrv_in_process

int adddeldrv_in_process
static

Definition at line 134 of file iomanX.c.

◆ file_table

iomanX_iop_file_t file_table[MAX_FILES]
static

Definition at line 145 of file iomanX.c.

◆ device_table

iomanX_iop_device_t* device_table[MAX_DEVICES]
static

Definition at line 149 of file iomanX.c.