From patchwork Mon Nov 21 09:46:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 23625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1482801wrr; Mon, 21 Nov 2022 01:50:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf53Bqb+8+rNa8dvih9zE9k2SSWHQqWTfqIVoIZz7XCqu8r761h/8ugbmj/ZhKjj2351RV9z X-Received: by 2002:a05:6402:3785:b0:461:e598:e0bb with SMTP id et5-20020a056402378500b00461e598e0bbmr15702702edb.21.1669024205802; Mon, 21 Nov 2022 01:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669024205; cv=none; d=google.com; s=arc-20160816; b=uOI5ts8Dd1nsHio5itzNsDFb1UV3DzwifjvodzofxTbaKpPTHbvGlLj7R/Rk4ru6tj HZ0ERjzUnqshf8Q8hklZ8I/BDAvG5cRHlKahuSY9bnnayW/CyxdV64AFq2+rk+Q8OOyg nXnAs9v8e8ibXvPB5aVX5BaiWJSvdjwTdRLzxHsD2N6mnrUXvkjS3ib+JpZCVaDpUa6G ONt4q2albAw0Qb1SD3dTHS9Hl1A1X5n/pfaFGVABAsQgZbBYIiL1wMk24nWHs68r/FQo UB+1cfxPnMOx99dzIegPKveV6E/0TGDyFbKuGNzq8Cs0tmGQZhvQ8+UrIZcB6Nytbf1J EfpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zyri+SBuvgKDYuFX7dN7KbRKRyv5O0A4/sXcofl/3vg=; b=csmLJODU0zWLHX7GI/T1T/EZm/VRXyPVeZc/jqWB6MeCAxjRS3vsng2ujyMctrUf8R 8he8KCnP9AHFyIxKiVGv5ZrP+N9gq8g3bjwGEDcTrljFhApqg/zw42hyovYGQ5twA71E Qk5Gk2w0f1kVlH74NP/dtm8nWk+rJthwIt0a5l3GvjwZqC2mDCbDYF03JeViWi7AVmNL YgNR29tXtAJ1kFIsx1kk0qJF7JktYutHkC4+NncxHJX+sepR/wgxc+3n1WmomAiyNpaH C6xeOdNH9SGPyWeC5RzQLoEQ2QkLwGcPA5OmyY33FF/H6ohzZC7CCi7qDMayRQRCbJQi IQqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PbmKzyJA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xj10-20020a170906db0a00b007ae286f26b1si9700147ejb.620.2022.11.21.01.49.41; Mon, 21 Nov 2022 01:50:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PbmKzyJA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbiKUJrS (ORCPT + 99 others); Mon, 21 Nov 2022 04:47:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230442AbiKUJq7 (ORCPT ); Mon, 21 Nov 2022 04:46:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E35C97EF7 for ; Mon, 21 Nov 2022 01:46:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D6C18B80DA1 for ; Mon, 21 Nov 2022 09:46:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD76DC43470; Mon, 21 Nov 2022 09:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669024015; bh=6RxV4EYuvPy7DNNaTcdLjKBIoSdpfXyaOictufStsKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbmKzyJAiZMH7k7Ui8IWm/NFM8pw2iSgk6LI0XsRucF7hljmIqkn4GSUwdETomb0l Wg6XScVHiv7Fb+QE71vFie6vBY8Bu7iJ7yMEfLfuT+N3x4th6qIYkxSP3DVzJfF+K/ KO21tfF5x4P2mFlkLtCOoqmjRv0LoP5RfZjrOCQQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: [PATCH 2/5] kobject: make kobject_namespace take a const * Date: Mon, 21 Nov 2022 10:46:46 +0100 Message-Id: <20221121094649.1556002-2-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221121094649.1556002-1-gregkh@linuxfoundation.org> References: <20221121094649.1556002-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3049; i=gregkh@linuxfoundation.org; h=from:subject; bh=6RxV4EYuvPy7DNNaTcdLjKBIoSdpfXyaOictufStsKc=; b=owGbwMvMwCRo6H6F97bub03G02pJDMnVnhynp5UXFyktfsL8qoJxXdzrC3ydl/peF1YZXV7z6NK/ MO78jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIzwmGBceilz0Q+lb9eNX7TT8sO/ KWLlWsXcEwv8jo8vRHv4vdjby+31SYtl3PaP7nnQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750098725356219791?= X-GMAIL-MSGID: =?utf-8?q?1750098725356219791?= kobject_namespace() should take a const *kobject as it does not modify the kobject passed to it. Change that, and the functions kobj_child_ns_ops() and kobj_ns_ops() needed to also be changed to const *. Cc: "Rafael J. Wysocki" Signed-off-by: Greg Kroah-Hartman Acked-by: Rafael J. Wysocki --- include/linux/kobject.h | 2 +- include/linux/kobject_ns.h | 4 ++-- lib/kobject.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/kobject.h b/include/linux/kobject.h index d978dbceb50d..5a2d58e10bf5 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -112,7 +112,7 @@ extern struct kobject * __must_check kobject_get_unless_zero( struct kobject *kobj); extern void kobject_put(struct kobject *kobj); -extern const void *kobject_namespace(struct kobject *kobj); +extern const void *kobject_namespace(const struct kobject *kobj); extern void kobject_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid); extern char *kobject_get_path(const struct kobject *kobj, gfp_t flag); diff --git a/include/linux/kobject_ns.h b/include/linux/kobject_ns.h index 2b5b64256cf4..be707748e7ce 100644 --- a/include/linux/kobject_ns.h +++ b/include/linux/kobject_ns.h @@ -47,8 +47,8 @@ struct kobj_ns_type_operations { int kobj_ns_type_register(const struct kobj_ns_type_operations *ops); int kobj_ns_type_registered(enum kobj_ns_type type); -const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent); -const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj); +const struct kobj_ns_type_operations *kobj_child_ns_ops(const struct kobject *parent); +const struct kobj_ns_type_operations *kobj_ns_ops(const struct kobject *kobj); bool kobj_ns_current_may_mount(enum kobj_ns_type type); void *kobj_ns_grab_current(enum kobj_ns_type type); diff --git a/lib/kobject.c b/lib/kobject.c index 26e744a46d24..6e0bf03f4f36 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -25,7 +25,7 @@ * and thus @kobj should have a namespace tag associated with it. Returns * %NULL otherwise. */ -const void *kobject_namespace(struct kobject *kobj) +const void *kobject_namespace(const struct kobject *kobj) { const struct kobj_ns_type_operations *ns_ops = kobj_ns_ops(kobj); @@ -1039,7 +1039,7 @@ int kobj_ns_type_registered(enum kobj_ns_type type) return registered; } -const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent) +const struct kobj_ns_type_operations *kobj_child_ns_ops(const struct kobject *parent) { const struct kobj_ns_type_operations *ops = NULL; @@ -1049,7 +1049,7 @@ const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent) return ops; } -const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj) +const struct kobj_ns_type_operations *kobj_ns_ops(const struct kobject *kobj) { return kobj_child_ns_ops(kobj->parent); }