许多函数在本章中已经被介绍过; 这是它们全部的一个快速总结.
#include <linux/kobject.h>
包含文件, 包含 kobject 的定义, 相关结构, 和函数.
void kobject_init(struct kobject *kobj);
int kobject_set_name(struct kobject *kobj, const char *format, ...);
用作 kobject 初始化的函数
struct kobject *kobject_get(struct kobject *kobj);
void kobject_put(struct kobject *kobj);
为 kobjects 管理引用计数的函数.
struct kobj_type;
struct kobj_type *get_ktype(struct kobject *kobj);
表示一个kobjct 被嵌入的结构类型. 使用 get_ktype 来获得关联到一个给定 kobject 的 kobj_type.
int kobject_add(struct kobject *kobj);
extern int kobject_register(struct kobject *kobj);
void kobject_del(struct kobject *kobj);
void kobject_unregister(struct kobject *kobj);
kobject_add 添加一个 kobject 到系统, 处理 kset 成员关系, sysfs 表示, 以及热插拔事件产生. kobject_register 是一个方便函数, 它结合 kobject_init 和 kobject_add. 使用 kobject_del 来去除一个 kobject 或者 kobject_unregister, 它结合了 kobject_del 和 kobject_put.
void kset_init(struct kset *kset);
int kset_add(struct kset *kset);
int kset_register(struct kset *kset);
void kset_unregister(struct kset *kset);
为 ksets 初始化和注册的函数.
decl_subsys(name, type, hotplug_ops);
易于声明子系统的一个宏.
void subsystem_init(struct subsystem *subsys);
int subsystem_register(struct subsystem *subsys);
void subsystem_unregister(struct subsystem *subsys);
struct subsystem *subsys_get(struct subsystem *subsys);
void subsys_put(struct subsystem *subsys);
对子系统的操作.
包含 sysfs 声明的包含文件.
int sysfs_create_file(struct kobject *kobj, struct attribute *attr);
int sysfs_remove_file(struct kobject *kobj, struct attribute *attr);
int sysfs_create_bin_file(struct kobject *kobj, struct bin_attribute *attr);
int sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
int sysfs_create_link(struct kobject *kobj, struct kobject *target, char *name);
void sysfs_remove_link(struct kobject *kobj, char *name);
创建和去除和一个 kobject 关联的属性文件的函数.
int bus_register(struct bus_type *bus);
void bus_unregister(struct bus_type *bus);
在设备模型中进行注册和注销总线的函数.
int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *, void *));
int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, void *data, int (*fn)(struct device_driver *, void *));
列举每个设备和驱动的函数, 特别地, 绑定到给定总线的设备.
BUS_ATTR(name, mode, show, store);
int bus_create_file(struct bus_type *bus, struct bus_attribute *attr);
void bus_remove_file(struct bus_type *bus, struct bus_attribute *attr);
BUS_ATTR 宏可能用来声明一个 bus_attribute 结构, 它可能接着被添加和去除, 使用上面 2 个函数.
int device_register(struct device *dev);
void device_unregister(struct device *dev);
处理设备注册的函数.
DEVICE_ATTR(name, mode, show, store);
int device_create_file(struct device *device, struct device_attribute *entry);
void device_remove_file(struct device *dev, struct device_attribute *attr);
处理设备属性的宏和函数.
int driver_register(struct device_driver *drv);
void driver_unregister(struct device_driver *drv);
注册和注销一个设备驱动的函数.
DRIVER_ATTR(name, mode, show, store);
int driver_create_file(struct device_driver *drv, struct driver_attribute *attr);
void driver_remove_file(struct device_driver *drv, struct driver_attribute *attr);
关联驱动属性的宏和函数.
struct class_simple *class_simple_create(struct module *owner, char *name);
void class_simple_destroy(struct class_simple *cs);
struct class_device *class_simple_device_add(struct class_simple *cs, dev_t devnum, struct device *device, const char *fmt, ...);
void class_simple_device_remove(dev_t dev);
int class_simple_set_hotplug(struct class_simple *cs, int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size));
实现 class_simple 接口的函数; 它们管理包含一个 dev 属性和很少其他属性的简单的类入口
int class_register(struct class *cls);
void class_unregister(struct class *cls);
注册和注销类.
CLASS_ATTR(name, mode, show, store);
int class_create_file(struct class *cls, const struct class_attribute *attr);
void class_remove_file(struct class *cls, const struct class_attribute *attr);
处理类属性的常用宏和函数.
int class_device_register(struct class_device *cd);
void class_device_unregister(struct class_device *cd);
int class_device_rename(struct class_device *cd, char *new_name);
CLASS_DEVICE_ATTR(name, mode, show, store);
int class_device_create_file(struct class_device *cls, const struct class_device_attribute *attr);
属性类设备接口的函数和宏.
int class_interface_register(struct class_interface *intf);
void class_interface_unregister(struct class_interface *intf);
添加一个接口到一个类(或去除它)的函数.
#include <linux/firmware.h>
int request_firmware(const struct firmware **fw, char *name, struct device *device);
int request_firmware_nowait(struct module *module, char *name, struct device *device, void *context, void (*cont)(const struct firmware *fw, void *context));
void release_firmware(struct firmware *fw);
属性内核固件加载接口的函数.