afs: Make ONEGROUP_ENV not Linux-specific

The functionality in AFS_LINUX26_ONEGROUP_ENV does not really need to
be Linux-specific (it's just only implemented for Linux right now).
Rename it to AFS_PAG_ONEGROUP_ENV, and remove some Linux-specific
checks when checking for "onegroup" PAG GIDs.

[mmeffie@sinenomine.net: Move AFS_PAG_ONEGROUP_ENV to param.h]

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

Change-Id: Ifef8f833599eca4241b41035142e74f32e6efa99
Reviewed-on: https://gerrit.openafs.org/12525
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Andrew Deason 2015-08-08 16:13:54 -05:00 committed by Stephan Wiesand
parent 4097d8c44c
commit 4096ee7a75
8 changed files with 18 additions and 17 deletions

View File

@ -26,7 +26,7 @@
#include "afs/nfsclient.h"
#include "osi_compat.h"
#ifdef AFS_LINUX26_ONEGROUP_ENV
#ifdef AFS_PAG_ONEGROUP_ENV
static afs_uint32
afs_linux_pag_from_groups(struct group_info *group_info) {

View File

@ -15,11 +15,6 @@
#ifndef OSI_MACHDEP_H_
#define OSI_MACHDEP_H_
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
# define AFS_LINUX26_ONEGROUP_ENV 1
#endif
/* Only needed for xdr.h in glibc 2.1.x */
#ifndef quad_t
# define quad_t __quad_t

View File

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

View File

@ -382,7 +382,7 @@ afs_setpag_val(int pagval)
return (code);
}
#ifndef AFS_LINUX26_ONEGROUP_ENV
#ifndef AFS_PAG_ONEGROUP_ENV
int
afs_getpag_val(void)
{
@ -535,7 +535,7 @@ afs_DestroyReq(struct vrequest *av)
}
}
#ifndef AFS_LINUX26_ONEGROUP_ENV
#ifndef AFS_PAG_ONEGROUP_ENV
afs_uint32
afs_get_pag_from_groups(gid_t g0a, gid_t g1a)
{
@ -582,7 +582,8 @@ afs_get_groups_from_pag(afs_uint32 pag, gid_t * g0p, gid_t * g1p)
*g1p = g1 + 0x3f00;
}
#else
void afs_get_groups_from_pag(afs_uint32 pag, gid_t *g0p, gid_t *g1p)
void
afs_get_groups_from_pag(afs_uint32 pag, gid_t *g0p, gid_t *g1p)
{
AFS_STATCNT(afs_get_groups_from_pag);
*g0p = pag;

View File

@ -4561,7 +4561,7 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
newcred->cr_groupset.gs_union.un_groups[0] = g0;
newcred->cr_groupset.gs_union.un_groups[1] = g1;
#elif defined(AFS_LINUX26_ENV)
# ifdef AFS_LINUX26_ONEGROUP_ENV
# ifdef AFS_PAG_ONEGROUP_ENV
afs_set_cr_group_info(newcred, groups_alloc(1)); /* nothing sets this */
l = (((g0-0x3f00) & 0x3fff) << 14) | ((g1-0x3f00) & 0x3fff);
h = ((g0-0x3f00) >> 14);

View File

@ -817,14 +817,14 @@ ktc_curpag(void)
afs_uint32 g0, g1;
afs_uint32 h, l, ret;
int ngroups;
#ifdef AFS_LINUX26_ENV
#ifdef AFS_PAG_ONEGROUP_ENV
int i;
#endif
ngroups = getgroups(sizeof groups / sizeof groups[0], groups);
#ifdef AFS_LINUX26_ENV
/* check for AFS_LINUX26_ONEGROUP_ENV PAGs */
#ifdef AFS_PAG_ONEGROUP_ENV
/* Check for one-group PAGs. */
for (i = 0; i < ngroups; i++) {
if (((groups[i] >> 24) & 0xff) == 'A') {
return groups[i];

View File

@ -13,6 +13,8 @@
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
#include <linux/version.h>
#define AFS_LINUX20_ENV 1
#define AFS_LINUX22_ENV 1
#define AFS_LINUX24_ENV 1
@ -28,6 +30,9 @@
#define AFS_USERSPACE_IP_ADDR 1
#define RXK_LISTENER_ENV 1
#define AFS_GCPAGS 1 /* Set to Userdisabled, allow sysctl to override */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
# define AFS_PAG_ONEGROUP_ENV 1
#endif
#define AFS_HAVE_FFS 1 /* Use system's ffs */
#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */
#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */

View File

@ -133,7 +133,7 @@ os_haspag(void)
gid_t *groups;
afs_uint32 g0, g1;
afs_uint32 h, l, pag;
# ifdef AFS_LINUX26_ENV
# ifdef AFS_PAG_ONEGROUP_ENV
int i;
# endif
@ -143,8 +143,8 @@ os_haspag(void)
return 0;
ngroups = getgroups(ngroups, groups);
/* Check for AFS_LINUX26_ONEGROUP_ENV PAGs. */
# ifdef AFS_LINUX26_ENV
/* Check for one-group PAGs. */
# ifdef AFS_PAG_ONEGROUP_ENV
for (i = 0; i < ngroups; i++)
if (((groups[i] >> 24) & 0xff) == 'A') {
free(groups);