emile-map-set: manage only one driver

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Laurent Vivier committed 2014-06-01 02:47:21 +02:00
1 parent 098deb6716
commit cbe8d0c417
1 file changed
+5 -8
+5 -8
View File
@@ -295,6 +295,10 @@ static int put_driver(map_t *map, int partition, char* appledriver)
fprintf(stderr, "ERROR: cannot read drivers number\n");
return -1;
}
if (driver_number != 1) {
fprintf(stderr, "ERROR: cannot manage more than one driver\n");
return -1;
}
ret = map_get_partition_geometry(map, &block, &count);
if (ret == -1)
@@ -303,7 +307,7 @@ static int put_driver(map_t *map, int partition, char* appledriver)
return -1;
}
ret = map_set_driver_info(map, driver_number,
ret = map_set_driver_info(map, driver_number - 1,
block / (block_size / 512) ,
count / (block_size / 512), 1);
if (ret == -1)
@@ -312,13 +316,6 @@ static int put_driver(map_t *map, int partition, char* appledriver)
return -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 = map_write(map, partition);
if (ret != partition)
{