vfs: introduce adjustable ISO9660 buffer length for file reading

This commit is contained in:
2025-08-22 17:50:42 +03:00
parent 9bb6d9d1a5
commit 7c43956ebe
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ test-cdrom:
qemu-system-i386 -cdrom boot.iso -m 4096M -d int
cdrom:
qemu-system-i386 -cdrom boot.iso -m 4096M
qemu-system-i386 -cdrom boot.iso -m 32M
debug-cdrom:
qemu-system-i386 -s -S -cdrom boot.iso -m 4096M -monitor stdio
+2
View File
@@ -1,6 +1,8 @@
#ifndef VFS_H
#define VFS_H
#define ISO_9660_BUFFER_LENGTH 2048
#include <stdbool.h>
#include "../include/atapi.h"
#include "../include/lib9660.h"
+4 -4
View File
@@ -71,9 +71,9 @@ size_t vfs_read_file(l9660_file *file, uint8_t* buffer)
l9660_status status;
for(;;) {
char buf[128];
char buf[ISO_9660_BUFFER_LENGTH];
size_t read;
status = l9660_read(file, buf, 128, &read);
status = l9660_read(file, buf, ISO_9660_BUFFER_LENGTH, &read);
if (status != L9660_OK) {
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;
while(total_read < length) {
char buf[128];
size_t to_read = (length - total_read) < 128 ? (length - total_read) : 128;
char buf[ISO_9660_BUFFER_LENGTH];
size_t to_read = (length - total_read) < ISO_9660_BUFFER_LENGTH ? (length - total_read) : ISO_9660_BUFFER_LENGTH;
size_t read = 0;
status = l9660_read(file, buf, to_read, &read);