Date: Mon, 11 Nov 2019 15:23:58 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354614 - in stable/11/sys: compat/linuxkpi/common/include/linux sys Message-ID: <201911111523.xABFNwMK022191@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911111523.xABFNwMK022191>