CE add mkdir command, implement create_dir () syscall
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m1s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m1s
This commit is contained in:
@@ -61,6 +61,7 @@ int vfs_create_volume (const char* key, int fs_type, struct device* back_device,
|
||||
volume->driver_ops.write_file = &tarfs_write_file;
|
||||
volume->driver_ops.read_dir_entry = &tarfs_read_dir_entry;
|
||||
volume->driver_ops.create_file = &tarfs_create_file;
|
||||
volume->driver_ops.create_dir = &tarfs_create_dir;
|
||||
break;
|
||||
case VFS_FAT16:
|
||||
volume->driver_ops.mount = &fatfs_mount;
|
||||
@@ -70,6 +71,7 @@ int vfs_create_volume (const char* key, int fs_type, struct device* back_device,
|
||||
volume->driver_ops.write_file = &fatfs_write_file;
|
||||
volume->driver_ops.read_dir_entry = &fatfs_read_dir_entry;
|
||||
volume->driver_ops.create_file = &fatfs_create_file;
|
||||
volume->driver_ops.create_dir = &fatfs_create_dir;
|
||||
break;
|
||||
case VFS_FAT32:
|
||||
volume->driver_ops.mount = &fatfs_mount;
|
||||
@@ -79,6 +81,7 @@ int vfs_create_volume (const char* key, int fs_type, struct device* back_device,
|
||||
volume->driver_ops.write_file = &fatfs_write_file;
|
||||
volume->driver_ops.read_dir_entry = &fatfs_read_dir_entry;
|
||||
volume->driver_ops.create_file = &fatfs_create_file;
|
||||
volume->driver_ops.create_dir = &fatfs_create_dir;
|
||||
break;
|
||||
default:
|
||||
free (volume);
|
||||
@@ -279,6 +282,24 @@ int vfs_read_dir_entry (struct proc* proc, const char* volume_name, const char*
|
||||
return volume->driver_ops.read_dir_entry (volume, path, entry, entry_num);
|
||||
}
|
||||
|
||||
int vfs_create_dir (struct proc* proc, const char* volume_name, const char* path) {
|
||||
struct vfs_volume* volume = vfs_find_volume (volume_name);
|
||||
|
||||
if (volume == NULL)
|
||||
return -ST_NOT_FOUND;
|
||||
|
||||
spin_lock (&volume->lock);
|
||||
|
||||
if (volume->locked && volume->owner != proc) {
|
||||
spin_unlock (&volume->lock);
|
||||
return -ST_PERMISSION_ERROR;
|
||||
}
|
||||
|
||||
spin_unlock (&volume->lock);
|
||||
|
||||
return volume->driver_ops.create_dir (volume, path);
|
||||
}
|
||||
|
||||
void vfs_init (void) {
|
||||
memset (&volume_table, 0, sizeof (volume_table));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user