/*! \brief Entry point for IRX. * \ingroup ps2netfs * * argc and argv make no difference to runstate. * * \param argc Number of arguments. * \param argv Pointer to array of arguments. * \return Module Status on Exit. * * return values: * MODULE_RESIDENT_END if loaded and registered as library. * MODULE_NO_RESIDENT_END if just exiting normally. */ int _start(int argc, char *argv[]) { printf("%s - v%d.%d - Copyright (c) 2004 adresd\n", PS2NETFS_MODNAME,PS2NETFS_VERSION_HIGH,PS2NETFS_VERSION_LOW); if (!devscan_getmodule(IOPMGR_IOMAN_IDENT)) { printf("ioman not found\n"); return MODULE_NO_RESIDENT_END; } if (!devscan_getmodule(IOPMGR_IOMANX_IDENT)) { printf("iomanx not found\n"); return MODULE_NO_RESIDENT_END; } if (ps2netfs_Init() == 0) { printf("\nServer Started\n"); return MODULE_RESIDENT_END; } printf("\nExiting.\n"); return MODULE_NO_RESIDENT_END; }
/*! \brief Initialise the devices table * \ingroup ps2netfs * * \param devtype Mask for device types to return (0x10 = FS drivers). * \return Number of devices found. * * This scans ioman and iomanx for devices, then adds them to the * internal list, with basename and the handler type. * * Also used to re-init the devices table */ int devscan_setup(int devtype) { smod_mod_info_t *info; iop_device_t **devinfo_table; int i; int count = 0; dbgprintf("devscan: setup\n"); // clear device list memset(&dev_info_list,0,sizeof(dev_info_list)); /* do the ioman devices */ if ((info = devscan_getmodule(IOPMGR_IOMAN_IDENT))) { /* Find the start of the device info array, in .bss. */ devinfo_table = (iop_device_t **)(info->text_start + info->text_size + info->data_size + 0x0c); /* The device info table had 16 entries, but some may be empty. Just look at all of them. */ for (i = 0; i < DEVSCAN_IOMAX; i++) { if (devinfo_table[i]) if ((devinfo_table[i]->type & devtype)) { dev_info_list[count].devtype = IOPMGR_DEVTYPE_IOMAN; strncpy(dev_info_list[count].name,devinfo_table[i]->name,255); dev_info_list[count].name[255] = '\0'; dev_info_list[count].len = strlen(dev_info_list[count].name); dbgprintf("devscan: ioman '%s'\n",dev_info_list[count].name); count++; } } } /* do the iomanx devices */ if ((info = devscan_getmodule(IOPMGR_IOMANX_IDENT))) { /* Find the start of the device info array, in .bss. */ devinfo_table = (iop_device_t **)(info->text_start + info->text_size + info->data_size); /* The device info table had 32 entries, but some may be empty. Just look at all of them. */ for (i = 0; i < DEVSCAN_IOXMAX; i++) { if (devinfo_table[i]) /* only add iomanx ones here, so must have extended flag set else we get duplication with new iomanx */ if ((devinfo_table[i]->type & IOP_DT_FSEXT) && (devinfo_table[i]->type & devtype)) { dev_info_list[count].devtype = IOPMGR_DEVTYPE_IOMANX; strncpy(dev_info_list[count].name,devinfo_table[i]->name,255); dev_info_list[count].name[255] = '\0'; dev_info_list[count].len = strlen(dev_info_list[count].name); dbgprintf("devscan: iomanx '%s'\n",dev_info_list[count].name); count++; } } } return count; }