2
* Copyright (C) 2005, 2006, 2007 Junjiro Okajima
4
* This program, aufs is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
/* $Id: wkq.h,v 1.8 2007/04/30 05:48:24 sfjro Exp $ */
21
#ifndef __AUFS_WKQ_H__
22
#define __AUFS_WKQ_H__
26
#include <linux/sched.h>
27
#include <linux/workqueue.h>
30
struct workqueue_struct *q;
34
unsigned int max_busy;
37
typedef void (*au_wkq_func_t)(void *args);
39
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
40
#define AuInitWkq(wk, func) INIT_WORK(wk, func)
41
#define AuWkqFunc(name, arg) void name(struct work_struct *arg)
43
typedef void (*work_func_t)(void *arg);
44
#define AuInitWkq(wk, func) INIT_WORK(wk, func, wk)
45
#define AuWkqFunc(name, arg) void name(void *arg)
48
extern struct au_wkq *au_wkq;
50
void au_wkq_run(au_wkq_func_t func, void *args, int dlgt, int do_wait);
51
//void au_wkq_wait_nwtask(void);
52
int __init au_wkq_init(void);
53
void au_wkq_fin(void);
55
/* ---------------------------------------------------------------------- */
57
static inline int is_aufsd(struct task_struct *tsk)
59
return (!tsk->mm && !strcmp(current->comm, AUFS_WKQ_NAME));
62
static inline void au_wkq_wait(au_wkq_func_t func, void *args, int dlgt)
64
au_wkq_run(func, args, dlgt, /*do_wait*/1);
67
static inline void au_wkq_nowait(au_wkq_func_t func, void *args, int dlgt)
69
au_wkq_run(func, args, dlgt, /*do_wait*/0);
72
#endif /* __KERNEL__ */
73
#endif /* __AUFS_WKQ_H__ */