From a3b98fcaa2fc299809275a53af27ab338a3cf1c5 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Sun, 1 Mar 2026 00:29:04 +0100 Subject: [PATCH] Rename read syscall, vfs_read and so to xxx_read_file --- ce/ce.c | 2 +- include/syscall_defs.h | 2 +- kernel/fs/fatfs.c | 8 ++++---- kernel/fs/fatfs.h | 8 ++++---- kernel/fs/tarfs.c | 8 ++++---- kernel/fs/tarfs.h | 8 ++++---- kernel/fs/vfs.c | 18 +++++++++--------- kernel/fs/vfs.h | 12 ++++++------ kernel/proc/proc.c | 2 +- kernel/syscall/syscall.c | 8 ++++---- libsystem/system.c | 4 ++-- libsystem/system.h | 2 +- 12 files changed, 41 insertions(+), 41 deletions(-) diff --git a/ce/ce.c b/ce/ce.c index 22c1788..cf27372 100644 --- a/ce/ce.c +++ b/ce/ce.c @@ -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: diff --git a/include/syscall_defs.h b/include/syscall_defs.h index 6aee081..c898ce9 100644 --- a/include/syscall_defs.h +++ b/include/syscall_defs.h @@ -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 diff --git a/kernel/fs/fatfs.c b/kernel/fs/fatfs.c index c984f10..04601d0 100644 --- a/kernel/fs/fatfs.c +++ b/kernel/fs/fatfs.c @@ -164,8 +164,8 @@ 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, - size_t size) { +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; FL_FILE* file = fl_fopen (fatfs_ctx, path, "wb+"); @@ -181,8 +181,8 @@ 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, - size_t size) { +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; FL_FILE* file = fl_fopen (fatfs_ctx, path, "wb+"); diff --git a/kernel/fs/fatfs.h b/kernel/fs/fatfs.h index fb8b029..834b4ea 100644 --- a/kernel/fs/fatfs.h +++ b/kernel/fs/fatfs.h @@ -18,11 +18,11 @@ 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, - size_t size); +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, - size_t size); +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, size_t entry_num); diff --git a/kernel/fs/tarfs.c b/kernel/fs/tarfs.c index a028325..a77cd53 100644 --- a/kernel/fs/tarfs.c +++ b/kernel/fs/tarfs.c @@ -150,8 +150,8 @@ 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, - size_t size) { +int tarfs_read_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off, + size_t size) { (void)volume; const char* filename = path_basename (path); @@ -196,8 +196,8 @@ 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, - size_t size) { +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; } diff --git a/kernel/fs/tarfs.h b/kernel/fs/tarfs.h index 4ddfed5..ab487dc 100644 --- a/kernel/fs/tarfs.h +++ b/kernel/fs/tarfs.h @@ -40,11 +40,11 @@ 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, - size_t size); +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, - size_t size); +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, size_t entry_num); diff --git a/kernel/fs/vfs.c b/kernel/fs/vfs.c index 11a405c..6164c69 100644 --- a/kernel/fs/vfs.c +++ b/kernel/fs/vfs.c @@ -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,8 +183,8 @@ 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, - size_t off, size_t size) { +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); if (volume == NULL) @@ -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) { diff --git a/kernel/fs/vfs.h b/kernel/fs/vfs.h index ac7a805..de5e36b 100644 --- a/kernel/fs/vfs.h +++ b/kernel/fs/vfs.h @@ -38,11 +38,11 @@ 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, - size_t size); + 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, - size_t size); + 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, size_t entry_num); @@ -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); diff --git a/kernel/proc/proc.c b/kernel/proc/proc.c index 8145fba..60ff459 100644 --- a/kernel/proc/proc.c +++ b/kernel/proc/proc.c @@ -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; diff --git a/kernel/syscall/syscall.c b/kernel/syscall/syscall.c index b449e5c..12bb594 100644 --- a/kernel/syscall/syscall.c +++ b/kernel/syscall/syscall.c @@ -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, diff --git a/libsystem/system.c b/libsystem/system.c index 545a06f..af3c63b 100644 --- a/libsystem/system.c +++ b/libsystem/system.c @@ -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) { diff --git a/libsystem/system.h b/libsystem/system.h index cb0bc38..2834ee2 100644 --- a/libsystem/system.h +++ b/libsystem/system.h @@ -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);