PS2SDK
PS2 Homebrew Libraries
fileXio.h
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
19
#ifndef __FILEXIO_H__
20
#define __FILEXIO_H__
21
22
#include <
tamtypes.h
>
23
#include <
iox_stat.h
>
24
25
#ifdef _EE
26
#ifndef NEWLIB_PORT_AWARE
27
#error "Using fio/fileXio functions directly in the newlib port will lead to problems."
28
#error "Use posix function calls instead."
29
#endif
30
#endif
31
32
#define FILEXIO_IRX 0xb0b0b00
33
35
#define FILEXIO_DEFAULT_RW_BUFFER_SIZE (16 * 1024)
36
37
enum
FILEXIO_CMDS {
38
FILEXIO_DOPEN = 0x01,
39
FILEXIO_DREAD,
40
FILEXIO_DCLOSE,
41
FILEXIO_MOUNT,
42
FILEXIO_UMOUNT,
43
FILEXIO_GETDIR,
44
FILEXIO_STOP,
45
FILEXIO_COPYFILE,
46
FILEXIO_OPEN,
47
FILEXIO_CLOSE,
48
FILEXIO_READ,
49
FILEXIO_WRITE,
50
FILEXIO_LSEEK,
51
FILEXIO_IOCTL,
52
FILEXIO_RMDIR,
53
FILEXIO_GETSTAT,
54
FILEXIO_CHSTAT,
55
FILEXIO_FORMAT,
56
FILEXIO_ADDDRV,
57
FILEXIO_DELDRV,
58
FILEXIO_RENAME,
59
FILEXIO_CHDIR,
60
FILEXIO_SYNC,
61
FILEXIO_DEVCTL,
62
FILEXIO_SYMLINK,
63
FILEXIO_READLINK,
64
FILEXIO_IOCTL2,
65
FILEXIO_LSEEK64,
66
FILEXIO_MKDIR,
67
FILEXIO_REMOVE,
68
FILEXIO_GETDEVICELIST,
69
FILEXIO_SETRWBUFFSIZE
70
};
71
73
typedef
struct
74
{
75
int
ssize;
76
int
esize;
77
void
*sbuf;
78
void
*ebuf;
79
u8 sbuffer[64];
80
u8 ebuffer[64];
81
}
rests_pkt
;
// sizeof = 144
82
83
#define FILEXIO_MOUNTFLAG_NORMAL 0
84
#define FILEXIO_MOUNTFLAG_READONLY 1
85
#define FILEXIO_MOUNTFLAG_ROBUST 2
86
87
#define FILEXIO_DIRFLAGS_DIR 0xa0
88
#define FILEXIO_DIRFLAGS_FILE 0x80
89
90
#define CTL_BUF_SIZE 2048
91
#define IOCTL_BUF_SIZE 1024
92
93
#define FILEXIO_MAX_DEVICES 32
94
95
#define FILEXIO_DT_CHAR 0x01
96
#define FILEXIO_DT_CONS 0x02
97
#define FILEXIO_DT_BLOCK 0x04
98
#define FILEXIO_DT_RAW 0x08
99
#define FILEXIO_DT_FS 0x10
100
101
#define FILEXIO_DT_FSEXT 0x10000000
102
103
struct
fileXioDirEntry
104
{
105
u32 fileSize;
106
u8 fileProperties;
107
char
filename[128 + 1];
108
}
__attribute__
((
aligned
(64)));
109
110
struct
fileXioDevice
111
{
112
char
name[16];
113
unsigned
int
type;
115
unsigned
int
version
;
116
char
desc[128];
117
}
__attribute__
((
aligned
(64)));
118
119
struct
fxio_devlist_packet
120
{
121
struct
fileXioDevice
*deviceEntry;
122
unsigned
int
reqEntries;
123
};
124
125
struct
fxio_getdir_packet
126
{
127
char
pathname[512];
128
struct
fileXioDirEntry
*dirEntry;
129
unsigned
int
reqEntries;
130
};
131
132
struct
fxio_mount_packet
133
{
134
char
blockdevice[512];
135
char
mountpoint[512];
136
int
flags;
137
};
138
139
struct
fxio_unmount_packet
140
{
141
char
mountpoint[512];
142
};
143
144
struct
fxio_copyfile_packet
145
{
146
char
source[512];
147
char
dest[512];
148
int
mode;
149
};
150
151
struct
fxio_mkdir_packet
152
{
153
char
pathname[512];
154
int
mode;
155
};
156
158
struct
fxio_pathsel_packet
159
{
160
char
pathname[512];
161
};
162
164
struct
fxio_rename_packet
165
{
166
char
source[512];
167
char
dest[512];
168
};
169
170
struct
fxio_readlink_packet
171
{
172
char
source[512];
173
void
*buffer;
174
unsigned
int
buflen;
175
};
176
177
struct
fxio_open_packet
178
{
179
char
pathname[512];
180
int
flags, mode;
181
};
182
184
struct
fxio_close_packet
185
{
186
int
fd;
187
};
188
189
struct
fxio_read_packet
190
{
191
int
fd;
192
void
*buffer;
193
int
size;
194
void
*intrData;
195
};
196
197
struct
fxio_write_packet
198
{
199
int
fd;
200
const
void
*buffer;
201
int
size;
202
unsigned
int
unalignedDataLen;
203
unsigned
char
unalignedData[64];
204
};
205
206
struct
fxio_lseek_packet
207
{
208
int
fd;
209
u32 offset;
210
int
whence;
211
};
212
213
struct
fxio_lseek64_packet
214
{
215
int
fd;
216
u32 offset_lo;
217
u32 offset_hi;
218
int
whence;
219
};
220
221
struct
fxio_chstat_packet
222
{
223
char
pathname[512];
224
iox_stat_t
*stat;
225
int
mask;
226
};
227
228
struct
fxio_getstat_packet
229
{
230
char
pathname[512];
231
iox_stat_t
*stat;
232
};
233
234
struct
fxio_format_packet
235
{
236
char
device[128];
237
char
blockDevice[512];
238
char
args[512];
239
int
arglen;
240
};
241
242
struct
fxio_sync_packet
243
{
244
char
device[512];
245
int
flags;
246
};
247
248
struct
fxio_dread_packet
249
{
250
int
fd;
251
iox_dirent_t
*dirent;
252
};
253
254
struct
fxio_devctl_packet
255
{
256
char
name[CTL_BUF_SIZE];
257
u8 arg[CTL_BUF_SIZE];
258
int
cmd;
259
int
arglen;
260
void
*buf;
261
int
buflen;
262
void
*intr_data;
263
};
264
265
struct
fxio_ioctl_packet
266
{
267
int
fd;
268
u8 arg[IOCTL_BUF_SIZE];
269
int
cmd;
270
};
271
272
struct
fxio_ioctl2_packet
273
{
274
int
fd;
275
u8 arg[CTL_BUF_SIZE];
276
int
cmd;
277
int
arglen;
278
void
*buf;
279
int
buflen;
280
void
*intr_data;
281
};
282
283
struct
fxio_ctl_return_pkt
284
{
285
void
*dest;
286
int
len;
287
u8 buf[CTL_BUF_SIZE];
288
int
padding[2];
289
};
290
291
struct
fxio_lseek64_return_pkt
292
{
293
u32 pos_lo, pos_hi;
294
};
295
296
struct
fxio_rwbuff
297
{
298
int
size;
299
};
300
301
#endif
/* __FILEXIO_H__ */
iox_stat_t
Definition:
iox_stat.h:92
fileXioDevice
Definition:
fileXio.h:110
fxio_format_packet
Definition:
fileXio.h:234
fxio_devctl_packet
Definition:
fileXio.h:254
fxio_unmount_packet
Definition:
fileXio.h:139
fxio_getdir_packet
Definition:
fileXio.h:125
fxio_lseek64_return_pkt
Definition:
fileXio.h:291
fxio_rename_packet
Definition:
fileXio.h:164
fxio_ioctl_packet
Definition:
fileXio.h:265
fxio_lseek_packet
Definition:
fileXio.h:206
fileXioDirEntry
Definition:
fileXio.h:103
rests_pkt
Definition:
fileXio.h:73
fxio_rwbuff
Definition:
fileXio.h:296
fxio_ctl_return_pkt
Definition:
fileXio.h:283
fxio_sync_packet
Definition:
fileXio.h:242
fxio_dread_packet
Definition:
fileXio.h:248
fxio_read_packet
Definition:
fileXio.h:189
tamtypes.h
fxio_open_packet
Definition:
fileXio.h:177
fxio_mount_packet
Definition:
fileXio.h:132
fxio_getstat_packet
Definition:
fileXio.h:228
iox_dirent_t
Definition:
iox_stat.h:111
fxio_mkdir_packet
Definition:
fileXio.h:151
fxio_close_packet
Definition:
fileXio.h:184
fxio_ioctl2_packet
Definition:
fileXio.h:272
__attribute__
Definition:
gif_registers.h:38
fxio_lseek64_packet
Definition:
fileXio.h:213
fxio_readlink_packet
Definition:
fileXio.h:170
fxio_chstat_packet
Definition:
fileXio.h:221
fxio_devlist_packet
Definition:
fileXio.h:119
fxio_write_packet
Definition:
fileXio.h:197
fileXioDevice::version
unsigned int version
Definition:
fileXio.h:115
fxio_pathsel_packet
Definition:
fileXio.h:158
fxio_copyfile_packet
Definition:
fileXio.h:144
iox_stat.h
common
include
fileXio.h
Generated on Tue Oct 13 2026 12:30:40 for PS2SDK by
1.8.17