-/*
- * ckrm_events.h - Class-based Kernel Resource Management (CKRM)
- * event handling
+/* ckrm.h - Class-based Kernel Resource Management (CKRM)
*
* Copyright (C) Hubertus Franke, IBM Corp. 2003,2004
* (C) Shailabh Nagar, IBM Corp. 2003
*
*/
-/*
- * Changes
+/* Changes
*
* 28 Aug 2003
* Created.
* New Event callback structure
*/
-#ifndef _LINUX_CKRM_EVENTS_H
-#define _LINUX_CKRM_EVENTS_H
+#ifndef _LINUX_CKRM_H
+#define _LINUX_CKRM_H
#ifdef CONFIG_CKRM
-/*
- * Data structure and function to get the list of registered
- * resource controllers.
- */
+// Data structure and function to get the list of registered
+// resource controllers.
+
+// #include <linux/sched.h>
-/*
- * CKRM defines a set of events at particular points in the kernel
+/* CKRM defines a set of events at particular points in the kernel
* at which callbacks registered by various class types are called
*/
enum ckrm_event {
- /*
- * we distinguish these events types:
+ /* we distinguish various events types
*
* (a) CKRM_LATCHABLE_EVENTS
* events can be latched for event callbacks by classtypes
CKRM_EVENT_RECLASSIFY = CKRM_NONLATCHABLE_EVENTS,
/* events (c) */
-
CKRM_NOTCLASSIFY_EVENTS,
CKRM_EVENT_MANUAL = CKRM_NOTCLASSIFY_EVENTS,
#ifdef __KERNEL__
#ifdef CONFIG_CKRM
-/*
- * CKRM event callback specification for the classtypes or resource controllers
- * typically an array is specified using CKRM_EVENT_SPEC terminated with
- * CKRM_EVENT_SPEC_LAST and then that array is registered using
- * ckrm_register_event_set.
- * Individual registration of event_cb is also possible
- */
+extern void ckrm_invoke_event_cb_chain(enum ckrm_event ev, void *arg);
typedef void (*ckrm_event_cb) (void *arg);
struct ckrm_hook_cb *next;
};
-struct ckrm_event_spec {
- enum ckrm_event ev;
- struct ckrm_hook_cb cb;
-};
-
-#define CKRM_EVENT_SPEC(EV,FCT) { CKRM_EVENT_##EV, \
- { (ckrm_event_cb)FCT, NULL } }
-
-int ckrm_register_event_set(struct ckrm_event_spec especs[]);
-int ckrm_unregister_event_set(struct ckrm_event_spec especs[]);
-int ckrm_register_event_cb(enum ckrm_event ev, struct ckrm_hook_cb *cb);
-int ckrm_unregister_event_cb(enum ckrm_event ev, struct ckrm_hook_cb *cb);
-
-extern void ckrm_invoke_event_cb_chain(enum ckrm_event ev, void *arg);
-
#define CKRM_DEF_CB(EV,fct) \
static inline void ckrm_cb_##fct(void) \
{ \
ckrm_invoke_event_cb_chain(CKRM_EVENT_##EV,(void*)arg); \
}
-#else /* !CONFIG_CKRM */
+#else // !CONFIG_CKRM
#define CKRM_DEF_CB(EV,fct) \
static inline void ckrm_cb_##fct(void) { }
#define CKRM_DEF_CB_ARG(EV,fct,argtp) \
static inline void ckrm_cb_##fct(argtp arg) { }
-#endif /* CONFIG_CKRM */
+#endif // CONFIG_CKRM
-/*
+/*-----------------------------------------------------------------
* define the CKRM event functions
* EVENT FCT ARG
- */
+ *-----------------------------------------------------------------*/
-/* forward declarations for function arguments */
+// types we refer at
struct task_struct;
struct sock;
struct user_struct;
CKRM_DEF_CB_ARG(LISTEN_START, listen_start, struct sock *);
CKRM_DEF_CB_ARG(LISTEN_STOP, listen_stop, struct sock *);
-/* some other functions required */
+// some other functions required
#ifdef CONFIG_CKRM
extern void ckrm_init(void);
-extern void ckrm_cb_newtask(struct task_struct *);
-extern void ckrm_cb_exit(struct task_struct *);
+void ckrm_cb_newtask(struct task_struct *);
+void ckrm_cb_exit(struct task_struct *);
#else
-#define ckrm_init() do { } while (0)
+#define ckrm_init(x) do { } while (0)
#define ckrm_cb_newtask(x) do { } while (0)
#define ckrm_cb_exit(x) do { } while (0)
#endif
extern int get_exe_path_name(struct task_struct *, char *, int);
-#endif /* __KERNEL__ */
-#endif /* _LINUX_CKRM_EVENTS_H */
+#endif // __KERNEL__
+
+#endif // _LINUX_CKRM_H