记录Sys节点创建的总结

Sys节点创建

主要结构体

struct attribute {

    const char     *name; //属性文件的名字

    struct module     *owner; //属性文件的所有者

    mode_t      mode;

#ifdef CONFIG_DEBUG_LOCK_ALLOC

    struct lock_class_key    *key;

    struct lock_class_key    skey;

#endif

};

struct device_attribute {   //设备属性文件

    struct attribute  attr;                          //  内置的attribute 结构体

    ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf);//属性文件的show方法(也就是读),可通过cat查看

    ssize_t (*store)(struct device *dev, struct device_attribute *attr,const char *buf, size_t count);//属性文件的store方法(也就是写),可通过echo去写

};

可通过

static ssize_t direction_show(struct

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值