diff --git a/kernel/fs/filebase.c b/kernel/fs/filebase.c index ced5663..aa3f4b9 100644 --- a/kernel/fs/filebase.c +++ b/kernel/fs/filebase.c @@ -76,7 +76,7 @@ vfs_node_desc_t *vfs_handle_to_fd(vfs_handle_t handle) { task_t *t = sched_get_current_task(); if (t != NULL) { - vfs_node_desc_t* nd = (vfs_node_desc_t*)ht_search(&(t->openfiles), handle); + vfs_node_desc_t* nd = (vfs_node_desc_t*)ht_search(&(t->open_files_table), handle); if (nd != NULL) return nd; klogw("VFS: cannot locate %d (0x%x) in file list of task %d, " "maybe we need to increase hash table's size.\n", diff --git a/kernel/fs/vfs.c b/kernel/fs/vfs.c index 393aa06..a54a238 100644 --- a/kernel/fs/vfs.c +++ b/kernel/fs/vfs.c @@ -529,7 +529,7 @@ vfs_handle_t vfs_open(char *path, vfs_openmode_t mode) /* Add to current task */ task_t *t = sched_get_current_task(); if (t != NULL) { - ht_insert(&(t->openfiles), fh, nd); + ht_insert(&(t->open_files_table), fh, nd); } else { kloge("VFS: cannot insert \"%s\" because of invalid task\n", path); } @@ -567,7 +567,7 @@ int64_t vfs_close(vfs_handle_t handle) task_t *t = sched_get_current_task(); if (t != NULL) { - ht_delete(&(t->openfiles), handle); + ht_delete(&(t->open_files_table), handle); } else { kloge("VFS: cannot remove file %d because of invalid task\n", handle); } diff --git a/kernel/proc/sched.c b/kernel/proc/sched.c index 8b146cd..84c00ec 100644 --- a/kernel/proc/sched.c +++ b/kernel/proc/sched.c @@ -597,20 +597,20 @@ task_t *sched_execve( } /* Increase refcount of all open files */ - ht_init(&tc->openfiles, tp->openfiles.size); - for (i = 0; i < tp->openfiles.size; i++) { - if (tp->openfiles.array[i].key == -1 - || tp->openfiles.array[i].data == NULL) + ht_init(&tc->open_files_table, tp->open_files_table.size); + for (i = 0; i < tp->open_files_table.size; i++) { + if (tp->open_files_table.array[i].key == -1 + || tp->open_files_table.array[i].data == NULL) { continue; } vfs_node_desc_t* nd = (vfs_node_desc_t*)kmalloc(sizeof(vfs_node_desc_t)); - memcpy(nd, tp->openfiles.array[i].data, sizeof(vfs_node_desc_t)); - tc->openfiles.array[i] = tp->openfiles.array[i]; - tc->openfiles.array[i].data = nd; + memcpy(nd, tp->open_files_table.array[i].data, sizeof(vfs_node_desc_t)); + tc->open_files_table.array[i] = tp->open_files_table.array[i]; + tc->open_files_table.array[i].data = nd; nd->inode->refcount++; klogd("SCHED: copy fd %d from tid %d to tid %d\n", - tc->openfiles.array[i].key, tp->tid, tc->tid); + tc->open_files_table.array[i].key, tp->tid, tc->tid); } } diff --git a/kernel/proc/task.c b/kernel/proc/task.c index 8f0accb..28bb3bc 100644 --- a/kernel/proc/task.c +++ b/kernel/proc/task.c @@ -127,7 +127,7 @@ task_t *task_make( strcpy(ntask->cwd, "/"); strncpy(ntask->name, name, sizeof(ntask->name)); - ht_init(&ntask->openfiles, HT_DEFAULT_ARRAY_SIZE); + ht_init(&ntask->open_files_table, HT_DEFAULT_ARRAY_SIZE); klogi("TASK: Create tid %d with name \"%s\" (task 0x%x)\n", ntask->tid, name, ntask); @@ -253,20 +253,20 @@ task_t *task_fork(task_t *tp) } /* Increase refcount of all open files */ - ht_init(&tc->openfiles, tp->openfiles.size); - for (i = 0; i < tp->openfiles.size; i++) { - if (tp->openfiles.array[i].key == -1 - || tp->openfiles.array[i].data == NULL) + ht_init(&tc->open_files_table, tp->open_files_table.size); + for (i = 0; i < tp->open_files_table.size; i++) { + if (tp->open_files_table.array[i].key == -1 + || tp->open_files_table.array[i].data == NULL) { continue; } vfs_node_desc_t* nd = (vfs_node_desc_t*)kmalloc(sizeof(vfs_node_desc_t)); - memcpy(nd, tp->openfiles.array[i].data, sizeof(vfs_node_desc_t)); - tc->openfiles.array[i].key = tp->openfiles.array[i].key; - tc->openfiles.array[i].data = nd; + memcpy(nd, tp->open_files_table.array[i].data, sizeof(vfs_node_desc_t)); + tc->open_files_table.array[i].key = tp->open_files_table.array[i].key; + tc->open_files_table.array[i].data = nd; nd->inode->refcount++; klogd("TASK: copy fd %d from tid %d to tid %d\n", - tc->openfiles.array[i].key, tp->tid, tc->tid); + tc->open_files_table.array[i].key, tp->tid, tc->tid); } task_debug(tc, false); diff --git a/kernel/proc/task.h b/kernel/proc/task.h index 352a6bc..9c095c7 100644 --- a/kernel/proc/task.h +++ b/kernel/proc/task.h @@ -227,7 +227,7 @@ typedef struct _task_t { auxval_t aux; vec_struct(task_id_t) child_list; - ht_t openfiles; + ht_t open_files_table; vec_struct(file_dup_t) dup_list; int64_t errno;