Monday, January 9, 2012

Steps for Adding Kobjects (incomplete)

1. embed a kobject in your structure.

struct some_struct {
    struct kobject kobj;

2. allocate some_struct my_s and initialize the embedded kobject
memset(&my_s->kobj,0,sizeof(struct kobject));
kobject_init(&my_s->kobj,&my_ktype);  <-- detailed in step 3

kobject_add(&my_s->kobj,hooked_kobj,"my_s"); <-- here hooked_obj can be kernel_kobj... this will list the kobject under /sys/kernel

3. ok... my_ktype

No comments:

Post a Comment