Optimize XiZi_AIoT FS fd allocation.
This commit is contained in:
parent
16a53d4e80
commit
b6dd58c629
|
@ -57,7 +57,7 @@ static int InodeFreeRecursive(struct Inode* dp);
|
|||
static char* PathElementExtract(char* path, char* name);
|
||||
static uint32_t InodeBlockMapping(struct Inode* inode, uint32_t block_num);
|
||||
|
||||
#define MAX_SUPPORT_FD 1024
|
||||
#define MAX_SUPPORT_FD 2048
|
||||
static struct FileDescriptor fd_table[MAX_SUPPORT_FD];
|
||||
|
||||
struct MemFsRange MemFsRange;
|
||||
|
@ -486,7 +486,7 @@ void FreeFileDescriptor(int fd)
|
|||
printf("fd invlid.\n");
|
||||
return;
|
||||
}
|
||||
fd_table[fd].data = 0;
|
||||
fd_table[fd].data = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -495,8 +495,9 @@ int AllocFileDescriptor(void)
|
|||
int free_idx = -1;
|
||||
for (int i = 0; i < MAX_SUPPORT_FD; i++) {
|
||||
// found free fd
|
||||
if (free_idx == -1 && fd_table[i].data == 0) {
|
||||
if (free_idx == -1 && fd_table[i].data == NULL) {
|
||||
free_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (free_idx == -1) {
|
||||
|
|
|
@ -23,7 +23,7 @@ struct CwdPair {
|
|||
struct Inode* Inode;
|
||||
};
|
||||
|
||||
#define MAX_SUPPORT_SESSION 1024
|
||||
#define MAX_SUPPORT_SESSION 2048
|
||||
static struct CwdPair session_cwd[MAX_SUPPORT_SESSION];
|
||||
|
||||
static struct CwdPair* get_session_cwd(void)
|
||||
|
|
|
@ -53,7 +53,7 @@ uintptr_t* _page_walk(uintptr_t* pgdir, uintptr_t vaddr, bool alloc)
|
|||
pgtbl_vaddr = (uintptr_t*)P2V(pgtbl_paddr);
|
||||
} else {
|
||||
if (!alloc || !(pgtbl_vaddr = (uintptr_t*)kalloc(sizeof(uintptr_t) * NUM_LEVEL4_PTE))) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(pgtbl_vaddr, 0, sizeof(uintptr_t) * NUM_LEVEL4_PTE);
|
||||
|
|
|
@ -41,7 +41,7 @@ Modification:
|
|||
extern uint8_t _binary_fs_img_start[], _binary_fs_img_end[];
|
||||
|
||||
#define SHOWINFO_BORDER_LINE() LOG_PRINTF("******************************************************\n");
|
||||
#define SHOWTASK_TASK_BASE_INFO(task) LOG_PRINTF(" %-4d %-16s %-4d 0x%x(%-d)\n", task->pid, task->name, task->priority, task->mem_size >> 10, task->mem_size >> 10)
|
||||
#define SHOWTASK_TASK_BASE_INFO(task) LOG_PRINTF(" %-6d %-16s %-4d 0x%x(%-d)\n", task->pid, task->name, task->priority, task->mem_size >> 10, task->mem_size >> 10)
|
||||
|
||||
void show_tasks(void)
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ void show_tasks(void)
|
|||
LOG_PRINTF("CPU %-2d: %s\n", i, (global_cpus[i].task == NULL ? "NULL" : global_cpus[i].task->name));
|
||||
}
|
||||
SHOWINFO_BORDER_LINE();
|
||||
LOG_PRINTF("%-8s %-4s %-16s %-4s %-8s\n", "STAT", "ID", "TASK", "PRI", "MEM(KB)");
|
||||
LOG_PRINTF("%-8s %-6s %-16s %-4s %-8s\n", "STAT", "ID", "TASK", "PRI", "MEM(KB)");
|
||||
DOUBLE_LIST_FOR_EACH_ENTRY(task, &xizi_task_manager.task_running_list_head, node)
|
||||
{
|
||||
LOG_PRINTF("%-8s", "RUNNING");
|
||||
|
|
Loading…
Reference in New Issue