/* FIFO common definitions and utility functions. */ #ifndef __UNC_SCHED_FIFO_H__ #define __UNC_SCHED_FIFO_H__ typedef struct { struct list_head queue; atomic_t count; spinlock_t lock; unsigned int time_slice; } fifo_domain_t; #define FIFO_INIT(name, time_slice) \ { LIST_HEAD_INIT(name.queue), \ ATOMIC_INIT(0), \ SPIN_LOCK_UNLOCKED, \ time_slice} void fifo_domain_init(fifo_domain_t* fifo, unsigned int exec_budget); void fifo_enqueue(fifo_domain_t* fifo, struct task_struct* task); void fifo_add(fifo_domain_t* fifo, struct task_struct* task); void lifo_add(fifo_domain_t* fifo, struct task_struct* task); struct task_struct* __fifo_take(fifo_domain_t* fifo); struct task_struct* fifo_take(fifo_domain_t* fifo); struct task_struct* fifo_take_rq(fifo_domain_t* fifo, runqueue_t* rq, int cpu); static inline int fifo_jobs_pending(fifo_domain_t* fifo) { return atomic_read(&fifo->count) > 0; } #endif