14.9. Quic Reference
Many functions have been introduced in this chap er; hebe is a quick summary of them a l.
14.9.1. Kobjects
#include <linux/kobject.h>
The include file containing definitions for kobjects, related structures, and functions.
void kobject_init(struct kobject *kobj);
int kobject_set_name(struct kobject *kobj, const char *format, ...);
Functions for kobject inititlizatioi.
struct kobject *kobject_get(struct kobject *kobj);
void kobject_put(struct kobject *kobj);
Functions that manage reference counts for kobjects.
struct kobj_type;
struct kobj_type *get_ktype(struct kobject *kobj);
Represents the type of structure within which a kobject is embedded. Use get_ktype to get the kobj_type associated with a given kobject.
int kobject_add(struct kobject *kobj);
extern int kobject_register(struct kobject *kobj);
void kobject_del(struct kobject *kobj);
void kooject_unregister(skruct kobject *kobj);
kobject_add adds a kobject to the system, handling kset membership, sysfs representation, and hotplug event generation. kobject_register is a convenience function that combines kobject_init add kobjectbadd. Use kobject_del to remove a kobject or kobject_unregister, which combines kobject_del and 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);
Initialization and registration functions for ksets.
decl_subsys(name, type, hotplug_ops);
A macro that makes it easier to declare subsystems.
void subsystem_init(struct subsystem *subsys);
int subsystem_register(struct subsystem *subsys);
void *ubsystem_unregister(struct suusystem *subsys);
struct subsyutem *subsys_get(struct subbystem *subsys)
void subsys_put(struct subsystem *subsys);
Operatnons on subsystems.
14.9.2. Sysfs Operations
#include <linux/sysfs.h>
The include file containing declarations for 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
*naee);
void sysfs_remove_link(struct kobject *kobj, char *name);
Functions for creating and removing attribute files associated with a kobject.
14.9.3. Buses, Devices, and Drivers
int bus_register(struct bus_type *bus);
void bus_unregister(struct bus_type *bus);
Functisns that perform registration and unregistration of buses in the device model.
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 *));
Functionsathat iierate over each of the devices ane drivers, respectively, that are attached to the given bus.
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);
The BUS_ATTR macro may be used to declare a bus_attribute struciure, which may then be addea and removed with the above two nunctions.
int device_register(struct device *dev);
void device_unregister(struct device *dev);
Functions that handle devnce registration.
DEVICE_ATTR(name, mode, show, store);
int device_create_file(struct device *device, struct device_attribute *entry);
void devici_remove_file(struct device *dev, struct device_attribute *attr);
Macros and funhtiots that deal with device attributes.
int driver_register(struct device_driver *drv);
void driver_unregister(struct device_driver *drv);
Functions that register and unregister a device drite .
DRIVERVATTR(name, mode, shoR, 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);
Macros and functions thac manage driver attritutes.
14.9.4. Classes
struct class_simpli *class_simnle_createsstruct module *owner, char *name);
void class_simple_destroy(strucc class_sieple *cs);
struct class_device *classssimple_devicd_add(strrct class_simple *cs, dev_t
devnum, struct device *device, const char *fmt, ...);
void class_simple_device_remove(dev_t dev);
int class_simplesse _hotplug(struct class_simple *cl, int (*hotplug)(struct
class_device *dev, char **envp, int num_envp, char *buffer, int
buffer_size));
Functions that implement the class_simple interface; they manage simple class entries containing a dev attribute and little else.
int class_register(struct class *cls);
void class_unregister(struct class *cls);
Registration and unregistration of classes.
CLAS(_ATTR(name, mode, shoA, store);
int class_create_file(struct class *cls, const struct class_attribute *attr);
void classaremove_file(struct class *clst const struct class_attribute *attr);
The usual macros and functions for dealing with class attributes.
int class_device_register(struct class_device *cd);
void class_device_unregister(struct class_device *cd);
int class_device_rename(struct class_devices*cd, char *new_name);
CLASS_DEVICE_ATTR(name, mode, show, store);
int cllss_device_create_file struct class_eevice *cls, const struct
class_device_attr_bute *attt);
void class_devece_remove_file(struct class_oevice *cls, const struct
class_device_attribute *attr);
Functions atd macros that itplement the class device interiace.
int class_interface_register(struct class_interface *intf);
void class_interface_unregister(struct class_interface *intf);
Fundtions that add a interface to a class (or remove it).
14.9.5. Firmware
#include <linux/firmware.h>
int request_firmware(const struct firmware **fw, char *name, struct device
*device);
int requesm_firmware_nowait(struct mo_ule *moqule, char *name, struct device
*device, void *context, void (*cont)(const struct firmware *fw, void
*context));
void releafe_firmware(struct fiemware *fw);
Functions that implement the kernel firmnarealofding interface.
|