mirror of
https://github.com/vivier/EMILE.git
synced 2025-01-22 00:32:15 +00:00
Change emile_map_* to map_*
This commit is contained in:
parent
5a0b1494b5
commit
a60a6bfb71
@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "partition.h"
|
||||
#include "libmap.h"
|
||||
#include "libemile.h"
|
||||
|
||||
int verbose = 0;
|
||||
@ -64,7 +64,7 @@ static void usage(int argc, char** argv)
|
||||
fprintf(stderr, "\nbuild: \n%s\n", SIGNATURE);
|
||||
}
|
||||
|
||||
static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
static int get_driver(map_t *map, int partition, char* appledriver)
|
||||
{
|
||||
int driver;
|
||||
int block_size, block_count;
|
||||
@ -77,28 +77,28 @@ static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
emile_map_read(map, partition);
|
||||
if (strncmp(emile_map_get_partition_type(map),
|
||||
map_read(map, partition);
|
||||
if (strncmp(map_get_partition_type(map),
|
||||
"Apple_Driver", strlen("Apple_Driver")) != 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"ERROR: the type of the partition must begin with \"Apple_Driver\"\n");
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(emile_map_get_partition_name(map), "Macintosh") != 0)
|
||||
if (strcmp(map_get_partition_name(map), "Macintosh") != 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"ERROR: the name of the partition must be \"Macintosh\"\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
emile_map_geometry(map, &block_size, &block_count);
|
||||
map_geometry(map, &block_size, &block_count);
|
||||
printf("block size: %d\n", block_size);
|
||||
|
||||
emile_map_get_partition_geometry(map, &partition_base, &partition_size);
|
||||
map_get_partition_geometry(map, &partition_base, &partition_size);
|
||||
printf("partition base: %d, size %d\n", partition_base, partition_size);
|
||||
|
||||
driver_number = emile_map_get_driver_number(map);
|
||||
driver_number = map_get_driver_number(map);
|
||||
if (driver_number == 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: no driver on this device\n");
|
||||
@ -107,19 +107,19 @@ static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
|
||||
for (driver = 0; driver < driver_number; driver++)
|
||||
{
|
||||
emile_map_get_driver_info(map, driver, &block, &size, &type);
|
||||
part = emile_map_seek_driver_partition(map,
|
||||
map_get_driver_info(map, driver, &block, &size, &type);
|
||||
part = map_seek_driver_partition(map,
|
||||
block * block_size / 512 );
|
||||
if (part == partition)
|
||||
{
|
||||
emile_map_read(map, part);
|
||||
map_read(map, part);
|
||||
if (emile_is_apple_driver(map))
|
||||
break;
|
||||
}
|
||||
part = emile_map_seek_driver_partition(map, block);
|
||||
part = map_seek_driver_partition(map, block);
|
||||
if (part == partition)
|
||||
{
|
||||
emile_map_read(map, part);
|
||||
map_read(map, part);
|
||||
if (emile_is_apple_driver(map))
|
||||
break;
|
||||
}
|
||||
@ -133,7 +133,7 @@ static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
printf("Found driver %d for partition %d\n", driver, partition + 1);
|
||||
printf("base: %d size: %d type: %d\n", block * block_size / 512,
|
||||
size * block_size / 512 , type);
|
||||
emile_map_get_bootinfo(map, &bootstart, &bootsize, &bootaddr,
|
||||
map_get_bootinfo(map, &bootstart, &bootsize, &bootaddr,
|
||||
&bootentry, &checksum, processor);
|
||||
printf("Bootstart: %d, Bootsize: %d, Bootaddr: %d, Bootentry: %d\n",
|
||||
bootstart, bootsize, bootaddr, bootentry);
|
||||
@ -153,7 +153,7 @@ static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = open(emile_map_dev(map), O_RDONLY);
|
||||
fd = open(map_dev(map), O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot read driver (open())\n");
|
||||
@ -207,7 +207,7 @@ static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int put_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
static int put_driver(map_t *map, int partition, char* appledriver)
|
||||
{
|
||||
int block_size, block_count;
|
||||
int fd;
|
||||
@ -218,23 +218,23 @@ static int put_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
int block, count, checksum;
|
||||
char part_name[16];
|
||||
|
||||
emile_map_read(map, partition);
|
||||
map_read(map, partition);
|
||||
|
||||
if (strncmp(emile_map_get_partition_type(map),
|
||||
if (strncmp(map_get_partition_type(map),
|
||||
"Apple_Driver", strlen("Apple_Driver")) != 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"ERROR: the type of the partition must begin with \"Apple_Driver\"\n");
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(emile_map_get_partition_name(map), "Macintosh") != 0)
|
||||
if (strcmp(map_get_partition_name(map), "Macintosh") != 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"ERROR: the name of the partition must be \"Macintosh\"\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
emile_map_geometry(map, &block_size, &block_count);
|
||||
map_geometry(map, &block_size, &block_count);
|
||||
|
||||
/* read driver from file */
|
||||
|
||||
@ -276,7 +276,7 @@ static int put_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
|
||||
/* write file in partition */
|
||||
|
||||
sprintf(part_name, "%s%d", emile_map_dev(map), partition + 1);
|
||||
sprintf(part_name, "%s%d", map_dev(map), partition + 1);
|
||||
fd = open(part_name, O_WRONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
@ -297,26 +297,26 @@ static int put_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
|
||||
/* set bootinfo */
|
||||
|
||||
emile_map_set_bootinfo(map, 0, st.st_size, 0, 0, checksum, "68000");
|
||||
emile_map_partition_set_flags(map, 0x17F);
|
||||
map_set_bootinfo(map, 0, st.st_size, 0, 0, checksum, "68000");
|
||||
map_partition_set_flags(map, 0x17F);
|
||||
|
||||
/* add driver in drivers list */
|
||||
|
||||
driver_number = emile_map_get_driver_number(map);
|
||||
driver_number = map_get_driver_number(map);
|
||||
if (driver_number == -1)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot read drivers number\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = emile_map_get_partition_geometry(map, &block, &count);
|
||||
ret = map_get_partition_geometry(map, &block, &count);
|
||||
if (ret == -1)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot read partition geometry\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = emile_map_set_driver_info(map, driver_number,
|
||||
ret = map_set_driver_info(map, driver_number,
|
||||
block / (block_size / 512) ,
|
||||
count / (block_size / 512), 1);
|
||||
if (ret == -1)
|
||||
@ -325,21 +325,21 @@ static int put_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = emile_map_set_driver_number(map, driver_number + 1);
|
||||
ret = map_set_driver_number(map, driver_number + 1);
|
||||
if (driver_number == -1)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot set drivers number\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = emile_map_write(map, partition);
|
||||
ret = map_write(map, partition);
|
||||
if (ret != partition)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot set partition information\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = emile_block0_write(map);
|
||||
ret = map_block0_write(map);
|
||||
if (ret == -1)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot set drivers information\n");
|
||||
@ -351,7 +351,7 @@ static int put_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
emile_map_t *map;
|
||||
map_t *map;
|
||||
int ret;
|
||||
int disk;
|
||||
int partition = 0;
|
||||
@ -482,14 +482,14 @@ int main(int argc, char** argv)
|
||||
return 2;
|
||||
}
|
||||
|
||||
ret = emile_map_set_startup(disk_name, partition - 1);
|
||||
ret = map_set_startup(disk_name, partition - 1);
|
||||
if (ret == -1)
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (action & ACTION_GET)
|
||||
{
|
||||
map = emile_map_open(disk_name, O_RDONLY);
|
||||
map = map_open(disk_name, O_RDONLY);
|
||||
if (map == NULL)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot open partition map\n");
|
||||
@ -498,7 +498,7 @@ int main(int argc, char** argv)
|
||||
|
||||
if (appledriver == NULL) {
|
||||
fprintf(stderr, "ERROR: filename missing\n");
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
return 6;
|
||||
}
|
||||
|
||||
@ -507,17 +507,17 @@ int main(int argc, char** argv)
|
||||
fprintf(stderr,
|
||||
"ERROR: cannot put driver from partition %d to file %s\n",
|
||||
partition, appledriver);
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
return 6;
|
||||
}
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (action & ACTION_PUT)
|
||||
{
|
||||
map = emile_map_open(disk_name, O_RDWR);
|
||||
map = map_open(disk_name, O_RDWR);
|
||||
if (map == NULL)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot open partition map\n");
|
||||
@ -526,7 +526,7 @@ int main(int argc, char** argv)
|
||||
|
||||
if (appledriver == NULL) {
|
||||
fprintf(stderr, "ERROR: filename missing\n");
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
return 6;
|
||||
}
|
||||
|
||||
@ -535,22 +535,22 @@ int main(int argc, char** argv)
|
||||
fprintf(stderr,
|
||||
"ERROR: cannot put driver to partition %d from file %s\n",
|
||||
partition, appledriver);
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
return 6;
|
||||
}
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
return 0;
|
||||
}
|
||||
|
||||
map = emile_map_open(disk_name, O_RDWR);
|
||||
map = map_open(disk_name, O_RDWR);
|
||||
if (map == NULL)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot open partition map\n");
|
||||
return 4;
|
||||
}
|
||||
|
||||
ret = emile_map_read(map, partition - 1);
|
||||
ret = map_read(map, partition - 1);
|
||||
if (ret != partition - 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
@ -560,12 +560,12 @@ int main(int argc, char** argv)
|
||||
|
||||
if (action & ACTION_FLAGS)
|
||||
{
|
||||
emile_map_partition_set_flags(map, flags);
|
||||
map_partition_set_flags(map, flags);
|
||||
}
|
||||
|
||||
if (action & ACTION_TYPE)
|
||||
{
|
||||
ret = emile_map_set_partition_type(map, type);
|
||||
ret = map_set_partition_type(map, type);
|
||||
if (ret == -1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
@ -574,7 +574,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
ret = emile_map_write(map, partition - 1);
|
||||
ret = map_write(map, partition - 1);
|
||||
if (ret != partition - 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
@ -582,7 +582,7 @@ int main(int argc, char** argv)
|
||||
return 8;
|
||||
}
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <partition.h>
|
||||
#include <libmap.h>
|
||||
#include <emile.h>
|
||||
#include <libemile.h>
|
||||
#include <libiso9660.h>
|
||||
@ -258,21 +258,21 @@ static int set_second(char *image, int second_offset, char *kernel_image, char *
|
||||
static int set_first(char *image, int drive_num, int second_offset, int second_size)
|
||||
{
|
||||
int fd;
|
||||
emile_map_t* map;
|
||||
map_t* map;
|
||||
int start, count;
|
||||
int ret;
|
||||
int i;
|
||||
int boottype;
|
||||
char bootblock[BOOTBLOCK_SIZE];
|
||||
|
||||
map = emile_map_open(image, O_RDONLY);
|
||||
for (i = 0; i < emile_map_get_number(map); i++)
|
||||
map = map_open(image, O_RDONLY);
|
||||
for (i = 0; i < map_get_number(map); i++)
|
||||
{
|
||||
emile_map_read(map, i);
|
||||
if ( strcmp(APPLE_HFS, emile_map_get_partition_type(map)) == 0) {
|
||||
ret = emile_map_get_partition_geometry(map, &start, &count);
|
||||
emile_map_bootblock_read(map, bootblock);
|
||||
boottype = emile_map_bootblock_get_type(bootblock);
|
||||
map_read(map, i);
|
||||
if ( strcmp(APPLE_HFS, map_get_partition_type(map)) == 0) {
|
||||
ret = map_get_partition_geometry(map, &start, &count);
|
||||
map_bootblock_read(map, bootblock);
|
||||
boottype = map_bootblock_get_type(bootblock);
|
||||
if (boottype == EMILE_BOOTBLOCK)
|
||||
{
|
||||
printf("Bootable HFS partition found at position %d (%d * %d)\n",
|
||||
@ -281,9 +281,9 @@ static int set_first(char *image, int drive_num, int second_offset, int second_s
|
||||
}
|
||||
}
|
||||
}
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
|
||||
if (i == emile_map_get_number(map))
|
||||
if (i == map_get_number(map))
|
||||
return -1;
|
||||
|
||||
fd = open(image, O_RDWR);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <libconfig.h>
|
||||
|
||||
#include "libemile.h"
|
||||
#include "libmap.h"
|
||||
#include "emile_config.h"
|
||||
|
||||
int verbose = 0;
|
||||
@ -78,7 +79,7 @@ static void usage(int argc, char** argv)
|
||||
}
|
||||
|
||||
static int open_map_of( char *dev_name, int flags,
|
||||
emile_map_t **map, int *partition)
|
||||
map_t **map, int *partition)
|
||||
{
|
||||
int ret;
|
||||
int disk;
|
||||
@ -91,7 +92,7 @@ static int open_map_of( char *dev_name, int flags,
|
||||
|
||||
emile_get_dev_name(disk_name, driver, disk, 0);
|
||||
|
||||
*map = emile_map_open(disk_name, flags);
|
||||
*map = map_open(disk_name, flags);
|
||||
if (*map == NULL)
|
||||
return -1;
|
||||
|
||||
@ -100,7 +101,7 @@ static int open_map_of( char *dev_name, int flags,
|
||||
|
||||
static int check_has_apple_driver(char *dev_name)
|
||||
{
|
||||
emile_map_t *map;
|
||||
map_t *map;
|
||||
int partition;
|
||||
int ret;
|
||||
|
||||
@ -108,15 +109,15 @@ static int check_has_apple_driver(char *dev_name)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = emile_map_has_apple_driver(map);
|
||||
emile_map_close(map);
|
||||
ret = map_has_apple_driver(map);
|
||||
map_close(map);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int check_is_hfs(char *dev_name)
|
||||
{
|
||||
emile_map_t *map;
|
||||
map_t *map;
|
||||
int ret;
|
||||
int partition;
|
||||
char *part_type;
|
||||
@ -125,21 +126,21 @@ static int check_is_hfs(char *dev_name)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = emile_map_read(map, partition - 1);
|
||||
ret = map_read(map, partition - 1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
part_type = emile_map_get_partition_type(map);
|
||||
part_type = map_get_partition_type(map);
|
||||
ret = (strcmp("Apple_HFS", part_type) == 0);
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int check_is_EMILE_bootblock(char *dev_name)
|
||||
{
|
||||
emile_map_t *map;
|
||||
map_t *map;
|
||||
int ret;
|
||||
int partition;
|
||||
char bootblock[BOOTBLOCK_SIZE];
|
||||
@ -149,24 +150,24 @@ static int check_is_EMILE_bootblock(char *dev_name)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = emile_map_read(map, partition - 1);
|
||||
ret = map_read(map, partition - 1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_bootblock_read(map, bootblock);
|
||||
ret = map_bootblock_read(map, bootblock);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
bootblock_type = emile_map_bootblock_get_type(bootblock);
|
||||
bootblock_type = map_bootblock_get_type(bootblock);
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
|
||||
return EMILE_BOOTBLOCK == bootblock_type;
|
||||
}
|
||||
|
||||
static int backup_bootblock(char *dev_name, char *filename)
|
||||
{
|
||||
emile_map_t *map;
|
||||
map_t *map;
|
||||
int ret;
|
||||
int partition;
|
||||
char bootblock[BOOTBLOCK_SIZE];
|
||||
@ -176,15 +177,15 @@ static int backup_bootblock(char *dev_name, char *filename)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = emile_map_read(map, partition - 1);
|
||||
ret = map_read(map, partition - 1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_bootblock_read(map, bootblock);
|
||||
ret = map_bootblock_read(map, bootblock);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
|
||||
/* save bootblock */
|
||||
|
||||
@ -210,7 +211,7 @@ static int backup_bootblock(char *dev_name, char *filename)
|
||||
|
||||
static int restore_bootblock(char *dev_name, char *filename)
|
||||
{
|
||||
emile_map_t *map;
|
||||
map_t *map;
|
||||
int ret;
|
||||
int partition;
|
||||
char bootblock[BOOTBLOCK_SIZE];
|
||||
@ -240,22 +241,22 @@ static int restore_bootblock(char *dev_name, char *filename)
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_read(map, partition - 1);
|
||||
ret = map_read(map, partition - 1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_bootblock_write(map, bootblock);
|
||||
ret = map_bootblock_write(map, bootblock);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int copy_file_to_bootblock(char* first_path, char* dev_name)
|
||||
{
|
||||
emile_map_t *map;
|
||||
map_t *map;
|
||||
int ret;
|
||||
int partition;
|
||||
char bootblock[BOOTBLOCK_SIZE];
|
||||
@ -279,22 +280,22 @@ static int copy_file_to_bootblock(char* first_path, char* dev_name)
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_read(map, partition - 1);
|
||||
ret = map_read(map, partition - 1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_bootblock_write(map, bootblock);
|
||||
ret = map_bootblock_write(map, bootblock);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_HFS(char *dev_name)
|
||||
{
|
||||
emile_map_t *map;
|
||||
map_t *map;
|
||||
int ret;
|
||||
int partition;
|
||||
|
||||
@ -302,23 +303,23 @@ static int set_HFS(char *dev_name)
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_read(map, partition - 1);
|
||||
ret = map_read(map, partition - 1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_set_partition_type(map, "Apple_HFS");
|
||||
ret = map_set_partition_type(map, "Apple_HFS");
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_partition_set_bootable(map, 1);
|
||||
ret = map_partition_set_bootable(map, 1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
ret = emile_map_write(map, partition - 1);
|
||||
ret = map_write(map, partition - 1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "partition.h"
|
||||
#include "libmap.h"
|
||||
#include "libemile.h"
|
||||
|
||||
#define EMILE_MAX_DISK 16
|
||||
@ -88,7 +88,7 @@ static int emile_scanbus(device_name_t devices[EMILE_MAX_DISK])
|
||||
|
||||
void diskinfo(char* device)
|
||||
{
|
||||
emile_map_t* map;
|
||||
map_t* map;
|
||||
int j;
|
||||
int boottype;
|
||||
char bootblock[BOOTBLOCK_SIZE];
|
||||
@ -96,14 +96,14 @@ void diskinfo(char* device)
|
||||
int ret;
|
||||
|
||||
printf("%s:", device);
|
||||
map = emile_map_open(device, O_RDONLY);
|
||||
map = map_open(device, O_RDONLY);
|
||||
if (map == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot read map of %s\n", device);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = emile_map_geometry(map, &block_size, &block_count);
|
||||
ret = map_geometry(map, &block_size, &block_count);
|
||||
if ((ret != -1) && verbose)
|
||||
{
|
||||
printf(" block size: %d, blocks number: %d (",
|
||||
@ -118,17 +118,17 @@ void diskinfo(char* device)
|
||||
printf("\t<No information available>\n");
|
||||
return;
|
||||
}
|
||||
if (!emile_map_is_valid(map))
|
||||
if (!map_is_valid(map))
|
||||
{
|
||||
printf("\t<No valid partition map found>\n");
|
||||
return;
|
||||
}
|
||||
if (emile_map_get_driver_number(map) > 0)
|
||||
if (map_get_driver_number(map) > 0)
|
||||
printf(" Drivers\n");
|
||||
for (j = 0; j < emile_map_get_driver_number(map); j++)
|
||||
for (j = 0; j < map_get_driver_number(map); j++)
|
||||
{
|
||||
int block, size, type, part;
|
||||
emile_map_get_driver_info(map, j,
|
||||
map_get_driver_info(map, j,
|
||||
&block, &size, &type);
|
||||
printf(" %d: base: %d size: %d ",
|
||||
j, block * block_size / 512,
|
||||
@ -152,32 +152,32 @@ void diskinfo(char* device)
|
||||
printf("unknown (%04x)\n", type);
|
||||
break;
|
||||
}
|
||||
part = emile_map_seek_driver_partition(map,
|
||||
part = map_seek_driver_partition(map,
|
||||
block * block_size / 512);
|
||||
if (part == -1)
|
||||
{
|
||||
part = emile_map_seek_driver_partition(map,
|
||||
part = map_seek_driver_partition(map,
|
||||
block);
|
||||
if (part == -1)
|
||||
printf(" <invalid>\n");
|
||||
emile_map_read(map, part);
|
||||
map_read(map, part);
|
||||
}
|
||||
else
|
||||
{
|
||||
emile_map_read(map, part);
|
||||
map_read(map, part);
|
||||
if (!emile_is_apple_driver(map))
|
||||
{
|
||||
part = emile_map_seek_driver_partition(map,
|
||||
part = map_seek_driver_partition(map,
|
||||
block);
|
||||
if (part == -1)
|
||||
printf(" <invalid>\n");
|
||||
emile_map_read(map, part);
|
||||
map_read(map, part);
|
||||
}
|
||||
}
|
||||
printf(" <%d: %s [%s], ", part + 1,
|
||||
emile_map_get_partition_name(map),
|
||||
emile_map_get_partition_type(map));
|
||||
switch(emile_map_get_driver_signature(map))
|
||||
map_get_partition_name(map),
|
||||
map_get_partition_type(map));
|
||||
switch(map_get_driver_signature(map))
|
||||
{
|
||||
case kPatchDriverSignature:
|
||||
printf("patch driver");
|
||||
@ -198,26 +198,26 @@ void diskinfo(char* device)
|
||||
printf("Drive Setup HFS partition");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown (0x%08lx)", emile_map_get_driver_signature(map));
|
||||
printf("Unknown (0x%08lx)", map_get_driver_signature(map));
|
||||
break;
|
||||
}
|
||||
printf(">\n");
|
||||
}
|
||||
printf(" Partitions\n");
|
||||
for (j = 0; j < emile_map_get_number(map); j++)
|
||||
for (j = 0; j < map_get_number(map); j++)
|
||||
{
|
||||
emile_map_read(map, j);
|
||||
map_read(map, j);
|
||||
|
||||
if (emile_map_partition_is_startup(map))
|
||||
if (map_partition_is_startup(map))
|
||||
printf(" --> ");
|
||||
else
|
||||
printf(" ");
|
||||
printf("%d: ", j + 1);
|
||||
printf("%16s [%-16s] ",
|
||||
emile_map_get_partition_name(map),
|
||||
emile_map_get_partition_type(map));
|
||||
emile_map_bootblock_read(map, bootblock);
|
||||
boottype = emile_map_bootblock_get_type(bootblock);
|
||||
map_get_partition_name(map),
|
||||
map_get_partition_type(map));
|
||||
map_bootblock_read(map, bootblock);
|
||||
boottype = map_bootblock_get_type(bootblock);
|
||||
switch(boottype)
|
||||
{
|
||||
case INVALID_BOOTBLOCK:
|
||||
@ -232,7 +232,7 @@ void diskinfo(char* device)
|
||||
printf(" <unknown bootblock>");
|
||||
break;
|
||||
}
|
||||
if (emile_map_partition_is_bootable(map))
|
||||
if (map_partition_is_bootable(map))
|
||||
printf(" *\n");
|
||||
else
|
||||
putchar('\n');
|
||||
@ -243,11 +243,11 @@ void diskinfo(char* device)
|
||||
int checksum;
|
||||
char processor[16];
|
||||
if (*(unsigned long*)
|
||||
(emile_map_get_partition_type(map) + 28))
|
||||
(map_get_partition_type(map) + 28))
|
||||
printf(" patch: %s\n",
|
||||
emile_map_get_partition_type(map) + 28);
|
||||
map_get_partition_type(map) + 28);
|
||||
|
||||
ret = emile_map_get_partition_geometry(map,
|
||||
ret = map_get_partition_geometry(map,
|
||||
&start,
|
||||
&count);
|
||||
if( ret != -1)
|
||||
@ -258,8 +258,8 @@ void diskinfo(char* device)
|
||||
print_size(count, 512);
|
||||
printf(")\n");
|
||||
printf(" flags: 0x%08x\n",
|
||||
emile_map_partition_get_flags(map));
|
||||
emile_map_get_bootinfo(map, &bootstart,
|
||||
map_partition_get_flags(map));
|
||||
map_get_bootinfo(map, &bootstart,
|
||||
&bootsize, &bootaddr,
|
||||
&bootentry, &checksum,
|
||||
processor);
|
||||
@ -275,7 +275,7 @@ void diskinfo(char* device)
|
||||
}
|
||||
}
|
||||
}
|
||||
emile_map_close(map);
|
||||
map_close(map);
|
||||
}
|
||||
|
||||
void scanbus(void)
|
||||
|
Loading…
x
Reference in New Issue
Block a user