improve file access (direct i/o)

This commit is contained in:
Laurent Vivier 2005-11-14 07:35:45 +00:00
parent aed2d777a0
commit 1d9d4b7255

View File

@ -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;