1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

LinuxKPI: Add sysfs create/remove functions that handles multiple files in one call.

Reviewed by:	hps
Approved by:	imp (mentor), hps
MFC after:	1 week
Differential Revision:	D21475
This commit is contained in:
Johannes Lundberg 2019-09-02 14:51:59 +00:00
parent 6b62f42434
commit 458ba18d43
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351701
2 changed files with 24 additions and 1 deletions

View File

@ -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)
{

View File

@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 1300043 /* Master, propagated to newvers */
#define __FreeBSD_version 1300044 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,