Change userspace by partition type
Userspace should be on the first Linux partition found
This commit is contained in:
parent
70366fa7be
commit
9713f527a8
@ -46,7 +46,7 @@ void idleThread(void *arg)
|
||||
#define FILE_MAX_SIZE 64 // In nb of sectors
|
||||
void loadUserSpace()
|
||||
{
|
||||
struct ata_partition *part = ATAGetPartition(1);
|
||||
struct ata_partition *part = ATAGetPartitionByType(PART_TYPE_LINUX);
|
||||
|
||||
if (part == NULL) {
|
||||
printf("No user partition found\n");
|
||||
|
@ -521,6 +521,19 @@ struct ata_partition *ATAGetPartition(int id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ata_partition *ATAGetPartitionByType(uint type)
|
||||
{
|
||||
struct ata_partition *part;
|
||||
int count;
|
||||
list_foreach(partitions, part, count)
|
||||
{
|
||||
if (part->type == type)
|
||||
return part;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ata_partition *ATAPartitionCreate(uint type, uint size, uint32_t lba,
|
||||
struct ata_device *dev)
|
||||
{
|
||||
|
@ -104,5 +104,6 @@ int ATAReadPartitionSector(struct ata_partition *part, int offset, uint nbSector
|
||||
int ATAReadSector(struct ata_device *dev, int lba, uint nbSector, void *buf);
|
||||
int ATAWriteSector(struct ata_device *dev, int lba, uint nbSector, void *buf);
|
||||
struct ata_device *ATAGetDevice(int ctlId, int devId);
|
||||
struct ata_partition *ATAGetPartitionByType(uint type);
|
||||
int ATAReadPartition(struct ata_device *dev);
|
||||
struct ata_partition *ATAGetPartition(int id);
|
||||
|
Loading…
Reference in New Issue
Block a user