diff --git a/libemile/emile_first_set_param_scsi_extents.c b/libemile/emile_first_set_param_scsi_extents.c index f19e6f5..9efbb47 100644 --- a/libemile/emile_first_set_param_scsi_extents.c +++ b/libemile/emile_first_set_param_scsi_extents.c @@ -15,10 +15,7 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$"; #include "libemile.h" #include "emile.h" -#define BLOCK_SIZE 512 /* FIXME: should ask the disk driver */ - - -int emile_first_set_param_scsi_extents( int fd, int drive_num, int second_offset, int size) +int emile_first_set_param_scsi_extents( int fd, int drive_num, int second_offset, int size, int blocksize) { int ret; char first[1024]; @@ -36,14 +33,14 @@ int emile_first_set_param_scsi_extents( int fd, int drive_num, int second_offset max_blocks = read_short((u_int16_t*)&first[1022]) / 6; - write_short((u_int16_t*)&first[1014], BLOCK_SIZE); + write_short((u_int16_t*)&first[1014], blocksize); write_short((u_int16_t*)&first[1016], drive_num); write_long((u_int32_t*)&first[1018], 0); current = 1014; current -= 2; - write_short((u_int16_t*)&first[current], (size + BLOCK_SIZE - 1) / BLOCK_SIZE); + write_short((u_int16_t*)&first[current], (size + blocksize - 1) / blocksize); current -= 4; write_long((u_int32_t*)&first[current], second_offset); @@ -51,7 +48,7 @@ int emile_first_set_param_scsi_extents( int fd, int drive_num, int second_offset current -= 2; write_short((u_int16_t*)(&first[current]), 0); /* set second level size */ - write_long((u_int32_t*)&first[1018], (size + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE); + write_long((u_int32_t*)&first[1018], (size + blocksize - 1) / blocksize * blocksize); ret = lseek(fd, location, SEEK_SET); if (ret != location) diff --git a/libemile/libemile.h b/libemile/libemile.h index 358ac6f..9a9ef02 100644 --- a/libemile/libemile.h +++ b/libemile/libemile.h @@ -80,7 +80,8 @@ extern int emile_first_get_param(int fd, int *drive_num, int *second_offset, extern int emile_first_set_param_scsi(int fd, char *second_name); extern int emile_first_set_param_scsi_extents(int fd, int drive_num, int second_offset, - int second_size); + int second_size, + int blocksize); struct emile_container *emile_second_create_mapfile(short *unit_id, char *mapfile, char* kernel); extern int emile_is_url(char *path); extern int emile_floppy_create_image(char* first_level, char* second_level, diff --git a/tools/emile-first-tune.c b/tools/emile-first-tune.c index 2358fd1..f348898 100644 --- a/tools/emile-first-tune.c +++ b/tools/emile-first-tune.c @@ -120,7 +120,8 @@ int first_tune_scsi( char* image, int drive_num, int second_offset, int size) } ret = emile_first_set_param_scsi_extents(fd, drive_num, - second_offset, size); + second_offset, + size, BLOCK_SIZE); close(fd); diff --git a/tools/emile-mkisofs.c b/tools/emile-mkisofs.c index 932fb9c..a9bcf93 100644 --- a/tools/emile-mkisofs.c +++ b/tools/emile-mkisofs.c @@ -271,7 +271,7 @@ static int set_first(char *image, int drive_num, int second_offset, int second_s fd = open(image, O_RDWR); ret = lseek(fd, start * 512, SEEK_SET); - ret = emile_first_set_param_scsi_extents(fd, 3, second_offset / 4, second_size); + ret = emile_first_set_param_scsi_extents(fd, 3, second_offset / 4, second_size, BLOCKSIZE); close(fd); return ret;