Rename read syscall, vfs_read and so to xxx_read_file

This commit is contained in:
2026-03-01 00:29:04 +01:00
parent 0533c2705d
commit a3b98fcaa2
12 changed files with 41 additions and 41 deletions

View File

@@ -268,7 +268,7 @@ static void cat (char** file_paths, size_t files_count) {
goto close;
memset (buffer, 0, desc.size + 1);
read (path, 0, (uint8_t*)buffer, desc.size);
read_file (path, 0, (uint8_t*)buffer, desc.size);
printf ("%s\n", buffer);
close:

View File

@@ -16,7 +16,7 @@
#define SYS_EXEC 13
#define SYS_VOLUME_OPEN 14
#define SYS_VOLUME_CLOSE 15
#define SYS_READ 16
#define SYS_READ_FILE 16
#define SYS_DESCRIBE 17
#define SYS_MAIL_SEND 18
#define SYS_MAIL_RECEIVE 19

View File

@@ -164,7 +164,7 @@ int fatfs_describe (struct vfs_volume* volume, const char* path, struct desc* de
return ST_OK;
}
int fatfs_read (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int fatfs_read_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size) {
struct fatfs_ctx* fatfs_ctx = volume->udata;
@@ -181,7 +181,7 @@ int fatfs_read (struct vfs_volume* volume, const char* path, uint8_t* buffer, si
return ST_OK;
}
int fatfs_write (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int fatfs_write_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size) {
struct fatfs_ctx* fatfs_ctx = volume->udata;

View File

@@ -18,10 +18,10 @@ int fatfs32_format (struct vfs_volume* volume);
int fatfs_describe (struct vfs_volume* volume, const char* path, struct desc* desc);
int fatfs_read (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int fatfs_read_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size);
int fatfs_write (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int fatfs_write_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size);
int fatfs_read_dir_entry (struct vfs_volume* volume, const char* path, struct dir_entry* entry,

View File

@@ -150,7 +150,7 @@ int tarfs_describe (struct vfs_volume* volume, const char* path, struct desc* de
}
}
int tarfs_read (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int tarfs_read_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size) {
(void)volume;
@@ -196,7 +196,7 @@ int tarfs_read_dir_entry (struct vfs_volume* volume, const char* path, struct di
return ST_DIR_NO_ENTRIES;
}
int tarfs_write (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int tarfs_write_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size) {
(void)volume, (void)path, (void)buffer, (void)off, (void)size;
return ST_OK;

View File

@@ -40,10 +40,10 @@ int tarfs_format (struct vfs_volume* volume);
int tarfs_describe (struct vfs_volume* volume, const char* path, struct desc* desc);
int tarfs_read (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int tarfs_read_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size);
int tarfs_write (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int tarfs_write_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size);
int tarfs_read_dir_entry (struct vfs_volume* volume, const char* path, struct dir_entry* entry,

View File

@@ -57,24 +57,24 @@ int vfs_create_volume (const char* key, int fs_type, struct device* back_device)
volume->driver_ops.mount = &tarfs_mount;
volume->driver_ops.format = &tarfs_format;
volume->driver_ops.describe = &tarfs_describe;
volume->driver_ops.read = &tarfs_read;
volume->driver_ops.write = &tarfs_write;
volume->driver_ops.read_file = &tarfs_read_file;
volume->driver_ops.write_file = &tarfs_write_file;
volume->driver_ops.read_dir_entry = &tarfs_read_dir_entry;
break;
case VFS_FAT16:
volume->driver_ops.mount = &fatfs_mount;
volume->driver_ops.format = &fatfs16_format;
volume->driver_ops.describe = &fatfs_describe;
volume->driver_ops.read = &fatfs_read;
volume->driver_ops.write = &fatfs_write;
volume->driver_ops.read_file = &fatfs_read_file;
volume->driver_ops.write_file = &fatfs_write_file;
volume->driver_ops.read_dir_entry = &fatfs_read_dir_entry;
break;
case VFS_FAT32:
volume->driver_ops.mount = &fatfs_mount;
volume->driver_ops.format = &fatfs32_format;
volume->driver_ops.describe = &fatfs_describe;
volume->driver_ops.read = &fatfs_read;
volume->driver_ops.write = &fatfs_write;
volume->driver_ops.read_file = &fatfs_read_file;
volume->driver_ops.write_file = &fatfs_write_file;
volume->driver_ops.read_dir_entry = &fatfs_read_dir_entry;
break;
default:
@@ -183,7 +183,7 @@ int vfs_format (struct proc* proc, const char* volume_name) {
return volume->driver_ops.format (volume);
}
int vfs_read (struct proc* proc, const char* volume_name, const char* path, uint8_t* buffer,
int vfs_read_file (struct proc* proc, const char* volume_name, const char* path, uint8_t* buffer,
size_t off, size_t size) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
@@ -199,7 +199,7 @@ int vfs_read (struct proc* proc, const char* volume_name, const char* path, uint
spin_unlock (&volume->lock);
return volume->driver_ops.read (volume, path, buffer, off, size);
return volume->driver_ops.read_file (volume, path, buffer, off, size);
}
int vfs_describe (struct proc* proc, const char* volume_name, const char* path, struct desc* desc) {

View File

@@ -38,10 +38,10 @@ struct vfs_volume {
int (*describe) (struct vfs_volume* volume, const char* path, struct desc* desc);
int (*read) (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int (*read_file) (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size);
int (*write) (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
int (*write_file) (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
size_t size);
int (*read_dir_entry) (struct vfs_volume* volume, const char* path, struct dir_entry* entry,
@@ -64,8 +64,8 @@ int vfs_volume_close (struct proc* proc, const char* volume, struct reschedule_c
int vfs_format (struct proc* proc, const char* volume_name);
int vfs_read (struct proc* proc, const char* volume, const char* path, uint8_t* buffer, size_t off,
size_t size);
int vfs_read_file (struct proc* proc, const char* volume, const char* path, uint8_t* buffer,
size_t off, size_t size);
int vfs_describe (struct proc* proc, const char* volume, const char* path, struct desc* desc);

View File

@@ -149,7 +149,7 @@ struct proc* proc_from_file (struct proc* proc1, const char* volume, const char*
return NULL;
}
if ((ret = vfs_read (proc1, volume, path, temp_buffer, 0, desc.size)) < 0) {
if ((ret = vfs_read_file (proc1, volume, path, temp_buffer, 0, desc.size)) < 0) {
free (temp_buffer);
vfs_volume_close (proc1, volume, rctx);
return NULL;

View File

@@ -354,8 +354,8 @@ DEFINE_SYSCALL (sys_volume_close) {
return SYSRESULT (ret);
}
/* int read (char* path, size_t off, uint8_t* buffer, size_t size) */
DEFINE_SYSCALL (sys_read) {
/* int read_file (char* path, size_t off, uint8_t* buffer, size_t size) */
DEFINE_SYSCALL (sys_read_file) {
uintptr_t uvaddr_path = a1;
size_t off = (size_t)a2;
uintptr_t uvaddr_buffer = a3;
@@ -380,7 +380,7 @@ DEFINE_SYSCALL (sys_read) {
return SYSRESULT (-ST_BAD_ADDRESS_SPACE);
spin_lock (&proc->lock);
int ret = vfs_read (proc, proc->cwv, path, buffer, off, size);
int ret = vfs_read_file (proc, proc->cwv, path, buffer, off, size);
spin_unlock (&proc->lock);
return SYSRESULT (ret);
@@ -478,7 +478,7 @@ static syscall_handler_func_t handler_table[] = {
[SYS_EXEC] = &sys_exec,
[SYS_VOLUME_OPEN] = &sys_volume_open,
[SYS_VOLUME_CLOSE] = &sys_volume_close,
[SYS_READ] = &sys_read,
[SYS_READ_FILE] = &sys_read_file,
[SYS_DESCRIBE] = &sys_describe,
[SYS_MAIL_SEND] = &sys_mail_send,
[SYS_MAIL_RECEIVE] = &sys_mail_receive,

View File

@@ -45,8 +45,8 @@ int volume_open (const char* volume) { return (int)do_syscall (SYS_VOLUME_OPEN,
int volume_close (void) { return (int)do_syscall (SYS_VOLUME_CLOSE, 0); }
int read (const char* path, size_t off, uint8_t* buffer, size_t size) {
return (int)do_syscall (SYS_READ, path, off, buffer, size);
int read_file (const char* path, size_t off, uint8_t* buffer, size_t size) {
return (int)do_syscall (SYS_READ_FILE, path, off, buffer, size);
}
int describe (const char* path, struct desc* desc) {

View File

@@ -61,7 +61,7 @@ int volume_open (const char* volume);
int volume_close (void);
/* Read a file */
int read (const char* path, size_t off, uint8_t* buffer, size_t size);
int read_file (const char* path, size_t off, uint8_t* buffer, size_t size);
/* describe a file */
int describe (const char* path, struct desc* desc);