1 /* ckrm_ce.h - Header file to be used by Classification Engine of CKRM
3 * Copyright (C) Hubertus Franke, IBM Corp. 2003
4 * (C) Shailabh Nagar, IBM Corp. 2003
5 * (C) Chandra Seetharaman, IBM Corp. 2003
7 * Provides data structures, macros and kernel API of CKRM for
8 * classification engine.
10 * Latest version, more details at http://ckrm.sf.net
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.
24 * Adopted to classtypes
27 #ifndef _LINUX_CKRM_CE_H
28 #define _LINUX_CKRM_CE_H
32 #include "ckrm.h" // getting the event names
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 classification
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, void *obj);
44 typedef struct ckrm_eng_callback {
45 /* general state information */
46 int always_callback; /* set if CE should always be called back regardless of numclasses */
48 /* callbacks which are called without holding locks */
50 unsigned long c_interest; /* set of classification events CE is interested in */
51 ce_classify_fct_t classify; /* generic classify */
53 void (*class_add) (const char *name, void *core); /* class added */
54 void (*class_delete)(const char *name, void *core); /* class deleted */
56 /* callback which are called while holding task_lock(tsk) */
57 unsigned long n_interest; /* set of notification events CE is interested in */
58 ce_notify_fct_t notify; /* notify on class switch */
60 } ckrm_eng_callback_t;
65 typedef struct rbce_eng_callback {
66 int (*mkdir)(struct inode *, struct dentry *, int); // mkdir
67 int (*rmdir)(struct inode *, struct dentry *); // rmdir
68 } rbce_eng_callback_t;
70 extern int ckrm_register_engine (const char *name, ckrm_eng_callback_t *);
71 extern int ckrm_unregister_engine(const char *name);
73 extern void *ckrm_classobj(char *, int *classtype);
74 extern int get_exe_path_name(struct task_struct *t, char *filename, int max_size);
76 extern int rcfs_register_engine(rbce_eng_callback_t *);
77 extern int rcfs_unregister_engine(rbce_eng_callback_t *);
79 extern int ckrm_reclassify(int pid);
81 #ifndef _LINUX_CKRM_RC_H
82 // ckrm kernel has inlined functions for this which are exported
83 extern void ckrm_core_grab(void *);
84 extern void ckrm_core_drop(void *);
91 #endif // _LINUX_CKRM_CE_H