1KOBJECT_ADD(9)                   Driver Basics                  KOBJECT_ADD(9)
2
3
4

NAME

6       kobject_add - the main kobject add function
7

SYNOPSIS

9       int kobject_add(struct kobject * kobj, struct kobject * parent,
10                       const char * fmt, ...);
11

ARGUMENTS

13       kobj
14           the kobject to add
15
16       parent
17           pointer to the parent of the kobject.
18
19       fmt
20           format to name the kobject with.
21
22       ...
23           variable arguments
24

DESCRIPTION

26       The kobject name is set and added to the kobject hierarchy in this
27       function.
28
29       If parent is set, then the parent of the kobj will be set to it. If
30       parent is NULL, then the parent of the kobj will be set to the kobject
31       associated with the kset assigned to this kobject. If no kset is
32       assigned to the kobject, then the kobject will be located in the root
33       of the sysfs tree.
34
35       If this function returns an error, kobject_put must be called to
36       properly clean up the memory associated with the object. Under no
37       instance should the kobject that is passed to this function be directly
38       freed with a call to kfree, that can leak memory.
39
40       Note, no “add” uevent will be created with this call, the caller should
41       set up all of the necessary sysfs files for the object and then call
42       kobject_uevent with the UEVENT_ADD parameter to ensure that userspace
43       is properly notified of this kobject's creation.
44
46Kernel Hackers Manual 3.10         June 2019                    KOBJECT_ADD(9)
Impressum