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 enum FILEXIO_CMDS {
34  FILEXIO_DOPEN = 0x01,
35  FILEXIO_DREAD,
36  FILEXIO_DCLOSE,
37  FILEXIO_MOUNT,
38  FILEXIO_UMOUNT,
39  FILEXIO_GETDIR,
40  FILEXIO_STOP,
41  FILEXIO_COPYFILE,
42  FILEXIO_OPEN,
43  FILEXIO_CLOSE,
44  FILEXIO_READ,
45  FILEXIO_WRITE,
46  FILEXIO_LSEEK,
47  FILEXIO_IOCTL,
48  FILEXIO_RMDIR,
49  FILEXIO_GETSTAT,
50  FILEXIO_CHSTAT,
51  FILEXIO_FORMAT,
52  FILEXIO_ADDDRV,
53  FILEXIO_DELDRV,
54  FILEXIO_RENAME,
55  FILEXIO_CHDIR,
56  FILEXIO_SYNC,
57  FILEXIO_DEVCTL,
58  FILEXIO_SYMLINK,
59  FILEXIO_READLINK,
60  FILEXIO_IOCTL2,
61  FILEXIO_LSEEK64,
62  FILEXIO_MKDIR,
63  FILEXIO_REMOVE,
64  FILEXIO_GETDEVICELIST,
65  FILEXIO_SETRWBUFFSIZE
66 };
67 
69 typedef struct
70 {
71  int ssize;
72  int esize;
73  void *sbuf;
74  void *ebuf;
75  u8 sbuffer[64];
76  u8 ebuffer[64];
77 } rests_pkt; // sizeof = 144
78 
79 #define FILEXIO_MOUNTFLAG_NORMAL 0
80 #define FILEXIO_MOUNTFLAG_READONLY 1
81 #define FILEXIO_MOUNTFLAG_ROBUST 2
82 
83 #define FILEXIO_DIRFLAGS_DIR 0xa0
84 #define FILEXIO_DIRFLAGS_FILE 0x80
85 
86 #define CTL_BUF_SIZE 2048
87 #define IOCTL_BUF_SIZE 1024
88 
89 #define FILEXIO_MAX_DEVICES 32
90 
91 #define FILEXIO_DT_CHAR 0x01
92 #define FILEXIO_DT_CONS 0x02
93 #define FILEXIO_DT_BLOCK 0x04
94 #define FILEXIO_DT_RAW 0x08
95 #define FILEXIO_DT_FS 0x10
96 
97 #define FILEXIO_DT_FSEXT 0x10000000
98 
100 {
101  u32 fileSize;
102  u8 fileProperties;
103  char filename[128 + 1];
104 } __attribute__((aligned(64)));
105 
107 {
108  char name[16];
109  unsigned int type;
111  unsigned int version;
112  char desc[128];
113 } __attribute__((aligned(64)));
114 
116 {
117  struct fileXioDevice *deviceEntry;
118  unsigned int reqEntries;
119 };
120 
122 {
123  char pathname[512];
124  struct fileXioDirEntry *dirEntry;
125  unsigned int reqEntries;
126 };
127 
129 {
130  char blockdevice[512];
131  char mountpoint[512];
132  int flags;
133 };
134 
136 {
137  char mountpoint[512];
138 };
139 
141 {
142  char source[512];
143  char dest[512];
144  int mode;
145 };
146 
148 {
149  char pathname[512];
150  int mode;
151 };
152 
155 {
156  char pathname[512];
157 };
158 
161 {
162  char source[512];
163  char dest[512];
164 };
165 
167 {
168  char source[512];
169  void *buffer;
170  unsigned int buflen;
171 };
172 
174 {
175  char pathname[512];
176  int flags, mode;
177 };
178 
181 {
182  int fd;
183 };
184 
186 {
187  int fd;
188  void *buffer;
189  int size;
190  void *intrData;
191 };
192 
194 {
195  int fd;
196  const void *buffer;
197  int size;
198  unsigned int unalignedDataLen;
199  unsigned char unalignedData[64];
200 };
201 
203 {
204  int fd;
205  u32 offset;
206  int whence;
207 };
208 
210 {
211  int fd;
212  u32 offset_lo;
213  u32 offset_hi;
214  int whence;
215 };
216 
218 {
219  char pathname[512];
220  iox_stat_t *stat;
221  int mask;
222 };
223 
225 {
226  char pathname[512];
227  iox_stat_t *stat;
228 };
229 
231 {
232  char device[128];
233  char blockDevice[512];
234  char args[512];
235  int arglen;
236 };
237 
239 {
240  char device[512];
241  int flags;
242 };
243 
245 {
246  int fd;
247  iox_dirent_t *dirent;
248 };
249 
251 {
252  char name[CTL_BUF_SIZE];
253  u8 arg[CTL_BUF_SIZE];
254  int cmd;
255  int arglen;
256  void *buf;
257  int buflen;
258  void *intr_data;
259 };
260 
262 {
263  int fd;
264  u8 arg[IOCTL_BUF_SIZE];
265  int cmd;
266 };
267 
269 {
270  int fd;
271  u8 arg[CTL_BUF_SIZE];
272  int cmd;
273  int arglen;
274  void *buf;
275  int buflen;
276  void *intr_data;
277 };
278 
280 {
281  void *dest;
282  int len;
283  u8 buf[CTL_BUF_SIZE];
284  int padding[2];
285 };
286 
288 {
289  u32 pos_lo, pos_hi;
290 };
291 
293 {
294  int size;
295 };
296 
297 #endif /* __FILEXIO_H__ */
iox_stat_t
Definition: iox_stat.h:92
fileXioDevice
Definition: fileXio.h:106
fxio_format_packet
Definition: fileXio.h:230
fxio_devctl_packet
Definition: fileXio.h:250
fxio_unmount_packet
Definition: fileXio.h:135
fxio_getdir_packet
Definition: fileXio.h:121
fxio_lseek64_return_pkt
Definition: fileXio.h:287
fxio_rename_packet
Definition: fileXio.h:160
fxio_ioctl_packet
Definition: fileXio.h:261
fxio_lseek_packet
Definition: fileXio.h:202
fileXioDirEntry
Definition: fileXio.h:99
rests_pkt
Definition: fileXio.h:69
fxio_rwbuff
Definition: fileXio.h:292
fxio_ctl_return_pkt
Definition: fileXio.h:279
fxio_sync_packet
Definition: fileXio.h:238
fxio_dread_packet
Definition: fileXio.h:244
fxio_read_packet
Definition: fileXio.h:185
tamtypes.h
fxio_open_packet
Definition: fileXio.h:173
fxio_mount_packet
Definition: fileXio.h:128
fxio_getstat_packet
Definition: fileXio.h:224
iox_dirent_t
Definition: iox_stat.h:111
fxio_mkdir_packet
Definition: fileXio.h:147
fxio_close_packet
Definition: fileXio.h:180
fxio_ioctl2_packet
Definition: fileXio.h:268
__attribute__
Definition: gif_registers.h:38
fxio_lseek64_packet
Definition: fileXio.h:209
fxio_chstat_packet
Definition: fileXio.h:217
fxio_devlist_packet
Definition: fileXio.h:115
fxio_write_packet
Definition: fileXio.h:193
fileXioDevice::version
unsigned int version
Definition: fileXio.h:111
fxio_pathsel_packet
Definition: fileXio.h:154
fxio_copyfile_packet
Definition: fileXio.h:140
iox_stat.h