PS2SDK
PS2 Homebrew Libraries
ioman.h
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
16
#ifndef __IOMAN_H__
17
#define __IOMAN_H__
18
19
#include <types.h>
20
#include <
irx.h
>
21
#include <
io_common.h
>
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
27
extern
int
open(
const
char
*name,
int
mode);
28
extern
int
close(
int
fd);
29
extern
int
read(
int
fd,
void
*ptr,
size_t
size);
30
extern
int
write(
int
fd,
void
*ptr,
size_t
size);
31
extern
int
lseek(
int
fd,
int
pos,
int
mode);
32
extern
int
ioctl(
int
fd,
int
command,
void
*arg);
33
extern
int
remove(
const
char
*name);
34
extern
int
mkdir(
const
char
*path);
35
extern
int
rmdir(
const
char
*path);
36
extern
int
dopen(
const
char
*path,
int
mode);
37
extern
int
dclose(
int
fd);
38
extern
int
dread(
int
fd,
io_dirent_t
*buf);
39
extern
int
getstat(
const
char
*name,
io_stat_t
*stat);
40
extern
int
chstat(
const
char
*name,
io_stat_t
*stat,
unsigned
int
statmask);
41
extern
int
format(
const
char
*dev);
42
43
/* Device drivers. */
44
45
/* Device types. */
46
#define IOP_DT_CHAR 0x01
47
#define IOP_DT_CONS 0x02
48
#define IOP_DT_BLOCK 0x04
49
#define IOP_DT_RAW 0x08
50
#define IOP_DT_FS 0x10
51
53
typedef
struct
_iop_file
{
55
int
mode
;
57
int
unit
;
59
struct
_iop_device
*
device
;
61
void
*
privdata
;
62
}
iop_file_t
;
63
64
typedef
struct
_iop_device
{
65
const
char
*name;
66
unsigned
int
type;
68
unsigned
int
version
;
69
const
char
*desc;
70
struct
_iop_device_ops
*ops;
71
}
iop_device_t
;
72
73
#define IOMAN_RETURN_VALUE_IMPL(val) \
74
static inline int my_ioman_retval_##val##_int(void) {return -val;} \
75
static inline signed long long my_ioman_retval_##val##_s64(void) {return -val;}
76
#define IOMAN_RETURN_VALUE(val) ((void*)&my_ioman_retval_##val##_int)
77
#define IOMAN_RETURN_VALUE_S64(val) ((void*)&my_ioman_retval_##val##_s64)
78
79
typedef
struct
_iop_device_ops
{
80
int (*init)(
iop_device_t
*device);
81
int (*deinit)(
iop_device_t
*device);
82
int (*format)(
iop_file_t
*f);
83
int (*open)(
iop_file_t
*f,
const
char
*name,
int
flags);
84
int (*close)(
iop_file_t
*f);
85
int (*read)(
iop_file_t
*f,
void
*ptr,
int
size);
86
int (*write)(
iop_file_t
*f,
void
*ptr,
int
size);
87
int (*lseek)(
iop_file_t
*f,
int
offset,
int
mode);
88
int (*ioctl)(
iop_file_t
*f,
int
cmd,
void
*param);
89
int (*remove)(
iop_file_t
*f,
const
char
*name);
90
int (*mkdir)(
iop_file_t
*f,
const
char
*path);
91
int (*rmdir)(
iop_file_t
*f,
const
char
*path);
92
int (*dopen)(
iop_file_t
*f,
const
char
*path);
93
int (*dclose)(
iop_file_t
*f);
94
int (*dread)(
iop_file_t
*f,
io_dirent_t
*buf);
95
int (*getstat)(
iop_file_t
*f,
const
char
*name,
io_stat_t
*stat_);
96
int (*chstat)(
iop_file_t
*f,
const
char
*name,
io_stat_t
*stat_,
unsigned
int
statmask);
97
}
iop_device_ops_t
;
98
99
extern
int
AddDrv(
iop_device_t
*device);
100
extern
int
DelDrv(
const
char
*name);
101
102
#define ioman_IMPORTS_start DECLARE_IMPORT_TABLE(ioman, 1, 1)
103
#define ioman_IMPORTS_end END_IMPORT_TABLE
104
105
#define I_open DECLARE_IMPORT(4, open)
106
#define I_close DECLARE_IMPORT(5, close)
107
#define I_read DECLARE_IMPORT(6, read)
108
#define I_write DECLARE_IMPORT(7, write)
109
#define I_lseek DECLARE_IMPORT(8, lseek)
110
#define I_ioctl DECLARE_IMPORT(9, ioctl)
111
#define I_remove DECLARE_IMPORT(10, remove)
112
#define I_mkdir DECLARE_IMPORT(11, mkdir)
113
#define I_rmdir DECLARE_IMPORT(12, rmdir)
114
#define I_dopen DECLARE_IMPORT(13, dopen)
115
#define I_dclose DECLARE_IMPORT(14, dclose)
116
#define I_dread DECLARE_IMPORT(15, dread)
117
#define I_getstat DECLARE_IMPORT(16, getstat)
118
#define I_chstat DECLARE_IMPORT(17, chstat)
119
#define I_format DECLARE_IMPORT(18, format)
120
#define I_AddDrv DECLARE_IMPORT(20, AddDrv);
121
#define I_DelDrv DECLARE_IMPORT(21, DelDrv);
122
123
#ifdef __cplusplus
124
}
125
#endif
126
127
#endif
/* __IOMAN_H__ */
io_common.h
_iop_file::privdata
void * privdata
Definition:
ioman.h:61
_iop_file::mode
int mode
Definition:
ioman.h:55
irx.h
_iop_file::unit
int unit
Definition:
ioman.h:57
_iop_file
Definition:
ioman.h:53
io_stat_t
Definition:
io_common.h:47
_iop_device_ops
Definition:
ioman.h:79
io_dirent_t
Definition:
io_common.h:58
_iop_device::version
unsigned int version
Definition:
ioman.h:68
_iop_file::device
struct _iop_device * device
Definition:
ioman.h:59
_iop_device
Definition:
ioman.h:64
iop_file_t
struct _iop_file iop_file_t
iop
system
ioman
include
ioman.h
Generated on Sat May 16 2026 16:59:27 for PS2SDK by
1.8.17