From owner-svn-src-stable-12@freebsd.org Mon Sep 9 16:37:39 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27BDFD7A8A; Mon, 9 Sep 2019 16:37:39 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Rv370F70z4ChK; Mon, 9 Sep 2019 16:37:39 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFA1C18731; Mon, 9 Sep 2019 16:37:38 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89GbcQW046833; Mon, 9 Sep 2019 16:37:38 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89GbcWm046830; Mon, 9 Sep 2019 16:37:38 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201909091637.x89GbcWm046830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Mon, 9 Sep 2019 16:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352076 - in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 352076 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2019 16:37:39 -0000 Author: johalun Date: Mon Sep 9 16:37:38 2019 New Revision: 352076 URL: https://svnweb.freebsd.org/changeset/base/352076 Log: MFC r351701: LinuxKPI: Add sysfs create/remove functions that handles multiple files in one call. Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Sep 9 16:32:23 2019 (r352075) +++ stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Sep 9 16:37:38 2019 (r352076) @@ -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/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Mon Sep 9 16:32:23 2019 (r352075) +++ stable/12/sys/sys/param.h Mon Sep 9 16:37:38 2019 (r352076) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200516 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200517 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,