From: Andre Noll Date: Thu, 2 Jan 2014 01:05:54 +0000 (+0000) Subject: sched: Rename task->status to task->name. X-Git-Tag: v0.5.3~8^2~7 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=6df282b25d3ca0f2a55dd09546d0efc42a437ace;p=paraslash.git sched: Rename task->status to task->name. "status" has always been a misnomer for the user-defined description of a task. Now that the structure has been made local, only sched.c needs to be changed. --- diff --git a/sched.c b/sched.c index cad298b8..ae6b2a9d 100644 --- a/sched.c +++ b/sched.c @@ -19,6 +19,8 @@ #include "error.h" struct task { + /** The task name supplied when the task was registered(). */ + char name[255]; /** Copied from the task_info struct during task_register(). */ void (*pre_select)(struct sched *s, struct task *t); /** Copied from the task_info struct during task_register(). */ @@ -27,8 +29,6 @@ struct task { int error; /** Position of the task in the task list of the scheduler. */ struct list_head node; - /** The task name supplied when the task was registered(). */ - char status[255]; /** If less than zero, the task was notified by another task. */ int notification; /** True if task is in error state and exit status has been queried. */ @@ -62,7 +62,7 @@ static void sched_preselect(struct sched *s) static void unlink_and_free_task(struct task *t) { - PARA_INFO_LOG("freeing task %s\n", t->status); + PARA_INFO_LOG("freeing task %s\n", t->name); list_del(&t->node); free(t); } @@ -83,7 +83,7 @@ static inline void call_post_select(struct sched *s, struct task *t) pst = tv2ms(&diff); if (pst > 50) PARA_WARNING_LOG("%s: post_select time: %lums\n", - t->status, pst); + t->name, pst); #endif } @@ -216,7 +216,7 @@ void sched_shutdown(struct sched *s) if (t->error >= 0) /* The task list should contain only terminated tasks. */ PARA_WARNING_LOG("shutting down running task %s\n", - t->status); + t->name); unlink_and_free_task(t); } } @@ -239,8 +239,8 @@ struct task *task_register(struct task_info *info, struct sched *s) if (!s->task_list.next) INIT_LIST_HEAD(&s->task_list); - snprintf(t->status, sizeof(t->status) - 1, "%s", info->name); - t->status[sizeof(t->status) - 1] = '\0'; + snprintf(t->name, sizeof(t->name) - 1, "%s", info->name); + t->name[sizeof(t->name) - 1] = '\0'; t->notification = 0; t->error = 0; t->dead = false; @@ -283,7 +283,7 @@ char *get_task_list(struct sched *s) char *tmp_msg; tmp_msg = make_message("%s%p\t%s\t%s\n", msg? msg : "", t, t->error < 0? (t->dead? "dead" : "zombie") : "running", - t->status); + t->name); free(msg); msg = tmp_msg; } @@ -314,7 +314,7 @@ void task_notify(struct task *t, int err) assert(err > 0); if (t->notification == -err) /* ignore subsequent notifications */ return; - PARA_INFO_LOG("notifying task %s: %s\n", t->status, para_strerror(err)); + PARA_INFO_LOG("notifying task %s: %s\n", t->name, para_strerror(err)); t->notification = -err; }