afs: define NUMPAGGROUPS once

Define the number of groups per PAG in one place.  Prefix the define
with AFS_ to avoid name conflicts in the future (unlikely as it may be).

Fix the misnamed AFSPAGGGROUPS symbol in linux implementation of two
groups per PAG.

Reviewed-on: https://gerrit.openafs.org/12382
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit b39095c3a7e1c631bb17816b7e707bc21a6b8c71)

Change-Id: I8e0531e9a7e2fc1f3d1eb8255c75ecd758dbce9a
Reviewed-on: https://gerrit.openafs.org/12524
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Michael Meffie 2016-09-09 16:23:46 -04:00 committed by Stephan Wiesand
parent d102a911ce
commit 4097d8c44c
3 changed files with 11 additions and 14 deletions

View File

@ -27,14 +27,13 @@
#include "osi_compat.h"
#ifdef AFS_LINUX26_ONEGROUP_ENV
# define NUMPAGGROUPS 1
static afs_uint32
afs_linux_pag_from_groups(struct group_info *group_info) {
afs_uint32 g0 = 0;
afs_uint32 i;
if (group_info->ngroups < NUMPAGGROUPS)
if (group_info->ngroups < AFS_NUMPAGGROUPS)
return NOPAG;
for (i = 0; i < group_info->ngroups; i++) {
@ -54,7 +53,7 @@ afs_linux_pag_to_groups(afs_uint32 newpag,
afs_kgid_t newkgid = afs_make_kgid(newpag);
if (afs_linux_pag_from_groups(old) == NOPAG)
need_space = NUMPAGGROUPS;
need_space = AFS_NUMPAGGROUPS;
*new = groups_alloc(old->ngroups + need_space);
@ -75,12 +74,11 @@ afs_linux_pag_to_groups(afs_uint32 newpag,
}
#else
# define NUMPAGGROUPS 2
static inline afs_uint32
afs_linux_pag_from_groups(struct group_info *group_info) {
if (group_info->ngroups < NUMPAGGROUPS)
if (group_info->ngroups < AFS_NUMPAGGROUPS)
return NOPAG;
return afs_get_pag_from_groups(GROUP_AT(group_info, 0), GROUP_AT(group_info, 1));
@ -95,7 +93,7 @@ afs_linux_pag_to_groups(afs_uint32 newpag,
gid_t g1;
if (afs_linux_pag_from_groups(old) == NOPAG)
need_space = NUMPAGGGROUPS;
need_space = AFS_NUMPAGGROUPS;
*new = groups_alloc(old->ngroups + need_space);

View File

@ -448,4 +448,10 @@ extern afs_ucred_t afs_osi_cred, *afs_osi_credp;
#define osi_curcred() (u.u_cred)
#endif
#ifdef AFS_LINUX26_ONEGROUP_ENV
#define AFS_NUMPAGGROUPS 1
#else
#define AFS_NUMPAGGROUPS 2
#endif
#endif /* _AFS_OSI_ */

View File

@ -42,13 +42,6 @@ afs_uint32 pagCounter = 1;
afs_uint32 pagCounter = 0;
#endif /* UKERNEL */
#ifdef AFS_LINUX26_ONEGROUP_ENV
#define NUMPAGGROUPS 1
#else
#define NUMPAGGROUPS 2
#endif
/* Local variables */
/*
* Pags are implemented as follows: the set of groups whose long
* representation is '41XXXXXX' hex are used to represent the pags.
@ -633,7 +626,7 @@ osi_get_group_pag(afs_ucred_t *cred)
if (cred->cr_ngrps < 2)
return NOPAG;
# elif defined(AFS_LINUX26_ENV)
if (afs_cr_group_info(cred)->ngroups < NUMPAGGROUPS)
if (afs_cr_group_info(cred)->ngroups < AFS_NUMPAGGROUPS)
return NOPAG;
# elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_XBSD_ENV)
# if defined(AFS_SUN510_ENV)