modify emile_second_set_param() to not check if bootblock is present, checking is moving before call

This commit is contained in:
Laurent Vivier 2006-09-20 23:28:53 +00:00
parent 2438e1a8c0
commit 723a50c993
3 changed files with 10 additions and 14 deletions

View File

@ -13,22 +13,9 @@
int emile_second_set_param(int fd, char *kernel, char *parameters, char *initrd)
{
int ret;
int drive, second, size;
char *configuration;
off_t offset;
/* can work on an image or directly on second level file */
lseek(fd, 0, SEEK_SET);
ret = emile_first_get_param(fd, &drive, &second, &size);
if (ret == EEMILE_UNKNOWN_FIRST)
{
/* should be a second level file */
ret = lseek(fd, 0, SEEK_SET);
if (ret == -1)
return -1;
}
offset = lseek(fd, 0, SEEK_CUR);
configuration = emile_second_get_configuration(fd);

View File

@ -51,6 +51,7 @@ static int set_cmdline(char* image, char *kernel, char* cmdline, char *ramdisk)
{
int fd;
int ret;
int drive, second, size;
fd = open(image, O_RDWR);
@ -60,6 +61,10 @@ static int set_cmdline(char* image, char *kernel, char* cmdline, char *ramdisk)
return 2;
}
ret = emile_first_get_param(fd, &drive, &second, &size);
if (ret == EEMILE_UNKNOWN_FIRST)
return -1;
ret = emile_second_set_param(fd, kernel, cmdline, ramdisk);
close(fd);

View File

@ -704,6 +704,7 @@ int main(int argc, char **argv)
struct emile_container *container;
short unit_id;
char map_info[64];
int drive, second, size;
container = emile_second_create_mapfile(&unit_id, map_path, kernel_path);
if (container == NULL)
@ -722,7 +723,10 @@ int main(int argc, char **argv)
/* set second configuration */
ret = emile_second_set_param(fd, map_info, append_string, ramdisk_path);
ret = emile_first_get_param(fd, &drive, &second, &size);
if (ret != EEMILE_UNKNOWN_FIRST)
ret = emile_second_set_param(fd, map_info,
append_string, ramdisk_path);
}
close(fd);