+ if (used)
+ free(used);
+}
+
+struct partition_t*
+partitions_lookup(const char *device)
+{
+ ihandle disk;
+ struct mac_driver_desc *desc = (struct mac_driver_desc *)block_buffer;
+ struct partition_t* list = NULL;
+ unsigned int prom_blksize, iso_root_block;
+
+ strncpy(block_buffer, device, 2040);
+ if (_machine != _MACH_bplan)
+ strcat(block_buffer, ":0");
+
+ /* Open device */
+ disk = prom_open(block_buffer);
+ if (disk == NULL) {
+ prom_printf("Can't open device <%s>\n", block_buffer);
+ goto bail;
+ }
+ prom_blksize = prom_getblksize(disk);
+ DEBUG_F("block size of device is %d\n", prom_blksize);
+
+ if (prom_blksize <= 1)
+ prom_blksize = 512;
+ if (prom_blksize > MAX_BLOCK_SIZE) {
+ prom_printf("block_size %d not supported !\n", prom_blksize);
+ goto bail;
+ }
+
+ /* Read boot blocs */
+ if (prom_readblocks(disk, 0, 1, block_buffer) != 1) {
+ prom_printf("Can't read boot blocks\n");
+ goto bail;
+ }
+ if (desc->signature == MAC_DRIVER_MAGIC) {
+ /* pdisk partition format */
+ partition_mac_lookup(device, disk, prom_blksize, &list);
+ } else if ((block_buffer[510] == 0x55) && (block_buffer[511] == 0xaa)) {
+ /* fdisk partition format */
+ partition_fdisk_lookup(device, disk, prom_blksize, &list);
+ } else if (prom_blksize == 2048 && identify_iso_fs(disk, &iso_root_block)) {
+ add_new_partition(&list,
+ 0,
+ '\0',
+ '\0',
+ iso_root_block,
+ 0,
+ prom_blksize,
+ 0);
+ prom_printf("ISO9660 disk\n");
+ } else if (_amiga_find_rdb(device, disk, prom_blksize) != -1) {
+ /* amiga partition format */
+ partition_amiga_lookup(device, disk, prom_blksize, &list);
+ } else {
+ prom_printf("No supported partition table detected\n");
+ goto bail;
+ }