2007-10-09 20:00:27 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* (c) 2004-2007 Laurent Vivier <Laurent@lvivier.info>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "libmap.h"
|
|
|
|
|
|
|
|
int map_partition_read(map_t* map, off_t block, size_t nb, 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)
|
|
|
|
* FLOPPY_SECTOR_SIZE;
|
|
|
|
|
|
|
|
ret = map->device->read_sector(map->device,
|
2007-10-09 20:14:23 +00:00
|
|
|
offset, sector,
|
2007-10-09 20:00:27 +00:00
|
|
|
nb * FLOPPY_SECTOR_SIZE);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|