Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between sysfs_create_file() and sysfs_create_group()?

The two functions' prototypes:

int sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp)
int sysfs_create_file(struct kobject * kobj, const struct attribute * attr)

It seems to me that these two functions will both create attributes under the kobj->name directory in sysfs. The only difference I can find is, the group func can create a group of attributes in one time as the file func only one attribute. So are there other deferences? Or is my understanding of the functions wrong?

like image 645
Yang Zhou Avatar asked Oct 19 '12 08:10

Yang Zhou


1 Answers

Yes, the group is just a helper wrapper that makes it easier to manage multiple attributes. You can read about them in section 9 of this pdf.

like image 119
Jester Avatar answered Oct 01 '22 21:10

Jester