17#ifdef IOMANX_ENABLE_LEGACY_IOMAN_HOOK
37static const char *ioman_modname =
"IO/File_Manager";
59 int len = strlen(name) + 1;
65 if (!memcmp(
info->name, name, len))
80 for(table = lib->caller; table != NULL; table = table->next)
83 for(stub = (
struct irx_import_stub *) table->stubs; stub->jump != 0; stub++)
86 stub->jump = 0x08000000 | (((u32) lib->exports[stub->fno] << 4) >> 6);
93static u32 *ioman_exports;
95static u32 Addr_IOMAN_open = 0;
96static u32 Addr_IOMAN_close = 0;
97static u32 Addr_IOMAN_read = 0;
98static u32 Addr_IOMAN_write = 0;
99static u32 Addr_IOMAN_lseek = 0;
100static u32 Addr_IOMAN_ioctl = 0;
101static u32 Addr_IOMAN_remove = 0;
102static u32 Addr_IOMAN_mkdir = 0;
103static u32 Addr_IOMAN_rmdir = 0;
104static u32 Addr_IOMAN_dopen = 0;
105static u32 Addr_IOMAN_dclose = 0;
106static u32 Addr_IOMAN_dread = 0;
107static u32 Addr_IOMAN_getstat = 0;
108static u32 Addr_IOMAN_chstat = 0;
109static u32 Addr_IOMAN_format = 0;
111static u32 Addr_IOMAN_AddDrv = 0;
112static u32 Addr_IOMAN_DelDrv = 0;
122 res = AddDrv(device);
124 if (Addr_IOMAN_AddDrv)
131static int sbv_DelDrv(
const char *name)
137 if (Addr_IOMAN_DelDrv)
138 return(((
int (*)(
const char *)) (Addr_IOMAN_DelDrv))(name));
149int ioman_open(
const char *name, u32 flags)
151 return(iomanX_open(name, flags, 0644));
154int ioman_mkdir(
const char *name)
156 return(iomanX_mkdir(name, 0755));
160int ioman_format(
const char *dev)
167int mode2modex(
int mode);
168int modex2mode(
int mode);
172 stat->mode = modex2mode(iox_stat->mode);
173 stat->attr = iox_stat->attr;
174 stat->size = iox_stat->size;
175 memcpy(stat->ctime, iox_stat->ctime,
sizeof(iox_stat->ctime));
176 memcpy(stat->atime, iox_stat->atime,
sizeof(iox_stat->atime));
177 memcpy(stat->mtime, iox_stat->mtime,
sizeof(iox_stat->mtime));
178 stat->hisize = iox_stat->hisize;
183 iox_stat->mode = mode2modex(stat->mode);
184 iox_stat->attr = stat->attr;
185 iox_stat->size = stat->size;
186 memcpy(iox_stat->ctime, stat->ctime,
sizeof(stat->ctime));
187 memcpy(iox_stat->atime, stat->atime,
sizeof(stat->atime));
188 memcpy(iox_stat->mtime, stat->mtime,
sizeof(stat->mtime));
189 iox_stat->hisize = stat->hisize;
197 if (f == NULL || !(f->
mode & 8))
205 res = f->
device->ops->dread(f, &iox_dirent);
207 statx2stat(&iox_dirent.stat, &io_dirent->stat);
209 strncpy(io_dirent->name, iox_dirent.name,
sizeof(iox_dirent.name));
214 io_dread_t *io_dread = (io_dread_t*) f->
device->ops->dread;
215 res = io_dread(f, io_dirent);
221int ioman_getstat(
const char *name,
io_stat_t *stat)
224 int res = iomanX_getstat(name, &iox_stat);
226 statx2stat(&iox_stat, stat);
230int ioman_chstat(
const char *name,
io_stat_t *stat,
unsigned int mask)
233 stat2statx(stat, &iox_stat);
234 return iomanX_chstat(name, &iox_stat, mask);
241 iop_library_t ioman_library = { NULL, NULL, 0x102, 0,
"ioman\0\0" };
244 dev_list = iomanX_GetDeviceList();
257 if ((ioman_exports = (u32 *)QueryLibraryEntryTable(&ioman_library)) != NULL)
260 Addr_IOMAN_open = ioman_exports[4];
261 Addr_IOMAN_close = ioman_exports[5];
262 Addr_IOMAN_read = ioman_exports[6];
263 Addr_IOMAN_write = ioman_exports[7];
264 Addr_IOMAN_lseek = ioman_exports[8];
265 Addr_IOMAN_ioctl = ioman_exports[9];
266 Addr_IOMAN_remove = ioman_exports[10];
267 Addr_IOMAN_mkdir = ioman_exports[11];
268 Addr_IOMAN_rmdir = ioman_exports[12];
269 Addr_IOMAN_dopen = ioman_exports[13];
270 Addr_IOMAN_dclose = ioman_exports[14];
271 Addr_IOMAN_dread = ioman_exports[15];
272 Addr_IOMAN_getstat = ioman_exports[16];
273 Addr_IOMAN_chstat = ioman_exports[17];
274 Addr_IOMAN_format = ioman_exports[18];
275 Addr_IOMAN_AddDrv = ioman_exports[20];
276 Addr_IOMAN_DelDrv = ioman_exports[21];
279 ioman_exports[4] = (u32) ioman_open;
280 ioman_exports[5] = (u32) iomanX_close;
281 ioman_exports[6] = (u32) iomanX_read;
282 ioman_exports[7] = (u32) iomanX_write;
283 ioman_exports[8] = (u32) iomanX_lseek;
284 ioman_exports[9] = (u32) iomanX_ioctl;
285 ioman_exports[10] = (u32) iomanX_remove;
286 ioman_exports[11] = (u32) ioman_mkdir;
287 ioman_exports[12] = (u32) iomanX_rmdir;
288 ioman_exports[13] = (u32) iomanX_dopen;
289 ioman_exports[14] = (u32) iomanX_close;
290 ioman_exports[15] = (u32) ioman_dread;
291 ioman_exports[16] = (u32) ioman_getstat;
292 ioman_exports[17] = (u32) ioman_chstat;
293 ioman_exports[18] = (u32) ioman_format;
294 ioman_exports[20] = (u32) iomanX_AddDrv;
295 ioman_exports[21] = (u32) iomanX_DelDrv;
297 ioman_exports[20] = (u32) sbv_AddDrv;
298 ioman_exports[21] = (u32) sbv_DelDrv;
302 fix_imports((
iop_library_t *) (((u32) ioman_exports) - 0x14));
313 dev_list = iomanX_GetDeviceList();
316 for (i = 0; i < MAX_DEVICES; i++) {
317 if (dev_list[i] != NULL) {
318 dev_list[i]->ops->deinit(dev_list[i]);
324 ioman_exports[4] = Addr_IOMAN_open;
325 ioman_exports[5] = Addr_IOMAN_close;
326 ioman_exports[6] = Addr_IOMAN_read;
327 ioman_exports[7] = Addr_IOMAN_write;
328 ioman_exports[8] = Addr_IOMAN_lseek;
329 ioman_exports[9] = Addr_IOMAN_ioctl;
330 ioman_exports[10] = Addr_IOMAN_remove;
331 ioman_exports[11] = Addr_IOMAN_mkdir;
332 ioman_exports[12] = Addr_IOMAN_rmdir;
333 ioman_exports[13] = Addr_IOMAN_dopen;
334 ioman_exports[14] = Addr_IOMAN_dclose;
335 ioman_exports[15] = Addr_IOMAN_dread;
336 ioman_exports[16] = Addr_IOMAN_getstat;
337 ioman_exports[17] = Addr_IOMAN_chstat;
338 ioman_exports[18] = Addr_IOMAN_format;
340 ioman_exports[20] = Addr_IOMAN_AddDrv;
341 ioman_exports[21] = Addr_IOMAN_DelDrv;
344 fix_imports((
iop_library_t *) (((u32) ioman_exports) - 0x14));
int iomanX_format(const char *dev, const char *blockdev, void *arg, int arglen)
struct _iomanX_iop_device * device
ModuleInfo_t * image_info
int smod_get_next_mod(smod_mod_info_t *cur_mod, smod_mod_info_t *next_mod)
int smod_get_mod_by_name(const char *name, smod_mod_info_t *info)