- PL2545 WAR: disable CKRM numtasks controller
[linux-2.6.git] / include / linux / ckrm_ce.h
1 /*
2  *  ckrm_ce.h - Header file to be used by Classification Engine of CKRM
3  *
4  * Copyright (C) Hubertus Franke, IBM Corp. 2003
5  *           (C) Shailabh Nagar,  IBM Corp. 2003
6  *           (C) Chandra Seetharaman, IBM Corp. 2003
7  * 
8  * Provides data structures, macros and kernel API of CKRM for 
9  * classification engine.
10  *
11  * Latest version, more details at http://ckrm.sf.net
12  * 
13  * This program is free software; you can redistribute it and/or modify it
14  * under the terms of version 2.1 of the GNU Lesser General Public License
15  * as published by the Free Software Foundation.
16  *
17  * This program is distributed in the hope that it would be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22
23 /* Changes
24  *
25  * 12 Nov 2003
26  *        Created.
27  * 22 Apr 2004
28  *        Adopted to classtypes
29  */
30
31 #ifndef _LINUX_CKRM_CE_H
32 #define _LINUX_CKRM_CE_H
33
34 #ifdef CONFIG_CKRM
35
36 #include <linux/ckrm_events.h>
37
38 /*
39  * Action parameters identifying the cause of a task<->class notify callback 
40  * these can perculate up to user daemon consuming records send by the 
41  * classification engine
42  */
43
44 #ifdef __KERNEL__
45
46 typedef void *(*ce_classify_fct_t) (enum ckrm_event event, void *obj, ...);
47 typedef void (*ce_notify_fct_t) (enum ckrm_event event, void *classobj,
48                                  void *obj);
49
50 typedef struct ckrm_eng_callback {
51         /* general state information */
52         int always_callback;    /* set if CE should always be called back 
53                                    regardless of numclasses */
54
55         /* callbacks which are called without holding locks */
56
57         unsigned long c_interest;       /* set of classification events of 
58                                          * interest to CE 
59                                          */
60
61         /* generic classify */
62         ce_classify_fct_t classify;
63
64         /* class added */
65         void (*class_add) (const char *name, void *core, int classtype);
66
67         /* class deleted */
68         void (*class_delete) (const char *name, void *core, int classtype);
69
70         /* callbacks which are called while holding task_lock(tsk) */
71         unsigned long n_interest;       /* set of notification events of 
72                                          *  interest to CE 
73                                          */
74         /* notify on class switch */
75         ce_notify_fct_t notify; 
76 } ckrm_eng_callback_t;
77
78 struct inode;
79 struct dentry;
80
81 typedef struct rbce_eng_callback {
82         int (*mkdir) (struct inode *, struct dentry *, int);    /* mkdir */
83         int (*rmdir) (struct inode *, struct dentry *);         /* rmdir */
84         int (*mnt) (void);
85         int (*umnt) (void);
86 } rbce_eng_callback_t;
87
88 extern int ckrm_register_engine(const char *name, ckrm_eng_callback_t *);
89 extern int ckrm_unregister_engine(const char *name);
90
91 extern void *ckrm_classobj(const char *, int *classtype);
92 extern int get_exe_path_name(struct task_struct *t, char *filename,
93                              int max_size);
94
95 extern int rcfs_register_engine(rbce_eng_callback_t *);
96 extern int rcfs_unregister_engine(rbce_eng_callback_t *);
97
98 extern int ckrm_reclassify(int pid);
99
100 #ifndef _LINUX_CKRM_RC_H
101
102 extern void ckrm_core_grab(void *);
103 extern void ckrm_core_drop(void *);
104 #endif
105
106 #endif /* CONFIG_CKRM */
107 #endif /* __KERNEL__ */
108 #endif /* _LINUX_CKRM_CE_H */