From patchwork Fri May 29 07:40:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578047 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA109912 for ; Fri, 29 May 2020 07:57:42 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97E83207D4 for ; Fri, 29 May 2020 07:57:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97E83207D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qGpn144126; Fri, 29 May 2020 07:57:31 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 318xe1ry8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:57:30 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7ri5k183955; Fri, 29 May 2020 07:55:30 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 31a9ktuw9q-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:55:29 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrU-0000JH-Vr; Fri, 29 May 2020 00:55:28 -0700 Received: from userp3030.oracle.com ([156.151.31.80]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdl-0006c3-Ao for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:17 -0700 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7d1P5039658 for ; Fri, 29 May 2020 07:41:16 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userp3030.oracle.com with ESMTP id 317ds3wpwc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:16 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7ewSv007504 for ; Fri, 29 May 2020 07:41:16 GMT Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by userp2030.oracle.com with ESMTP id 31akmj1bbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:16 +0000 Received: by mail-pl1-f195.google.com with SMTP id y11so755420plt.12 for ; Fri, 29 May 2020 00:41:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ztkbZyMAj8QAP+BJLtRR/lmTCR2M8J8E3LJknwjviqU=; b=YO49MOdT2hBjAe7ezJQSFaulR2zkIkWCy9NhhT2aVroiOmJscDlS//2VzQxdJv26TS E6pye4/C20qkH3QI4IQhyIsWoszk1CYRy0HGGgFbAwRGbDLDpMAVySwgxoiGAXjsiAoC 7dMXW7kjZz3YUWogr+p+j10xwZFGo5osrL4NqrIB3hn0ZHGF8tdfR3BJdJVOOJy2WKtz AzmMdWc/O2hrdflHmUHohSFaYhs8wIgssByJnioYTDCoiZav/XrL3+FubNaotk7KVzNn LPQ9QdrJy5WoAR91TOWsCcD9MLNSohYgK70tkO4jztezNDB6XvvJALtbysrX5WNRRWWc FFjQ== X-Gm-Message-State: AOAM530ctxmpxUob71QqunEhT/nP3xXMyOVsiI3Qtkm/YdfJ7wBq9eHr DNHKo7ovPLRaDAJZdKMYdZM= X-Google-Smtp-Source: ABdhPJwef9VnxevTutof/OWjXxMen8nqP316VSHb8lndoYqWe0y1ALBADBIyXeEXdBPr/HgBfKduig== X-Received: by 2002:a17:902:bd95:: with SMTP id q21mr7959305pls.238.1590738074446; Fri, 29 May 2020 00:41:14 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id e26sm6189878pgl.27.2020.05.29.00.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:12 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 10D65418C0; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:40:56 +0000 Message-Id: <20200529074108.16928-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.214.195 X-ServerName: mail-pl1-f195.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 clxscore=186 bulkscore=0 priorityscore=70 adultscore=0 mlxlogscore=473 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290059 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=725 adultscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 01/13] sysctl: add new register_sysctl_subdir() helper X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 cotscore=-2147483648 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 Often enough all we need to do is create a subdirectory so that we can stuff sysctls underneath it. However, *if* that directory was already created early on the boot sequence we really have no need to use the full boiler plate code for it, we can just use local variables to help us guide sysctl to place the new leaf files. So use a helper to do precisely this. Signed-off-by: Luis Chamberlain --- include/linux/sysctl.h | 11 +++++++++++ kernel/sysctl.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index ddaa06ddd852..58bc978d4f03 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -205,6 +205,9 @@ void unregister_sysctl_table(struct ctl_table_header * table); extern int sysctl_init(void); extern void register_sysctl_init(const char *path, struct ctl_table *table, const char *table_name); +extern struct ctl_table_header *register_sysctl_subdir(const char *base, + const char *subdir, + struct ctl_table *table); void do_sysctl_args(void); extern int pwrsw_enabled; @@ -223,6 +226,14 @@ static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * return NULL; } +static +inline struct ctl_table_header *register_sysctl_subdir(const char *base, + const char *subdir, + struct ctl_table *table) +{ + return NULL; +} + static inline struct ctl_table_header *register_sysctl_paths( const struct ctl_path *path, struct ctl_table *table) { diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 008ac0576ae5..04ff032f2863 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -3195,6 +3195,43 @@ void __init register_sysctl_init(const char *path, struct ctl_table *table, } kmemleak_not_leak(hdr); } + +struct ctl_table_header *register_sysctl_subdir(const char *base, + const char *subdir, + struct ctl_table *table) +{ + struct ctl_table_header *hdr = NULL; + struct ctl_table subdir_table[] = { + { + .procname = subdir, + .mode = 0555, + .child = table, + }, + { } + }; + struct ctl_table base_table[] = { + { + .procname = base, + .mode = 0555, + .child = subdir_table, + }, + { } + }; + + if (!table->procname) + goto out; + + hdr = register_sysctl_table(base_table); + if (unlikely(!hdr)) { + pr_err("failed when creating subdirectory sysctl %s/%s/%s\n", + base, subdir, table->procname); + goto out; + } + kmemleak_not_leak(hdr); +out: + return hdr; +} +EXPORT_SYMBOL_GPL(register_sysctl_subdir); #endif /* CONFIG_SYSCTL */ /* * No sense putting this after each symbol definition, twice, From patchwork Fri May 29 07:40:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54CE0139A for ; Fri, 29 May 2020 07:58:53 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3077C207D4 for ; Fri, 29 May 2020 07:58:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3077C207D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7pjUG189534; Fri, 29 May 2020 07:58:39 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 316u8r8yrq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:58:39 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7viZ0034422; Fri, 29 May 2020 07:58:38 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 31a9ktuyw1-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:58:38 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrU-0000Ik-RC; Fri, 29 May 2020 00:55:28 -0700 Received: from userp3020.oracle.com ([156.151.31.79]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdl-0006cJ-Un for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:18 -0700 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7bip5110229 for ; Fri, 29 May 2020 07:41:17 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userp3020.oracle.com with ESMTP id 31a9ktuh97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:17 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7fHDV007658 for ; Fri, 29 May 2020 07:41:17 GMT Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by userp2030.oracle.com with ESMTP id 31akmj1bbp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:16 +0000 Received: by mail-pj1-f68.google.com with SMTP id nm22so121677pjb.4 for ; Fri, 29 May 2020 00:41:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2jHA8VIMvKgrxc1AW+DPbkuZZuKskUQcNv9lMPkimBs=; b=DlWWSdtoZBbmjxFZZt2BgENgR6EdMf6g/a1CzdafYweZfhuK+GpNvbPj+I5iyn/6lq cdusd7R86h0h1SnU9GlpE+axdE+aGgd2+PsaZaZ3t6nmNyDOzxHYvraErZmg/saKMT5z dQp5D5vA5hshHSBN7tqDXMbC2PIxDVtj1cUrf5GQYWzwlDcq5fPEnfWf1NI6wYucIgC3 UnzjnQ04fy6CfRvzojxY8l31/OUoRVd1tFar1rwGUJPZIW4g3NrT5rTHlqhZmdZHei4H LJNRh+UOmt4aq1qm4mk64ljnGgtEWctLaEQqaZcm1fxu6ruCry50uoeNG+bH8sJvm1jS jkKA== X-Gm-Message-State: AOAM530LfiJhXFn7hzQPwyw3ek70z7BMaUmXbRC0xuorr3r4+vwuod3q 61Cmh4Xr7e4Kh9W7c//23mI= X-Google-Smtp-Source: ABdhPJwLKp4Ek16GIR6wfTGzoNi9sGCN2B5VA54FGeDyqorTPtnWjcRjvN0kcQMGbXM4anhxYRPvyw== X-Received: by 2002:a17:90a:b011:: with SMTP id x17mr8088274pjq.175.1590738075444; Fri, 29 May 2020 00:41:15 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id a7sm6765760pfa.187.2020.05.29.00.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:12 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 67FA942309; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:40:58 +0000 Message-Id: <20200529074108.16928-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.216.68 X-ServerName: mail-pj1-f68.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 clxscore=186 bulkscore=0 priorityscore=115 adultscore=0 mlxlogscore=752 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290059 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 03/13] hpet: use new sysctl subdir helper register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290063 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 priorityscore=1501 spamscore=0 cotscore=-2147483648 suspectscore=0 phishscore=0 clxscore=1034 mlxlogscore=999 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci drivers/char/hpet.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- drivers/char/hpet.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index ed3b7dab678d..169c970d5ff8 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -746,26 +746,6 @@ static struct ctl_table hpet_table[] = { {} }; -static struct ctl_table hpet_root[] = { - { - .procname = "hpet", - .maxlen = 0, - .mode = 0555, - .child = hpet_table, - }, - {} -}; - -static struct ctl_table dev_root[] = { - { - .procname = "dev", - .maxlen = 0, - .mode = 0555, - .child = hpet_root, - }, - {} -}; - static struct ctl_table_header *sysctl_header; /* @@ -1059,7 +1039,7 @@ static int __init hpet_init(void) if (result < 0) return -ENODEV; - sysctl_header = register_sysctl_table(dev_root); + sysctl_header = register_sysctl_subdir("dev", "hpet", hpet_table); result = acpi_bus_register_driver(&hpet_acpi_driver); if (result < 0) { From patchwork Fri May 29 07:40:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578045 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5150414C0 for ; Fri, 29 May 2020 07:56:16 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21C10207F5 for ; Fri, 29 May 2020 07:56:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21C10207F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qDnR144074; Fri, 29 May 2020 07:55:31 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 318xe1ry0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:55:30 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7rhfi183872; Fri, 29 May 2020 07:55:30 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 31a9ktuw9s-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:55:29 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000Jm-1i; Fri, 29 May 2020 00:55:29 -0700 Received: from aserp3020.oracle.com ([141.146.126.70]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdn-0006cX-Me for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:19 -0700 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7bhR6111490 for ; Fri, 29 May 2020 07:41:19 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserp3020.oracle.com with ESMTP id 317j5xqxs2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:19 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7ewSw007504 for ; Fri, 29 May 2020 07:41:18 GMT Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by userp2030.oracle.com with ESMTP id 31akmj1bbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:17 +0000 Received: by mail-pf1-f194.google.com with SMTP id 64so678675pfg.8 for ; Fri, 29 May 2020 00:41:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/vA3i/UOi3UGtI8x+kS8OZpNUo79BRU7m0khtdFXp1w=; b=A683RaslxF9mxyh+mo2SD9KbuBS7DrUPTZ8Fg1S3bdQM0U4nlcbvGgHMj2c1dEl8DE 0FsRMxGgbXhwl2V1oWLJx8JwkGSvCQgB2kNR+bci7pM6aN0GiKLdO4urC9SRTZ+q4iIU 7ohy0BNH473OfIl/mCXfUp8rrI0jY7DSwVcHKb/RHdObUkYfBEoh7aFtimDnsTStinRF pLGav/dK0JEMySkWdx6jPwn1GI80/cbDDz0KnefyASONvKoriFAzz6qb+z+jHL4Wq2Oi 40l5KFfxxzV4RCdDWWfoVCF4oDf5/kFKUzbsrBkumQEW43qqnrHVUUsZ7D8sdmp7RAgV BNnQ== X-Gm-Message-State: AOAM533CE1dfLo3GhXcqJ620Et5BDx3gjMfNVgaZ06o2FRydw2P3ElMU hfiTuKgtW5K0RveRyt3FnRc= X-Google-Smtp-Source: ABdhPJwVflgyvahnPxBVjITKozn64OGLurCkYnovebI0IemGuS43xiHECvCCud24IYthmkf9lnECTw== X-Received: by 2002:aa7:8658:: with SMTP id a24mr7517245pfo.135.1590738076317; Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id q189sm6758936pfc.112.2020.05.29.00.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:12 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 916034230A; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:40:59 +0000 Message-Id: <20200529074108.16928-5-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.210.194 X-ServerName: mail-pf1-f194.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 clxscore=186 bulkscore=0 priorityscore=78 adultscore=0 mlxlogscore=898 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290059 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 04/13] i915: use new sysctl subdir helper register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 cotscore=-2147483648 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci drivers/gpu/drm/i915/i915_perf.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- drivers/gpu/drm/i915/i915_perf.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index 665bb076e84d..52509b573794 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -4203,26 +4203,6 @@ static struct ctl_table oa_table[] = { {} }; -static struct ctl_table i915_root[] = { - { - .procname = "i915", - .maxlen = 0, - .mode = 0555, - .child = oa_table, - }, - {} -}; - -static struct ctl_table dev_root[] = { - { - .procname = "dev", - .maxlen = 0, - .mode = 0555, - .child = i915_root, - }, - {} -}; - /** * i915_perf_init - initialize i915-perf state on module bind * @i915: i915 device instance @@ -4383,7 +4363,7 @@ static int destroy_config(int id, void *p, void *data) void i915_perf_sysctl_register(void) { - sysctl_header = register_sysctl_table(dev_root); + sysctl_header = register_sysctl_subdir("dev", "i915", oa_table); } void i915_perf_sysctl_unregister(void) From patchwork Fri May 29 07:41:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7E43912 for ; Fri, 29 May 2020 07:56:15 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B9496207F5 for ; Fri, 29 May 2020 07:56:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9496207F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qE6F144095; Fri, 29 May 2020 07:55:31 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 318xe1ry0c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:55:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7ri28184026; Fri, 29 May 2020 07:55:30 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 31a9ktuw9t-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:55:30 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000KH-4f; Fri, 29 May 2020 00:55:29 -0700 Received: from aserp3020.oracle.com ([141.146.126.70]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdo-0006cm-4j for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:20 -0700 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7bhNJ111482 for ; Fri, 29 May 2020 07:41:20 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp3020.oracle.com with ESMTP id 317j5xqxt4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:19 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7Xgvv018469 for ; Fri, 29 May 2020 07:41:19 GMT Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by userp2040.oracle.com with ESMTP id 31avwbshjw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:18 +0000 Received: by mail-pl1-f194.google.com with SMTP id t7so776815plr.0 for ; Fri, 29 May 2020 00:41:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iFuOAMMzx366XD73njtfa9qdyal/YI+SEog1dnntDeg=; b=bMAa1+lNMWfMXqWzvG2pVYUFnJIGcXAkmx3cIfv2Kap0PbLFLXRlmW/qfdx7rUX9e3 ItxsvIt7rVmRYRQY57AolAKQ/zYr4DC4KLjwyn54x/SfOwiVRaubFuIUsD0q8W+htTLA UaBfpnsvLlWwJtMRyXPRscFnN2r5pDuHkc/Umv0tAXS3x2mMcYael2o5i2ai0weN6Gbq Qwve1r9C3LmJ8oJXWNgR2LTqCmYMtpxS2tnuWiH2DxkbX5KZ155f3fHACdfhMrlt13Xz 0jTbyD2rovjHjys/t7CNkQfhxjiE7mlU0x24sTXAjYR3Jzua8MKlRL9I8xrCDCwIN45z 1yTw== X-Gm-Message-State: AOAM531UJ+ImjOXBt3viXFbaewjr4slS0luOrEz4e6GwRI6jXwmLnuAf EEZp04gztG3Wy/85rPrcazs= X-Google-Smtp-Source: ABdhPJyWq+uNBt+z7g4lF4BNt9x39LLqlR7x3RVbHVyGUC5VKz7sfj4vqnpPnSKalsV1vnr314j4sQ== X-Received: by 2002:a17:902:82c9:: with SMTP id u9mr7568085plz.179.1590738077450; Fri, 29 May 2020 00:41:17 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id 70sm6443717pfx.78.2020.05.29.00.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id B233242337; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:00 +0000 Message-Id: <20200529074108.16928-6-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.214.194 X-ServerName: mail-pl1-f194.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 cotscore=-2147483648 bulkscore=0 adultscore=0 mlxlogscore=691 clxscore=186 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=60 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290058 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=943 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 05/13] macintosh/mac_hid.c: use new sysctl subdir helper register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 cotscore=-2147483648 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci drivers/macintosh/mac_hid.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- drivers/macintosh/mac_hid.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index 28b8581b44dd..736d0e151716 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c @@ -239,33 +239,12 @@ static struct ctl_table mac_hid_files[] = { { } }; -/* dir in /proc/sys/dev */ -static struct ctl_table mac_hid_dir[] = { - { - .procname = "mac_hid", - .maxlen = 0, - .mode = 0555, - .child = mac_hid_files, - }, - { } -}; - -/* /proc/sys/dev itself, in case that is not there yet */ -static struct ctl_table mac_hid_root_dir[] = { - { - .procname = "dev", - .maxlen = 0, - .mode = 0555, - .child = mac_hid_dir, - }, - { } -}; - static struct ctl_table_header *mac_hid_sysctl_header; static int __init mac_hid_init(void) { - mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir); + mac_hid_sysctl_header = register_sysctl_subdir("dev", "mac_hid", + mac_hid_files); if (!mac_hid_sysctl_header) return -ENOMEM; From patchwork Fri May 29 07:41:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578053 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7228F912 for ; Fri, 29 May 2020 07:58:55 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 43F23207D4 for ; Fri, 29 May 2020 07:58:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43F23207D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qGpw144126; Fri, 29 May 2020 07:58:40 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 318xe1rycn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:58:39 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7r0C2108336; Fri, 29 May 2020 07:58:39 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 317ds3x63g-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:58:39 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000Ko-6l; Fri, 29 May 2020 00:55:29 -0700 Received: from aserp3030.oracle.com ([141.146.126.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdp-0006cz-FT for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:21 -0700 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7d8jZ051690 for ; Fri, 29 May 2020 07:41:21 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp3030.oracle.com with ESMTP id 317ddu2hbp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:21 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7WMmo015117 for ; Fri, 29 May 2020 07:41:20 GMT Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by userp2040.oracle.com with ESMTP id 31avwbshk2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:20 +0000 Received: by mail-pl1-f193.google.com with SMTP id m7so769773plt.5 for ; Fri, 29 May 2020 00:41:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GvzomajvqaDlmHgD5CFBW/9i29+5hKQDe8Dyx3XaSq4=; b=JCTHq3U3glcKYH/FGX7exx/zapmb2WjHZ70Lmsh9LNghKsc8tnIK1ablV/DQX9uOKX AuWwg3A014bBZzK+Qvdjtmj+Mi74U70y0WEbr5s10VDK8MCBVCGniNMl2CZxNaUzN0zs gNKlBK1I4IbGtEGhan117HpfXB1Km7aQkFeobAsbZIC4Rc4F8d+I0g1XhoPugx52jO7J FjruxO5xsa5HjET4ekivURQ7Wlyv8Bug5yoz7cp9+zJWmORMXzD1Fvh1J5gwwkn8ituq Nhr+VP1roQr16hU3CrNLx83je2xqYQuRZ+N/m+05VIPGB0Aw3cyq29Ilf3VNjs+oz/nb j9sQ== X-Gm-Message-State: AOAM532CPMyo7tnaJ9zhekAmsYhZAnNeq0701xcrX9FZuiv/lMPYch/p eLLMrzAgPPI+LdxQuQjsYIc= X-Google-Smtp-Source: ABdhPJzaH+urrC8l82AOcunlppRYvCYY8eRn8tjh5bOS5g7bJ5viHl156VGCztJ4ox/+xnpOBndUZg== X-Received: by 2002:a17:902:7001:: with SMTP id y1mr7344091plk.114.1590738078586; Fri, 29 May 2020 00:41:18 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id gd1sm7404001pjb.14.2020.05.29.00.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id BDFF742340; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:01 +0000 Message-Id: <20200529074108.16928-7-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.214.193 X-ServerName: mail-pl1-f193.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 cotscore=-2147483648 bulkscore=0 adultscore=0 mlxlogscore=838 clxscore=186 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=100 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290058 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 06/13] ocfs2: use new sysctl subdir helper register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 cotscore=-2147483648 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci fs/ocfs2/stackglue.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- fs/ocfs2/stackglue.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index a191094694c6..addafced7f59 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c @@ -677,28 +677,8 @@ static struct ctl_table ocfs2_mod_table[] = { }, { } }; - -static struct ctl_table ocfs2_kern_table[] = { - { - .procname = "ocfs2", - .data = NULL, - .maxlen = 0, - .mode = 0555, - .child = ocfs2_mod_table - }, - { } -}; - -static struct ctl_table ocfs2_root_table[] = { - { - .procname = "fs", - .data = NULL, - .maxlen = 0, - .mode = 0555, - .child = ocfs2_kern_table - }, - { } -}; + .data = NULL, + .data = NULL, static struct ctl_table_header *ocfs2_table_header; @@ -711,7 +691,8 @@ static int __init ocfs2_stack_glue_init(void) { strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB); - ocfs2_table_header = register_sysctl_table(ocfs2_root_table); + ocfs2_table_header = register_sysctl_subdir("fs", "ocfs2", + ocfs2_mod_table); if (!ocfs2_table_header) { printk(KERN_ERR "ocfs2 stack glue: unable to register sysctl\n"); From patchwork Fri May 29 07:41:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA34F139A for ; Fri, 29 May 2020 07:56:15 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8F2B207D4 for ; Fri, 29 May 2020 07:56:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8F2B207D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7rdYO145397; Fri, 29 May 2020 07:55:31 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 318xe1ry0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:55:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7rh91183863; Fri, 29 May 2020 07:55:30 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 31a9ktuw9v-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:55:30 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000Lq-CO; Fri, 29 May 2020 00:55:29 -0700 Received: from aserp3030.oracle.com ([141.146.126.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdr-0006dT-DP for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:23 -0700 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7d8jb051690 for ; Fri, 29 May 2020 07:41:23 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp3030.oracle.com with ESMTP id 317ddu2hcd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:23 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7Wucs017692 for ; Fri, 29 May 2020 07:41:22 GMT Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by userp2040.oracle.com with ESMTP id 31avwbshke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:22 +0000 Received: by mail-pg1-f196.google.com with SMTP id c75so1024437pga.3 for ; Fri, 29 May 2020 00:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sBgsWCIFjc1dCALH3PIiiJW4ZW3ozJ7JvpAnInxDZto=; b=ii41nA8ekwx7SpDKar/UzbzgB2jaZUeNQhRxXXPq631XyyDzqv7I9XH8hMadSc32NG FH2YfnMq8sNjxhQnmk2FKhY4nUktjVn54gXiQpJrDJI7vM/Yl9U/Ms70JhFbgGq3Lgtj jjNxa83wbLCowQf4+Cfbg+O4S4dhncmom2+xbmBDEQMYUTbtJtz9yWoR/D/xBWurPBSq ZNtS+rW44Yv0lOKGIyARmCSE3C/FwXjbHTJW1tN2qR1FWhRMxd1B95scN7a+JbIjKP7A M9numq9Zdy+APim4gTv+uybXx7pKhHxAtCwHi08wtjcG039Xte/MdGZwR+U29hDdOQ9G ziTw== X-Gm-Message-State: AOAM532alLzNopC9bTLbun1uI6k5JsK/z/b/7qkt5f+mdBjO9xJRBAr/ ezATn0Cn6Y42OkDeNFS7rmw= X-Google-Smtp-Source: ABdhPJzuX8lSSg8Aasn2k4DvlaVD+6USysUPj9KRkIoQC5Conauc3KXazu1gR/0/ORcChuqRpyUMwQ== X-Received: by 2002:aa7:9f5a:: with SMTP id h26mr7127671pfr.51.1590738080556; Fri, 29 May 2020 00:41:20 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id p19sm6115830pfn.216.2020.05.29.00.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id C929442341; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:02 +0000 Message-Id: <20200529074108.16928-8-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.215.196 X-ServerName: mail-pg1-f196.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 cotscore=-2147483648 bulkscore=0 adultscore=0 mlxlogscore=626 clxscore=215 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=104 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290058 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=878 bulkscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 07/13] test_sysctl: use new sysctl subdir helper register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 cotscore=-2147483648 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 This simplifies the code considerably. The following coccinelle SmPL grammar rule was used to transform this code. // pycocci sysctl-subdir.cocci lib/test_sysctl.c @c1@ expression E1; identifier subdir, sysctls; @@ static struct ctl_table subdir[] = { { .procname = E1, .maxlen = 0, .mode = 0555, .child = sysctls, }, { } }; @c2@ identifier c1.subdir; expression E2; identifier base; @@ static struct ctl_table base[] = { { .procname = E2, .maxlen = 0, .mode = 0555, .child = subdir, }, { } }; @c3@ identifier c2.base; identifier header; @@ header = register_sysctl_table(base); @r1 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.subdir, c1.sysctls; @@ -static struct ctl_table subdir[] = { - { - .procname = E1, - .maxlen = 0, - .mode = 0555, - .child = sysctls, - }, - { } -}; @r2 depends on c1 && c2 && c3@ identifier c1.subdir; expression c2.E2; identifier c2.base; @@ -static struct ctl_table base[] = { - { - .procname = E2, - .maxlen = 0, - .mode = 0555, - .child = subdir, - }, - { } -}; @r3 depends on c1 && c2 && c3@ expression c1.E1; identifier c1.sysctls; expression c2.E2; identifier c2.base; identifier c3.header; @@ header = -register_sysctl_table(base); +register_sysctl_subdir(E2, E1, sysctls); Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- lib/test_sysctl.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 84eaae22d3a6..b17581307756 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -128,26 +128,6 @@ static struct ctl_table test_table[] = { { } }; -static struct ctl_table test_sysctl_table[] = { - { - .procname = "test_sysctl", - .maxlen = 0, - .mode = 0555, - .child = test_table, - }, - { } -}; - -static struct ctl_table test_sysctl_root_table[] = { - { - .procname = "debug", - .maxlen = 0, - .mode = 0555, - .child = test_sysctl_table, - }, - { } -}; - static struct ctl_table_header *test_sysctl_header; static int __init test_sysctl_init(void) @@ -155,7 +135,8 @@ static int __init test_sysctl_init(void) test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL); if (!test_data.bitmap_0001) return -ENOMEM; - test_sysctl_header = register_sysctl_table(test_sysctl_root_table); + test_sysctl_header = register_sysctl_subdir("debug", "test_sysctl", + test_table); if (!test_sysctl_header) { kfree(test_data.bitmap_0001); return -ENOMEM; From patchwork Fri May 29 07:41:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578051 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C047912 for ; Fri, 29 May 2020 07:58:54 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 780B2207D4 for ; Fri, 29 May 2020 07:58:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 780B2207D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qfdv072643; Fri, 29 May 2020 07:58:39 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 318xbk90hj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:58:39 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7vihg034462; Fri, 29 May 2020 07:58:39 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 31a9ktuyw8-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:58:39 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000LJ-91; Fri, 29 May 2020 00:55:29 -0700 Received: from aserp3030.oracle.com ([141.146.126.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdq-0006dC-Jb for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:22 -0700 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7d8WM051710 for ; Fri, 29 May 2020 07:41:22 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp3030.oracle.com with ESMTP id 317ddu2hc7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:22 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7WPls015533 for ; Fri, 29 May 2020 07:41:21 GMT Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by userp2040.oracle.com with ESMTP id 31avwbshk6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:21 +0000 Received: by mail-pg1-f196.google.com with SMTP id f21so999526pgg.12 for ; Fri, 29 May 2020 00:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gyi+SSBMYaz8TR5pIeizC0x+opRDWqonQ2PbJtJFBcU=; b=sdGfYH07sQMxY01rjoOYJOqDrrkfPDdJVnEaBzBawi8HRLaIsZR1X6u8eVaeuWJGMs D9Ky1BsurgNQ3Hl4qu//5KdnKAJfMk3i5Z8wV2dbiz8+s0JHWIcKhBXS1Tvjih0TfbkZ OEhr3YEwxg3B6u3jMpfuAM/MJvMJm5sIhG3s8j8I/CSv2ti9mKwckd6P/RrZSPF+z559 s4+BpdbKPXuxSZ7QBKft+gePnNKJFoC507emIYdaq1wbT6F8gFMNOEQ5NOv2ICeKRGVx LQ+E/jfNnCH5UMfZTIY3LRK9G1Mu9uEGog8jK3lLcsp2AXKlg4DhE9g9XVV/sZVQHcAw KJwA== X-Gm-Message-State: AOAM532WqekQzEILb3UuP2q7Sv624xA7Td6eR/TxoubV0Gj4rr4dLmUQ Inu/FXvl0X0WTmxU5hAcbX0= X-Google-Smtp-Source: ABdhPJx56643L02wDwth5rceoeGJdrDM09GlBME9Pg+5yDtZkMeY7H83kJ7EluZRQYSUUOaPNTyILA== X-Received: by 2002:aa7:9510:: with SMTP id b16mr7400994pfp.265.1590738079523; Fri, 29 May 2020 00:41:19 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id s63sm7735409pjj.16.2020.05.29.00.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id D3A3042349; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:03 +0000 Message-Id: <20200529074108.16928-9-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.215.196 X-ServerName: mail-pg1-f196.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 cotscore=-2147483648 bulkscore=0 adultscore=0 mlxlogscore=764 clxscore=236 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=111 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290058 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 08/13] inotify: simplify sysctl declaration with register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290063 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 cotscore=-2147483648 suspectscore=0 bulkscore=0 clxscore=1015 impostorscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 From: Xiaoming Ni move inotify_user sysctl to inotify_user.c and use the new register_sysctl_subdir() helper. Signed-off-by: Xiaoming Ni Signed-off-by: Luis Chamberlain --- fs/notify/inotify/inotify_user.c | 11 ++++++++++- include/linux/inotify.h | 3 --- kernel/sysctl.c | 11 ----------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index f88bbcc9efeb..64859fbf8463 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -46,7 +46,7 @@ struct kmem_cache *inotify_inode_mark_cachep __read_mostly; #include -struct ctl_table inotify_table[] = { +static struct ctl_table inotify_table[] = { { .procname = "max_user_instances", .data = &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES], @@ -73,6 +73,14 @@ struct ctl_table inotify_table[] = { }, { } }; + +static void __init inotify_sysctls_init(void) +{ + register_sysctl_subdir("fs", "inotify", inotify_table); +} + +#else +#define inotify_sysctls_init() do { } while (0) #endif /* CONFIG_SYSCTL */ static inline __u32 inotify_arg_to_mask(u32 arg) @@ -826,6 +834,7 @@ static int __init inotify_user_setup(void) inotify_max_queued_events = 16384; init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES] = 128; init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES] = 8192; + inotify_sysctls_init(); return 0; } diff --git a/include/linux/inotify.h b/include/linux/inotify.h index 6a24905f6e1e..8d20caa1b268 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h @@ -7,11 +7,8 @@ #ifndef _LINUX_INOTIFY_H #define _LINUX_INOTIFY_H -#include #include -extern struct ctl_table inotify_table[]; /* for sysctl */ - #define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ IN_MOVED_TO | IN_CREATE | IN_DELETE | \ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 04ff032f2863..30c2d521502a 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -123,10 +123,6 @@ static const int maxolduid = 65535; static int ngroups_max = NGROUPS_MAX; static const int cap_last_cap = CAP_LAST_CAP; -#ifdef CONFIG_INOTIFY_USER -#include -#endif - #ifdef CONFIG_PROC_SYSCTL /** @@ -3012,13 +3008,6 @@ static struct ctl_table fs_table[] = { .proc_handler = proc_dointvec, }, #endif -#ifdef CONFIG_INOTIFY_USER - { - .procname = "inotify", - .mode = 0555, - .child = inotify_table, - }, -#endif #ifdef CONFIG_EPOLL { .procname = "epoll", From patchwork Fri May 29 07:41:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B738139A for ; Fri, 29 May 2020 08:00:49 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06715206F1 for ; Fri, 29 May 2020 08:00:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06715206F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7ps2x189581; Fri, 29 May 2020 08:00:40 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 316u8r9015-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 08:00:40 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qxaZ108257; Fri, 29 May 2020 07:58:39 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 317ds3x63v-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:58:39 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000NL-Kb; Fri, 29 May 2020 00:55:29 -0700 Received: from userp3030.oracle.com ([156.151.31.80]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdu-0006e8-86 for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:26 -0700 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7d2jd039845 for ; Fri, 29 May 2020 07:41:26 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userp3030.oracle.com with ESMTP id 317ds3wq01-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:25 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7ewHF007498 for ; Fri, 29 May 2020 07:41:25 GMT Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by userp2030.oracle.com with ESMTP id 31akmj1bcq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:25 +0000 Received: by mail-pj1-f66.google.com with SMTP id k2so845760pjs.2 for ; Fri, 29 May 2020 00:41:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OeMaeWf8ySHfvuEzWncwhX9a4D5s1xQoEDO3/r/aYzY=; b=fKYmJZ69XowGB1LtOIP7BsszPimxRRh/DekuG6+KIjxglGW9iTETXcYuu259FJa+TB UdmWl5nVk1AAe/d82eDAVDdqcAKP6qH2CP/0yB+IhyNesNtlASEBrmCPbSs1aWzUr+wZ o7g5uG+2U+pHmqBi1nDRB/e2J8P4NhuEB/AwJzivmxvzfRx01g1wXFcygdu87n/LpUp0 9LJSoiPiwqvNSR+ltBpZr8KV1884FUASix4lg2ngw54KIYkcd302/VRHnp3xGras261d sDgac3kTaz2R/bX1w2Pp+N+mVqvTox2z4ARpo6UA12scXRFFUG7SO0Ekn+qMgpIAiVjS hI/g== X-Gm-Message-State: AOAM532QKesVifIxFfbkS47xDIveyJr8nCZrzWEL4RhtTuEO+4F3fNS3 ZlYjOVPD+Rlx5zuzoq0UL4w= X-Google-Smtp-Source: ABdhPJyZTqVeXpnC780yNsYcAysPbnmEI2o7s7rzYFo+LKi1oKtcOEgW9W/Zd68h1pyiVT90AxPOjw== X-Received: by 2002:a17:90a:2807:: with SMTP id e7mr7981405pjd.6.1590738083514; Fri, 29 May 2020 00:41:23 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id jx10sm6903511pjb.46.2020.05.29.00.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id DDE9C42376; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:04 +0000 Message-Id: <20200529074108.16928-10-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.216.66 X-ServerName: mail-pj1-f66.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 clxscore=237 bulkscore=0 priorityscore=111 adultscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290059 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 09/13] firmware_loader: simplify sysctl declaration with register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 priorityscore=1501 spamscore=0 cotscore=-2147483648 suspectscore=0 phishscore=0 clxscore=1034 mlxlogscore=999 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 From: Xiaoming Ni Move the firmware config sysctl table to fallback_table.c and use the new register_sysctl_subdir() helper. This removes the clutter from kernel/sysctl.c. Signed-off-by: Xiaoming Ni Signed-off-by: Luis Chamberlain --- drivers/base/firmware_loader/fallback.c | 4 ++++ drivers/base/firmware_loader/fallback.h | 11 ++++++++++ drivers/base/firmware_loader/fallback_table.c | 22 +++++++++++++++++-- include/linux/sysctl.h | 1 - kernel/sysctl.c | 7 ------ 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c index d9ac7296205e..8190653ae9a3 100644 --- a/drivers/base/firmware_loader/fallback.c +++ b/drivers/base/firmware_loader/fallback.c @@ -200,12 +200,16 @@ static struct class firmware_class = { int register_sysfs_loader(void) { + int ret = register_firmware_config_sysctl(); + if (ret != 0) + return ret; return class_register(&firmware_class); } void unregister_sysfs_loader(void) { class_unregister(&firmware_class); + unregister_firmware_config_sysctl(); } static ssize_t firmware_loading_show(struct device *dev, diff --git a/drivers/base/firmware_loader/fallback.h b/drivers/base/firmware_loader/fallback.h index 06f4577733a8..7d2cb5f6ceb8 100644 --- a/drivers/base/firmware_loader/fallback.h +++ b/drivers/base/firmware_loader/fallback.h @@ -42,6 +42,17 @@ void fw_fallback_set_default_timeout(void); int register_sysfs_loader(void); void unregister_sysfs_loader(void); +#ifdef CONFIG_SYSCTL +extern int register_firmware_config_sysctl(void); +extern void unregister_firmware_config_sysctl(void); +#else +static inline int register_firmware_config_sysctl(void) +{ + return 0; +} +static inline void unregister_firmware_config_sysctl(void) { } +#endif /* CONFIG_SYSCTL */ + #else /* CONFIG_FW_LOADER_USER_HELPER */ static inline int firmware_fallback_sysfs(struct firmware *fw, const char *name, struct device *device, diff --git a/drivers/base/firmware_loader/fallback_table.c b/drivers/base/firmware_loader/fallback_table.c index 46a731dede6f..4234aa5ee5df 100644 --- a/drivers/base/firmware_loader/fallback_table.c +++ b/drivers/base/firmware_loader/fallback_table.c @@ -24,7 +24,7 @@ struct firmware_fallback_config fw_fallback_config = { EXPORT_SYMBOL_NS_GPL(fw_fallback_config, FIRMWARE_LOADER_PRIVATE); #ifdef CONFIG_SYSCTL -struct ctl_table firmware_config_table[] = { +static struct ctl_table firmware_config_table[] = { { .procname = "force_sysfs_fallback", .data = &fw_fallback_config.force_sysfs_fallback, @@ -45,4 +45,22 @@ struct ctl_table firmware_config_table[] = { }, { } }; -#endif + +static struct ctl_table_header *hdr; +int register_firmware_config_sysctl(void) +{ + if (hdr) + return -EEXIST; + hdr = register_sysctl_subdir("kernel", "firmware_config", + firmware_config_table); + if (!hdr) + return -ENOMEM; + return 0; +} + +void unregister_firmware_config_sysctl(void) +{ + if (hdr) + unregister_sysctl_table(hdr); +} +#endif /* CONFIG_SYSCTL */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 58bc978d4f03..aa01f54d0442 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -217,7 +217,6 @@ extern int no_unaligned_warning; extern struct ctl_table sysctl_mount_point[]; extern struct ctl_table random_table[]; -extern struct ctl_table firmware_config_table[]; extern struct ctl_table epoll_table[]; #else /* CONFIG_SYSCTL */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 30c2d521502a..e007375c8a11 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2088,13 +2088,6 @@ static struct ctl_table kern_table[] = { .mode = 0555, .child = usermodehelper_table, }, -#ifdef CONFIG_FW_LOADER_USER_HELPER - { - .procname = "firmware_config", - .mode = 0555, - .child = firmware_config_table, - }, -#endif { .procname = "overflowuid", .data = &overflowuid, From patchwork Fri May 29 07:41:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578057 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0608692A for ; Fri, 29 May 2020 08:01:59 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB06F206F1 for ; Fri, 29 May 2020 08:01:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB06F206F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qe4E144246; Fri, 29 May 2020 08:01:49 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 318xe1ryuf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 08:01:49 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7x0BJ157673; Fri, 29 May 2020 08:01:48 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 317ds3xb05-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 08:01:48 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000ML-FP; Fri, 29 May 2020 00:55:29 -0700 Received: from userp3020.oracle.com ([156.151.31.79]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZds-0006dg-3g for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:24 -0700 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7bhDX110217 for ; Fri, 29 May 2020 07:41:23 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by userp3020.oracle.com with ESMTP id 31a9ktuhb8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:23 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7WPlt015533 for ; Fri, 29 May 2020 07:41:23 GMT Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by userp2040.oracle.com with ESMTP id 31avwbshkm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:22 +0000 Received: by mail-pj1-f66.google.com with SMTP id q9so830579pjm.2 for ; Fri, 29 May 2020 00:41:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EMTldmiu4HpdS3+bhynB06GHRs/PyLwICOClb2SLlV8=; b=ZW6dJXsksrLWWDoCaUKayKg2rIRZK8ji/Y0cewzgzItkanCmNgyhVIO/33W9LSfBSu PzLpv2gdRf9RAMvrq6m7pvDDu/uerkLU9VwaM8PNnZtqTXdkF8a3J1c/JfJVwdbzJdE6 gALIx5b46sTfvE8iCPUeDEc8iVAZgI/D4tiHoJhNYoKv1P11BBoqi2uTfX+X5lYz6r4s phZPjDYozP5ZGoZKfLtWoa5s0QuDHL2Q31dEl7hCqz2J4lY5Wq40n1kOdM942O+1bh1V rVJoEMuDkacsBkJWMSXe10s6p84h7Bt0yrtxrVC+KSpbFwC/WZqblCchgwtNX7bsg+AD jrrg== X-Gm-Message-State: AOAM532F05OF4bcS8ttxmMWsixB9tu3G3sYIP9bMXt0vIBl9pmI7XzES 7rzJBY3zJLzBp1G2kTH00Go= X-Google-Smtp-Source: ABdhPJw+tLCz0Ai55w1J/TSc/SJ1hmAb/QR0nXrNQObS7m5mw2Mpybr+mAQiJMcxaaq1sxYWrYa58A== X-Received: by 2002:a17:902:7281:: with SMTP id d1mr7887571pll.78.1590738081442; Fri, 29 May 2020 00:41:21 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id gd8sm101244pjb.28.2020.05.29.00.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id E7F0642380; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:05 +0000 Message-Id: <20200529074108.16928-11-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.216.66 X-ServerName: mail-pj1-f66.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 cotscore=-2147483648 bulkscore=0 adultscore=0 mlxlogscore=642 clxscore=236 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=111 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290058 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=899 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 10/13] eventpoll: simplify sysctl declaration with register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290063 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 cotscore=-2147483648 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1034 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 From: Xiaoming Ni Move epoll_table sysctl to fs/eventpoll.c and remove the clutter out of kernel/sysctl.c by using register_sysctl_subdir().. Signed-off-by: Xiaoming Ni Signed-off-by: Luis Chamberlain --- fs/eventpoll.c | 10 +++++++++- include/linux/poll.h | 2 -- include/linux/sysctl.h | 1 - kernel/sysctl.c | 7 ------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 12eebcdea9c8..957ebc9700e3 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -299,7 +299,7 @@ static LIST_HEAD(tfile_check_list); static long long_zero; static long long_max = LONG_MAX; -struct ctl_table epoll_table[] = { +static struct ctl_table epoll_table[] = { { .procname = "max_user_watches", .data = &max_user_watches, @@ -311,6 +311,13 @@ struct ctl_table epoll_table[] = { }, { } }; + +static void __init epoll_sysctls_init(void) +{ + register_sysctl_subdir("fs", "epoll", epoll_table); +} +#else +#define epoll_sysctls_init() do { } while (0) #endif /* CONFIG_SYSCTL */ static const struct file_operations eventpoll_fops; @@ -2422,6 +2429,7 @@ static int __init eventpoll_init(void) /* Allocates slab cache used to allocate "struct eppoll_entry" */ pwq_cache = kmem_cache_create("eventpoll_pwq", sizeof(struct eppoll_entry), 0, SLAB_PANIC|SLAB_ACCOUNT, NULL); + epoll_sysctls_init(); return 0; } diff --git a/include/linux/poll.h b/include/linux/poll.h index 1cdc32b1f1b0..a9e0e1c2d1f2 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -8,12 +8,10 @@ #include #include #include -#include #include #include #include -extern struct ctl_table epoll_table[]; /* for sysctl */ /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating additional memory. */ #ifdef __clang__ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index aa01f54d0442..e5364b69dd95 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -217,7 +217,6 @@ extern int no_unaligned_warning; extern struct ctl_table sysctl_mount_point[]; extern struct ctl_table random_table[]; -extern struct ctl_table epoll_table[]; #else /* CONFIG_SYSCTL */ static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index e007375c8a11..5c116904feb7 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -3001,13 +3001,6 @@ static struct ctl_table fs_table[] = { .proc_handler = proc_dointvec, }, #endif -#ifdef CONFIG_EPOLL - { - .procname = "epoll", - .mode = 0555, - .child = epoll_table, - }, -#endif #endif { .procname = "protected_symlinks", From patchwork Fri May 29 07:41:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578043 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27F4B17D0 for ; Fri, 29 May 2020 07:56:16 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04892207D4 for ; Fri, 29 May 2020 07:56:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04892207D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qlRf190094; Fri, 29 May 2020 07:55:31 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 316u8r8yd2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:55:30 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7r0Au108336; Fri, 29 May 2020 07:55:30 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 317ds3x36u-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:55:30 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000Mq-I1; Fri, 29 May 2020 00:55:29 -0700 Received: from userp3020.oracle.com ([156.151.31.79]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdt-0006dv-8D for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:25 -0700 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7bi9s110282 for ; Fri, 29 May 2020 07:41:25 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userp3020.oracle.com with ESMTP id 31a9ktuhbk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:24 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7f12T007546 for ; Fri, 29 May 2020 07:41:24 GMT Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by userp2030.oracle.com with ESMTP id 31akmj1bcj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:24 +0000 Received: by mail-pg1-f193.google.com with SMTP id o6so191171pgh.2 for ; Fri, 29 May 2020 00:41:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C2AME75dBsNApuZxoQz+ouSeETod/FSpHW6fOtIBoA8=; b=HxurBrxVP/yMUsekFdxpQ+2JLxgy6o27Iu0BDiHITQFIlAVT2qa+A5+nJ8qqwT6ged 4dOCeeV+5KqlV3CXqB53rxws+iFdW/LVNsgnoDkXB3Rd8ptoZgC+ADc0PaXon72LLXq1 Kl9vIJAkNWo3X7RH+Hvy9AckR6VWbmS+IQpZE+typwHaBaeTYjCZk9R/E/d/HPUw1TKH mfTpgSghlvZgUiqmxlCQPZwOUcn0xZoN9Kqg4HQe3xb5G/qsBC8cD7mUqv9ENs7jGW3l Ev+GvGm6SrCwFTocZEkCWopgB3x3IB1Gch0AYpZv+qfWDqN0kBI2KQhZDSA30fpbcepl Y9pg== X-Gm-Message-State: AOAM530LagtGjpiXb7ABz3y7JcD9V6A/m1puGsYUkq6DHKhj7AndrZ/W jh98WGOq0WWmiEePKiHlkRA= X-Google-Smtp-Source: ABdhPJxK/ukzZZOooA7TqKRX6aKFoBfWQ0FrPQYbK4i1DMtq53A2mx5D7MUo+TbjaMx4o+x/3KgfHw== X-Received: by 2002:a63:711b:: with SMTP id m27mr6911712pgc.324.1590738082579; Fri, 29 May 2020 00:41:22 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id a7sm6766024pfa.187.2020.05.29.00.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id F2CEA4238B; Fri, 29 May 2020 07:41:10 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:06 +0000 Message-Id: <20200529074108.16928-12-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.215.193 X-ServerName: mail-pg1-f193.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 clxscore=247 bulkscore=0 priorityscore=95 adultscore=0 mlxlogscore=794 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290059 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 11/13] random: simplify sysctl declaration with register_sysctl_subdir() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 priorityscore=1501 spamscore=0 cotscore=-2147483648 suspectscore=0 phishscore=0 clxscore=1034 mlxlogscore=999 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 From: Xiaoming Ni Move random_table sysctl from kernel/sysctl.c to drivers/char/random.c and use register_sysctl_subdir() to help remove the clutter out of kernel/sysctl.c. Signed-off-by: Xiaoming Ni Signed-off-by: Luis Chamberlain --- drivers/char/random.c | 14 ++++++++++++-- include/linux/sysctl.h | 1 - kernel/sysctl.c | 5 ----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index a7cf6aa65908..73fd4b6e9c18 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2101,8 +2101,7 @@ static int proc_do_entropy(struct ctl_table *table, int write, } static int sysctl_poolsize = INPUT_POOL_WORDS * 32; -extern struct ctl_table random_table[]; -struct ctl_table random_table[] = { +static struct ctl_table random_table[] = { { .procname = "poolsize", .data = &sysctl_poolsize, @@ -2164,6 +2163,17 @@ struct ctl_table random_table[] = { #endif { } }; + +/* + * rand_initialize() is called before sysctl_init(), + * so we cannot call register_sysctl_init() in rand_initialize() + */ +static int __init random_sysctls_init(void) +{ + register_sysctl_subdir("kernel", "random", random_table); + return 0; +} +device_initcall(random_sysctls_init); #endif /* CONFIG_SYSCTL */ struct batched_entropy { diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index e5364b69dd95..33a471b56345 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -216,7 +216,6 @@ extern int unaligned_dump_stack; extern int no_unaligned_warning; extern struct ctl_table sysctl_mount_point[]; -extern struct ctl_table random_table[]; #else /* CONFIG_SYSCTL */ static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 5c116904feb7..f9a35325d5d5 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2078,11 +2078,6 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = sysctl_max_threads, }, - { - .procname = "random", - .mode = 0555, - .child = random_table, - }, { .procname = "usermodehelper", .mode = 0555, From patchwork Fri May 29 07:41:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578041 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE3A617C7 for ; Fri, 29 May 2020 07:56:15 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CAF6020810 for ; Fri, 29 May 2020 07:56:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CAF6020810 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qGT2072500; Fri, 29 May 2020 07:55:31 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 318xbk9073-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:55:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7rigs183915; Fri, 29 May 2020 07:55:30 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 31a9ktuwa2-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:55:30 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000Nq-Ma; Fri, 29 May 2020 00:55:29 -0700 Received: from aserp3030.oracle.com ([141.146.126.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdw-0006eP-8U for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:28 -0700 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7d9g0051779 for ; Fri, 29 May 2020 07:41:28 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserp3030.oracle.com with ESMTP id 317ddu2he1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:27 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7ewHG007498 for ; Fri, 29 May 2020 07:41:27 GMT Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by userp2030.oracle.com with ESMTP id 31akmj1bd2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:26 +0000 Received: by mail-pl1-f194.google.com with SMTP id a13so766252pls.8 for ; Fri, 29 May 2020 00:41:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DDbHuQyYpIA+NrKXcOMmKPCGJcWzsoGwYaKrbY/Qlik=; b=BpuDCgDEdjHX3+c2mY5T2qXFi182ZybAbhZvDN3waDP9UcRm/Vgra3QckoJA6E3u9d yEpqRmmPcK5Gj8PP5eqwNfQ32A+RQ8gmeXeZ7mroLm9EYabi0rSu1B94C5M7H/xsLztO xUgjLGLX94Mjx6ZKd+oZoU35KdSIMTq9mkRTLvdVq1+qNxg7Zz01Ph6TUvR8QWJU7mYw 50L4grRk1X7rv8fP9tznlnWExgH7Zc72JGPHAZ+GaM5m6MMjT/ctp9GVcW08tMkk899N +JCjqM8vx4Ex7DbBr+WPQ7CDtMC3WFODg5P0aRBTI5jsnAt8VmMQJ8+vpFS0zJqmLHev Utlw== X-Gm-Message-State: AOAM532KBqdeQGgnExwA8AstTA6jmRE1bi8ZIo8iy5OYwD5GyjwxznD7 n6A+0wOydY/3gq1Sn4PNiu4= X-Google-Smtp-Source: ABdhPJwGzuqDcH6Vkxqbl1C5ZMUAQstwFZ+JipZBre8wnuBfBUsU2v0rs/LBQURtmvm2RkRrx2hGlQ== X-Received: by 2002:a17:90a:fe0c:: with SMTP id ck12mr973724pjb.209.1590738085315; Fri, 29 May 2020 00:41:25 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id t201sm3703652pfc.104.2020.05.29.00.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:16 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 08CEC42394; Fri, 29 May 2020 07:41:11 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:07 +0000 Message-Id: <20200529074108.16928-13-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.214.194 X-ServerName: mail-pl1-f194.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 clxscore=237 bulkscore=0 priorityscore=60 adultscore=0 mlxlogscore=871 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290059 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 12/13] sysctl: add helper to register empty subdir X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 cotscore=-2147483648 suspectscore=0 bulkscore=0 clxscore=1034 impostorscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 The way to create a subdirectory from the base set of directories is a bit obscure, so provide a helper which makes this clear, and also helps remove boiler plate code required to do this work. Signed-off-by: Luis Chamberlain Reviewed-by: Kees Cook --- include/linux/sysctl.h | 7 +++++++ kernel/sysctl.c | 16 +++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 33a471b56345..89c92390e6de 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -208,6 +208,8 @@ extern void register_sysctl_init(const char *path, struct ctl_table *table, extern struct ctl_table_header *register_sysctl_subdir(const char *base, const char *subdir, struct ctl_table *table); +extern void register_sysctl_empty_subdir(const char *base, const char *subdir); + void do_sysctl_args(void); extern int pwrsw_enabled; @@ -231,6 +233,11 @@ inline struct ctl_table_header *register_sysctl_subdir(const char *base, return NULL; } +static inline void register_sysctl_empty_subdir(const char *base, + const char *subdir) +{ +} + static inline struct ctl_table_header *register_sysctl_paths( const struct ctl_path *path, struct ctl_table *table) { diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f9a35325d5d5..460532cd5ac8 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -3188,13 +3188,17 @@ struct ctl_table_header *register_sysctl_subdir(const char *base, { } }; - if (!table->procname) + if (table != sysctl_mount_point && !table->procname) goto out; hdr = register_sysctl_table(base_table); if (unlikely(!hdr)) { - pr_err("failed when creating subdirectory sysctl %s/%s/%s\n", - base, subdir, table->procname); + if (table != sysctl_mount_point) + pr_err("failed when creating subdirectory sysctl %s/%s/%s\n", + base, subdir, table->procname); + else + pr_err("failed when creating empty subddirectory %s/%s\n", + base, subdir); goto out; } kmemleak_not_leak(hdr); @@ -3202,6 +3206,12 @@ struct ctl_table_header *register_sysctl_subdir(const char *base, return hdr; } EXPORT_SYMBOL_GPL(register_sysctl_subdir); + +void register_sysctl_empty_subdir(const char *base, + const char *subdir) +{ + register_sysctl_subdir(base, subdir, sysctl_mount_point); +} #endif /* CONFIG_SYSCTL */ /* * No sense putting this after each symbol definition, twice, From patchwork Fri May 29 07:41:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11578035 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5638914C0 for ; Fri, 29 May 2020 07:56:14 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2E530207D4 for ; Fri, 29 May 2020 07:56:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E530207D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7qBKk072478; Fri, 29 May 2020 07:55:31 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 318xbk9074-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 07:55:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7rhYQ183875; Fri, 29 May 2020 07:55:30 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 31a9ktuwa5-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Fri, 29 May 2020 07:55:30 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZrV-0000OL-Ok; Fri, 29 May 2020 00:55:29 -0700 Received: from aserp3030.oracle.com ([141.146.126.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jeZdx-0006ed-Dh for ocfs2-devel@oss.oracle.com; Fri, 29 May 2020 00:41:29 -0700 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7d84c051707 for ; Fri, 29 May 2020 07:41:29 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp3030.oracle.com with ESMTP id 317ddu2hej-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 May 2020 07:41:29 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04T7WNux015288 for ; Fri, 29 May 2020 07:41:28 GMT Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by userp2040.oracle.com with ESMTP id 31avwbshmg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 29 May 2020 07:41:28 +0000 Received: by mail-pl1-f196.google.com with SMTP id x10so770591plr.4 for ; Fri, 29 May 2020 00:41:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1PG5LVb0n4wOO6VZREoyBILeBAzco+IYNIeDXsX/FzY=; b=iavm7YDxK/7ZqHAVuYBvGiwWrt4+qMFgie1Dl4XwoLS6AvZ5vMTk6Q5oOwGmvGPvhb xzJ7hTLdJdUhy9CNkC3v+SIy08ZwZrmlQH9rL1D9vdYvRqfFmpyQk8uIclub8KH5641r rLi2RM0pLewDL/O9KloU9m7rX5zHSdG7NzRw+u4O8nguh/Irt1T1NjwW5i3B0hTuKns4 SDTHxIWYn3xUcbOdvfTlfkhxgWEmuWOK3fpNAmsEmT3HyNwNEWgDenZcRicN2xa1Yf53 P2I6j4xK/W5TjBhoOTIRnNPjUhwf7ah/2bUD92Yu64+eeF9gNQXfdFaiY2KwligwyIbj MeYA== X-Gm-Message-State: AOAM531B7NCY1tdPBNF+fiOzYLtP7rUyrQNc324ji5nBK11H3SKZTv46 +DQp/V2BkmG4GP6dFTbStHc= X-Google-Smtp-Source: ABdhPJxM98lxrupu0HzIVHkaILQ2GJoC5HA3ATmBk5nOeI56XgjTlxA112dIBe6io3Hl67zR6z+BjQ== X-Received: by 2002:a17:90a:db0c:: with SMTP id g12mr7872171pjv.5.1590738086768; Fri, 29 May 2020 00:41:26 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id q21sm919935pfn.209.2020.05.29.00.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 00:41:25 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 13BC8423BF; Fri, 29 May 2020 07:41:11 +0000 (UTC) From: Luis Chamberlain To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz, amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu Date: Fri, 29 May 2020 07:41:08 +0000 Message-Id: <20200529074108.16928-14-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org> References: <20200529074108.16928-1-mcgrof@kernel.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 209.85.214.196 X-ServerName: mail-pl1-f196.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 cotscore=-2147483648 bulkscore=0 adultscore=0 mlxlogscore=999 clxscore=237 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=90 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290058 X-Spam: Clean X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290060 X-Mailman-Approved-At: Fri, 29 May 2020 00:55:28 -0700 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr, Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 13/13] fs: move binfmt_misc sysctl to its own file X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9635 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 cotscore=-2147483648 suspectscore=0 bulkscore=0 clxscore=1034 impostorscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290062 This moves the binfmt_misc sysctl to its own file to help remove clutter from kernel/sysctl.c. Signed-off-by: Luis Chamberlain --- fs/binfmt_misc.c | 1 + kernel/sysctl.c | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index f69a043f562b..656b3f5f3bbf 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -821,6 +821,7 @@ static int __init init_misc_binfmt(void) int err = register_filesystem(&bm_fs_type); if (!err) insert_binfmt(&misc_format); + register_sysctl_empty_subdir("fs", "binfmt_misc"); return err; } diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 460532cd5ac8..7714e7b476c2 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -3042,13 +3042,6 @@ static struct ctl_table fs_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_TWO, }, -#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) - { - .procname = "binfmt_misc", - .mode = 0555, - .child = sysctl_mount_point, - }, -#endif { .procname = "pipe-max-size", .data = &pipe_max_size,