sys-prototypes-20090315

LICENSE IPL10
FIXES 124233

prototype the sys directory
This commit is contained in:
Simon Wilkinson 2009-03-16 14:00:56 +00:00 committed by Derrick Brashear
parent 129905960d
commit 6e569d2518
11 changed files with 103 additions and 61 deletions

View File

@ -419,7 +419,7 @@ afs_depinstall: config comerr
dir_depinstall: config
${COMPILE_PART1} dir ${COMPILE_DEPINSTALL}
sys_depinstall: config
sys_depinstall: config rxgen
${COMPILE_PART1} sys ${COMPILE_DEPINSTALL}
kauth_depinstall: config rxgen comerr

View File

@ -30,6 +30,7 @@ all: \
${TOP_INCDIR}/afs/afssyscalls.h \
${TOP_INCDIR}/afs/afs.exp \
${TOP_INCDIR}/afs/xfsattrs.h \
${TOP_INCDIR}/afs/sys_prototypes.h \
${TOP_LIBDIR}/afs.exp \
${TOP_LIBDIR}/libsys.a \
${KERNELDIR}/afs/xfsattrs.h \
@ -56,6 +57,9 @@ ${TOP_LIBDIR}/afs.exp: afs.exp
${TOP_INCDIR}/afs/xfsattrs.h: xfsattrs.h
${INSTALL_DATA} $? $@
${TOP_INCDIR}/afs/sys_prototypes.h: sys_prototypes.h
${INSTALL} $? $@
${TOP_LIBDIR}/libsys.a: libsys.a
${INSTALL_DATA} $? $@
@ -75,6 +79,7 @@ depinstall: \
${TOP_INCDIR}/afs/rmtsys.h \
${TOP_INCDIR}/afs/afs.exp \
${TOP_INCDIR}/afs/xfsattrs.h \
${TOP_INCDIR}/afs/sys_prototypes.h \
${KERNELDIR}/afs/xfsattrs.h \
${UKERNELDIR}/afs/afsl.exp \
Krmtsys.cs.c Krmtsys.h Krmtsys.xdr.c rmtsys.h

View File

@ -15,7 +15,8 @@ RELDIR=sys
INCFILES =\
$(DESTDIR)\include\afs\afssyscalls.h \
$(DESTDIR)\include\afs\pioctl_nt.h
$(DESTDIR)\include\afs\pioctl_nt.h \
$(DESTDIR)\include\afs\sys_prototypes.h
# Library to install
@ -37,4 +38,4 @@ install9x: install
# Local clean target; augments predefined clean target
clean::
$(DEL) $(LIBFILE)
$(DEL) $(LIBFILE)

View File

@ -20,11 +20,8 @@ RCSID
#include <afs/afs_args.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
#include <unistd.h>
#else
#include <stdio.h>
#endif
#ifdef AFS_SUN5_ENV
#include <fcntl.h>
#endif

View File

@ -33,10 +33,12 @@ RCSID
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include "rx/rx.h"
#include "sys_prototypes.h"
#include "AFS_component_version_number.c"
extern afs_int32 setpag();
int ktc_newpag(void);
int
main(int argc, char *argv[])
@ -143,8 +145,8 @@ ktc_newpag(void)
sprintf(fname, "%s%d", prefix, getuid());
sprintf(fname5, "%s%d", prefix5, getuid());
} else {
sprintf(fname, "%sp%ld", prefix, pag);
sprintf(fname5, "%sp%ld", prefix5, pag);
sprintf(fname, "%sp%lud", prefix, (long unsigned int) pag);
sprintf(fname5, "%sp%lud", prefix5, (long unsigned int) pag);
}
/* ktc_set_tkt_string(fname); */

View File

@ -32,18 +32,20 @@ RCSID
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <rx/xdr.h>
#include "rmtsys.h"
#include "sys_prototypes.h"
#define NOPAG 0xffffffff /* Also defined in afs/afs.h */
static afs_int32 hostAddr = 0;
static int hostAddrLookup = 0;
char *afs_server = 0, server_name[128];
static afs_int32 SetClientCreds();
static afs_int32 SetClientCreds(struct clientcred *creds, afs_uint32 * groups);
int afs_get_pag_from_groups(afs_uint32 g0, afs_uint32 g1);
void afs_get_groups_from_pag(afs_uint32 pag, afs_uint32 * g0p, afs_uint32 * g1p);
@ -58,7 +60,6 @@ afs_int32
GetAfsServerAddr(char *syscall)
{
register struct hostent *th;
char *getenv();
if (hostAddrLookup) {
/* Take advantage of caching and assume that the remote host
@ -158,8 +159,9 @@ setpag(void)
{
struct rx_connection *conn;
clientcred creds;
afs_int32 errorcode, errornumber, newpag, ngroups, j, groups[NGROUPS_MAX];
afs_int32 errorcode, errornumber, newpag, ngroups, j;
afs_uint32 groups[NGROUPS_MAX];
if (!(conn = rx_connection(&errorcode, "setpag"))) {
/* Remote call can't be performed for some reason.
* Try the local 'setpag' system call ... */
@ -219,14 +221,10 @@ pioctl(char *path, afs_int32 cmd, struct ViceIoctl *data, afs_int32 follow)
afs_uint32 groups[NGROUPS_MAX];
rmtbulk InData, OutData;
char pathname[256], *pathp = pathname, *inbuffer;
#if 0/*ndef HAVE_GETCWD*/ /* XXX enable when autoconf happens */
extern char *getwd();
#define getcwd(x,y) getwd(x)
#endif
if (!(conn = rx_connection(&errorcode, "pioctl"))) {
/* Remote call can't be performed for some reason.
* Try the local 'pioctl' system call ... */
errorcode = lpioctl(path, cmd, data, follow);
errorcode = lpioctl(path, cmd, (char *)data, follow);
return errorcode;
}
(void)SetClientCreds(&creds, groups);
@ -323,7 +321,7 @@ afs_get_groups_from_pag(afs_uint32 pag, afs_uint32 * g0p, afs_uint32 * g1p)
static afs_int32
SetClientCreds(struct clientcred *creds, afs_int32 * groups)
SetClientCreds(struct clientcred *creds, afs_uint32 * groups)
{
afs_int32 ngroups;

View File

@ -33,9 +33,7 @@ RCSID
#include <stdio.h>
#include <rx/xdr.h>
#include "rmtsys.h"
extern RMTSYS_ExecuteRequest();
#include "sys_prototypes.h"
#define N_SECURITY_OBJECTS 1 /* No real security yet */

View File

@ -66,8 +66,7 @@ struct ClearToken {
};
char *
RSkipLine(astr)
register char *astr;
RSkipLine(register char *astr)
{
while (*astr != '\n')
astr++;
@ -77,8 +76,7 @@ RSkipLine(astr)
struct Acl *
RParseAcl(astr)
char *astr;
RParseAcl(char *astr)
{
int nplus, nminus, i, trights;
char tname[MAXNAME];
@ -131,7 +129,7 @@ RParseAcl(astr)
}
int
void
RAclToString(struct Acl *acl, char *mydata, int ntoh_conv)
{
char tstring[MAXSIZE];
@ -147,12 +145,11 @@ RAclToString(struct Acl *acl, char *mydata, int ntoh_conv)
sprintf(tstring, "%s %d\n", tp->name, tp->rights);
strcat(mydata, tstring);
}
return 0;
}
/* Free all malloced stuff */
int
void
RCleanAcl(struct Acl *aa)
{
register struct AclEntry *te, *ne;
@ -166,11 +163,10 @@ RCleanAcl(struct Acl *aa)
free(te);
}
free(aa);
return 0;
}
int
void
RFetchVolumeStatus_conversion(char *data, int ntoh_conv)
{
struct AFSFetchVolumeStatus *status = (AFSFetchVolumeStatus *) data;
@ -208,10 +204,9 @@ RFetchVolumeStatus_conversion(char *data, int ntoh_conv)
status->PartBlocksAvail = htonl(status->PartBlocksAvail);
status->PartMaxBlocks = htonl(status->PartMaxBlocks);
}
return 0;
}
int
void
RClearToken_convert(char *ptr, int ntoh_conv)
{
struct ClearToken *ticket = (struct ClearToken *)ptr;
@ -227,10 +222,9 @@ RClearToken_convert(char *ptr, int ntoh_conv)
ticket->BeginTimestamp = htonl(ticket->BeginTimestamp);
ticket->EndTimestamp = htonl(ticket->EndTimestamp);
}
return 0;
}
int
void
inparam_conversion(afs_int32 cmd, char *buffer, afs_int32 ntoh_conv)
{
struct Acl *acl;
@ -338,11 +332,10 @@ inparam_conversion(afs_int32 cmd, char *buffer, afs_int32 ntoh_conv)
/* Note that new pioctls are supposed to be in network order! */
break;
}
return 0;
}
int
void
outparam_conversion(afs_int32 cmd, char *buffer, afs_int32 ntoh_conv)
{
struct Acl *acl;
@ -449,5 +442,4 @@ outparam_conversion(afs_int32 cmd, char *buffer, afs_int32 ntoh_conv)
/* Note that new pioctls are supposed to be in network order! */
break;
}
return 0;
}

View File

@ -31,10 +31,10 @@ RCSID
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <stdarg.h>
/*#include <afs/cellconfig.h>*/
#include "rmtsys.h"
extern RMTSYS_ExecuteRequest();
#include "sys_prototypes.h"
#define NFS_EXPORTER 1 /* To probably handle more later */
#define PSETPAG 110 /* Also defined in afs/afs_pioctl.c */
@ -55,7 +55,8 @@ extern RMTSYS_ExecuteRequest();
/* Main routine of the remote AFS system call server. The calling process will
* never return; this is currently called from afsd (when "-rmtsys" is passed
* as a parameter) */
rmtsysd()
void
rmtsysd(void)
{
/* void catchsig(int); */
struct rx_securityClass *(securityObjects[N_SECURITY_OBJECTS]);
@ -77,13 +78,12 @@ rmtsysd()
rx_NewService(0, RMTSYS_SERVICEID, AFSCONF_RMTSYSSERVICE,
securityObjects, N_SECURITY_OBJECTS,
RMTSYS_ExecuteRequest);
if (service == (struct rx_service *)0)
if (service == NULL)
rmt_Quit("rx_NewService");
/* One may wish to tune some default RX params for better performance
* at some point... */
rx_SetMaxProcs(service, 2);
rx_StartServer(1); /* Donate this process to the server process pool */
return 0; /* not reached */
}
@ -91,10 +91,8 @@ rmtsysd()
* here we also get back the new pag value; we need this so that the caller
* can add it to its group list via setgroups() */
afs_int32
SRMTSYS_SetPag(call, creds, newpag, errornumber)
struct rx_call *call;
clientcred *creds;
afs_int32 *newpag, *errornumber;
SRMTSYS_SetPag(struct rx_call *call, clientcred *creds, afs_int32 *newpag,
afs_int32 *errornumber)
{
afs_uint32 blob[PIOCTL_HEADER];
struct ViceIoctl data;
@ -108,7 +106,7 @@ SRMTSYS_SetPag(call, creds, newpag, errornumber)
data.out = (caddr_t) blob;
data.out_size = sizeof(blob);
/* force local pioctl call */
error = lpioctl(0, _VICEIOCTL(PSetClientContext), &data, 1);
error = lpioctl(0, _VICEIOCTL(PSetClientContext), (char *)&data, 1);
if (error) {
if (errno == PSETPAG) {
*newpag = blob[0]; /* new pag value */
@ -121,12 +119,9 @@ SRMTSYS_SetPag(call, creds, newpag, errornumber)
/* Implements the remote pioctl(2) call */
afs_int32
SRMTSYS_Pioctl(call, creds, path, cmd, follow, InData, OutData, errornumber)
struct rx_call *call;
clientcred *creds;
afs_int32 cmd, follow, *errornumber;
char *path;
rmtbulk *InData, *OutData;
SRMTSYS_Pioctl(struct rx_call *call, clientcred *creds, char *path,
afs_int32 cmd, afs_int32 follow, rmtbulk *InData,
rmtbulk *OutData, afs_int32 *errornumber)
{
register afs_int32 error;
struct ViceIoctl data;
@ -150,7 +145,7 @@ SRMTSYS_Pioctl(call, creds, path, cmd, follow, InData, OutData, errornumber)
data.out = OutData->rmtbulk_val;
data.out_size = OutData->rmtbulk_len;
/* force local pioctl call */
error = lpioctl(pathp, _VICEIOCTL(PSetClientContext), &data, follow);
error = lpioctl(pathp, _VICEIOCTL(PSetClientContext), (char *)&data, follow);
if (error) {
*errornumber = errno;
} else {
@ -165,9 +160,13 @@ SRMTSYS_Pioctl(call, creds, path, cmd, follow, InData, OutData, errornumber)
return (0);
}
rmt_Quit(msg, a, b)
char *msg;
void
rmt_Quit(char *msg, ...)
{
fprintf(stderr, msg, a, b);
va_list ap;
va_start(ap, msg);
vfprintf(stderr, msg, ap);
va_end(ap);
exit(1);
}

View File

@ -19,10 +19,10 @@ RCSID
("$Header$");
#include <afs/afs_args.h>
#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
#include <unistd.h>
#else
#include <stdio.h>
#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV)
# include <sys/syscall.h>
#endif
#include "afssyscalls.h"
@ -48,9 +48,11 @@ lsetpag(void)
int
lsetpag(void)
{
int errcode, rval;
int errcode;
#ifdef AFS_LINUX20_ENV
int rval;
rval = proc_afs_syscall(AFSCALL_SETPAG,0,0,0,0,&errcode);
if(rval)

48
src/sys/sys_prototypes.h Normal file
View File

@ -0,0 +1,48 @@
/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
*
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
*/
#ifndef _SYS_PROTOTYPES_H
#define _SYS_PROTOTYPES_H
/* glue.c */
#ifdef AFS_LINUX20_ENV
extern int proc_afs_syscall(long, long, long, long, long, int *);
#endif
#ifdef AFS_DARWIN80_ENV
extern int ioctl_afs_syscall(long, long, long, long, long, long, long, int *);
#endif
/* pioctl.c */
extern int lpioctl(char *, int, char *, int);
/* rmtsys.ss.c */
struct rx_call;
extern int RMTSYS_ExecuteRequest(struct rx_call *);
/* rmtsysc.c */
struct ViceIoctl;
extern int pioctl(char *path, afs_int32 cmd, struct ViceIoctl *data,
afs_int32 follow);
#ifdef AFS_DUX40_ENV
extern int afs_setpag(void);
#else
extern int setpag(void);
#endif
/* rmtsysnet.c */
extern void inparam_conversion(afs_int32, char *, afs_int32);
extern void outparam_conversion(afs_int32, char *, afs_int32);
/* rmtsyss.c */
extern void rmt_Quit(char *msg, ...);
/* setpag.c */
extern int lsetpag(void);
#endif