ukernel: set pthread stacksize to an integer multiple of 8k
[openafs.git] / src / afs / UKERNEL / sysincludes.h
index 0e403da..aa82526 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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
 #define __AFS_SYSINCLUDESH__ 1
 
 #include  <stdio.h>
-#if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) /* must be included after KERNEL undef'd */
+#if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) && !defined(AFS_USR_DFBSD_ENV) /* must be included after KERNEL undef'd */
 #include  <errno.h>
 #endif
 #include  <stdlib.h>
 #include  <string.h>
-#include  <unistd.h>
-#include  <dirent.h>
 #include  <limits.h>
 #include  <assert.h>
 #include  <stdarg.h>
-#include <setjmp.h>
+
+#if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) && !defined(AFS_USR_DFBSD_ENV) /* must be included after KERNEL undef'd */
+#include  <unistd.h>
+#include  <ctype.h>
+#include  <sys/types.h>
+#include  <dirent.h>
+#include  <setjmp.h>
+#endif
 
 #ifdef AFS_USR_SUN5_ENV
 #include  <signal.h>
 #include  <sys/param.h>
-#include  <sys/types.h>
 #include  <sys/socket.h>
 #include  <net/if.h>
 #include  <sys/sockio.h>
@@ -41,7 +45,6 @@
 
 #ifdef AFS_USR_AIX_ENV
 #include  <sys/param.h>
-#include  <sys/types.h>
 #include  <sys/socket.h>
 #include  <net/if.h>
 #include  <fcntl.h>
@@ -54,7 +57,6 @@
 
 #ifdef AFS_USR_SGI_ENV
 #include  <sys/param.h>
-#include  <sys/types.h>
 #include  <sys/socket.h>
 #include  <net/if.h>
 #include  <sys/sockio.h>
@@ -68,7 +70,6 @@
 
 #ifdef AFS_USR_HPUX_ENV
 #include  <sys/param.h>
-#include  <sys/types.h>
 #include  <sys/socket.h>
 #include  <net/if.h>
 #include  <sys/file.h>
@@ -85,7 +86,6 @@
 #define AFS_USR_UNDEF_KERNEL_ENV 1
 #endif
 #include  <sys/param.h>
-#include  <sys/types.h>
 #include  <sys/socket.h>
 #include  <net/if.h>
 #include  <sys/file.h>
@@ -98,9 +98,9 @@
 #endif /* AFS_USR_OSF_ENV */
 
 #ifdef AFS_USR_LINUX22_ENV
-#include  <sys/ioctl.h>        /* _IOW() */
-#include  <sys/uio.h>  /* struct iovec */
-#include  <sys/time.h> /* struct timeval */
+#include  <sys/ioctl.h>                /* _IOW() */
+#include  <sys/uio.h>          /* struct iovec */
+#include  <sys/time.h>         /* struct timeval */
 #include  <sys/param.h>
 #include  <sys/types.h>
 #include  <sys/socket.h>
 #define FREAD                  0x0001
 #endif /* AFS_USR_LINUX22_ENV */
 
-#if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
+#if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV) || defined(AFS_USR_DFBSD_ENV)
+#ifdef _KERNEL
+#undef _KERNEL
+#endif
 #ifdef KERNEL
 #undef KERNEL
 #define AFS_USR_UNDEF_KERNEL_ENV 1
 #endif
 #include  <errno.h>
+#include  <setjmp.h>
 #include  <sys/param.h>
 #include  <sys/types.h>
 #include  <sys/socket.h>
 #include  <netinet/in.h>
 #include  <netdb.h>
 #include  <arpa/inet.h>
+#include  <dirent.h>
+#include  <ctype.h>
+#include  <unistd.h>
 #ifndef O_SYNC
 #define O_SYNC O_FSYNC
 #endif
 #endif /* AFS_USR_DARWIN_ENV || AFS_USR_FBSD_ENV */
 
-#ifdef AFS_AFSDB_ENV
+#ifdef HAVE_SYS_BITYPES_H
+#include <sys/bitypes.h>
+#endif
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+#ifndef HAVE_FSBLKCNT_T
+typedef unsigned int fsblkcnt_t;
+#endif
+
 #include <arpa/nameser.h>
+#ifdef HAVE_ARPA_NAMESER_COMPAT_H
+#include <arpa/nameser_compat.h>
+#endif
 #include <resolv.h>
-#endif /* AFS_AFSDB_ENV */
 
 /* glibc 2.2 has pthread_attr_setstacksize */
-#if defined(AFS_LINUX22_ENV) || defined(AFS_USR_LINUX22_ENV) && (__GLIBC_MINOR__ < 2)
+#if (defined(AFS_LINUX22_ENV) && !defined(AFS_USR_LINUX22_ENV)) || (defined(AFS_USR_LINUX22_ENV) && (__GLIBC_MINOR__ < 2))
 #define pthread_attr_setstacksize(a,b) 0
 #endif
 
-#include  <sys/stat.h> /* afs_usrops.h uses struct stat in prototypes */
+#include  <sys/stat.h>         /* afs_usrops.h uses struct stat in prototypes */
 
 #ifdef NETSCAPE_NSAPI
 
 #define MAXNAMLEN              512
 #endif
 
-#ifndef PAGESIZE
-#define PAGESIZE               4096
-#endif
-
 /*
  * This file contains data types and definitions for running
  * the AFS client in user space. Kernel data structures
 
 #ifdef UKERNEL
 
-#ifdef AFS_USR_SGI_ENV
 #undef socket
-#endif /* AFS_USR_SGI_ENV */
+#undef flock
 
 #if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
 #undef if_mtu
 #define vattr                  usr_vattr
 #define buf                    usr_buf
 #define statfs                 usr_statfs
-#define ucred                  usr_ucred
-#define user                   usr_user
-#define proc                   usr_proc
 #define file                   usr_file
 #define dirent                 usr_dirent
 #define flock                  usr_flock
 #define fid                    usr_fid
 #define sysent                 usr_sysent
+#define ifaddr                  usr_ifaddr
+#define ifnet                   usr_ifnet
 #define in_ifaddr              usr_in_ifaddr
-#define ifaddr                 usr_ifaddr
-#define ifnet                  usr_ifnet
+#undef socket
 #define socket                 usr_socket
 #define crget                  usr_crget
 #define crcopy                 usr_crcopy
 #define offset_t               usr_offset_t
 #define getpid()               usr_getpid()
 #define setpag(A,B,C,D)                usr_setpag((A),(B),(C),(D))
+#define osi_getpid()           afs_pointer_to_int(usr_thread_self())
 #ifdef pid_t
 #undef pid_t
 #endif
@@ -325,26 +341,18 @@ typedef long usr_ino_t;
 #ifdef VFIFO
 #undef VFIFO
 #endif
-#ifdef VDOOR
-#undef VDOOR
-#endif
-#ifdef VBAD
-#undef VBAD
-#endif
 #ifdef VSOCK
 #undef VSOCK
 #endif
 
-#define VNON                   0
-#define VREG                   1
-#define VDIR                   2
-#define VBLK                   3
-#define VCHR                   4
-#define VLNK                   5
-#define VFIFO                  6
-#define VDOOR                  7
-#define VBAD                   8
-#define VSOCK                  9
+#define VNON 0
+#define VREG S_IFREG
+#define VDIR S_IFDIR
+#define VBLK S_IFBLK
+#define VCHR S_IFCHR
+#define VLNK S_IFLNK
+#define VSOCK S_IFSOCK
+#define VFIFO S_IFIFO
 
 typedef int usr_vtype_t;
 
@@ -631,7 +639,7 @@ typedef int usr_vtype_t;
 #ifdef IO_SYNC
 #undef IO_SYNC
 #endif
+
 #define FAPPEND                        0x0100
 #define IO_APPEND              FAPPEND
 #define FSYNC                  0x0200
@@ -826,7 +834,7 @@ enum usr_uio_rw { USR_UIO_READ, USR_UIO_WRITE };
 #endif
 #define NBPG                   4096
 
-#define panic(S)               do{fprintf(stderr, S);assert(0);}while(0)
+#define panic(S)               do{fprintf(stderr, "%s", S);assert(0);}while(0)
 #define abort()                        assert(0)
 #define usr_assert(A)          assert(A)
 
@@ -840,9 +848,9 @@ enum usr_uio_rw { USR_UIO_READ, USR_UIO_WRITE };
  * waking when we do the signal.
  */
 typedef struct {
-       int                     waiters;
-       CRITICAL                lock;
-       CONDVAR                 cond;
+    int waiters;
+    CRITICAL lock;
+    CONDVAR cond;
 } usr_cond_t;
 
 #define usr_mutex_t            CRITICAL
@@ -943,11 +951,11 @@ extern pthread_cond_t usr_sleep_cond;
     do { \
        pthread_attr_t attr; \
        assert(pthread_attr_init(&attr) == 0); \
-       assert(pthread_attr_setstacksize(&attr, 124288) == 0); \
-       assert(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0); \
+       assert(pthread_attr_setstacksize(&attr, 122880) == 0);     \
        assert(pthread_create((A), &attr, (B), (void *)(C)) == 0); \
        assert(pthread_attr_destroy(&attr) == 0); \
     } while(0)
+#define usr_thread_join(A,B)   pthread_join(A, B)
 #define usr_thread_detach(A)   pthread_detach(A)
 #define usr_keycreate(A,B)     assert(pthread_key_create(A,B) == 0)
 #define usr_setspecific(A,B)   pthread_setspecific(A,B)
@@ -973,6 +981,9 @@ extern pthread_cond_t usr_sleep_cond;
 #define uprintf                        printf
 
 #define usr_getpid()           (int)(usr_thread_self())
+#ifdef ISAFS_GLOCK
+#undef ISAFS_GLOCK
+#endif
 #define ISAFS_GLOCK() (usr_thread_self() == afs_global_owner)
 
 #endif /* NETSCAPE_NSAPI */
@@ -988,50 +999,56 @@ extern pthread_cond_t usr_sleep_cond;
 { \
     (vp)->v_count++; \
 }
+
 #define VN_RELE(vp)     \
 do { \
     AFS_ASSERT_GLOCK(); \
     usr_assert((vp)->v_count > 0); \
     if (--((vp)->v_count) == 0) \
-       afs_inactive(vp, u.u_cred); \
+       afs_inactive(VTOAFS(vp), get_user_struct()->u_cred); \
 } while(0)
 
 struct usr_statfs {
-       unsigned long           f_type;
-       unsigned long           f_bsize;
-       unsigned long           f_frsize;
-       unsigned long           f_ffree;
-       unsigned long           f_favail;
-       struct {
-           unsigned long       val[2];
-       } f_fsid;
-       char                    f_basetype[FSTYPSZ];
-       unsigned long           f_flag;
-       unsigned long           f_namemax;
-       unsigned long           f_blocks;
-       unsigned long           f_bfree;
-       unsigned long           f_bavail;
-       unsigned long           f_files;
+    unsigned long f_type;
+    unsigned long f_bsize;
+    unsigned long f_frsize;
+    unsigned long f_ffree;
+    unsigned long f_favail;
+    struct {
+       unsigned long val[2];
+    } f_fsid;
+    char f_basetype[FSTYPSZ];
+    unsigned long f_flag;
+    unsigned long f_namemax;
+    unsigned long f_blocks;
+    unsigned long f_bfree;
+    unsigned long f_bavail;
+    unsigned long f_files;
 };
 
+#define ATTR_MODE      (1 << 0)
+#define ATTR_UID       (1 << 1)
+#define ATTR_GID       (1 << 2)
+#define ATTR_MTIME     (1 << 3)
+#define ATTR_SIZE      (1 << 4)
+
 struct usr_vattr {
-       long                    va_mask;
-       usr_vtype_t             va_type;
-       unsigned short          va_mode;
-       long                    va_uid;
-       long                    va_gid;
-       unsigned long           va_fsid;
-       unsigned long           va_nodeid;
-       unsigned long           va_nlink;
-       unsigned long           va_size;
-       struct timeval          va_atime;
-       struct timeval          va_mtime;
-       struct timeval          va_ctime;
-       unsigned long           va_rdev;
-       unsigned long           va_blocksize;
-       unsigned long           va_blocks;
-       unsigned long           va_vcode;
+    int va_mask;       /* bitmask of ATTR_* values above */
+    usr_vtype_t va_type;
+    mode_t va_mode;
+    uid_t va_uid;
+    gid_t va_gid;
+    int va_fsid;
+    ino_t va_nodeid;
+    nlink_t va_nlink;
+    afs_size_t va_size;
+    struct timeval va_atime;
+    struct timeval va_mtime;
+    struct timeval va_ctime;
+    dev_t va_rdev;
+    unsigned long va_blocksize;
+    fsblkcnt_t va_blocks;
+    unsigned long va_vcode;
 };
 
 #ifdef VSUID
@@ -1053,7 +1070,7 @@ struct usr_vattr {
 #undef VEXEC
 #endif
 
-#define VSUID                  04000 
+#define VSUID                  04000
 #define VSGID                  02000
 #define VSVTX                  01000
 #define VREAD                  00400
@@ -1062,99 +1079,97 @@ struct usr_vattr {
 
 
 struct usr_vnode {
-       unsigned short          v_flag;
-       unsigned long           v_count;
-       struct usr_vnodeops     *v_op;
-       struct usr_vfs  *       v_vfsp;
-       long                    v_type;
-       unsigned long           v_rdev;
-       char *                  v_data;
+    unsigned short v_flag;
+    unsigned long v_count;
+    struct usr_vnodeops *v_op;
+    struct usr_vfs *v_vfsp;
+    long v_type;
+    unsigned long v_rdev;
+    char *v_data;
 };
 
-struct usr_inode {
-       daddr_t                 i_db[NDADDR];
-       struct usr_vnode        *i_devvp;
-       unsigned long           i_dev;
-       long                    i_flag;
-       struct usr_inode        *i_freef;
-       struct usr_inode        **i_freeb;
-       long                    i_gid;
-       daddr_t                 i_ib[NIADDR];
-       unsigned short          i_mode;
-       short                   i_nlink;
-       unsigned long           i_number;
-       long                    i_size;
-       long                    i_uid;
-       struct usr_vnode        i_vnode;
-       struct {
-           unsigned long       ic_spare[4];
-       } i_ic;
+struct usr_inode {
+    daddr_t i_db[NDADDR];
+    struct usr_vnode *i_devvp;
+    unsigned long i_dev;
+    long i_flag;
+    struct usr_inode *i_freef;
+    struct usr_inode **i_freeb;
+    long i_gid;
+    daddr_t i_ib[NIADDR];
+    unsigned short i_mode;
+    short i_nlink;
+    unsigned long i_number;
+    long i_size;
+    long i_uid;
+    struct usr_vnode i_vnode;
+    struct {
+       unsigned long ic_spare[4];
+    } i_ic;
 };
-extern struct usr_inode *iget();
 
 struct usr_fileops {
-       int                     (*vno_rw)();
-       int                     (*vno_ioctl)();
-       int                     (*vno_select)();
-       int                     (*vno_closex)();
+    int (*vno_rw) (void);
+    int (*vno_ioctl) (void);
+    int (*vno_select) (void);
+    int (*vno_closex) (void);
 };
 
 struct usr_file {
-       unsigned short          f_flag;
-       offset_t                f_offset;
-       struct usr_ucred        *f_cred;
-       struct usr_fileops      *f_ops;
-       char *                  f_data;
-       long                    f_type;
+    unsigned short f_flag;
+    offset_t f_offset;
+    struct usr_ucred *f_cred;
+    struct usr_fileops *f_ops;
+    char *f_data;
+    long f_type;
 };
-extern struct usr_file *falloc();
+
 extern struct usr_file *getf(int);
 
-#ifdef fid_len 
-#undef fid_len 
+#ifdef fid_len
+#undef fid_len
 #endif
 #ifdef fid_data
 #undef fid_data
 #endif
 
 struct usr_fid {
-       unsigned short          fid_len;
-       unsigned short          fid_reserved;
-       char                    fid_data[MAXFIDSZ];
+    unsigned short fid_len;
+    unsigned short fid_reserved;
+    char fid_data[MAXFIDSZ];
 };
 
 struct usr_flock {
-       short                   l_type;
-       short                   l_whence;
-       off_t                   l_start;
-       off_t                   l_len;
-       long                    l_sysid;
-       pid_t                   l_pid;
+    short l_type;
+    short l_whence;
+    off_t l_start;
+    off_t l_len;
+    long l_sysid;
+    pid_t l_pid;
 };
 
-extern struct usr_ucred *usr_crget();
+extern struct usr_ucred *usr_crget(void);
 extern struct usr_ucred *usr_crcopy(struct usr_ucred *);
 extern int usr_crhold(struct usr_ucred *);
 extern int usr_crfree(struct usr_ucred *);
-extern struct usr_ucred *afs_global_ucredp;
-
-struct usr_proc {
-       unsigned long           p_flag;
-       pid_t                   p_pid;
-       pid_t                   p_ppid;
-       struct usr_ucred        *p_ucred;
-       char                    p_cursig;
+
+struct usr_proc {
+    unsigned long p_flag;
+    pid_t p_pid;
+    pid_t p_ppid;
+    struct usr_ucred *p_ucred;
+    char p_cursig;
 };
 
-struct usr_a {
-       int                     fd;
-       int                     syscall;
-       int                     parm1;
-       int                     parm2;
-       int                     parm3;
-       int                     parm4;
-       int                     parm5;
-       int                     parm6;
+struct usr_a {
+    int fd;
+    int syscall;
+    int parm1;
+    int parm2;
+    int parm3;
+    int parm4;
+    int parm5;
+    int parm6;
 };
 
 #ifdef uio_offset
@@ -1162,12 +1177,12 @@ struct  usr_a {
 #endif
 
 struct usr_uio {
-        struct iovec           *uio_iov;
-        int                    uio_iovcnt;
-        long                   uio_offset;
-        int                    uio_segflg;
-        short                  uio_fmode;
-        int                    uio_resid;
+    struct iovec *uio_iov;
+    int uio_iovcnt;
+    long uio_offset;
+    int uio_segflg;
+    short uio_fmode;
+    int uio_resid;
 };
 
 #ifdef b_blkno
@@ -1177,111 +1192,117 @@ struct usr_uio {
 #undef b_vp
 #endif
 
-struct usr_buf {
-       int                     b_flags;
-       short                   b_dev;
-       unsigned                b_bcount;
-       struct {
-           char *              b_addr;
-           struct usr_fs       *b_fs;
-       } b_un;
-       long                    b_blkno;
-       unsigned int            b_resid;
-       struct  usr_vnode       *b_vp;
+struct usr_buf {
+    int b_flags;
+    short b_dev;
+    unsigned b_bcount;
+    struct {
+       char *b_addr;
+       struct usr_fs *b_fs;
+    } b_un;
+    long b_blkno;
+    unsigned int b_resid;
+    struct usr_vnode *b_vp;
 };
 
 struct usr_socket {
-       int                     sock;
-       short                   port;
+    int sock;
+    short port;
 };
 
 #define NDIRSIZ_LEN(len) \
 ((sizeof (struct usr_dirent)+4 - (MAXNAMLEN+1)) + (((len)+1 + 3) &~ 3))
 
+struct vcache;
+#define afs_ucred_t struct usr_ucred
+#define AFS_FLOCK       flock
+
+
 struct usr_vnodeops {
-       int                     (*vn_open)();
-       int                     (*vn_close)();
-       int                     (*vn_rdwr)();
-       int                     (*vn_ioctl)();
-       int                     (*vn_select)();
-       int                     (*vn_getattr)();
-       int                     (*vn_setattr)();
-       int                     (*vn_access)();
-       int                     (*vn_lookup)();
-       int                     (*vn_create)();
-       int                     (*vn_remove)();
-       int                     (*vn_link)();
-       int                     (*vn_rename)();
-       int                     (*vn_mkdir)();
-       int                     (*vn_rmdir)();
-       int                     (*vn_readdir)();
-       int                     (*vn_symlink)();
-       int                     (*vn_readlink)();
-       int                     (*vn_fsync)();
-       int                     (*vn_inactive)();
-       int                     (*vn_bmap)();
-       int                     (*vn_strategy)();
-       int                     (*vn_bread)();
-       int                     (*vn_brelse)();
-       int                     (*vn_lockctl)();
-       int                     (*vn_fid)();
+    int (*vn_open) (struct vcache **, afs_int32, afs_ucred_t *);
+    int (*vn_close) (struct vcache *, afs_int32, afs_ucred_t *);
+    int (*vn_rdwr) (struct usr_vnode *avc, struct usr_uio *uio,
+                   int rw, int io, struct usr_ucred *cred);
+    int (*vn_ioctl) (void);
+    int (*vn_select) (void);
+    int (*vn_getattr) (struct vcache *avc, struct vattr *, afs_ucred_t *);
+    int (*vn_setattr) (struct vcache *avc, struct vattr *, afs_ucred_t *);
+    int (*vn_access) (struct vcache *avc, afs_int32, afs_ucred_t *);
+    int (*vn_lookup) (struct vcache *adp, char *, struct vcache **,
+                     afs_ucred_t *, int);
+    int (*vn_create) (struct vcache *adp, char *, struct vattr *,
+                     enum vcexcl, int, struct vcache **, afs_ucred_t *);
+    int (*vn_remove) (struct vcache *adp, char *, afs_ucred_t *);
+    int (*vn_link) (struct vcache *avc, struct vcache *adp, char *,
+                   afs_ucred_t *);
+    int (*vn_rename) (struct vcache *aodp, char *, struct vcache *, char *,
+                     afs_ucred_t *);
+    int (*vn_mkdir) (struct vcache *adp, char *, struct vattr *,
+                    struct vcache **, afs_ucred_t *);
+    int (*vn_rmdir) (struct vcache *adp, char *, afs_ucred_t *);
+    int (*vn_readdir) (struct vcache *avc, struct uio *, afs_ucred_t *);
+    int (*vn_symlink) (struct vcache *adp, char *, struct vattr *, char *,
+                      afs_ucred_t *);
+    int (*vn_readlink) (struct vcache *avc, struct uio *, afs_ucred_t *);
+    int (*vn_fsync) (struct vcache *avc, afs_ucred_t *);
+    int (*vn_inactive) (struct vcache *avc, afs_ucred_t *acred);
+    int (*vn_bmap) (void);
+    int (*vn_strategy) (void);
+    int (*vn_bread) (void);
+    int (*vn_brelse) (void);
+    int (*vn_lockctl) (struct vcache *, struct AFS_FLOCK *, int,
+                      afs_ucred_t *);
+    int (*vn_fid) (struct vcache *avc, struct fid **);
 };
 
 struct usr_fs {
-       int                     dummy;
+    int dummy;
 };
 
-struct usr_mount
-{
-       char                    m_flags;
-       unsigned long           m_dev;
-       struct usr_inode        *m_inodp;
-       struct usr_buf          *m_bufp;
-       struct usr_vnode        *m_mount;
+struct usr_mount {
+    char m_flags;
+    unsigned long m_dev;
+    struct usr_inode *m_inodp;
+    struct usr_buf *m_bufp;
+    struct usr_vnode *m_mount;
 };
 extern struct usr_mount *getmp(unsigned long);
 
 typedef long usr_whymountroot_t;
 
 struct usr_vfsops {
-       int (*vfs_mount)();
-       int (*vfs_unmount)();
-       int (*vfs_root)();
-       int (*vfs_statfs)();
-       int (*vfs_mountroot)();
-       int (*vfs_swapvp)();
+    int (*vfs_mount) (struct vfs *, char *, void *);
+    int (*vfs_unmount) (struct vfs *);
+    int (*vfs_root) (struct vfs *, struct vnode **);
+    int (*vfs_statfs) (struct vfs *, struct statfs *);
+    int (*vfs_mountroot) (struct vfs *);
+    int (*vfs_swapvp) (void);
 };
 
 struct usr_vfs {
-       struct usr_vnode        *vfs_vnodecovered;
-       struct {
-           unsigned long       val[2];
-       } vfs_fsid;
-       char *                  vfs_data;
-       unsigned long           vfs_bsize;
-       struct usr_mount        *vfs_mount;
-       struct usr_vfsops       *vfs_op;
-};
-
-struct usr_sysent {
-       char                    sy_narg;
-       int                     (*sy_call)();
+    struct usr_vnode *vfs_vnodecovered;
+    struct {
+       unsigned long val[2];
+    } vfs_fsid;
+    char *vfs_data;
+    unsigned long vfs_bsize;
+    struct usr_mount *vfs_mount;
+    struct usr_vfsops *vfs_op;
 };
-extern struct usr_sysent usr_sysent[];
 
 struct usr_ifnet {
-       struct usr_ifnet        *if_next;
-       short                   if_flags;
-       u_int                   if_mtu;
-       u_int                   if_metric;
-       struct usr_ifaddr       *if_addrlist;
+    struct usr_ifnet *if_next;
+    short if_flags;
+    u_int if_mtu;
+    u_int if_metric;
+    struct usr_ifaddr *if_addrlist;
 };
 extern struct usr_ifnet *usr_ifnet;
 
 struct usr_ifaddr {
-       struct usr_ifaddr       *ifa_next;
-       struct usr_ifnet        *ifa_ifp;
-       struct sockaddr         ifa_addr;
+    struct usr_ifaddr *ifa_next;
+    struct usr_ifnet *ifa_ifp;
+    struct sockaddr ifa_addr;
 };
 
 #ifdef ia_ifp
@@ -1292,35 +1313,27 @@ struct usr_ifaddr {
 #endif
 
 struct usr_in_ifaddr {
-       struct usr_in_ifaddr    *ia_next;
-       struct usr_ifnet        *ia_ifp;
-       struct                  sockaddr_in ia_addr;
-       unsigned long           ia_net;
-       unsigned long           ia_netmask;
-       unsigned long           ia_subnet;
-       unsigned long           ia_subnetmask;
-       struct                  in_addr ia_netbroadcast;
+    struct usr_in_ifaddr *ia_next;
+    struct usr_ifnet *ia_ifp;
+    struct sockaddr_in ia_addr;
+    unsigned long ia_net;
+    unsigned long ia_netmask;
+    unsigned long ia_subnet;
+    unsigned long ia_subnetmask;
+    struct in_addr ia_netbroadcast;
 };
 extern struct usr_in_ifaddr *usr_in_ifaddr;
 
-extern usr_key_t afs_global_u_key;     /* for per thread authentication */
-
-#if defined(AFS_USR_OSF_ENV)
-extern char V;
-#else
-extern long V;
-#endif
-
 #endif /* UKERNEL */
 
 struct min_direct {
-#if defined(AFS_OFS_ENV) || defined(AFS_USR_OSF_ENV)
-    unsigned int               d_fileno;
-#else /* AFS_OFS_ENV || AFS_USR_OSF_ENV */
-    unsigned long              d_fileno;
-#endif /* AFS_OFS_ENV || AFS_USR_OSF_ENV */
-    unsigned short             d_reclen;
-    unsigned short             d_namlen;
+#if defined(AFS_USR_OSF_ENV)
+    unsigned int d_fileno;
+#else                          /* AFS_OFS_ENV || AFS_USR_OSF_ENV */
+    unsigned long d_fileno;
+#endif                         /* AFS_OFS_ENV || AFS_USR_OSF_ENV */
+    unsigned short d_reclen;
+    unsigned short d_namlen;
 };
 
 #ifndef NGROUPS
@@ -1334,54 +1347,53 @@ struct min_direct {
 #endif
 
 struct usr_ucred {
-       unsigned long           cr_ref;
-       long                    cr_uid;
-       long                    cr_gid;
-       long                    cr_ruid;
-       long                    cr_rgid;
-       long                    cr_suid;
-       long                    cr_sgid;
-       long                    cr_ngroups;
-       gid_t                   cr_groups[NGROUPS];
+    unsigned long cr_ref;
+    long cr_uid;
+    long cr_gid;
+    long cr_ruid;
+    long cr_rgid;
+    long cr_suid;
+    long cr_sgid;
+    long cr_ngroups;
+    gid_t cr_groups[NGROUPS];
 };
 
 #ifdef u_rval1
 #undef u_rval1
 #endif
 
-struct usr_user {
-       int                     u_error;
-       int                     u_prio;
-       char *                  u_ap;
-       int                     u_rval1;
-       long                    u_viceid;
-       unsigned long           u_expiration;
-       struct usr_proc         *u_procp;
-       struct usr_ucred        *u_cred;
-       struct {
-           int                 r_val1;
-       } u_r;
+struct usr_user {
+    int u_error;
+    int u_prio;
+    char *u_ap;
+    int u_rval1;
+    long u_viceid;
+    unsigned long u_expiration;
+    struct usr_proc *u_procp;
+    struct usr_ucred *u_cred;
+    struct {
+       int r_val1;
+    } u_r;
 };
 #define u_rval1                        u_r.r_val1
-#define u                      (*(get_user_struct()))
 
 extern struct usr_user *get_user_struct(void);
 
 #define USR_DIRSIZE            2048
 
 struct usr_dirent {
-       unsigned long           d_ino;
-       unsigned long           d_off;
-       unsigned short          d_reclen;
-       char                    d_name[MAXNAMLEN+1];
+    unsigned long d_ino;
+    unsigned long d_off;
+    unsigned short d_reclen;
+    char d_name[MAXNAMLEN + 1];
 };
 
 typedef struct {
-        int                    dd_fd;
-        int                    dd_loc;
-        int                    dd_size;
-       int                     dd_reserved;
-        char                   *dd_buf;
+    int dd_fd;
+    int dd_loc;
+    int dd_size;
+    int dd_reserved;
+    char *dd_buf;
 } usr_DIR;
 
 extern unsigned short usr_rx_port;