mirror of
https://github.com/vivier/EMILE.git
synced 2025-08-15 07:27:41 +00:00
emile_first_set_param_scsi_extents() takes block size in argument
This commit is contained in:
@@ -15,10 +15,7 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
|
|||||||
#include "libemile.h"
|
#include "libemile.h"
|
||||||
#include "emile.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 blocksize)
|
||||||
|
|
||||||
|
|
||||||
int emile_first_set_param_scsi_extents( int fd, int drive_num, int second_offset, int size)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char first[1024];
|
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;
|
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_short((u_int16_t*)&first[1016], drive_num);
|
||||||
|
|
||||||
write_long((u_int32_t*)&first[1018], 0);
|
write_long((u_int32_t*)&first[1018], 0);
|
||||||
current = 1014;
|
current = 1014;
|
||||||
|
|
||||||
current -= 2;
|
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;
|
current -= 4;
|
||||||
write_long((u_int32_t*)&first[current], second_offset);
|
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;
|
current -= 2;
|
||||||
write_short((u_int16_t*)(&first[current]), 0);
|
write_short((u_int16_t*)(&first[current]), 0);
|
||||||
/* set second level size */
|
/* 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);
|
ret = lseek(fd, location, SEEK_SET);
|
||||||
if (ret != location)
|
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(int fd, char *second_name);
|
||||||
extern int emile_first_set_param_scsi_extents(int fd,
|
extern int emile_first_set_param_scsi_extents(int fd,
|
||||||
int drive_num, int second_offset,
|
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);
|
struct emile_container *emile_second_create_mapfile(short *unit_id, char *mapfile, char* kernel);
|
||||||
extern int emile_is_url(char *path);
|
extern int emile_is_url(char *path);
|
||||||
extern int emile_floppy_create_image(char* first_level, char* second_level,
|
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,
|
ret = emile_first_set_param_scsi_extents(fd, drive_num,
|
||||||
second_offset, size);
|
second_offset,
|
||||||
|
size, BLOCK_SIZE);
|
||||||
|
|
||||||
close(fd);
|
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);
|
fd = open(image, O_RDWR);
|
||||||
ret = lseek(fd, start * 512, SEEK_SET);
|
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);
|
close(fd);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user