mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-22 10:29:31 +00:00
emile_first_set_param_scsi_extents() takes block size in argument
This commit is contained in:
parent
c6bce62661
commit
73c91de7a6
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user