Further prototyping and cleanup of UKERNEL
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Tue, 21 Jul 2009 19:16:51 +0000 (20:16 +0100)
committerRuss Allbery <rra@stanford.edu>
Wed, 22 Jul 2009 17:35:14 +0000 (10:35 -0700)
This patch continues to reduce the number of warnings that come from
a UKERNEL build. It also replaces the use of a system provided suser()
call (which isn't available everywhere), with afs_suser that's provided
by UKERNEL. Note that this makes UKERNEL applications usable by
everyone, not just root.

fork_syscall() becomes a normal function
call_syscall() is ANSIfied
UKERNEL/osi_groups.c gets the includes it needs
UKERNEL/osi_machdep.c stops thinking it's on Solaris
UKERNEL/osi_vnodeops.c stops confusing vnodes and vcaches

Reviewed-on: http://gerrit.openafs.org/http://gerrit.openafs.org/166
Tested-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Russ Allbery <rra@stanford.edu>

src/afs/UKERNEL/afs_usrops.c
src/afs/UKERNEL/osi_groups.c
src/afs/UKERNEL/osi_machdep.h
src/afs/UKERNEL/osi_vnodeops.c
src/afs/afs_prototypes.h

index d0d4350..ce597ca 100644 (file)
@@ -138,6 +138,7 @@ pthread_cond_t usr_sleep_cond;
 #endif /* !NETSCAPE_NSAPI */
 
 int call_syscall(long, long, long, long, long, long);
+int fork_syscall(long, long, long, long, long, long);
 
 
 /*
@@ -1683,21 +1684,21 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam,
      */
     if (afsd_debug)
        printf("%s: Calling AFSOP_RXLISTENER_DAEMON\n", rn);
-    fork_syscall(AFSCALL_CALL, AFSOP_RXLISTENER_DAEMON, FALSE, FALSE, FALSE);
+    fork_syscall(AFSCALL_CALL, AFSOP_RXLISTENER_DAEMON, FALSE, FALSE, FALSE, 0);
 
     if (afsd_verbose)
        printf("%s: Forking rx callback listener.\n", rn);
     /* Child */
     if (preallocs < cacheStatEntries + 50)
        preallocs = cacheStatEntries + 50;
-    fork_syscall(AFSCALL_CALL, AFSOP_START_RXCALLBACK, preallocs);
+    fork_syscall(AFSCALL_CALL, AFSOP_START_RXCALLBACK, preallocs, 0, 0, 0);
 
     /*
      * Start the RX event handler.
      */
     if (afsd_debug)
        printf("%s: Calling AFSOP_RXEVENT_DAEMON\n", rn);
-    fork_syscall(AFSCALL_CALL, AFSOP_RXEVENT_DAEMON, FALSE);
+    fork_syscall(AFSCALL_CALL, AFSOP_RXEVENT_DAEMON, FALSE, 0, 0, 0);
 
     /*
      * Set up all the kernel processes needed for AFS.
@@ -1804,16 +1805,16 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam,
 
     if (afsd_verbose)
        printf("%s: Forking AFS daemon.\n", rn);
-    fork_syscall(AFSCALL_CALL, AFSOP_START_AFS);
+    fork_syscall(AFSCALL_CALL, AFSOP_START_AFS, 0, 0, 0, 0);
 
     if (afsd_verbose)
        printf("%s: Forking check server daemon.\n", rn);
-    fork_syscall(AFSCALL_CALL, AFSOP_START_CS);
+    fork_syscall(AFSCALL_CALL, AFSOP_START_CS, 0, 0, 0, 0);
 
     if (afsd_verbose)
        printf("%s: Forking %d background daemons.\n", rn, nDaemons);
     for (i = 0; i < nDaemons; i++) {
-       fork_syscall(AFSCALL_CALL, AFSOP_START_BKG);
+       fork_syscall(AFSCALL_CALL, AFSOP_START_BKG, 0, 0, 0, 0);
     }
 
     if (afsd_verbose)
@@ -1889,7 +1890,7 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam,
 
     if (afsd_verbose)
        printf("%s: Forking trunc-cache daemon.\n", rn);
-    fork_syscall(AFSCALL_CALL, AFSOP_START_TRUNCDAEMON);
+    fork_syscall(AFSCALL_CALL, AFSOP_START_TRUNCDAEMON, 0, 0, 0, 0);
 
     /*
      * Mount the AFS filesystem
@@ -1996,8 +1997,8 @@ syscallThread(void *argp)
 }
 
 int
-fork_syscall(syscall, afscall, param1, param2, param3, param4)
-     long syscall, afscall, param1, param2, param3, param4;
+fork_syscall(long syscall, long afscall, long param1, long param2,
+            long param3, long param4)
 {
     usr_thread_t tid;
     struct syscallThreadArgs *sysArgsP;
@@ -2018,8 +2019,8 @@ fork_syscall(syscall, afscall, param1, param2, param3, param4)
 }
 
 int
-call_syscall(syscall, afscall, param1, param2, param3, param4)
-     long syscall, afscall, param1, param2, param3, param4;
+call_syscall(long syscall, long afscall, long param1, long param2,
+            long param3, long param4)
 {
     int code = 0;
     struct a {
index 7856c61..6662dc6 100644 (file)
@@ -18,7 +18,7 @@
 #include "afs/sysincludes.h"
 #include "afsincludes.h"
 #include "afs/afs_stats.h"     /* statistics */
-
+#include "afs/afs_prototypes.h"
 
 int
 afs_xsetgroups(void)
index 19a25f5..5560efd 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 /*
- * Solaris OSI header file. Extends afs_osi.h.
+ * UKERNEL OSI header file. Extends afs_osi.h.
  *
  * afs_osi.h includes this file, which is the only way this file should
  * be included in a source file. This file can redefine macros declared in
 #define gop_lookupname(fnamep,segflg,followlink,compvpp) lookupname((fnamep),(segflg),(followlink),(compvpp))
 
 #define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
-#define        afs_suser(x)        suser(x)
 
+#if 0
+#define        afs_suser(x)        suser(x)
+#endif
 /*
  * Global lock support.
  */
@@ -67,4 +69,6 @@ extern usr_mutex_t afs_global_lock;
 
 extern int afs_bufferpages;
 
+extern int afs_suser(void *credp);
+
 #endif /* _OSI_MACHDEP_H_ */
index 3c0ee94..d04013f 100644 (file)
@@ -22,9 +22,9 @@ afs_vrdwr(struct usr_vnode *avc, struct usr_uio *uio, int rw, int io,
     int rc;
 
     if (rw == UIO_WRITE) {
-       rc = afs_write(avc, uio, io, cred, 0);
+       rc = afs_write(VTOAFS(avc), uio, io, cred, 0);
     } else {
-       rc = afs_read(avc, uio, cred, 0, 0, 0);
+       rc = afs_read(VTOAFS(avc), uio, cred, 0, 0, 0);
     }
 
     return rc;
index f886fd0..2d29703 100644 (file)
@@ -575,7 +575,7 @@ extern int AddPag(struct proc *p, afs_int32 aval, struct AFS_UCRED **credpp);
 extern int AddPag(afs_int32 aval, struct AFS_UCRED **credpp);
 #endif
 extern int afs_InitReq(register struct vrequest *av, struct AFS_UCRED *acred);
-#if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS)
+#if defined(UKERNEL)
 extern afs_uint32 afs_get_pag_from_groups(gid_t g0a, gid_t g1a);
 #else
 #ifdef AFS_LINUX26_ONEGROUP_ENV
@@ -871,7 +871,9 @@ extern void afs_AddToMean(struct afs_MeanStats *oldMean, afs_int32 newValue);
 
 /* afs_syscall.c */
 extern int copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst);
-
+#ifdef UKERNEL
+extern int Afs_syscall(void);
+#endif
 
 /* UKERNEL/afs_usrops.c */
 #ifdef UKERNEL