From patchwork Mon Dec 4 19:03:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Becker X-Patchwork-Id: 10091351 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 48D0160327 for ; Mon, 4 Dec 2017 19:04:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A301290AA for ; Mon, 4 Dec 2017 19:04:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E12A290FA; Mon, 4 Dec 2017 19:04:41 +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 DC77E290AA for ; Mon, 4 Dec 2017 19:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752642AbdLDTEG (ORCPT ); Mon, 4 Dec 2017 14:04:06 -0500 Received: from mail-ua0-f193.google.com ([209.85.217.193]:35697 "EHLO mail-ua0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752599AbdLDTD6 (ORCPT ); Mon, 4 Dec 2017 14:03:58 -0500 Received: by mail-ua0-f193.google.com with SMTP id l2so13284447uak.2; Mon, 04 Dec 2017 11:03:58 -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=EhteFTbpIApbu0ySQN+Y95EmP6huUgwBVCeECzoawWMs53owEd+1HJTWxyT5UHXZqJ K8JjIK7whC0rXBiecJ+7UjTDS7sLFU8cuAiHlDMkjZPEJZbh5JXtZ/dKbMggroqxQRT3 BW5/wRmbBCpg424dp9/rpVgrae+f4xsNVNj21Ct5YnAveBQNjGagKTPy8cxCiWduU6SC JZ4ijsdFCZScpM7CzxAn/OuLTR3KxaRmLo+C3MyMHcXYRi1q9fF9PdLHJMnIXP2AtBdB SGg1h5HXBSNxaZZR9BvoniKypq2ePVRBl+LLwAEEUYiQto3SH4xKzEGm4q7DdRohgaMG 9afg== 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=IbOwgUReET63aIbPI/8rRlvMsAyIWM7VShJJjBgAE1ryYzppCbetsKL3DFaW/9XU15 lYfuFk0CqV7JrNxkTObKYAUlSYh7lEJavbVsgMD9qECQLQ/r1G/GIC6+spv9cCPNCVdm QrAhph2c8AuSBnxUTnz9Yq175rM0wH7Y2/bRMONNKQxpBIJYoGkzvSSIIRgorD+0Sd+V xIN+PGhCa/5vVd3Ig/iwYXZCElDL7c2KbFulx7DyR9rObcPdepClewjAcwGEFREBEBSq 2L+M7Tp2lledLBpq/UJjeu0vyWu4AuX1aMgvslrtShWvNfuyNkx33KNBbHIxvj5x16Q0 SkZA== X-Gm-Message-State: AKGB3mKiH4ou34OqBBzOmrjlU1Ziyfu+YZf1NdXPkZCYWsYU3lNx5ET0 QUqErAzBlYw7UfU88REwORzXejLchA== X-Google-Smtp-Source: AGs4zMa5vF+0JOjJrL3DdeW2j2AFc4Cw93ZVbQl80cXXcr3Yo/1rjAKG98jsB6tS6Cp8vyVYECw/Fg== X-Received: by 10.176.2.116 with SMTP id 107mr105777uas.8.1512414237989; Mon, 04 Dec 2017 11:03:57 -0800 (PST) Received: from tbecker-rhat.redhat.com ([201.37.68.249]) by smtp.googlemail.com with ESMTPSA id o12sm2941797uaj.10.2017.12.04.11.03.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Dec 2017 11:03:57 -0800 (PST) From: Thiago Rafael Becker To: bfields@fieldses.org, neilb@suse.com Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Thiago Rafael Becker Subject: [PATCH 1/3, v3] kernel: make groups_sort globally visible Date: Mon, 4 Dec 2017 17:03:22 -0200 Message-Id: <20171204190324.6629-2-thiago.becker@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171204190324.6629-1-thiago.becker@gmail.com> References: <20171204190324.6629-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)