[555] in arla-drinkers
Patch for transarc initgroups behavior and xfs_set_pag(part_one,p
daemon@ATHENA.MIT.EDU (Neulinger, Nathan R.)
Tue Feb 2 17:46:29 1999
From owner-arla-drinkers@stacken.kth.se Tue Feb 02 22:46:28 1999
Return-Path: <owner-arla-drinkers@stacken.kth.se>
Delivered-To: arla-drinkers-mtg@bloom-picayune.mit.edu
Received: (qmail 18644 invoked from network); 2 Feb 1999 22:46:26 -0000
Received: from unknown (HELO sundance.stacken.kth.se) (130.237.234.41)
by bloom-picayune.mit.edu with SMTP; 2 Feb 1999 22:46:26 -0000
Received: (from majordom@localhost)
by sundance.stacken.kth.se (8.8.8/8.8.8) id XAA11530
for arla-drinkers-list; Tue, 2 Feb 1999 23:37:51 +0100 (MET)
Received: from umr.edu (hermes.cc.umr.edu [131.151.1.68])
by sundance.stacken.kth.se (8.8.8/8.8.8) with ESMTP id XAA11526
for <arla-drinkers@stacken.kth.se>; Tue, 2 Feb 1999 23:37:44 +0100 (MET)
Received: from umr-mail01.cc.umr.edu (umr-mail01.cc.umr.edu [131.151.37.121]) via ESMTP by hermes.cc.umr.edu (8.8.7/R.4.20) id QAA07949; Tue, 2 Feb 1999 16:37:42 -0600 (CST)
Received: by umr-mail01.cc.umr.edu with Internet Mail Service (5.5.2232.9)
id <D9V03L7Y>; Tue, 2 Feb 1999 16:37:42 -0600
Message-ID: <9DA8D24B915BD1118911006094516EAF019C7EB5@umr-mail02.cc.umr.edu>
From: "Neulinger, Nathan R." <nneul@umr.edu>
To: "'arla-drinkers@stacken.kth.se'" <arla-drinkers@stacken.kth.se>
Subject: Patch for transarc initgroups behavior and xfs_set_pag(part_one,p
art_two) call
Date: Tue, 2 Feb 1999 16:37:39 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2232.9)
Content-Type: multipart/mixed;
boundary="----_=_NextPart_000_01BE4EFC.A5260760"
Sender: owner-arla-drinkers@stacken.kth.se
Precedence: bulk
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01BE4EFC.A5260760
Content-Type: text/plain;
charset="ISO-8859-1"
The attached patch provides support for Transarc style setgroups() behavior.
Basically, the PAG is preserved across a setgroups() system call. This patch
is linux specific, but should be VERY easy to apply to the other
architecture's xfs sources.
Granted, some people don't depend or need this behavior, but some do, and
this takes the client one step closer to being compatible with Transarc's.
Description of changes:
Split xfs_setpag_call into xfs_setpag_call and xfs_set_pag
xfs_set_pag sets the current pag without affecting
pag_part_*
xfs_setpag_call calls xfs_set_pag and does the pag_part_*
changes
Changed sys_call_routine to afs_sys_call_routine
Changed sys_call_table to be a void *array (more appropriate)
Added setgroups_sys_call_routine typedef
Added pag_setgroups routine
Updated install_afs_syscall and remove_afs_syscall routines to also
do setgroups.
All setgroups code is #if defined(WITH_PAG_SETGROUPS), the other code
changes should not have any effect.
I hope to see this in the next release! :)
-- Nathan
------------------------------------------------------------
Nathan Neulinger EMail: nneul@umr.edu
University of Missouri - Rolla Phone: (573) 341-4841
Computing Services Fax: (573) 341-4216
------_=_NextPart_000_01BE4EFC.A5260760
Content-Type: application/octet-stream;
name="pag-setgroups-diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="pag-setgroups-diff"
Content-Location: ATT-0-E11F2D51E7BAD211BE01006094517AC7-P
AG-S%7EA1
diff -u -r arla-0.21/xfs/linux/xfs_syscalls.c =
arla-0.21-patched/xfs/linux/xfs_syscalls.c=0A=
--- arla-0.21/xfs/linux/xfs_syscalls.c Sun Jan 24 16:53:56 1999=0A=
+++ arla-0.21-patched/xfs/linux/xfs_syscalls.c Tue Feb 2 16:24:55 =
1999=0A=
@@ -51,6 +51,11 @@=0A=
RCSID("$Id: xfs_syscalls.c,v 1.45 1999/01/24 22:53:56 map Exp $");=0A=
=0A=
/* =0A=
+ * Flag to enable/disable Transarc style setgroups syscall behavior=0A=
+ */=0A=
+#define WITH_PAG_SETGROUPS 1=0A=
+=0A=
+/* =0A=
* Def pag:=0A=
* 33536 <=3D g0 <=3D 34560=0A=
* 32512 <=3D g1 <=3D 48896=0A=
@@ -106,7 +111,7 @@=0A=
}=0A=
=0A=
static int=0A=
-xfs_setpag_call(void)=0A=
+xfs_set_pag(int part_one, int part_two)=0A=
{=0A=
int i ;=0A=
=0A=
@@ -152,8 +157,16 @@=0A=
=0A=
}=0A=
=0A=
- current->groups[0] =3D pag_part_one ;=0A=
- current->groups[1] =3D pag_part_two++ ;=0A=
+ current->groups[0] =3D part_one ;=0A=
+ current->groups[1] =3D part_two ;=0A=
+=0A=
+ return 0;=0A=
+}=0A=
+=0A=
+static int=0A=
+xfs_setpag_call(void)=0A=
+{=0A=
+ xfs_set_pag(pag_part_one, pag_part_two++);=0A=
=0A=
if (pag_part_two > XFS_PAG2_ULIM) {=0A=
pag_part_one++ ;=0A=
@@ -378,6 +391,7 @@=0A=
=0A=
#define MIN(a,b) ((a<b)?a:b)=0A=
=0A=
+=0A=
asmlinkage int=0A=
sys_afs (int operation,=0A=
char *a_pathP,=0A=
@@ -541,21 +555,61 @@=0A=
return error;=0A=
}=0A=
=0A=
-typedef int (*sys_call_routine)(int operation,=0A=
+typedef int (*afs_sys_call_routine)(int operation,=0A=
char *a_pathP,=0A=
int a_opcode,=0A=
struct ViceIoctl *a_paramsP,=0A=
int a_followSymlinks);=0A=
+static afs_sys_call_routine *old_afs_syscall=3DNULL;=0A=
=0A=
-extern sys_call_routine sys_call_table[];=0A=
+#if defined(WITH_PAG_SETGROUPS)=0A=
+typedef int (*setgroups_sys_call_routine)(int gidsetsize,=0A=
+ gid_t *grouplist);=0A=
+setgroups_sys_call_routine old_setgroups_syscall=3DNULL;=0A=
+#endif=0A=
=0A=
-static sys_call_routine old_afs_syscall=3DNULL;=0A=
+extern void *sys_call_table[];=0A=
+=0A=
+#if defined(WITH_PAG_SETGROUPS)=0A=
+asmlinkage int=0A=
+sys_pag_setgroups (int gidsetsize, =0A=
+ gid_t *grouplist)=0A=
+{=0A=
+ int res =3D 0;=0A=
+ int waspag =3D 0;=0A=
+ pag_t oldpag =3D 0;=0A=
+=0A=
+ if (xfs_is_pag()) {=0A=
+ oldpag =3D xfs_get_pag();=0A=
+ waspag =3D 1;=0A=
+ }=0A=
+ if (old_setgroups_syscall)=0A=
+ {=0A=
+ res =3D old_setgroups_syscall(gidsetsize, grouplist);=0A=
+ }=0A=
+ else=0A=
+ {=0A=
+ printk(KERN_EMERG "XFS Panic: Old setgroups syscall is NULL");=0A=
+ res =3D -EINVAL;=0A=
+ }=0A=
+=0A=
+ if ( waspag )=0A=
+ {=0A=
+ xfs_set_pag((oldpag>>16) & 0x0000FFFF, oldpag & 0x0000FFFF);=0A=
+ }=0A=
+ return res;=0A=
+}=0A=
+#endif=0A=
=0A=
void=0A=
install_afs_syscall (void)=0A=
{=0A=
old_afs_syscall =3D sys_call_table[__NR_afs_syscall];=0A=
sys_call_table[__NR_afs_syscall] =3D &sys_afs;=0A=
+#if defined(WITH_PAG_SETGROUPS)=0A=
+ old_setgroups_syscall =3D sys_call_table[__NR_setgroups];=0A=
+ sys_call_table[__NR_setgroups] =3D &sys_pag_setgroups;=0A=
+#endif=0A=
}=0A=
=0A=
void=0A=
@@ -565,4 +619,11 @@=0A=
sys_call_table[__NR_afs_syscall] =3D old_afs_syscall;=0A=
old_afs_syscall =3D NULL;=0A=
}=0A=
+#if defined(WITH_PAG_SETGROUPS)=0A=
+ if (old_setgroups_syscall) {=0A=
+ sys_call_table[__NR_setgroups] =3D old_setgroups_syscall;=0A=
+ old_setgroups_syscall =3D NULL;=0A=
+ }=0A=
+#endif=0A=
}=0A=
+=0A=
------_=_NextPart_000_01BE4EFC.A5260760--