kobj = kmalloc(sizeof (*kobj), GFP_KERNEL) ;

if (ikobj)

return -ENOMEM;

memset(kobj, 0, sizeof (*kobj));

kobj->kset = kset;

kobj->parent = parent_kobj;

kobj ect_init(kobj) ;

        
kobject_set_name (),    .

int kobject set name (struct kobject * kobj, const char * fmt, ...);

     ,    -
 printf()  printk().    ,     
k_name  kobject.     ,    
   name,      
  .

          , 
    kset,     ktype. 
     ,   kset  
 ktype   .      ktype, 
   kset,  .  ,  
kobject    ktype,     !

 

   ,      kobject,
     .  
      .   -
      ,    ,  ,  
 (pinned, , ).  ,    ,
     .     
  ,      . 
    (getting),   (putting)
  .      ,  
 ,     .

       
kobject get ().

struct kobject * kobject get(struct kobject *kobj);

      kobject     
NULL   .

       

kobject_put().

void kobject_put(struct kobject *kobj);

 kobject    sysfs 361