From 6e569d2518dba2f947626b40597c71e9798936b7 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 16 Mar 2009 14:00:56 +0000 Subject: [PATCH] sys-prototypes-20090315 LICENSE IPL10 FIXES 124233 prototype the sys directory --- Makefile.in | 2 +- src/sys/Makefile.in | 5 +++++ src/sys/NTMakefile | 5 +++-- src/sys/glue.c | 3 --- src/sys/pagsh.c | 8 ++++--- src/sys/rmtsysc.c | 18 +++++++-------- src/sys/rmtsysd.c | 4 +--- src/sys/rmtsysnet.c | 24 +++++++------------- src/sys/rmtsyss.c | 39 ++++++++++++++++---------------- src/sys/setpag.c | 8 ++++--- src/sys/sys_prototypes.h | 48 ++++++++++++++++++++++++++++++++++++++++ 11 files changed, 103 insertions(+), 61 deletions(-) create mode 100644 src/sys/sys_prototypes.h diff --git a/Makefile.in b/Makefile.in index 5ba4e8ca3d..5126d3b118 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/src/sys/Makefile.in b/src/sys/Makefile.in index 25f38cbbdc..f59b034fc8 100644 --- a/src/sys/Makefile.in +++ b/src/sys/Makefile.in @@ -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 diff --git a/src/sys/NTMakefile b/src/sys/NTMakefile index 1d8d7bdacf..308a26c50f 100644 --- a/src/sys/NTMakefile +++ b/src/sys/NTMakefile @@ -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) \ No newline at end of file + $(DEL) $(LIBFILE) diff --git a/src/sys/glue.c b/src/sys/glue.c index cf92c615e8..3bb34e0213 100644 --- a/src/sys/glue.c +++ b/src/sys/glue.c @@ -20,11 +20,8 @@ RCSID #include #include #include -#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV) #include -#else #include -#endif #ifdef AFS_SUN5_ENV #include #endif diff --git a/src/sys/pagsh.c b/src/sys/pagsh.c index 4ab8636237..4a66af8d2e 100644 --- a/src/sys/pagsh.c +++ b/src/sys/pagsh.c @@ -33,10 +33,12 @@ RCSID #include #include #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); */ diff --git a/src/sys/rmtsysc.c b/src/sys/rmtsysc.c index a7ad054332..bc04243c69 100644 --- a/src/sys/rmtsysc.c +++ b/src/sys/rmtsysc.c @@ -32,18 +32,20 @@ RCSID #include #include #include +#include #ifdef HAVE_UNISTD_H #include #endif #include #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; diff --git a/src/sys/rmtsysd.c b/src/sys/rmtsysd.c index aceb44b5d7..0d59a79990 100644 --- a/src/sys/rmtsysd.c +++ b/src/sys/rmtsysd.c @@ -33,9 +33,7 @@ RCSID #include #include #include "rmtsys.h" - - -extern RMTSYS_ExecuteRequest(); +#include "sys_prototypes.h" #define N_SECURITY_OBJECTS 1 /* No real security yet */ diff --git a/src/sys/rmtsysnet.c b/src/sys/rmtsysnet.c index 4430b3899c..cdea577e9a 100644 --- a/src/sys/rmtsysnet.c +++ b/src/sys/rmtsysnet.c @@ -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; } diff --git a/src/sys/rmtsyss.c b/src/sys/rmtsyss.c index 2cb68a97b4..61d6303db8 100644 --- a/src/sys/rmtsyss.c +++ b/src/sys/rmtsyss.c @@ -31,10 +31,10 @@ RCSID #include #include #include +#include /*#include */ #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); } diff --git a/src/sys/setpag.c b/src/sys/setpag.c index 3e2e8c8276..a30a597462 100644 --- a/src/sys/setpag.c +++ b/src/sys/setpag.c @@ -19,10 +19,10 @@ RCSID ("$Header$"); #include -#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV) #include -#else #include +#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) +# include #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) diff --git a/src/sys/sys_prototypes.h b/src/sys/sys_prototypes.h new file mode 100644 index 0000000000..9ec9d95c17 --- /dev/null +++ b/src/sys/sys_prototypes.h @@ -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