use bytes instead of block

This commit is contained in:
Laurent Vivier 2007-10-09 20:40:37 +00:00
parent 6c9d87a9dc
commit 00c1bbf35a
4 changed files with 8 additions and 14 deletions

View File

@ -14,5 +14,5 @@
int map_bootblock_read(map_t* map, char* bootblock)
{
return map_partition_read(map, 0, BOOTBLOCK_SIZE / FLOPPY_SECTOR_SIZE, bootblock);
return map_partition_read(map, 0, BOOTBLOCK_SIZE, bootblock);
}

View File

@ -14,5 +14,5 @@
int map_bootblock_write(map_t* map, char* bootblock)
{
return map_partition_write(map, 0, BOOTBLOCK_SIZE / FLOPPY_SECTOR_SIZE, bootblock);
return map_partition_write(map, 0, BOOTBLOCK_SIZE, bootblock);
}

View File

@ -12,20 +12,17 @@
#include "libmap.h"
int map_partition_read(map_t* map, off_t block, size_t nb, char* sector)
int map_partition_read(map_t* map, off_t offset, size_t size, char* sector)
{
off_t offset;
int ret;
if (!map_partition_is_valid(map))
return -1;
offset = read_long((u_int32_t*)&map->partition.PyPartStart + block)
offset += read_long((u_int32_t*)&map->partition.PyPartStart)
* FLOPPY_SECTOR_SIZE;
ret = map->device->read_sector(map->device,
offset, sector,
nb * FLOPPY_SECTOR_SIZE);
ret = map->device->read_sector(map->device, offset, sector, size);
return ret;
}

View File

@ -12,20 +12,17 @@
#include "libmap.h"
int map_partition_write(map_t* map, off_t block, size_t nb, char* sector)
int map_partition_write(map_t* map, off_t offset, size_t size, char* sector)
{
off_t offset;
int ret;
if (!map_partition_is_valid(map))
return -1;
offset = read_long((u_int32_t*)&map->partition.PyPartStart + block)
offset += read_long((u_int32_t*)&map->partition.PyPartStart)
* FLOPPY_SECTOR_SIZE;
ret = map->device->write_sector(map->device,
offset, sector,
nb * FLOPPY_SECTOR_SIZE);
ret = map->device->write_sector(map->device, offset, sector, size);
return ret;
}