W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
許多函數(shù)在本章中已經(jīng)被介紹過; 這是它們?nèi)康囊粋€快速總結(jié).
#include <linux/kobject.h>
包含文件, 包含 kobject 的定義, 相關(guān)結(jié)構(gòu), 和函數(shù).
void kobject_init(struct kobject *kobj);
int kobject_set_name(struct kobject *kobj, const char *format, ...);
用作 kobject 初始化的函數(shù)
struct kobject *kobject_get(struct kobject *kobj);
void kobject_put(struct kobject *kobj);
為 kobjects 管理引用計數(shù)的函數(shù).
struct kobj_type;
struct kobj_type *get_ktype(struct kobject *kobj);
表示一個kobjct 被嵌入的結(jié)構(gòu)類型. 使用 get_ktype 來獲得關(guān)聯(lián)到一個給定 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 到系統(tǒng), 處理 kset 成員關(guān)系, sysfs 表示, 以及熱插拔事件產(chǎn)生. kobject_register 是一個方便函數(shù), 它結(jié)合 kobject_init 和 kobject_add. 使用 kobject_del 來去除一個 kobject 或者 kobject_unregister, 它結(jié)合了 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 初始化和注冊的函數(shù).
decl_subsys(name, type, hotplug_ops);
易于聲明子系統(tǒng)的一個宏.
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);
對子系統(tǒng)的操作.
包含 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);
創(chuàng)建和去除和一個 kobject 關(guān)聯(lián)的屬性文件的函數(shù).
int bus_register(struct bus_type *bus);
void bus_unregister(struct bus_type *bus);
在設(shè)備模型中進(jìn)行注冊和注銷總線的函數(shù).
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 *));
列舉每個設(shè)備和驅(qū)動的函數(shù), 特別地, 綁定到給定總線的設(shè)備.
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 結(jié)構(gòu), 它可能接著被添加和去除, 使用上面 2 個函數(shù).
int device_register(struct device *dev);
void device_unregister(struct device *dev);
處理設(shè)備注冊的函數(shù).
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);
處理設(shè)備屬性的宏和函數(shù).
int driver_register(struct device_driver *drv);
void driver_unregister(struct device_driver *drv);
注冊和注銷一個設(shè)備驅(qū)動的函數(shù).
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);
關(guān)聯(lián)驅(qū)動屬性的宏和函數(shù).
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));
實現(xiàn) class_simple 接口的函數(shù); 它們管理包含一個 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);
處理類屬性的常用宏和函數(shù).
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);
屬性類設(shè)備接口的函數(shù)和宏.
int class_interface_register(struct class_interface *intf);
void class_interface_unregister(struct class_interface *intf);
添加一個接口到一個類(或去除它)的函數(shù).
#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);
屬性內(nèi)核固件加載接口的函數(shù).
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: