From patchwork Tue Dec 5 14:05:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Becker X-Patchwork-Id: 10092979 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 58EF36035E for ; Tue, 5 Dec 2017 14:06:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EA9428C94 for ; Tue, 5 Dec 2017 14:06:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 439092947B; Tue, 5 Dec 2017 14:06:50 +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 EFA2E28C94 for ; Tue, 5 Dec 2017 14:06:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753006AbdLEOGi (ORCPT ); Tue, 5 Dec 2017 09:06:38 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:41247 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752974AbdLEOFg (ORCPT ); Tue, 5 Dec 2017 09:05:36 -0500 Received: by mail-qt0-f194.google.com with SMTP id i40so864057qti.8; Tue, 05 Dec 2017 06:05:36 -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=o7uJIKxEmwozdvSyAPAezB4/1m/UNNvUqG0YL3ZiHG8=; b=gRI9U9hNkAViHe21to5cTwGj9pqRRQtt9peJAtlAVL38kJlpmnhdTrxm3cTnZM7RoY /gNb2KZaa2k35MyrzvOdaRAYGcmMMoH0INriof7ODwnq+2YHkUntX/2U58kHPIRVsPw6 UlO8nBTaxRiskkIF8rveZagUy4K/yk1F/9/aqgpwszgk7ZOzlTfBiMuEV7++ggpEedx1 r88Y1mf0GOuVgjkXsOJxLbMTsvbYM4b9GtyGZsQnWuvOmKvtwlG2QKNthQ07ubSGIvjv kYCuVOdEitxqHccu0rzmqDeH3ZplTd5JK25SmkwsGwLKF2JcbqCVH5yhFz3h3OlXbJ1T TEbQ== 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=o7uJIKxEmwozdvSyAPAezB4/1m/UNNvUqG0YL3ZiHG8=; b=ADMUAAlXb3W5vR6wHafl5yj+5sZasxwckrwQa7Tw3j8sYElfafzItLNKY9xj6syqW7 sz2w6d4jAmJrK/68jSoVYidim0xwJMVmgFvFGlPj8oNB5ELsocmQTqPWpKHje5j4+rYN rB5TnQQEgN3jTdboRuFhczqM/jyBkj8/ezM+UkoGOrG0SQI/xL3WErxhfWUoteCqF7WR UZsQbVaPdRv8sRm+WJtoEXj2EkHq5peHvT1skkerXXbAuxgFEKo5WiVcWXymowjs6ANh sDYuSKOxVYpVdHLNfwJn1QOZUf6B7jKix1+07LXSNbpX+SNH83W2bBeSPQAgWywr3gLX xo2w== X-Gm-Message-State: AKGB3mIWviICClkTfVvIPapIQJUmpAxdCEkOkwtBNZ+i3YAl8KEp2Xsm 2DhfFfX6oJBafpoqosZ71w== X-Google-Smtp-Source: AGs4zMYrm0MzkRCO5jsd6nonRf14FZ8qUAWcwTqOaRVsU3j+6SUwBrCRZMPm8bTkso3yuH02agEC3Q== X-Received: by 10.237.63.121 with SMTP id q54mr2309685qtf.337.1512482736050; Tue, 05 Dec 2017 06:05:36 -0800 (PST) Received: from tbecker-rhat.redhat.com ([201.37.68.249]) by smtp.googlemail.com with ESMTPSA id f5sm148437qte.87.2017.12.05.06.05.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 06:05:35 -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: Tue, 5 Dec 2017 12:05:10 -0200 Message-Id: <20171205140512.13349-2-thiago.becker@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171205140512.13349-1-thiago.becker@gmail.com> References: <20171130130457.11429-1-thiago.becker@gmail.com> <20171205140512.13349-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 *); /* * 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)