diff options
| author | Johannes Lundberg <johalun@FreeBSD.org> | 2019-09-02 14:51:59 +0000 |
|---|---|---|
| committer | Johannes Lundberg <johalun@FreeBSD.org> | 2019-09-02 14:51:59 +0000 |
| commit | 458ba18d43ec1b2a3f4493153fd07726a76525fd (patch) | |
| tree | 8b3cf46bdc0a054d4fd062e3579e695bbd2f0998 /sys/compat/linuxkpi/common/include/linux/sysfs.h | |
| parent | 6b62f4243483cd3c0df7a67a7313144e9a75a85c (diff) | |
Notes
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/sysfs.h')
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/sysfs.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h index 95f91c6e2e79..536ed1b02ada 100644 --- a/sys/compat/linuxkpi/common/include/linux/sysfs.h +++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h @@ -152,6 +152,29 @@ sysfs_remove_file(struct kobject *kobj, const struct attribute *attr) sysctl_remove_name(kobj->oidp, attr->name, 1, 1); } +static inline int +sysfs_create_files(struct kobject *kobj, const struct attribute * const *attrs) +{ + int error = 0; + int i; + + for (i = 0; attrs[i] && !error; i++) + error = sysfs_create_file(kobj, attrs[i]); + while (error && --i >= 0) + sysfs_remove_file(kobj, attrs[i]); + + return (error); +} + +static inline void +sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attrs) +{ + int i; + + for (i = 0; attrs[i]; i++) + sysfs_remove_file(kobj, attrs[i]); +} + static inline void sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { |
