bool fatMount (const char* name, const DISC_INTERFACE* interface, sec_t startSector, uint32_t cacheSize) { PARTITION* partition; devoptab_t* devops; char* nameCopy; devops = _FAT_mem_allocate (sizeof(devoptab_t) + strlen(name) + 1); if (!devops) { return false; } // Use the space allocated at the end of the devoptab struct for storing the name nameCopy = (char*)(devops+1); // Initialize the file system partition = _FAT_partition_constructor (interface, cacheSize, startSector); if (!partition) { _FAT_mem_free (devops); return false; } // Add an entry for this device to the devoptab table memcpy (devops, &dotab_fat, sizeof(dotab_fat)); strcpy (nameCopy, name); devops->name = nameCopy; devops->deviceData = partition; My_AddDevice (devops); return true; }
bool fatMount (const char* name, const DISC_INTERFACE* interface, sec_t startSector, uint32_t cacheSize, uint32_t SectorsPerPage) { PARTITION* partition; struct devoptab_t* devops; //char* nameCopy; if(!name || strlen(name) > 8 || !interface) return false; if(!interface->startup()) return false; if(!interface->isInserted()) return false; //char devname[10]; //sprintf(devname, "%s:", name); //if(FindDevice(devname) >= 0) // return true; devops = (struct devoptab_t*)_FAT_mem_allocate (sizeof(struct devoptab_t) + strlen(name) + 1); if (!devops) { return false; } #ifdef LIBFAT_PC _sole_device = devops; #endif // Use the space allocated at the end of the devoptab struct for storing the name //nameCopy = (char*)(devops+1); // Initialize the file system partition = _FAT_partition_constructor (interface, cacheSize, SectorsPerPage, startSector); if (!partition) { _FAT_mem_free (devops); return false; } // Add an entry for this device to the devoptab table memcpy (devops, &dotab_fat, sizeof(dotab_fat)); //strcpy (nameCopy, name); //devops->name = nameCopy; devops->deviceData = partition; //AddDevice (devops); return true; }