mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-22 10:29:31 +00:00
improve file access (direct i/o)
This commit is contained in:
parent
aed2d777a0
commit
1d9d4b7255
@ -19,7 +19,31 @@ ssize_t iso9660_read(iso9660_FILE *file, void *buf, size_t count)
|
||||
{
|
||||
size_t part;
|
||||
|
||||
if (file->index == 2048)
|
||||
/* direct i/o */
|
||||
|
||||
if ( (file->index == sizeof (file->buffer)) &&
|
||||
(count > sizeof (file->buffer)) )
|
||||
{
|
||||
int extents;
|
||||
|
||||
if (file->len < count)
|
||||
extents = file->len / sizeof(file->buffer);
|
||||
else
|
||||
extents = count / sizeof (file->buffer);
|
||||
|
||||
part = extents * sizeof (file->buffer);
|
||||
|
||||
__iso9660_device_read(file->extent,
|
||||
buf + read, part);
|
||||
file->len -= part;
|
||||
file->extent += extents;
|
||||
count -= part;
|
||||
read += part;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file->index == sizeof (file->buffer))
|
||||
{
|
||||
if (file->len <= 0)
|
||||
return read;
|
||||
|
Loading…
Reference in New Issue
Block a user