mirror of
https://github.com/vivier/EMILE.git
synced 2024-11-14 06:08:49 +00:00
First revision
This commit is contained in:
parent
0e11baa633
commit
3538ecd3c2
40
libemile/emile_map_has_apple_driver.c
Normal file
40
libemile/emile_map_has_apple_driver.c
Normal file
@ -0,0 +1,40 @@
|
||||
static __attribute__((used)) char* rcsid = "$CVSHeader$";
|
||||
/*
|
||||
*
|
||||
* (c) 2004 Laurent Vivier <LaurentVivier@wanadoo.fr>
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://developer.apple.com/technotes/tn/tn1189.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "partition.h"
|
||||
#include "libemile.h"
|
||||
|
||||
int emile_map_has_apple_driver(emile_map_t *map)
|
||||
{
|
||||
int block, size, type, part;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < emile_map_get_driver_number(map); i++)
|
||||
{
|
||||
emile_map_get_driver_info(map, i, &block, &size, &type);
|
||||
|
||||
part = emile_map_seek_driver_partition(map, block);
|
||||
|
||||
ret = emile_map_read(map, part);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
if (strncmp(map->partition.PartType,
|
||||
APPLE_DRIVER, strlen(APPLE_DRIVER)) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
29
libemile/emile_map_seek_driver_partition.c
Normal file
29
libemile/emile_map_seek_driver_partition.c
Normal file
@ -0,0 +1,29 @@
|
||||
static __attribute__((used)) char* rcsid = "$CVSHeader$";
|
||||
/*
|
||||
*
|
||||
* (c) 2004 Laurent Vivier <LaurentVivier@wanadoo.fr>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libemile.h"
|
||||
|
||||
int emile_map_seek_driver_partition(emile_map_t *map, int base)
|
||||
{
|
||||
int start;
|
||||
int count;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < emile_map_get_number(map); i++)
|
||||
{
|
||||
ret = emile_map_read(map, i);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
emile_map_get_partition_geometry(map, &start, &count);
|
||||
if (base == start)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user