X-Git-Url: http://git.ozlabs.org/?p=yaboot.git;a=blobdiff_plain;f=second%2Fpartition.c;h=05823092614e1b9011fe4e2d88d26f69ebe32e40;hp=e3ab4c58855d7adfbfc48fe17366dc063fbe667f;hb=c864c0961c4405bda1179fa4dc438fad3005e119;hpb=70ca99a5e21616ae261f6c49c8955b516b4219d6 diff --git a/second/partition.c b/second/partition.c index e3ab4c5..0582309 100644 --- a/second/partition.c +++ b/second/partition.c @@ -67,7 +67,7 @@ static unsigned char block_buffer[MAX_BLOCK_SIZE]; static void add_new_partition(struct partition_t** list, int part_number, const char *part_type, const char *part_name, unsigned long part_start, unsigned long part_size, - unsigned short part_blocksize) + unsigned short part_blocksize, int sys_ind) { struct partition_t* part; part = (struct partition_t*)malloc(sizeof(struct partition_t)); @@ -78,6 +78,7 @@ add_new_partition(struct partition_t** list, int part_number, const char *part_t part->part_start = part_start; part->part_size = part_size; part->blocksize = part_blocksize; + part->sys_ind = sys_ind; /* Tack this entry onto the list */ part->next = *list; @@ -149,7 +150,8 @@ partition_mac_lookup( const char *dev_name, prom_handle disk, part->name, /* name */ part->start_block + part->data_start, /* start */ part->data_count, /* size */ - ptable_block_size ); + ptable_block_size, + 0); } } @@ -170,14 +172,15 @@ partition_fdisk_lookup( const char *dev_name, prom_handle disk, (struct fdisk_partition *) (block_buffer + 0x1be); for (partition=1; partition <= 4 ;partition++, part++) { - if (part->sys_ind == LINUX_NATIVE) { + if (part->sys_ind == LINUX_NATIVE || part->sys_ind == LINUX_RAID) { add_new_partition( list, partition, "Linux", /* type */ '\0', /* name */ swab32(*(unsigned int *)(part->start4)), swab32(*(unsigned int *)(part->size4)), - 512 /*blksize*/ ); + 512 /*blksize*/, + part->sys_ind /* partition type */ ); } } } @@ -277,6 +280,10 @@ partition_amiga_lookup( const char *dev_name, prom_handle disk, possible = amiga_block[AMIGA_RDBLIMIT]/32 +1; used = (unsigned int *) malloc (sizeof (unsigned int) * (possible + 1)); + if (!used) { + prom_printf("Can't allocate memory\n"); + return; + } for (i=0; i < possible; i++) used[i] = 0; @@ -316,8 +323,11 @@ partition_amiga_lookup( const char *dev_name, prom_handle disk, '\0', /* name */ blockspercyl * amiga_block[AMIGA_PART_LOWCYL], /* start */ blockspercyl * (amiga_block[AMIGA_PART_HIGHCYL] - amiga_block[AMIGA_PART_LOWCYL] + 1), /* size */ - prom_blksize ); + prom_blksize, + 0 ); } + if (used) + free(used); } struct partition_t* @@ -365,7 +375,8 @@ partitions_lookup(const char *device) '\0', iso_root_block, 0, - prom_blksize); + prom_blksize, + 0); prom_printf("ISO9660 disk\n"); } else if (_amiga_find_rdb(device, disk, prom_blksize) != -1) { /* amiga partition format */