~ubuntu-branches/ubuntu/precise/aufs/precise

« back to all changes in this revision

Viewing changes to fs/aufs/wkq.h

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2007-05-09 15:29:28 UTC
  • Revision ID: james.westby@ubuntu.com-20070509152928-4sywrmkifvz0bq02
Tags: upstream-0+20070509
ImportĀ upstreamĀ versionĀ 0+20070509

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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
 
17
 */
 
18
 
 
19
/* $Id: wkq.h,v 1.8 2007/04/30 05:48:24 sfjro Exp $ */
 
20
 
 
21
#ifndef __AUFS_WKQ_H__
 
22
#define __AUFS_WKQ_H__
 
23
 
 
24
#ifdef __KERNEL__
 
25
 
 
26
#include <linux/sched.h>
 
27
#include <linux/workqueue.h>
 
28
 
 
29
struct au_wkq {
 
30
        struct workqueue_struct *q;
 
31
 
 
32
        /* accounting */
 
33
        atomic_t busy;
 
34
        unsigned int max_busy;
 
35
};
 
36
 
 
37
typedef void (*au_wkq_func_t)(void *args);
 
38
 
 
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)
 
42
#else
 
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)
 
46
#endif
 
47
 
 
48
extern struct au_wkq *au_wkq;
 
49
 
 
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);
 
54
 
 
55
/* ---------------------------------------------------------------------- */
 
56
 
 
57
static inline int is_aufsd(struct task_struct *tsk)
 
58
{
 
59
        return (!tsk->mm && !strcmp(current->comm, AUFS_WKQ_NAME));
 
60
}
 
61
 
 
62
static inline void au_wkq_wait(au_wkq_func_t func, void *args, int dlgt)
 
63
{
 
64
        au_wkq_run(func, args, dlgt, /*do_wait*/1);
 
65
}
 
66
 
 
67
static inline void au_wkq_nowait(au_wkq_func_t func, void *args, int dlgt)
 
68
{
 
69
        au_wkq_run(func, args, dlgt, /*do_wait*/0);
 
70
}
 
71
 
 
72
#endif /* __KERNEL__ */
 
73
#endif /* __AUFS_WKQ_H__ */