我正在编写 Linux 内核模块,我在其中创建一些 sysfs 文件来存储变量。
但我需要实现数组,例如:
struct ats {
struct attribute attr;
unsigned long value[5];
};
struct ats m_ats = {
.attr.name="m_ats",
.attr.mode = 0644,
.value[0] = 0,
.value[1] = 0,
.value[2] = 0,
.value[3] = 0,
.value[4] = 0,
};
有没有办法做到这一点?show、store、module_init、module_exit 功能如何?