version 1.1.1.1, 2008/06/03 10:38:51 |
version 1.1.1.1.2.1, 2008/08/13 17:12:45 |
|
|
#endif |
#endif |
|
|
/* |
/* |
* Lookup task by task id. |
* Convert task ID to a task structure. |
* Returns locked task. Caller must unlock it after using it. |
* Returns locked task. Caller must unlock it after using it. |
*/ |
*/ |
struct task * |
struct task * |
|
|
} |
} |
|
|
/* |
/* |
* Update task id of specified task. |
* Update task id of the specified task. |
*/ |
*/ |
void |
void |
task_update(struct task *t, task_t task) |
task_update(struct task *t, task_t task) |
|
|
} |
} |
|
|
/* |
/* |
|
* Get new file descriptor in the task. |
|
* Find the smallest empty slot in the fd array. |
|
* Returns -1 if there is no empty slot. |
|
*/ |
|
int |
|
task_newfd(struct task *t) |
|
{ |
|
int fd; |
|
|
|
for (fd = 0; fd < OPEN_MAX; fd++) |
|
if (t->file[fd] == NULL) |
|
break; |
|
if (fd == OPEN_MAX) |
|
return -1; /* slot full */ |
|
|
|
return fd; |
|
} |
|
|
|
/* |
* Convert to full path from the cwd of task and path. |
* Convert to full path from the cwd of task and path. |
* @t: task structure |
* @t: task structure |
* @path: target path |
* @path: target path |
|
|
int i; |
int i; |
|
|
TASK_LOCK(); |
TASK_LOCK(); |
printf("Dump file data\n"); |
dprintf("Dump file data\n"); |
printf(" task nr_open cwd\n"); |
dprintf(" task opens cwd\n"); |
printf(" -------- ------- ------------------------------\n"); |
dprintf(" -------- ------- ------------------------------\n"); |
for (i = 0; i < TASK_MAXBUCKETS; i++) { |
for (i = 0; i < TASK_MAXBUCKETS; i++) { |
head = &task_table[i]; |
head = &task_table[i]; |
for (n = list_first(head); n != head; n = list_next(n)) { |
for (n = list_first(head); n != head; n = list_next(n)) { |
t = list_entry(n, struct task, link); |
t = list_entry(n, struct task, link); |
printf(" %08x %7x %s\n", t->task, t->nr_open, t->cwd); |
dprintf(" %08x %7x %s\n", (int)t->task, t->nopens, |
|
t->cwd); |
} |
} |
} |
} |
printf("\n"); |
dprintf("\n"); |
TASK_UNLOCK(); |
TASK_UNLOCK(); |
#endif |
#endif |
} |
} |
|
|
list_init(&task_table[i]); |
list_init(&task_table[i]); |
} |
} |
|
|
|
#ifdef DEBUG_VFS |
void |
void |
task_debug(void) |
task_debug(void) |
{ |
{ |
|
|
|
|
for (i = 0; i < TASK_MAXBUCKETS; i++) { |
for (i = 0; i < TASK_MAXBUCKETS; i++) { |
head = &task_table[i]; |
head = &task_table[i]; |
syslog(LOG_DEBUG, "head=%x head->next=%x head->prev=%x\n", |
dprintf("head=%x head->next=%x head->prev=%x\n", head, |
head, head->next, head->prev); |
head->next, head->prev); |
ASSERT(head->next); |
ASSERT(head->next); |
ASSERT(head->prev); |
ASSERT(head->prev); |
} |
} |
} |
} |
|
#endif |