From dc6299f5bbe9defe8627519674a3ffab01443410 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sat, 11 Jul 2009 00:15:26 +0100 Subject: [PATCH] Ukernel prototypes Prototypes and warning fixes for the cache manager when built as part of libuafs Reviewed-on: http://gerrit.openafs.org/73 Verified-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/afs/UKERNEL/afs_usrops.c | 83 +++++++++++-------------------- src/afs/UKERNEL/afs_usrops.h | 2 + src/afs/UKERNEL/osi_groups.c | 4 +- src/afs/UKERNEL/osi_vfsops.c | 37 ++++++-------- src/afs/UKERNEL/osi_vnodeops.c | 5 +- src/afs/UKERNEL/sysincludes.h | 25 +++++----- src/afs/VNOPS/afs_vnop_access.c | 2 +- src/afs/VNOPS/afs_vnop_dirops.c | 3 +- src/afs/VNOPS/afs_vnop_lookup.c | 17 +++---- src/afs/VNOPS/afs_vnop_open.c | 2 +- src/afs/VNOPS/afs_vnop_remove.c | 2 +- src/afs/VNOPS/afs_vnop_strategy.c | 1 - src/afs/afs_callback.c | 11 ++-- src/afs/afs_dcache.c | 6 ++- src/afs/afs_disconnected.c | 6 +-- src/afs/afs_icl.c | 4 +- src/afs/afs_osi.h | 2 +- src/afs/afs_osi_pag.c | 6 ++- src/afs/afs_pioctl.c | 8 ++- src/afs/afs_prototypes.h | 28 ++++++++--- src/afs/afs_segments.c | 4 ++ src/afs/afs_server.c | 8 +-- src/afs/afs_syscall.c | 1 + src/afs/afs_vcache.c | 15 +++--- src/afs/afs_volume.c | 3 +- src/kauth/kalocalcell.c | 5 +- src/rx/UKERNEL/rx_knet.c | 5 +- src/rx/rx_getaddr.c | 7 ++- src/rx/rx_kcommon.c | 4 +- 29 files changed, 157 insertions(+), 149 deletions(-) diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 94f7c89846..d0d435061d 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -15,16 +15,10 @@ #include #include "afs/param.h" - - #ifdef UKERNEL #include "afs/sysincludes.h" /* Standard vendor system headers */ #include -#include -#include -#include -#include #include "afsincludes.h" /* Afs-based standard headers */ #include "afs_usrops.h" @@ -32,6 +26,7 @@ #include "afs/auth.h" #include "afs/cellconfig.h" #include "afs/vice.h" +#include "afs/kauth.h" #include "afs/kautils.h" #include "afs/afsutil.h" #include "rx/rx_globals.h" @@ -104,8 +99,6 @@ int missing_CellInfoFile = 1; struct afs_cacheParams cparams; /* params passed to cache manager */ struct afsconf_dir *afs_cdir; /* config dir */ -static int HandleMTab(); - int afs_bufferpages = 100; int usr_udpcksum = 0; @@ -787,7 +780,6 @@ int afs_osi_Read(struct osi_file *fp, int offset, void *buf, afs_int32 len) { int rc, ret; - int code; struct stat st; AFS_ASSERT_GLOCK(); @@ -826,7 +818,6 @@ int afs_osi_Write(struct osi_file *fp, afs_int32 offset, void *buf, afs_int32 len) { int rc, ret; - int code; struct stat st; AFS_ASSERT_GLOCK(); @@ -917,13 +908,6 @@ afs_osi_VOP_RDWR(struct usr_vnode *vnodeP, struct usr_uio *uioP, int rw, return 0; } -/* - * Use malloc/free routines with check patterns before and after each block - */ - -static char *afs_check_string1 = "UAFS"; -static char *afs_check_string2 = "AFS_OSI_"; - void * afs_osi_Alloc(size_t size) { @@ -1037,7 +1021,7 @@ osi_Active(struct vcache *avc) } int -afs_osi_MapStrategy(int (*aproc) (), struct usr_buf *bp) +afs_osi_MapStrategy(int (*aproc) (struct usr_buf *), struct usr_buf *bp) { afs_int32 returnCode; returnCode = (*aproc) (bp); @@ -1084,8 +1068,6 @@ void osi_Init(void) { int i; - int rc; - usr_thread_t tid; /* * Allocate the table used to implement psuedo-inodes. @@ -1481,8 +1463,6 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam, int nDaemonsParam, int cacheFlagsParam, char *logFile) { int st; - struct usr_proc *procp; - struct usr_ucred *ucredp; int i; int rc; int currVFile; /* Current AFS cache file number */ @@ -1490,8 +1470,6 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam, int cacheIteration; /* cache verification loop counter */ int vFilesFound; /* Num data cache files found in sweep */ FILE *logfd; - afs_int32 vfs1_type = -1; - struct afs_ioctl iob; char tbuffer[1024]; char *p; char lastchar; @@ -1669,8 +1647,9 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam, } memset(pathname_for_V, 0, (cacheFiles * sizeof(char *))); if (afsd_debug) - printf("%s: %d pathname_for_V entries at 0x%x, %d bytes\n", rn, - cacheFiles, pathname_for_V, (cacheFiles * sizeof(AFSD_INO_T))); + printf("%s: %d pathname_for_V entries at %" AFS_PTR_FMT + ", %lud bytes\n", rn, cacheFiles, pathname_for_V, + afs_printable_uint32_lu(cacheFiles * sizeof(AFSD_INO_T))); /* * Set up all the pathnames we'll need for later. @@ -2016,6 +1995,7 @@ syscallThread(void *argp) return 0; } +int fork_syscall(syscall, afscall, param1, param2, param3, param4) long syscall, afscall, param1, param2, param3, param4; { @@ -2037,6 +2017,7 @@ fork_syscall(syscall, afscall, param1, param2, param3, param4) return 0; } +int call_syscall(syscall, afscall, param1, param2, param3, param4) long syscall, afscall, param1, param2, param3, param4; { @@ -2220,6 +2201,7 @@ uafs_LookupName(char *path, struct usr_vnode *parentVp, struct usr_vnode *vp; struct usr_vnode *nextVp; struct usr_vnode *linkVp; + struct vcache *nextVc; char *tmpPath; char *pathP; char *nextPathP = NULL; @@ -2289,17 +2271,20 @@ uafs_LookupName(char *path, struct usr_vnode *parentVp, * lookup the next component in the path, we can release the * subdirectory since we hold the global lock */ + nextVc = NULL; nextVp = NULL; #ifdef AFS_WEB_ENHANCEMENTS if ((nextPathP != NULL && *nextPathP != '\0') || !no_eval_mtpt) - code = afs_lookup(vp, pathP, &nextVp, u.u_cred, 0); + code = afs_lookup(VTOAFS(vp), pathP, &nextVc, u.u_cred, 0); else code = - afs_lookup(vp, pathP, &nextVp, u.u_cred, + afs_lookup(VTOAFS(vp), pathP, &nextVc, u.u_cred, AFS_LOOKUP_NOEVAL); #else - code = afs_lookup(vp, pathP, &nextVp, u.u_cred, 0); + code = afs_lookup(VTOAFS(vp), pathP, &nextVc, u.u_cred, 0); #endif /* AFS_WEB_ENHANCEMENTS */ + if (nextVc) + nextVp=AFSTOV(nextVc); if (code != 0) { VN_RELE(vp); afs_osi_Free(tmpPath, strlen(path) + 1); @@ -2389,7 +2374,7 @@ uafs_LookupLink(struct usr_vnode *vp, struct usr_vnode *parentVp, /* * Read the link data */ - code = afs_readlink(vp, &uio, u.u_cred); + code = afs_readlink(VTOAFS(vp), &uio, u.u_cred); if (code) { afs_osi_Free(pathP, MAX_OSI_PATH + 1); return code; @@ -2552,7 +2537,7 @@ uafs_mkdir_r(char *path, int mode) int code; char *nameP; struct vnode *parentP; - struct vnode *dirP; + struct vcache *dirP; struct usr_vattr attrs; if (uafs_IsRoot(path)) { @@ -2593,13 +2578,13 @@ uafs_mkdir_r(char *path, int mode) attrs.va_uid = u.u_cred->cr_uid; attrs.va_gid = u.u_cred->cr_gid; dirP = NULL; - code = afs_mkdir(parentP, nameP, &attrs, &dirP, u.u_cred); + code = afs_mkdir(VTOAFS(parentP), nameP, &attrs, &dirP, u.u_cred); VN_RELE(parentP); if (code != 0) { errno = code; return -1; } - VN_RELE(dirP); + VN_RELE(AFSTOV(dirP)); return 0; } @@ -3339,7 +3324,7 @@ uafs_fsync_r(int fd) return -1; } - code = afs_fsync(fileP, u.u_cred); + code = afs_fsync(VTOAFS(fileP), u.u_cred); if (code != 0) { errno = code; return -1; @@ -3374,7 +3359,7 @@ uafs_close_r(int fd) } afs_FileTable[fd] = NULL; - code = afs_close(fileP, afs_FileFlags[fd], u.u_cred); + code = afs_close(VTOAFS(fileP), afs_FileFlags[fd], u.u_cred); VN_RELE(fileP); if (code != 0) { errno = code; @@ -3449,7 +3434,7 @@ uafs_link_r(char *existing, char *new) /* * Create the link */ - code = afs_link(existP, dirP, nameP, u.u_cred); + code = afs_link(VTOAFS(existP), VTOAFS(dirP), nameP, u.u_cred); VN_RELE(existP); VN_RELE(dirP); if (code != 0) { @@ -3518,7 +3503,7 @@ uafs_symlink_r(char *target, char *source) attrs.va_mode = 0777; attrs.va_uid = u.u_cred->cr_uid; attrs.va_gid = u.u_cred->cr_gid; - code = afs_symlink(dirP, nameP, &attrs, target, u.u_cred); + code = afs_symlink(VTOAFS(dirP), nameP, &attrs, target, u.u_cred); VN_RELE(dirP); if (code != 0) { errno = code; @@ -3575,7 +3560,7 @@ uafs_readlink_r(char *path, char *buf, int len) /* * Read the the link */ - code = afs_readlink(vp, &uio, u.u_cred); + code = afs_readlink(VTOAFS(vp), &uio, u.u_cred); VN_RELE(vp); if (code) { errno = code; @@ -3606,8 +3591,6 @@ int uafs_unlink_r(char *path) { int code; - int openFlags; - struct usr_vnode *fileP; struct usr_vnode *dirP; char *nameP; @@ -3643,7 +3626,7 @@ uafs_unlink_r(char *path) /* * Remove the file */ - code = afs_remove(dirP, nameP, u.u_cred); + code = afs_remove(VTOAFS(dirP), nameP, u.u_cred); VN_RELE(dirP); if (code != 0) { errno = code; @@ -3720,7 +3703,7 @@ uafs_rename_r(char *old, char *new) /* * Rename the file */ - code = afs_rename(odirP, onameP, ndirP, nnameP, u.u_cred); + code = afs_rename(VTOAFS(odirP), onameP, VTOAFS(ndirP), nnameP, u.u_cred); VN_RELE(odirP); VN_RELE(ndirP); if (code != 0) { @@ -3749,8 +3732,6 @@ int uafs_rmdir_r(char *path) { int code; - int openFlags; - struct usr_vnode *fileP; struct usr_vnode *dirP; char *nameP; @@ -3786,7 +3767,7 @@ uafs_rmdir_r(char *path) /* * Remove the directory */ - code = afs_rmdir(dirP, nameP, u.u_cred); + code = afs_rmdir(VTOAFS(dirP), nameP, u.u_cred); VN_RELE(dirP); if (code != 0) { errno = code; @@ -3934,7 +3915,7 @@ uafs_getdents_r(int fd, struct min_direct *buf, int len) /* * read the next chunk from the directory */ - code = afs_readdir(vp, &uio, u.u_cred); + code = afs_readdir(VTOAFS(vp), &uio, u.u_cred); if (code != 0) { errno = code; return -1; @@ -3960,7 +3941,6 @@ uafs_readdir(usr_DIR * dirp) struct usr_dirent * uafs_readdir_r(usr_DIR * dirp) { - int rc; int code; int len; struct usr_uio uio; @@ -3999,7 +3979,7 @@ uafs_readdir_r(usr_DIR * dirp) /* * read the next chunk from the directory */ - code = afs_readdir(vp, &uio, u.u_cred); + code = afs_readdir(VTOAFS(vp), &uio, u.u_cred); if (code != 0) { errno = code; return NULL; @@ -4274,8 +4254,6 @@ int uafs_statmountpoint(char *path) { int retval; - int code; - char buf[256]; AFS_GLOCK(); retval = uafs_statmountpoint_r(path); @@ -4289,7 +4267,6 @@ uafs_statmountpoint_r(char *path) int code; struct vnode *vp; struct vcache *avc; - struct vrequest treq; int r; code = uafs_LookupName(path, afs_CurrentDir, &vp, 0, 1); @@ -4312,7 +4289,7 @@ uafs_statmountpoint_r(char *path) int uafs_getRights(char *path) { - int code, rc; + int code; struct vnode *vp; int afs_rights; @@ -4328,7 +4305,7 @@ uafs_getRights(char *path) PRSFS_READ | PRSFS_WRITE | PRSFS_INSERT | PRSFS_LOOKUP | PRSFS_DELETE | PRSFS_LOCK | PRSFS_ADMINISTER; - afs_rights = afs_getRights(vp, afs_rights, u.u_cred); + afs_rights = afs_getRights(VTOAFS(vp), afs_rights, u.u_cred); AFS_GUNLOCK(); return afs_rights; diff --git a/src/afs/UKERNEL/afs_usrops.h b/src/afs/UKERNEL/afs_usrops.h index d475fe5dda..7fc68f87e3 100644 --- a/src/afs/UKERNEL/afs_usrops.h +++ b/src/afs/UKERNEL/afs_usrops.h @@ -149,5 +149,7 @@ extern int uafs_RPCStatsEnableProc(void); extern int uafs_RPCStatsDisableProc(void); extern int uafs_RPCStatsEnablePeer(void); extern int uafs_RPCStatsDisablePeer(void); +extern int uafs_IsRoot(char *path); +extern int uafs_statmountpoint_r(char *path); #endif /* __AFS_USROPS_H__ */ diff --git a/src/afs/UKERNEL/osi_groups.c b/src/afs/UKERNEL/osi_groups.c index 3352b6c28e..7856c61725 100644 --- a/src/afs/UKERNEL/osi_groups.c +++ b/src/afs/UKERNEL/osi_groups.c @@ -21,7 +21,7 @@ int -afs_xsetgroups() +afs_xsetgroups(void) { usr_assert(0); return 0; @@ -49,8 +49,6 @@ static int afs_setgroups(struct AFS_UCRED **cred, int ngroups, gid_t * gidset, int change_parent) { - int ngrps; - int i; gid_t *gp; AFS_STATCNT(afs_setgroups); diff --git a/src/afs/UKERNEL/osi_vfsops.c b/src/afs/UKERNEL/osi_vfsops.c index 4801bd258a..8910dbebca 100644 --- a/src/afs/UKERNEL/osi_vfsops.c +++ b/src/afs/UKERNEL/osi_vfsops.c @@ -15,12 +15,9 @@ #include "afsincludes.h" /* Afs-based standard headers */ #include "afs/afs_stats.h" /* statistics stuff */ +int afs_statfs(register struct vfs *afsp, struct statfs *abp); +int afs_sync(struct vfs *afsp); -int afs_mount(); -int afs_unmount(); -int afs_root(); -int afs_statfs(); -int afs_sync(); struct vfsops Afs_vfsops = { afs_mount, @@ -38,10 +35,8 @@ int afs_rootCellIndex = 0; #include "sys/syscall.h" #endif -afs_mount(afsp, path, data) - char *path; - caddr_t data; - struct vfs *afsp; +int +afs_mount(struct vfs *path, char *data, struct vfs *afsp) { AFS_STATCNT(afs_mount); @@ -57,8 +52,8 @@ afs_mount(afsp, path, data) return 0; } -afs_unmount(afsp) - struct vfs *afsp; +int +afs_unmount(struct vfs *afsp) { AFS_STATCNT(afs_unmount); afs_globalVFS = 0; @@ -66,9 +61,8 @@ afs_unmount(afsp) return 0; } -afs_root(OSI_VFS_ARG(afsp), avpp) - OSI_VFS_DECL(afsp); - struct vnode **avpp; +int +afs_root(OSI_VFS_DECL(afsp), struct vnode **avpp) { register afs_int32 code = 0; struct vrequest treq; @@ -107,16 +101,15 @@ afs_root(OSI_VFS_ARG(afsp), avpp) return code; } -afs_sync(afsp) - struct vfs *afsp; +int +afs_sync(struct vfs *afsp) { AFS_STATCNT(afs_sync); return 0; } -afs_statfs(afsp, abp) - register struct vfs *afsp; - struct statfs *abp; +int +afs_statfs(register struct vfs *afsp, struct statfs *abp) { AFS_STATCNT(afs_statfs); abp->f_type = 0; @@ -126,13 +119,15 @@ afs_statfs(afsp, abp) return 0; } -afs_mountroot() +int +afs_mountroot(void) { AFS_STATCNT(afs_mountroot); return (EINVAL); } -afs_swapvp() +int +afs_swapvp(void) { AFS_STATCNT(afs_swapvp); return (EINVAL); diff --git a/src/afs/UKERNEL/osi_vnodeops.c b/src/afs/UKERNEL/osi_vnodeops.c index 3241ecd7c7..3c0ee94d04 100644 --- a/src/afs/UKERNEL/osi_vnodeops.c +++ b/src/afs/UKERNEL/osi_vnodeops.c @@ -33,12 +33,13 @@ afs_vrdwr(struct usr_vnode *avc, struct usr_uio *uio, int rw, int io, int afs_inactive(struct vcache *avc, struct AFS_UCRED *acred) { - struct vnode *vp = AFSTOV(avc); if (afs_shuttingdown) - return; + return 0; usr_assert(avc->vrefCount == 0); afs_InactiveVCache(avc, acred); + + return 0; } struct usr_vnodeops Afs_vnodeops = { diff --git a/src/afs/UKERNEL/sysincludes.h b/src/afs/UKERNEL/sysincludes.h index cc61bbdba2..a0c9d54cda 100644 --- a/src/afs/UKERNEL/sysincludes.h +++ b/src/afs/UKERNEL/sysincludes.h @@ -16,19 +16,21 @@ #endif #include #include -#include -#include #include #include #include + #if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) /* must be included after KERNEL undef'd */ -#include +#include +#include +#include +#include +#include #endif #ifdef AFS_USR_SUN5_ENV #include #include -#include #include #include #include @@ -43,7 +45,6 @@ #ifdef AFS_USR_AIX_ENV #include -#include #include #include #include @@ -56,7 +57,6 @@ #ifdef AFS_USR_SGI_ENV #include -#include #include #include #include @@ -70,7 +70,6 @@ #ifdef AFS_USR_HPUX_ENV #include -#include #include #include #include @@ -87,7 +86,6 @@ #define AFS_USR_UNDEF_KERNEL_ENV 1 #endif #include -#include #include #include #include @@ -135,6 +133,9 @@ #include #include #include +#include +#include +#include #ifndef O_SYNC #define O_SYNC O_FSYNC #endif @@ -1010,7 +1011,7 @@ 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), u.u_cred); \ } while(0) struct usr_statfs { @@ -1225,8 +1226,8 @@ struct vcache; struct usr_vnodeops { - int (*vn_open) (char *path, int flags, int mode); - int (*vn_close) (int fd); + int (*vn_open) (struct vcache **, afs_int32, struct AFS_UCRED *); + int (*vn_close) (struct vcache *, afs_int32, struct AFS_UCRED *); int (*vn_rdwr) (struct usr_vnode *avc, struct usr_uio *uio, int rw, int io, struct usr_ucred *cred); int (*vn_ioctl) (void); @@ -1277,7 +1278,7 @@ extern struct usr_mount *getmp(unsigned long); typedef long usr_whymountroot_t; struct usr_vfsops { - int (*vfs_mount) (struct vfs *, char *, caddr_t); + int (*vfs_mount) (struct vfs *, char *, struct vfs *); int (*vfs_unmount) (struct vfs *); int (*vfs_root) (struct vfs *, struct vnode **); int (*vfs_statfs) (struct vfs *, struct statfs *); diff --git a/src/afs/VNOPS/afs_vnop_access.c b/src/afs/VNOPS/afs_vnop_access.c index 79dfb12b82..13c309c97d 100644 --- a/src/afs/VNOPS/afs_vnop_access.c +++ b/src/afs/VNOPS/afs_vnop_access.c @@ -357,7 +357,7 @@ afs_getRights(OSI_VC_DECL(avc), register afs_int32 arights, struct vrequest treq; OSI_VC_CONVERT(avc); - if (code = afs_InitReq(&treq, acred)) + if ((code = afs_InitReq(&treq, acred))) return code; code = afs_VerifyVCache(avc, &treq); diff --git a/src/afs/VNOPS/afs_vnop_dirops.c b/src/afs/VNOPS/afs_vnop_dirops.c index a76538c72f..cd9c8f7893 100644 --- a/src/afs/VNOPS/afs_vnop_dirops.c +++ b/src/afs/VNOPS/afs_vnop_dirops.c @@ -42,7 +42,9 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, register struct afs_conn *tc; struct VenusFid newFid; register struct dcache *tdc; +#ifdef AFS_DISCON_ENV struct dcache *new_dc; +#endif afs_size_t offset, len; register struct vcache *tvc; struct AFSStoreStatus InStatus; @@ -475,7 +477,6 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) done: AFS_DISCON_UNLOCK(); - done3: afs_PutFakeStat(&fakestate); code = afs_CheckCode(code, &treq, 27); done2: diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 04ced6d928..0c8ad6a6ff 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -17,7 +17,6 @@ #include #include "afs/param.h" - #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ #include "afs/afs_stats.h" /* statistics */ @@ -27,11 +26,8 @@ #include "afs/afs_osidnlc.h" #include "afs/afs_dynroot.h" - -extern struct DirEntry *afs_dir_GetBlob(); extern struct vcache *afs_globalVp; - afs_int32 afs_bkvolpref = 0; afs_int32 afs_bulkStatsDone; static int bulkStatCounter = 0; /* counter for bulk stat seq. numbers */ @@ -661,7 +657,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) afs_int32 retry; /* handle low-level SGI MP race conditions */ long volStates; /* flags from vol structure */ struct volume *volp = 0; /* volume ptr */ - struct VenusFid dotdot = {0, 0, 0}; + struct VenusFid dotdot = {0, {0, 0, 0}}; int flagIndex = 0; /* First file with bulk fetch flag set */ int inlinebulk = 0; /* Did we use InlineBulk RPC or not? */ XSTATS_DECLS; @@ -1769,11 +1765,11 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED afs_AddMarinerName(aname, tvc); #if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS) - if (!(flags & AFS_LOOKUP_NOEVAL)) + if (!(flags & AFS_LOOKUP_NOEVAL)) { /* Here we don't enter the name into the DNLC because we want the - * evaluated mount dir to be there (the vcache for the mounted volume) - * rather than the vc of the mount point itself. we can still find the - * mount point's vc in the vcache by its fid. */ + * evaluated mount dir to be there (the vcache for the mounted + * volume) rather than the vc of the mount point itself. We can + * still find the mount point's vc in the vcache by its fid. */ #endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */ if (!hit && force_eval) { osi_dnlc_enter(adp, aname, tvc, &versionNo); @@ -1787,6 +1783,9 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED return 0; /* can't have been any errors if hit and !code */ #endif } +#if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS) + } +#endif } if (bulkcode) code = bulkcode; diff --git a/src/afs/VNOPS/afs_vnop_open.c b/src/afs/VNOPS/afs_vnop_open.c index 9832de9646..304c0bc492 100644 --- a/src/afs/VNOPS/afs_vnop_open.c +++ b/src/afs/VNOPS/afs_vnop_open.c @@ -169,7 +169,7 @@ afs_open(struct vcache **avcp, afs_int32 aflags, struct AFS_UCRED *acred) if ((afs_preCache != 0) && (writing == 0) && (vType(tvc) != VDIR) && (!afs_BBusy())) { register struct dcache *tdc; - afs_size_t offset, len, totallen = 0; + afs_size_t offset, len; tdc = afs_GetDCache(tvc, 0, &treq, &offset, &len, 1); diff --git a/src/afs/VNOPS/afs_vnop_remove.c b/src/afs/VNOPS/afs_vnop_remove.c index a0a538cdb6..818c0e7f4f 100644 --- a/src/afs/VNOPS/afs_vnop_remove.c +++ b/src/afs/VNOPS/afs_vnop_remove.c @@ -434,7 +434,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) if (!code) { struct VenusFid *oldmvid = NULL; if (tvc->mvid) - oldmvid = (char *)tvc->mvid; + oldmvid = tvc->mvid; tvc->mvid = (struct VenusFid *)unlname; if (oldmvid) osi_FreeSmallSpace(oldmvid); diff --git a/src/afs/VNOPS/afs_vnop_strategy.c b/src/afs/VNOPS/afs_vnop_strategy.c index 327b44043a..21385c7edd 100644 --- a/src/afs/VNOPS/afs_vnop_strategy.c +++ b/src/afs/VNOPS/afs_vnop_strategy.c @@ -35,7 +35,6 @@ int afs_ustrategy(register struct buf *abp) { register afs_int32 code; struct uio tuio; - struct uio *tuiop = &tuio; struct iovec tiovec[1]; register struct vcache *tvc = VTOAFS(abp->b_vp); register afs_int32 len = abp->b_bcount; diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index 87f3ec7e11..26d5fb6eb8 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -1726,14 +1726,9 @@ resume: } #endif -int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName) - struct rx_call *a_call; - afs_int32 a_index; - afs_int32 *addr; - afs_int32 *inode; - afs_int32 *flags; - afs_int32 *time; - char ** fileName; +int SRXAFSCB_GetDE(struct rx_call *a_call, afs_int32 a_index, afs_int32 *addr, + afs_int32 *inode, afs_int32 *flags, afs_int32 *time, + char ** fileName) { /*SRXAFSCB_GetDE*/ int code = 0; /*Return code*/ #if 0 && defined(AFS_LINUX24_ENV) diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 6308ab5d01..77510ff9c8 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -2433,7 +2433,10 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { - afs_int32 length_hi, length, bytes; +#ifdef AFS_64BIT_CLIENT + afs_int32 length_hi; +#endif + afs_int32 length, bytes; #ifndef AFS_NOSTATS numFetchLoops++; if (fromReplica) @@ -3707,7 +3710,6 @@ int afs_MakeShadowDir(struct vcache *avc, struct dcache *adc) struct osi_file *tfile_src, *tfile_dst; struct VenusFid shadow_fid; char *data; - int lock_held = 0; /* Is this a dir? */ if (vType(avc) != VDIR) diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index f833176c81..94fcc737dc 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -50,7 +50,6 @@ enum { afs_int32 afs_ConflictPolicy = SERVER_WINS; -static void afs_DisconResetVCache(struct vcache *, struct AFS_UCRED *); static void afs_DisconDiscardAllShadows(int, struct AFS_UCRED *); void afs_DbgListDirEntries(struct VenusFid *afid); @@ -659,7 +658,7 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, struct afs_conn *tc; afs_int32 hash, new_hash, index; afs_size_t tlen; - int code, op; + int code, op = 0; XSTATS_DECLS; tname = afs_osi_Alloc(AFSNAMEMAX); @@ -1104,7 +1103,6 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) struct AFSCallBack callback; struct AFSVolSync tsync; int code = 0; - int ucode; afs_int32 start = 0; XSTATS_DECLS; /*AFS_STATCNT(afs_ResyncDisconFiles);*/ @@ -1356,7 +1354,7 @@ afs_DisconDiscardAll(struct AFS_UCRED *acred) { * * \note Call with afs_DDirtyVCListLock read locked. */ -void afs_DbgDisconFiles() +void afs_DbgDisconFiles(void) { struct vcache *tvc; struct afs_q *q; diff --git a/src/afs/afs_icl.c b/src/afs/afs_icl.c index 40d67807a2..17e33984e4 100644 --- a/src/afs/afs_icl.c +++ b/src/afs/afs_icl.c @@ -77,8 +77,8 @@ afs_icl_InitLogs(void) } -struct afs_icl_log *afs_icl_FindLog(); -struct afs_icl_set *afs_icl_FindSet(); +struct afs_icl_log *afs_icl_FindLog(char *); +struct afs_icl_set *afs_icl_FindSet(char *); int diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 378f6d45c1..cc4f1d26a5 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -279,7 +279,7 @@ typedef struct timeval osi_timeval_t; * and kernel space. Call these to avoid taking page faults while * holding the global lock. */ -#ifdef CAST_USER_ADDR_T +#if defined(CAST_USER_ADDR_T) && !defined(UKERNEL) #define __U(X) CAST_USER_ADDR_T((X)) #else #define __U(X) (X) diff --git a/src/afs/afs_osi_pag.c b/src/afs/afs_osi_pag.c index 248315242d..7c30310d53 100644 --- a/src/afs/afs_osi_pag.c +++ b/src/afs/afs_osi_pag.c @@ -376,7 +376,7 @@ afs_setpag_val(int pagval) #ifndef AFS_LINUX26_ONEGROUP_ENV int -afs_getpag_val() +afs_getpag_val(void) { int pagvalue; struct AFS_UCRED *credp = u.u_cred; @@ -427,7 +427,9 @@ AddPag(afs_int32 aval, struct AFS_UCRED **credpp) int afs_InitReq(register struct vrequest *av, struct AFS_UCRED *acred) { +#ifdef AFS_LINUX26_ENV int code; +#endif int i = 0; AFS_STATCNT(afs_InitReq); @@ -610,7 +612,9 @@ PagInCred(struct AFS_UCRED *cred) #else pag = (afs_int32) afs_get_pag_from_groups(g0, g1); #endif +#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DUX40_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_XBSD_ENV) out: +#endif #if defined(AFS_LINUX26_ENV) && defined(LINUX_KEYRING_SUPPORT) if (pag == NOPAG && cred->cr_rgid != NFSXLATOR_CRED) { struct key *key; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index b002e99819..622a4dd51f 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -239,7 +239,7 @@ static pioctlFunction CpioctlSw[] = { PGetPAG, /* 13 */ }; -static int (*(OpioctlSw[])) () = { +static pioctlFunction OpioctlSw[] = { PBogus, /* 0 */ PNFSNukeCreds, /* 1 -- nuke all creds for NFS client */ #if defined(AFS_CACHE_BYPASS) @@ -680,6 +680,8 @@ afs_xioctl(void) #endif /* AFS_SUN5_ENV */ #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) return (code); +#else + return 0; #endif } #endif /* AFS_SGI_ENV */ @@ -789,7 +791,9 @@ afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow) #ifdef AFS_NEED_CLIENTCONTEXT struct AFS_UCRED *tmpcred = NULL; #endif +#if defined(AFS_NEED_CLIENTCONTEXT) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) struct AFS_UCRED *foreigncreds = NULL; +#endif register afs_int32 code = 0; struct vnode *vp = NULL; #ifdef AFS_AIX41_ENV @@ -4751,7 +4755,7 @@ DECL_PIOCTL(PDiscon) DECL_PIOCTL(PNFSNukeCreds) { - afs_uint32 addr, code; + afs_uint32 addr; register afs_int32 i; register struct unixuser *tu; diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 7eb42d3c07..e67f2362a2 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -674,11 +674,16 @@ extern void shutdown_osifile(void); /* ARCH/osi_groups.c */ -#if defined AFS_XBSD_ENV -#if !defined(AFS_DFBSD_ENV) || !defined(UKERNEL) +#if defined(UKERNEL) +extern int usr_setpag(struct usr_ucred **cred, afs_uint32 pagvalue, + afs_uint32 * newpag, int change_parent); +#else +# if defined AFS_XBSD_ENV +# if !defined(AFS_DFBSD_ENV) extern int setpag(struct proc *proc, struct ucred **cred, afs_uint32 pagvalue, afs_uint32 * newpag, int change_parent); -#endif +# endif +# endif #endif @@ -734,6 +739,12 @@ extern void vcache2inode(struct vcache *avc); extern void vcache2fakeinode(struct vcache *rootvp, struct vcache *mpvp); #endif +#ifdef UKERNEL +extern int afs_mount(struct vfs *path, char *data, struct vfs *afsp); +extern int afs_root(OSI_VFS_DECL(afsp), struct vnode **avpp); +extern int afs_unmount(struct vfs *afsp); +#endif + /* afs_pag_call.c */ extern afs_int32 afs_nfs_server_addr; extern void afspag_Init(afs_int32 nfs_server_addr); @@ -858,11 +869,16 @@ extern void uafs_Shutdown(void); extern void osi_ReleaseVM(struct vcache *avc, int len, struct usr_ucred *credp); extern int osi_GetTime(struct timeval *tv); +extern int iodone(struct usr_buf *bp); +extern int usr_ioctl(void); +extern int lookupname(char *fnamep, int segflg, int followlink, + struct usr_vnode **compvpp); +extern int usr_uiomove(char *kbuf, int n, int rw, struct usr_uio *uio); +extern int afs_osi_VOP_RDWR(struct usr_vnode *vnodeP, struct usr_uio *uioP, + int rw, int flags, struct usr_ucred *credP); + #endif - - - /* afs_user.c */ extern afs_rwlock_t afs_xuser; extern struct unixuser *afs_users[NUSERS]; diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index ea96c92118..09c013dc65 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -58,7 +58,9 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) do { tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { +#ifdef AFS_64BIT_CLIENT retry: +#endif RX_AFS_GUNLOCK(); tcall = rx_NewCall(tc->id); RX_AFS_GLOCK(); @@ -361,7 +363,9 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, stored = 0; tc = afs_Conn(&avc->f.fid, areq, 0); if (tc) { +#ifdef AFS_64BIT_CLIENT restart: +#endif RX_AFS_GUNLOCK(); tcall = rx_NewCall(tc->id); #ifdef AFS_64BIT_CLIENT diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index ac90039626..0e17d675ca 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -487,7 +487,7 @@ afs_CountServers(void) void -ForceAllNewConnections() +ForceAllNewConnections(void) { int srvAddrCount; struct srvAddr **addrs; @@ -1850,7 +1850,7 @@ void afs_ActivateServer(struct srvAddr *sap) { } } -void afs_RemoveAllConns() +void afs_RemoveAllConns(void) { int i; struct server *ts, *nts; @@ -1887,7 +1887,7 @@ void afs_RemoveAllConns() } -void afs_MarkAllServersUp() +void afs_MarkAllServersUp(void) { int i; struct server *ts; @@ -1906,7 +1906,7 @@ void afs_MarkAllServersUp() ReleaseWriteLock(&afs_xserver); } -void shutdown_server() +void shutdown_server(void) { int i; diff --git a/src/afs/afs_syscall.c b/src/afs/afs_syscall.c index c9581aa5e2..912fd86202 100644 --- a/src/afs/afs_syscall.c +++ b/src/afs/afs_syscall.c @@ -488,6 +488,7 @@ afs_syscall(long syscall, long parm1, long parm2, long parm3, long parm4) /* eparm is also used by AFSCALL_CALL in afsd.c */ #else #if defined(UKERNEL) +int Afs_syscall() { register struct a { diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 825a672bd8..be7fc0ea99 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -85,8 +85,10 @@ extern int afsd_dynamic_vcaches; /* Disk backed vcache definitions * Both protected by xvcache */ +#ifdef AFS_DISCON_ENV static int afs_nextVcacheSlot = 0; static struct afs_slotlist *afs_freeSlotList = NULL; +#endif /* Forward declarations */ static afs_int32 afs_QueueVCB(struct vcache *avc); @@ -3279,11 +3281,12 @@ void shutdown_vcache(void) { int i; - struct afs_cbr *tsp, *nsp; + struct afs_cbr *tsp; /* - * XXX We may potentially miss some of the vcaches because if when there're no - * free vcache entries and all the vcache entries are active ones then we allocate - * an additional one - admittedly we almost never had that occur. + * XXX We may potentially miss some of the vcaches because if when + * there are no free vcache entries and all the vcache entries are active + * ones then we allocate an additional one - admittedly we almost never + * had that occur. */ { @@ -3375,7 +3378,7 @@ shutdown_vcache(void) QInit(&afs_vhashTV[i]); } -void afs_DisconGiveUpCallbacks() { +void afs_DisconGiveUpCallbacks(void) { int i; struct vcache *tvc; int nq=0; @@ -3407,7 +3410,7 @@ void afs_DisconGiveUpCallbacks() { * disconnected mode to tidy up during reconnection * */ -void afs_ClearAllStatdFlag() { +void afs_ClearAllStatdFlag(void) { int i; struct vcache *tvc; diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 3c7bcc4e1c..247a045a38 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -1056,7 +1056,8 @@ InstallUVolumeEntry(struct volume *av, struct uvldbentry *ve, int acell, && ts->addr) { /* uuid, uniquifier, and portal are the same */ } else { - afs_uint32 *addrp, nentries, code, unique; + afs_uint32 *addrp, code; + afs_int32 nentries, unique; bulkaddrs addrs; ListAddrByAttributes attrs; afsUUID uuid; diff --git a/src/kauth/kalocalcell.c b/src/kauth/kalocalcell.c index 5bcd308889..959b909107 100644 --- a/src/kauth/kalocalcell.c +++ b/src/kauth/kalocalcell.c @@ -54,12 +54,13 @@ static char cell_name[MAXCELLCHARS]; int ka_CellConfig(const char *dir) { - int code; #ifdef UKERNEL conf = afs_cdir; strcpy(cell_name, afs_LclCellName); return 0; #else /* UKERNEL */ + int code; + LOCK_GLOBAL_MUTEX; if (conf) afsconf_Close(conf); @@ -77,7 +78,9 @@ ka_CellConfig(const char *dir) char * ka_LocalCell(void) { +#ifndef UKERNEL int code = 0; +#endif LOCK_GLOBAL_MUTEX; if (conf) { diff --git a/src/rx/UKERNEL/rx_knet.c b/src/rx/UKERNEL/rx_knet.c index 3139d83766..00d800faf1 100644 --- a/src/rx/UKERNEL/rx_knet.c +++ b/src/rx/UKERNEL/rx_knet.c @@ -23,7 +23,7 @@ unsigned short usr_rx_port = 0; struct usr_ifnet *usr_ifnet = NULL; struct usr_in_ifaddr *usr_in_ifaddr = NULL; -void rxk_InitializeSocket(); +void rxk_InitializeSocket(void); void afs_rxevent_daemon(void) @@ -196,7 +196,7 @@ rxk_NewSocket(short aport) void rxk_InitializeSocket(void) { - int rc, sock, i; + int rc, sock; #ifdef AFS_USR_AIX_ENV unsigned long len, optval, optval0, optlen; #else /* AFS_USR_AIX_ENV */ @@ -283,7 +283,6 @@ osi_NetSend(osi_socket sockp, struct sockaddr_in *addr, struct iovec *iov, { int rc; int i; - unsigned long tmp; struct usr_socket *usockp = (struct usr_socket *)sockp; struct msghdr msg; struct iovec tmpiov[64]; diff --git a/src/rx/rx_getaddr.c b/src/rx/rx_getaddr.c index bcf9add613..6e8c5f4140 100644 --- a/src/rx/rx_getaddr.c +++ b/src/rx/rx_getaddr.c @@ -429,11 +429,14 @@ int rx_getAllAddrMaskMtu(afs_uint32 addrBuffer[], afs_uint32 maskBuffer[], afs_uint32 mtuBuffer[], int maxSize) { - int s; - int i, len, count = 0; + int i, count = 0; +#if defined(AFS_USERSPACE_IP_ADDR) + int s, len; struct ifconf ifc; struct ifreq ifs[NIFS], *ifr; struct sockaddr_in *a; +#endif + #if defined(AFS_AIX41_ENV) || defined(AFS_USR_AIX_ENV) char *cp, *cplim; /* used only for AIX 41 */ #endif diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 5a3b07d0aa..00b7cced37 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -407,11 +407,13 @@ void rxi_InitPeerParams(struct rx_peer *pp) { u_short rxmtu; - afs_int32 i, mtu; #ifdef ADAPT_MTU + afs_int32 mtu; #ifndef AFS_SUN5_ENV #ifdef AFS_USERSPACE_IP_ADDR + afs_int32 i; + i = rxi_Findcbi(pp->host); if (i == -1) { pp->timeout.sec = 3;