Author: hselasky
Date: Mon Nov 11 15:23:58 2019
New Revision: 354614
URL: https://svnweb.freebsd.org/changeset/base/354614

Log:
  MFC r351701:
  LinuxKPI: Add sysfs create/remove functions that handles multiple files in 
one call.
  
  Differential Revision:        D21475

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h
  stable/11/sys/sys/param.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h  Mon Nov 11 
14:56:22 2019        (r354613)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h  Mon Nov 11 
15:23:58 2019        (r354614)
@@ -152,6 +152,29 @@ sysfs_remove_file(struct kobject *kobj, const struct a
                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)
 {

Modified: stable/11/sys/sys/param.h
==============================================================================
--- stable/11/sys/sys/param.h   Mon Nov 11 14:56:22 2019        (r354613)
+++ stable/11/sys/sys/param.h   Mon Nov 11 15:23:58 2019        (r354614)
@@ -58,7 +58,7 @@
  *             in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1103501      /* Master, propagated to newvers */
+#define __FreeBSD_version 1103502      /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to