struct kobject, the related data structures, and their usage are described in Chapter 1; thus, here our discussion is restricted to a recap of the most essential points. In particular, it is important to remember that

□ kobjects are included in a hierarchic organization; most important, they can have a parent and can be included in a kset. This determines where the kobject appears in the sysfs hierarchy: If a parent exists, a new entry in the directory of the parent is created. Otherwise, it is placed in the directory of the kobject that belongs to the kset the object is contained in (if both of these possibilities fail, the entry for the kobject is located directly in the top level of the system hierarchy, but this is obviously a rare case).

□ Every kobject is represented as a directory within sysfs. The files that appear in this directory are the attributes of the object. The operations used to export and set attribute values are provided by the subsystem (class, driver, etc.) to which the kobject belongs.

□ Buses, devices, drivers, and classes are the main kernel objects using the kobject mechanism; they thus account for nearly all entries of sysfs.

Continue reading here: Directory Entries

Was this article helpful?

0 0