{
struct workqueue_struct *wq;
struct work_exec *exec;
- bool retval = 0;
+ bool retval = false;
wq = work->work_queue;
if (unlikely(wq == NULL))
TAILQ_FOREACH(exec, &wq->exec_head, entry) {
if (exec->target == work) {
exec->target = NULL;
- retval = 1;
+ retval = true;
break;
}
}
case WORK_ST_EXEC:
case WORK_ST_CANCEL:
if (linux_work_exec_unblock(work) != 0)
- return (1);
+ return (true);
/* FALLTHROUGH */
case WORK_ST_IDLE:
work->work_queue = wq;
taskqueue_enqueue(wq->taskqueue, &work->work_task);
- return (1);
+ return (true);
default:
- return (0); /* already on a queue */
+ return (false); /* already on a queue */
}
}
case WORK_ST_CANCEL:
if (delay == 0 && linux_work_exec_unblock(&dwork->work) != 0) {
dwork->timer.expires = jiffies;
- return (1);
+ return (true);
}
/* FALLTHROUGH */
case WORK_ST_IDLE:
&linux_delayed_work_timer_fn, dwork);
mtx_unlock(&dwork->timer.mtx);
}
- return (1);
+ return (true);
default:
- return (0); /* already on a queue */
+ return (false); /* already on a queue */
}
}
if (linux_cancel_timer(dwork, 0)) {
atomic_cmpxchg(&dwork->work.state,
WORK_ST_CANCEL, WORK_ST_IDLE);
- return (1);
+ return (true);
}
/* FALLTHROUGH */
case WORK_ST_TASK:
if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) == 0) {
atomic_cmpxchg(&dwork->work.state,
WORK_ST_CANCEL, WORK_ST_IDLE);
- return (1);
+ return (true);
}
/* FALLTHROUGH */
default:
- return (0);
+ return (false);
}
}
linux_flush_work(struct work_struct *work)
{
struct taskqueue *tq;
- int retval;
+ bool retval;
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
"linux_flush_work() might sleep");
switch (atomic_read(&work->state)) {
case WORK_ST_IDLE:
- return (0);
+ return (false);
default:
tq = work->work_queue->taskqueue;
retval = taskqueue_poll_is_busy(tq, &work->work_task);
linux_flush_delayed_work(struct delayed_work *dwork)
{
struct taskqueue *tq;
- int retval;
+ bool retval;
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
"linux_flush_delayed_work() might sleep");
switch (atomic_read(&dwork->work.state)) {
case WORK_ST_IDLE:
- return (0);
+ return (false);
case WORK_ST_TIMER:
if (linux_cancel_timer(dwork, 1))
linux_delayed_work_enqueue(dwork);
case WORK_ST_TIMER:
case WORK_ST_TASK:
case WORK_ST_CANCEL:
- return (1);
+ return (true);
default:
- return (0);
+ return (false);
}
}
switch (atomic_read(&work->state)) {
case WORK_ST_IDLE:
- return (0);
+ return (false);
case WORK_ST_EXEC:
tq = work->work_queue->taskqueue;
return (taskqueue_poll_is_busy(tq, &work->work_task));
default:
- return (1);
+ return (true);
}
}