57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
|
#ifdef __KERNEL__
|
||
|
|
||
|
#include <linux/init.h>
|
||
|
#include <linux/module.h>
|
||
|
|
||
|
#include "proc_api.h"
|
||
|
#include "obj_api.h"
|
||
|
|
||
|
#define VERSION ("obj0.0.0.2")
|
||
|
|
||
|
const char* obj_version(void)
|
||
|
{
|
||
|
return VERSION;
|
||
|
}
|
||
|
|
||
|
void object_init(void)
|
||
|
{
|
||
|
#if 0
|
||
|
PCMHI_OBJECT obj, tmp;
|
||
|
int i;
|
||
|
for(i = 0; i < 10; i++)
|
||
|
{
|
||
|
memset(&obj_array[i], 0, sizeof(CMHI_OBJECT));
|
||
|
sprintf(obj_array[i].name, "obj_%02d", i);
|
||
|
atomic_add(i, &obj_array[i].ref_count);
|
||
|
HASH_ADD_STR(g_objects, name, &obj_array[i]);
|
||
|
}
|
||
|
|
||
|
HASH_ITER(hh, g_objects, obj, tmp)
|
||
|
{
|
||
|
int val = atomic_read(&(obj->ref_count));
|
||
|
printk(KERN_ERR "Name = %s, ref_count = %d\n", obj->name, val);
|
||
|
HASH_DEL(g_objects, obj);
|
||
|
}
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
static int object_module_init(void)
|
||
|
{
|
||
|
printk(KERN_ALERT "Hello ISG objects manager version: %s\n", VERSION);
|
||
|
|
||
|
/* if(proc_api_register(&g_ProcApi) != ERR_DBGFS_NO_ERROR) {
|
||
|
printk(KERN_ERR "Regisetr %s Error\n", g_ProcApi.dir_name);
|
||
|
} */
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
module_init(object_module_init);
|
||
|
|
||
|
static void __exit object_module_exit(void)
|
||
|
{
|
||
|
printk(KERN_ALERT "Bye ISG objects manager version: %s\n", VERSION);
|
||
|
// proc_api_unregister(&g_ProcApi);
|
||
|
}
|
||
|
module_exit(object_module_exit);
|
||
|
#endif // __KERNEL__
|