mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-22 10:29:31 +00:00
9bd9755dbb
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU>
31 lines
549 B
C
31 lines
549 B
C
/*
|
|
*
|
|
* (c) 2004, 2005 Laurent Vivier <Laurent@Vivier.EU>
|
|
*
|
|
*/
|
|
|
|
#include <sys/types.h>
|
|
#include <string.h>
|
|
|
|
#include <macos/devices.h>
|
|
|
|
#include "libscsi.h"
|
|
|
|
#define ISO_BLOCKS(X) (((X) / device->sector_size) + (((X)%device->sector_size)?1:0))
|
|
|
|
/* offset is a block number
|
|
* size is the number of bytes to read
|
|
*/
|
|
|
|
int scsi_read_sector(scsi_device_t *device,
|
|
off_t offset, void* buffer, size_t size)
|
|
{
|
|
OSErr err;
|
|
|
|
err = scsi_READ(device->target, offset, ISO_BLOCKS(size), buffer, size);
|
|
if (err != noErr)
|
|
return -1;
|
|
|
|
return 0;
|
|
}
|