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
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  */
18
19 /* Changes
20  *
21  * 12 Nov 2003
22  *        Created.
23  * 22 Apr 2004
24  *        Adopted to classtypes
25  */
26
27 #ifndef _LINUX_CKRM_CE_H
28 #define _LINUX_CKRM_CE_H
29
30 #ifdef CONFIG_CKRM
31
32 #include "ckrm.h"               // getting the event names
33
34 /* Action parameters identifying the cause of a task<->class notify callback 
35  * these can perculate up to user daemon consuming records send by the 
36  * classification engine
37  */
38
39 #ifdef __KERNEL__
40
41 typedef void *(*ce_classify_fct_t) (enum ckrm_event event, void *obj, ...);
42 typedef void (*ce_notify_fct_t) (enum ckrm_event event, void *classobj,
43                                  void *obj);
44
45 typedef struct ckrm_eng_callback {
46         /* general state information */
47         int always_callback;    /* set if CE should always be called back 
48                                    regardless of numclasses */
49
50
51
52
53         /* callbacks which are called without holding locks */
54
55         unsigned long c_interest;       /* set of classification events of 
56                                            interest to CE 
57                                         */
58
59         /* generic classify */
60         ce_classify_fct_t classify;     
61         /* class added */
62         void (*class_add) (const char *name, void *core, int classtype);
63         /* class deleted */
64         void (*class_delete) (const char *name, void *core, int classtype);
65
66
67         /* callbacks which are called while holding task_lock(tsk) */
68
69         unsigned long n_interest;       /* set of notification events of 
70                                            interest to CE 
71                                         */
72         /* notify on class switch */
73         ce_notify_fct_t notify; 
74
75 } ckrm_eng_callback_t;
76
77 struct inode;
78 struct dentry;
79
80 typedef struct rbce_eng_callback {
81         int (*mkdir) (struct inode *, struct dentry *, int);    // mkdir
82         int (*rmdir) (struct inode *, struct dentry *); // rmdir
83         int (*mnt) (void);
84         int (*umnt) (void);
85 } rbce_eng_callback_t;
86
87 extern int ckrm_register_engine(const char *name, ckrm_eng_callback_t *);
88 extern int ckrm_unregister_engine(const char *name);
89
90 extern void *ckrm_classobj(char *, int *classtype);
91 extern int get_exe_path_name(struct task_struct *t, char *filename,
92                              int max_size);
93
94 extern int rcfs_register_engine(rbce_eng_callback_t *);
95 extern int rcfs_unregister_engine(rbce_eng_callback_t *);
96
97 extern int ckrm_reclassify(int pid);
98
99 #ifndef _LINUX_CKRM_RC_H
100 // ckrm kernel has inlined functions for this which are exported
101 extern void ckrm_core_grab(void *);
102 extern void ckrm_core_drop(void *);
103 #endif
104
105 #endif                          // CONFIG_CKRM
106
107 #endif                          // __KERNEL__
108
109 #endif                          // _LINUX_CKRM_CE_H