Linux Kernel
3.7.1
|
#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/export.h>
#include <linux/stat.h>
#include <linux/slab.h>
Go to the source code of this file.
Functions | |
char * | kobject_get_path (struct kobject *kobj, gfp_t gfp_mask) |
EXPORT_SYMBOL_GPL (kobject_get_path) | |
int | kobject_set_name_vargs (struct kobject *kobj, const char *fmt, va_list vargs) |
int | kobject_set_name (struct kobject *kobj, const char *fmt,...) |
EXPORT_SYMBOL (kobject_set_name) | |
void | kobject_init (struct kobject *kobj, struct kobj_type *ktype) |
EXPORT_SYMBOL (kobject_init) | |
int | kobject_add (struct kobject *kobj, struct kobject *parent, const char *fmt,...) |
EXPORT_SYMBOL (kobject_add) | |
int | kobject_init_and_add (struct kobject *kobj, struct kobj_type *ktype, struct kobject *parent, const char *fmt,...) |
EXPORT_SYMBOL_GPL (kobject_init_and_add) | |
int | kobject_rename (struct kobject *kobj, const char *new_name) |
EXPORT_SYMBOL_GPL (kobject_rename) | |
int | kobject_move (struct kobject *kobj, struct kobject *new_parent) |
void | kobject_del (struct kobject *kobj) |
struct kobject * | kobject_get (struct kobject *kobj) |
void | kobject_put (struct kobject *kobj) |
struct kobject * | kobject_create (void) |
: the name for the kobject | |
kobject_create_and_add - create a struct kobject dynamically and register it with sysfs : the parent kobject of this kobject, if any. This function creates a kobject structure dynamically and registers it with sysfs. When you are finished with this structure, call kobject_put() and the structure will be dynamically freed when it is no longer being used. If the kobject was not able to be created, NULL will be returned. | |
struct sysfs_ops | kobj_sysfs_ops |
struct kobject * | kobject_create_and_add (const char *name, struct kobject *parent) |
EXPORT_SYMBOL_GPL (kobject_create_and_add) | |
void | kset_init (struct kset *k) |
int | kset_register (struct kset *k) |
void | kset_unregister (struct kset *k) |
: object's name. | |
kset_find_obj - search for object in kset. : kset we're looking in. Lock kset via ->subsys, and iterate over ->list, looking for a matching kobject. If matching object is found take a reference and return the object. | |
struct kobject * | kset_find_obj (struct kset *kset, const char *name) |
EXPORT_SYMBOL | ( | kobject_set_name | ) |
EXPORT_SYMBOL | ( | kobject_init | ) |
EXPORT_SYMBOL | ( | kobject_add | ) |
EXPORT_SYMBOL | ( | kobject_get | ) |
EXPORT_SYMBOL | ( | kobject_put | ) |
EXPORT_SYMBOL | ( | kobject_del | ) |
EXPORT_SYMBOL | ( | kset_register | ) |
EXPORT_SYMBOL | ( | kset_unregister | ) |
EXPORT_SYMBOL_GPL | ( | kobject_get_path | ) |
EXPORT_SYMBOL_GPL | ( | kobject_init_and_add | ) |
EXPORT_SYMBOL_GPL | ( | kobject_rename | ) |
EXPORT_SYMBOL_GPL | ( | kobject_create_and_add | ) |
EXPORT_SYMBOL_GPL | ( | kset_create_and_add | ) |
|
read |
void kobj_ns_drop | ( | enum kobj_ns_type | type, |
void * | ns | ||
) |
void* kobj_ns_grab_current | ( | enum kobj_ns_type | type | ) |
const void* kobj_ns_initial | ( | enum kobj_ns_type | type | ) |
const void* kobj_ns_netlink | ( | enum kobj_ns_type | type, |
struct sock * | sk | ||
) |
|
read |
int kobj_ns_type_register | ( | const struct kobj_ns_type_operations * | ops | ) |
int kobj_ns_type_registered | ( | enum kobj_ns_type | type | ) |
kobject_add - the main kobject add function : the kobject to add : pointer to the parent of the kobject. : format to name the kobject with.
The kobject name is set and added to the kobject hierarchy in this function.
If is set, then the parent of the will be set to it. If is NULL, then the parent of the will be set to the kobject associted with the kset assigned to this kobject. If no kset is assigned to the kobject, then the kobject will be located in the root of the sysfs tree.
If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. Under no instance should the kobject that is passed to this function be directly freed with a call to kfree(), that can leak memory.
Note, no "add" uevent will be created with this call, the caller should set up all of the necessary sysfs files for the object and then call kobject_uevent() with the UEVENT_ADD parameter to ensure that userspace is properly notified of this kobject's creation.
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.
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.
int kobject_init_and_add | ( | struct kobject * | kobj, |
struct kobj_type * | ktype, | ||
struct kobject * | parent, | ||
const char * | fmt, | ||
... | |||
) |
kobject_init_and_add - initialize a kobject structure and add it to the kobject hierarchy : pointer to the kobject to initialize : pointer to the ktype for this kobject. : pointer to the parent of this kobject. : the name of the kobject.
This function combines the call to kobject_init() and kobject_add(). The same type of error handling after a call to kobject_add() and kobject lifetime rules are the same here.