sysfs_create_group(cradle_kobj, &cradle_prop_attr_group)函数的功能参数返回值
时间: 2023-12-21 18:04:04 浏览: 161
The function sysfs_create_group() is used to create a new attribute group for a given kernel object in the sysfs filesystem. The parameters passed to the function are:
1. cradle_kobj - a pointer to the kernel object for which the attribute group is being created.
2. grp - a pointer to the attribute group structure that defines the attributes to be added to the group.
The function returns zero on success, and a negative error code on failure.
Example usage:
static struct attribute_group cradle_attr_grp = {
.name = "cradle",
.attrs = cradle_attrs,
};
...
if (sysfs_create_group(&cradle_kobj, &cradle_attr_grp)) {
printk(KERN_ERR "Failed to create sysfs group for cradle\n");
return -ENOMEM;
}
阅读全文