From patchwork Thu Nov 30 13:04:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Becker X-Patchwork-Id: 10084841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 39A0D60234 for ; Thu, 30 Nov 2017 13:06:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2955029F99 for ; Thu, 30 Nov 2017 13:06:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E33329FA5; Thu, 30 Nov 2017 13:06:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB1BF29F99 for ; Thu, 30 Nov 2017 13:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752176AbdK3NGq (ORCPT ); Thu, 30 Nov 2017 08:06:46 -0500 Received: from mail-qk0-f196.google.com ([209.85.220.196]:35883 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751929AbdK3NGp (ORCPT ); Thu, 30 Nov 2017 08:06:45 -0500 Received: by mail-qk0-f196.google.com with SMTP id t187so8705564qkh.3; Thu, 30 Nov 2017 05:06:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u+/JPatdhUlra+t4p6rJMiGv6kcz+j5Pp89/ZII2QuE=; b=ujM07cqKXeRQ6r5Hbz7bk2cHElqU7expRiLFcZ5CKjnrD/eWANf2HJT0KScAONccyz 61RsWNkaJQJn7rRgxRIPMfnNS1tdk54hF1gDwARMSAL28PZNngLnUfXtesNxvK978aqP lsUliRq+QdcDTV4fv/eoKijYH6Mqd0bFt0YU4RT3Zse+qC9w3A7DFjdWXy/IGkRvlwcF Wpp98LHFY5IO7n6Qyc3K+12Tk4NwdGBWpcuKqFZXl0y85nHvd2p2gUAFx2eSXLAyJxQt 1TPPLPrA0anr4nu+rvi4ZXyrAjNcvonalph6BcRqSEBFsrvCPspsRtprv+yRvK6Qln8g /DPw== 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; bh=u+/JPatdhUlra+t4p6rJMiGv6kcz+j5Pp89/ZII2QuE=; b=uQ19Mpq7Ecv7TnjD62XgkQES8uKuuFHQ7AORX9/WULQHPPSTy6VbdWZzzWCfEqez+6 Jp+PVWl4G4l1duexOY7U9PHUWeM/6S32fOGHV5gQ4JlINm3xITW6JUpkJJv6O3YIgPPJ raVNyxwzIdP6PQby/udmsHiideRhv5rtZhllmIMytEF6cojNdPFA5yhBagx+tV/3uPwD hN9RwylIw9LGHJhL9Y810hPl5jqKjKsUX4pcnYpQOEq76cDmLI5ThmoCVq0STxtNW21Y mwrUnODsdt7gBmodId0+c66R5zaTyQs41wgfGlf/xgQVgCVsuT2cfEKtcx87kjtZboq/ w1uw== X-Gm-Message-State: AKGB3mLdU6LT1OVKRrnsMTqlkkj+4SdDrnYcTKwHByGg3IqNtucgFrHg wEIUcmPlxnEOZrIqUEeKErVXYhMLSA== X-Google-Smtp-Source: AGs4zMbaOFCVNXnBWWhBLI6RRcvcmbWaGJED7frWXR8OIUT9go92nwvLM0ioAzUxzlclVhIlHtelPQ== X-Received: by 10.55.71.5 with SMTP id u5mr2361582qka.166.1512047204281; Thu, 30 Nov 2017 05:06:44 -0800 (PST) Received: from tbecker-rhat.redhat.com ([189.7.118.40]) by smtp.googlemail.com with ESMTPSA id c72sm2862490qka.31.2017.11.30.05.06.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 05:06:43 -0800 (PST) From: Thiago Rafael Becker To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Thiago Rafael Becker Subject: [PATCH 1/3, V2] kernel: make groups_sort globally visible Date: Thu, 30 Nov 2017 11:04:55 -0200 Message-Id: <20171130130457.11429-2-thiago.becker@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171130130457.11429-1-thiago.becker@gmail.com> References: <20171130130457.11429-1-thiago.becker@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation to move group_info sorting to the caller, make group_sort globally visible. Signed-off-by: Thiago Rafael Becker --- include/linux/cred.h | 1 + kernel/groups.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/cred.h b/include/linux/cred.h index 099058e..6312865 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -83,6 +83,7 @@ extern int set_current_groups(struct group_info *); extern void set_groups(struct cred *, struct group_info *); extern int groups_search(const struct group_info *, kgid_t); extern bool may_setgroups(void); +extern void groups_sort(struct group_info *group_info); /* * The security context of a task diff --git a/kernel/groups.c b/kernel/groups.c index e357bc8..4c9c9ed 100644 --- a/kernel/groups.c +++ b/kernel/groups.c @@ -86,11 +86,13 @@ static int gid_cmp(const void *_a, const void *_b) return gid_gt(a, b) - gid_lt(a, b); } -static void groups_sort(struct group_info *group_info) +void groups_sort(struct group_info *group_info) { sort(group_info->gid, group_info->ngroups, sizeof(*group_info->gid), gid_cmp, NULL); } +EXPORT_SYMBOL(groups_sort); + /* a simple bsearch */ int groups_search(const struct group_info *group_info, kgid_t grp)