Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
kobject.h File Reference
#include <linux/types.h>
#include <linux/list.h>
#include <linux/sysfs.h>
#include <linux/compiler.h>
#include <linux/spinlock.h>
#include <linux/kref.h>
#include <linux/kobject_ns.h>
#include <linux/kernel.h>
#include <linux/wait.h>
#include <linux/atomic.h>

Go to the source code of this file.

Data Structures

struct  kobject
 
struct  kobj_type
 
struct  kobj_uevent_env
 
struct  kset_uevent_ops
 
struct  kobj_attribute
 
struct  kset
 

Macros

#define UEVENT_HELPER_PATH_LEN   256
 
#define UEVENT_NUM_ENVP   32 /* number of env pointers */
 
#define UEVENT_BUFFER_SIZE   2048 /* buffer for the variables */
 

Enumerations

enum  kobject_action {
  KOBJ_ADD, KOBJ_REMOVE, KOBJ_CHANGE, KOBJ_MOVE,
  KOBJ_ONLINE, KOBJ_OFFLINE, KOBJ_MAX
}
 

Functions

 __printf (2, 3) int kobject_set_name(struct kobject *kobj
 
const char int kobject_set_name_vargs (struct kobject *kobj, const char *fmt, va_list vargs)
 
void kobject_init (struct kobject *kobj, struct kobj_type *ktype)
 
 __printf (3, 4) __must_check int kobject_add(struct kobject *kobj
 
struct kobject const char __printf (4, 5) __must_check int kobject_init_and_add(struct kobject *kobj
 
struct kobject const char
struct kobj_type struct
kobject const char void 
kobject_del (struct kobject *kobj)
 
struct kobject *__must_check kobject_create (void)
 
struct kobject *__must_check kobject_create_and_add (const char *name, struct kobject *parent)
 
int __must_check kobject_rename (struct kobject *, const char *new_name)
 
int __must_check kobject_move (struct kobject *, struct kobject *)
 
struct kobjectkobject_get (struct kobject *kobj)
 
void kobject_put (struct kobject *kobj)
 
charkobject_get_path (struct kobject *kobj, gfp_t flag)
 
void kset_init (struct kset *kset)
 
int __must_check kset_register (struct kset *kset)
 
void kset_unregister (struct kset *kset)
 
struct kset *__must_check kset_create_and_add (const char *name, const struct kset_uevent_ops *u, struct kobject *parent_kobj)
 
struct kobjectkset_find_obj (struct kset *, const char *)
 

Variables

char uevent_helper []
 
u64 uevent_seqnum
 
const charname
 
struct kobjectparent
 
struct kobject const charfmt
 
struct kobject const char
struct kobj_type
ktype
 
struct sysfs_ops kobj_sysfs_ops
 
struct kobjectkernel_kobj
 
struct kobjectmm_kobj
 
struct kobjecthypervisor_kobj
 
struct kobjectpower_kobj
 
struct kobjectfirmware_kobj
 
static const charformat
 

Macro Definition Documentation

#define UEVENT_BUFFER_SIZE   2048 /* buffer for the variables */

Definition at line 32 of file kobject.h.

#define UEVENT_HELPER_PATH_LEN   256

Definition at line 30 of file kobject.h.

#define UEVENT_NUM_ENVP   32 /* number of env pointers */

Definition at line 31 of file kobject.h.

Enumeration Type Documentation

Enumerator:
KOBJ_ADD 
KOBJ_REMOVE 
KOBJ_CHANGE 
KOBJ_MOVE 
KOBJ_ONLINE 
KOBJ_OFFLINE 
KOBJ_MAX 

Definition at line 50 of file kobject.h.

Function Documentation

__printf ( ,
 
)
__printf ( ,
 
)
__printf ( ,
 
)
struct kobject* __must_check kobject_create ( void  )
read

kobject_create - create a struct kobject dynamically

This function creates a kobject structure dynamically and sets it up to be a "dynamic" kobject with a default release function set up.

If the kobject was not able to be created, NULL will be returned. The kobject structure returned from here must be cleaned up with a call to kobject_put() and not kfree(), as kobject_init() has already been called on this structure.

Definition at line 620 of file kobject.c.

struct kobject* __must_check kobject_create_and_add ( const char name,
struct kobject parent 
)
read

Definition at line 645 of file kobject.c.

kobject_del - unlink kobject from hierarchy. : object.

Definition at line 509 of file kobject.c.

struct kobject* kobject_get ( struct kobject kobj)
read

kobject_get - increment refcount for object. : object.

Definition at line 525 of file kobject.c.

char* kobject_get_path ( struct kobject kobj,
gfp_t  gfp_mask 
)

kobject_get_path - generate and return the path associated with a given kobj and kset pair.

: kobject in question, with which to build the path : the allocation type used to allocate the path

The result must be freed by the caller with kfree().

Definition at line 102 of file kobject.c.

void kobject_init ( struct kobject kobj,
struct kobj_type ktype 
)

kobject_init - initialize a kobject structure : pointer to the kobject to initialize : pointer to the ktype for this kobject.

This function will properly initialize a kobject such that it can then be passed to the kobject_add() call.

After this function is called, the kobject MUST be cleaned up by a call to kobject_put(), not by a call to kfree directly to ensure that all of the memory is cleaned up properly.

Definition at line 268 of file kobject.c.

int __must_check kobject_move ( struct kobject kobj,
struct kobject new_parent 
)

kobject_move - move object to another parent : object in question. : object's new parent (can be NULL)

Definition at line 459 of file kobject.c.

void kobject_put ( struct kobject kobj)

kobject_put - decrement refcount for object. : object.

Decrement the refcount, and if 0, call kobject_cleanup().

Definition at line 587 of file kobject.c.

int __must_check kobject_rename ( struct kobject kobj,
const char new_name 
)

kobject_rename - change the name of an object : object in question. : object's new name

It is the responsibility of the caller to provide mutual exclusion between two different calls of kobject_rename on the same kobject and to ensure that new_name is valid and won't conflict with other kobjects.

Definition at line 397 of file kobject.c.

const char int kobject_set_name_vargs ( struct kobject kobj,
const char fmt,
va_list  vargs 
)

kobject_set_name_vargs - Set the name of an kobject : struct kobject to set the name of : format string used to build the name : vargs to format the string.

Definition at line 213 of file kobject.c.

struct kset* __must_check kset_create_and_add ( const char name,
const struct kset_uevent_ops u,
struct kobject parent_kobj 
)
read

Definition at line 834 of file kobject.c.

struct kobject* kset_find_obj ( struct kset ,
const char  
)
read

Definition at line 745 of file kobject.c.

void kset_init ( struct kset k)

kset_init - initialize a kset for use : kset

Definition at line 669 of file kobject.c.

int __must_check kset_register ( struct kset k)

kset_register - initialize and add a kset. : kset.

Definition at line 710 of file kobject.c.

void kset_unregister ( struct kset k)

kset_unregister - remove a kset. : kset.

Definition at line 729 of file kobject.c.

Variable Documentation

struct kobject* firmware_kobj

Definition at line 18 of file firmware.c.

Definition at line 87 of file kobject.h.

Definition at line 226 of file kobject.h.

struct kobject* hypervisor_kobj

Definition at line 16 of file hypervisor.c.

struct kobject* kernel_kobj

Definition at line 167 of file ksysfs.c.

struct sysfs_ops kobj_sysfs_ops

Definition at line 701 of file kobject.c.

Definition at line 91 of file kobject.h.

struct kobject* mm_kobj

Definition at line 140 of file mm_init.c.

const char* name

Definition at line 76 of file kobject.h.

Definition at line 87 of file kobject.h.

struct kobject* power_kobj

Definition at line 56 of file power.c.

char uevent_helper[]

Definition at line 32 of file kobject_uevent.c.

u64 uevent_seqnum

Definition at line 31 of file kobject_uevent.c.