vfs: introduce adjustable ISO9660 buffer length for file reading
This commit is contained in:
@@ -59,7 +59,7 @@ test-cdrom:
|
|||||||
qemu-system-i386 -cdrom boot.iso -m 4096M -d int
|
qemu-system-i386 -cdrom boot.iso -m 4096M -d int
|
||||||
|
|
||||||
cdrom:
|
cdrom:
|
||||||
qemu-system-i386 -cdrom boot.iso -m 4096M
|
qemu-system-i386 -cdrom boot.iso -m 32M
|
||||||
|
|
||||||
debug-cdrom:
|
debug-cdrom:
|
||||||
qemu-system-i386 -s -S -cdrom boot.iso -m 4096M -monitor stdio
|
qemu-system-i386 -s -S -cdrom boot.iso -m 4096M -monitor stdio
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef VFS_H
|
#ifndef VFS_H
|
||||||
#define VFS_H
|
#define VFS_H
|
||||||
|
|
||||||
|
#define ISO_9660_BUFFER_LENGTH 2048
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "../include/atapi.h"
|
#include "../include/atapi.h"
|
||||||
#include "../include/lib9660.h"
|
#include "../include/lib9660.h"
|
||||||
|
|||||||
+4
-4
@@ -71,9 +71,9 @@ size_t vfs_read_file(l9660_file *file, uint8_t* buffer)
|
|||||||
l9660_status status;
|
l9660_status status;
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
char buf[128];
|
char buf[ISO_9660_BUFFER_LENGTH];
|
||||||
size_t read;
|
size_t read;
|
||||||
status = l9660_read(file, buf, 128, &read);
|
status = l9660_read(file, buf, ISO_9660_BUFFER_LENGTH, &read);
|
||||||
|
|
||||||
if (status != L9660_OK) {
|
if (status != L9660_OK) {
|
||||||
printf("An error occurred during file read!\n");
|
printf("An error occurred during file read!\n");
|
||||||
@@ -97,8 +97,8 @@ size_t vfs_read_file_length(l9660_file *file, uint8_t* buffer, size_t length)
|
|||||||
l9660_status status;
|
l9660_status status;
|
||||||
|
|
||||||
while(total_read < length) {
|
while(total_read < length) {
|
||||||
char buf[128];
|
char buf[ISO_9660_BUFFER_LENGTH];
|
||||||
size_t to_read = (length - total_read) < 128 ? (length - total_read) : 128;
|
size_t to_read = (length - total_read) < ISO_9660_BUFFER_LENGTH ? (length - total_read) : ISO_9660_BUFFER_LENGTH;
|
||||||
size_t read = 0;
|
size_t read = 0;
|
||||||
|
|
||||||
status = l9660_read(file, buf, to_read, &read);
|
status = l9660_read(file, buf, to_read, &read);
|
||||||
|
|||||||
Reference in New Issue
Block a user