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)
 
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 150 of file iomanX.c.

◆ EUNSUP

#define EUNSUP   48

Definition at line 157 of file iomanX.c.

◆ HANDLE_RESULT_CLEAR_INFO

#define HANDLE_RESULT_CLEAR_INFO   1

Definition at line 161 of file iomanX.c.

◆ HANDLE_RESULT_CLEAR_INFO_ON_ERROR

#define HANDLE_RESULT_CLEAR_INFO_ON_ERROR   2

Definition at line 162 of file iomanX.c.

◆ HANDLE_RESULT_RETURN_ZERO

#define HANDLE_RESULT_RETURN_ZERO   4

Definition at line 163 of file iomanX.c.

◆ HANDLE_RESULT_RETURN_FD

#define HANDLE_RESULT_RETURN_FD   8

Definition at line 164 of file iomanX.c.

◆ IOMANX_ENTRYPOINT

#define IOMANX_ENTRYPOINT   iomanX_start

Definition at line 233 of file iomanX.c.

◆ IOMANX_CLEANUP

#define IOMANX_CLEANUP   shutdown

Definition at line 238 of file iomanX.c.

Function Documentation

◆ iomanX_StdioInit()

void iomanX_StdioInit ( int  mode)

Definition at line 381 of file iomanX.c.

◆ open_tty_handles()

static int open_tty_handles ( const char *  tty_name)
static

Definition at line 428 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 632 of file iomanX.c.

◆ xx_rename()

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

Definition at line 718 of file iomanX.c.

◆ xx_dir()

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

Definition at line 782 of file iomanX.c.

◆ _ioabort()

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

Definition at line 894 of file iomanX.c.

◆ new_iob()

static iomanX_iop_file_t * new_iob ( void  )
static

Definition at line 899 of file iomanX.c.

◆ get_iob()

static iomanX_iop_file_t * get_iob ( int  fd)
static

Definition at line 919 of file iomanX.c.

◆ lookup_dev()

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

Definition at line 926 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 970 of file iomanX.c.

◆ tty_noop()

static int tty_noop ( void  )
static

Definition at line 1016 of file iomanX.c.

◆ iomanX_GetDevType()

unsigned int iomanX_GetDevType ( int  fd)

Definition at line 1151 of file iomanX.c.

◆ ShowDrv()

static void ShowDrv ( void  )
static

Definition at line 1162 of file iomanX.c.

◆ register_tty()

static void register_tty ( void  )
static

Definition at line 1186 of file iomanX.c.

◆ register_dummytty()

static void register_dummytty ( void  )
static

Definition at line 1192 of file iomanX.c.

◆ write_str_to_stdout()

static void write_str_to_stdout ( const char *  in_str)
inlinestatic

Definition at line 166 of file iomanX.c.

◆ set_errno()

static int set_errno ( int  in_errno)
inlinestatic

Definition at line 171 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 179 of file iomanX.c.

◆ handle_result()

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

Definition at line 200 of file iomanX.c.

◆ handle_result64()

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

Definition at line 212 of file iomanX.c.

◆ IOMANX_ENTRYPOINT()

int IOMANX_ENTRYPOINT ( int  ac,
char **  av 
)

Definition at line 241 of file iomanX.c.

◆ IOMANX_CLEANUP()

int IOMANX_CLEANUP ( int  arg)

Definition at line 289 of file iomanX.c.

◆ iomanX_open()

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

Definition at line 436 of file iomanX.c.

◆ iomanX_lseek()

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

Definition at line 459 of file iomanX.c.

◆ iomanX_lseek64()

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

Definition at line 478 of file iomanX.c.

◆ iomanX_read()

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

Definition at line 499 of file iomanX.c.

◆ iomanX_write()

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

Definition at line 509 of file iomanX.c.

◆ iomanX_close()

int iomanX_close ( int  fd)

Definition at line 519 of file iomanX.c.

◆ iomanX_ioctl()

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

Definition at line 532 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 542 of file iomanX.c.

◆ iomanX_dopen()

int iomanX_dopen ( const char *  path)

Definition at line 555 of file iomanX.c.

◆ iomanX_dread()

int iomanX_dread ( int  fd,
iox_dirent_t buf 
)

Definition at line 571 of file iomanX.c.

◆ iomanX_remove()

int iomanX_remove ( const char *  name)

Definition at line 607 of file iomanX.c.

◆ iomanX_mkdir()

int iomanX_mkdir ( const char *  path,
int  mode 
)

Definition at line 622 of file iomanX.c.

◆ iomanX_rmdir()

int iomanX_rmdir ( const char *  path)

Definition at line 627 of file iomanX.c.

◆ iomanX_getstat()

int iomanX_getstat ( const char *  name,
iox_stat_t stat 
)

Definition at line 691 of file iomanX.c.

◆ iomanX_chstat()

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

Definition at line 696 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 701 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 763 of file iomanX.c.

◆ iomanX_symlink()

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

Definition at line 769 of file iomanX.c.

◆ iomanX_chdir()

int iomanX_chdir ( const char *  name)

Definition at line 774 of file iomanX.c.

◆ iomanX_sync()

int iomanX_sync ( const char *  dev,
int  flag 
)

Definition at line 816 of file iomanX.c.

◆ iomanX_mount()

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

Definition at line 821 of file iomanX.c.

◆ iomanX_umount()

int iomanX_umount ( const char *  fsname)

Definition at line 841 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 859 of file iomanX.c.

◆ iomanX_readlink()

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

Definition at line 877 of file iomanX.c.

◆ iomanX_AddDrv()

int iomanX_AddDrv ( iomanX_iop_device_t device)

Definition at line 1022 of file iomanX.c.

◆ iomanX_DelDrv()

int iomanX_DelDrv ( const char *  name)

Definition at line 1093 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:
= {
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
(void *)&tty_noop,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}

Definition at line 87 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 116 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 123 of file iomanX.c.

◆ adddeldrv_in_process

int adddeldrv_in_process
static

Definition at line 131 of file iomanX.c.

◆ file_table

iomanX_iop_file_t file_table[MAX_FILES]
static

Definition at line 142 of file iomanX.c.

◆ device_table

iomanX_iop_device_t* device_table[MAX_DEVICES]
static

Definition at line 146 of file iomanX.c.