zoukankan      html  css  js  c++  java
  • Linux 内核设备属性

    sysfs 中的设备入口可有属性. 相关的结构是:

    struct device_attribute { struct attribute attr;

    ssize_t (*show)(struct device *dev, char *buf); ssize_t (*store)(struct device *dev, const char *buf, size_t count);

    };

    这些属性结构可在编译时建立, 使用这些宏: DEVICE_ATTR(name, mode, show, store);

    结果结构通过前缀 dev_attr_ 到给定名子上来命名. 属性文件的实际管理使用通常的函 数对来处理:

    int device_create_file(struct device *device, struct device_attribute *entry); void device_remove_file(struct device *dev, struct device_attribute *attr);

    struct bus_type 的 dev_attrs 成员指向一个缺省的属性列表, 这些属性给添加到总线 的每个设备创建.

  • 相关阅读:
    artTemplate的使用总结
    死锁的简单实现
    代理模式
    装饰器模式
    建造者模式
    工厂模式
    单例模式
    linux查看日志内容
    系统信息及系统操作
    设计模式-建造者模式
  • 原文地址:https://www.cnblogs.com/fanweisheng/p/11147953.html
Copyright © 2011-2022 走看看