diff options
Diffstat (limited to 'io-module/mtac.c')
-rw-r--r-- | io-module/mtac.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/io-module/mtac.c b/io-module/mtac.c new file mode 100644 index 0000000..b9a2520 --- /dev/null +++ b/io-module/mtac.c @@ -0,0 +1,22 @@ +static struct kobj_attribute* create_attribute(const char* _name, umode_t _mode) { + char* attr_name; + struct kobj_attribute* _attr; + + _attr = kzalloc(sizeof(struct kobj_attribute), GFP_KERNEL); + if (! _attr) { + log_error("kzalloc of attribute %s failed", _name); + return NULL; + } + + sysfs_attr_init(_attr); + attr_name = kstrdup(_name, GFP_KERNEL); + if (! attr_name) { + log_error("GFP_KERNEL dup failed for attribute [%s]", _name); + return NULL; + } + + _attr->attr.name = attr_name; + _attr->attr.mode = _mode; + + return _attr; +} |