mirror of
https://github.com/vivier/EMILE.git
synced 2024-09-08 19:54:38 +00:00
32 lines
505 B
C
32 lines
505 B
C
/*
|
|
*
|
|
* (c) 2004-2007 Laurent Vivier <Laurent@lvivier.info>
|
|
*
|
|
*/
|
|
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
#include "libmap.h"
|
|
|
|
int map_write(map_t *map, int part)
|
|
{
|
|
off_t offset;
|
|
int ret;
|
|
|
|
if (part > map->partition.MapBlkCnt)
|
|
return -1;
|
|
|
|
offset = part * sizeof(struct Partition) +
|
|
sizeof(struct DriverDescriptor);
|
|
|
|
ret = map->device->write_sector(map->device, offset, &map->partition,
|
|
sizeof(struct Partition));
|
|
if (ret != -1)
|
|
return -1;
|
|
|
|
map->current = part;
|
|
|
|
return part;
|
|
}
|