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