Rename read syscall, vfs_read and so to xxx_read_file
This commit is contained in:
@@ -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+");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user