reindent-20030715
[openafs.git] / src / afs / DUX / osi_vfsops.c
index 4063b6c..a70d2c9 100644 (file)
 #include <afsconfig.h>
 #include "afs/param.h"
 
-RCSID("$Header$");
+RCSID
+    ("$Header$");
 
 #include "afs/sysincludes.h"   /* Standard vendor system headers */
 #include "afsincludes.h"       /* Afs-based standard headers */
-#include "afs/afs_stats.h"   /* statistics stuff */
+#include "afs/afs_stats.h"     /* statistics stuff */
 #include <sys/types.h>
 #include <kern/mach_param.h>
 #include <sys/sysconfig.h>
@@ -37,10 +38,8 @@ udecl_simple_lock_data(, afsmntid_lock)
 #define AFSMNTID_LOCK()         usimple_lock(&afsmntid_lock)
 #define AFSMNTID_UNLOCK()       usimple_unlock(&afsmntid_lock)
 #define AFSMNTID_LOCK_INIT()    usimple_lock_init(&afsmntid_lock)
-
-
-int mp_afs_mount(struct mount *afsp,char * path, caddr_t data,
-                struct nameidata *ndp)
+     int mp_afs_mount(struct mount *afsp, char *path, caddr_t data,
+                     struct nameidata *ndp)
 {
     u_int size;
 
@@ -51,7 +50,7 @@ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data,
     AFS_GLOCK();
     AFS_STATCNT(afs_mount);
 
-    if (afs_globalVFS) { /* Don't allow remounts. */
+    if (afs_globalVFS) {       /* Don't allow remounts. */
        AFS_GUNLOCK();
        return (EBUSY);
     }
@@ -65,7 +64,7 @@ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data,
     afsp->m_stat.f_fsid.val[1] = MOUNT_AFS;
     AFSMNTID_LOCK();
     if (++afs_mntid == 0)
-        ++afs_mntid;
+       ++afs_mntid;
     AFSMNTID_UNLOCK();
     BM(AFSMNTID_LOCK());
     tfsid.val[0] = makedev(130, afs_mntid);
@@ -73,29 +72,30 @@ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data,
     BM(AFSMNTID_UNLOCK());
 
     while (xmp = getvfs(&tfsid)) {
-        UNMOUNT_READ_UNLOCK(xmp);
-        tfsid.val[0]++;
-        AFSMNTID_LOCK();
-        afs_mntid++;
-        AFSMNTID_UNLOCK();
+       UNMOUNT_READ_UNLOCK(xmp);
+       tfsid.val[0]++;
+       AFSMNTID_LOCK();
+       afs_mntid++;
+       AFSMNTID_UNLOCK();
     }
     if (major(tfsid.val[0]) != 130) {
        AFS_GUNLOCK();
-        return (ENOENT);
+       return (ENOENT);
     }
     afsp->m_stat.f_fsid.val[0] = tfsid.val[0];
 
     afsp->m_stat.f_mntonname = AFS_KALLOC(MNAMELEN);
-    afsp->m_stat.f_mntfromname = AFS_KALLOC(MNAMELEN); 
-    if ( !afsp->m_stat.f_mntonname || !afsp->m_stat.f_mntfromname)
+    afsp->m_stat.f_mntfromname = AFS_KALLOC(MNAMELEN);
+    if (!afsp->m_stat.f_mntonname || !afsp->m_stat.f_mntfromname)
        panic("malloc failure in afs_mount\n");
 
     memset(afsp->m_stat.f_mntonname, 0, MNAMELEN);
     memset(afsp->m_stat.f_mntfromname, 0, MNAMELEN);
-    AFS_COPYINSTR(path, (caddr_t)afsp->m_stat.f_mntonname, MNAMELEN, &size, code);
+    AFS_COPYINSTR(path, (caddr_t) afsp->m_stat.f_mntonname, MNAMELEN, &size,
+                 code);
     memcpy(afsp->m_stat.f_mntfromname, "AFS", 4);
     AFS_GUNLOCK();
-    (void) mp_afs_statfs(afsp);
+    (void)mp_afs_statfs(afsp);
     AFS_GLOCK();
     afs_vfsdev = afsp->m_stat.f_fsid.val[0];
 
@@ -109,7 +109,8 @@ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data,
 }
 
 
-int mp_afs_unmount (struct mount *afsp, int flag)
+int
+mp_afs_unmount(struct mount *afsp, int flag)
 {
     AFS_GLOCK();
     AFS_STATCNT(afs_unmount);
@@ -120,16 +121,18 @@ int mp_afs_unmount (struct mount *afsp, int flag)
 }
 
 
-int mp_afs_start(struct mount *mp, int flags)
+int
+mp_afs_start(struct mount *mp, int flags)
 {
-    return(0);
+    return (0);
 }
 
-int mp_afs_root (struct mount *afsp, struct vnode **avpp)
+int
+mp_afs_root(struct mount *afsp, struct vnode **avpp)
 {
     register afs_int32 code = 0;
     struct vrequest treq;
-    register struct vcache *tvp=0;
+    register struct vcache *tvp = 0;
 
     AFS_GLOCK();
     AFS_STATCNT(afs_root);
@@ -141,8 +144,8 @@ int mp_afs_root (struct mount *afsp, struct vnode **avpp)
            afs_globalVp = NULL;
        }
 
-       if (!(code = afs_InitReq(&treq, u.u_cred)) &&
-           !(code = afs_CheckInit())) {
+       if (!(code = afs_InitReq(&treq, u.u_cred))
+           && !(code = afs_CheckInit())) {
            tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
            /* we really want this to stay around */
            if (tvp) {
@@ -156,7 +159,7 @@ int mp_afs_root (struct mount *afsp, struct vnode **avpp)
        AFS_GUNLOCK();
        VN_HOLD(vp);
        VN_LOCK(vp);
-       vp->v_flag |= VROOT;        /* No-op on Ultrix 2.2 */
+       vp->v_flag |= VROOT;    /* No-op on Ultrix 2.2 */
        VN_UNLOCK(vp);
        AFS_GLOCK();
 
@@ -171,12 +174,13 @@ int mp_afs_root (struct mount *afsp, struct vnode **avpp)
 }
 
 
-mp_afs_quotactl(struct mount *mp, int cmd, uid_t uid, caddr_t arg)
+mp_afs_quotactl(struct mount * mp, int cmd, uid_t uid, caddr_t arg)
 {
     return EOPNOTSUPP;
 }
 
-int mp_afs_statfs(struct mount *afsp)
+int
+mp_afs_statfs(struct mount *afsp)
 {
     struct nstatfs *abp = &afsp->m_stat;
 
@@ -191,7 +195,7 @@ int mp_afs_statfs(struct mount *afsp)
      * storing something there.
      */
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree  = 2000000;
+       abp->f_ffree = 2000000;
     abp->f_fsize = 1024;
 
     abp->f_fsid.val[0] = afsp->m_stat.f_fsid.val[0];
@@ -202,7 +206,8 @@ int mp_afs_statfs(struct mount *afsp)
 }
 
 
-int mp_afs_sync(struct mount *mp, int flags)
+int
+mp_afs_sync(struct mount *mp, int flags)
 {
     AFS_STATCNT(afs_sync);
     return 0;
@@ -210,14 +215,16 @@ int mp_afs_sync(struct mount *mp, int flags)
 
 
 #ifdef AFS_DUX50_ENV
-int mp_afs_smoothsync(struct mount *mp, u_int age, u_int smsync_flag)
+int
+mp_afs_smoothsync(struct mount *mp, u_int age, u_int smsync_flag)
 {
     AFS_STATCNT(afs_sync);
     return 0;
 }
 #endif
 
-int mp_afs_fhtovp(struct mount *afsp, struct fid *fidp, struct vnode **avcp)
+int
+mp_afs_fhtovp(struct mount *afsp, struct fid *fidp, struct vnode **avcp)
 {
     struct vrequest treq;
     register code = 0;
@@ -228,7 +235,7 @@ int mp_afs_fhtovp(struct mount *afsp, struct fid *fidp, struct vnode **avcp)
     *avcp = NULL;
 
     if ((code = afs_InitReq(&treq, u.u_cred)) == 0) {
-       code = afs_osi_vget((struct vcache**)avcp, fidp, &treq);
+       code = afs_osi_vget((struct vcache **)avcp, fidp, &treq);
     }
 
     afs_Trace3(afs_iclSetp, CM_TRACE_VGET, ICL_TYPE_POINTER, *avcp,
@@ -268,11 +275,12 @@ int mp_afs_fhtovp(struct mount *afsp, struct fid *fidp, struct vnode **avcp)
  */
 
 #define AFS_FIDDATASIZE 8
-#define AFS_SIZEOFSMALLFID 12 /* full size of fid, including len field */
-extern int afs_NFSRootOnly; /* 1 => only allow NFS mounts of /afs. */
-int afs_fid_vnodeoverflow=0, afs_fid_uniqueoverflow=0;
+#define AFS_SIZEOFSMALLFID 12  /* full size of fid, including len field */
+extern int afs_NFSRootOnly;    /* 1 => only allow NFS mounts of /afs. */
+int afs_fid_vnodeoverflow = 0, afs_fid_uniqueoverflow = 0;
 
-int mp_afs_vptofh(struct vnode *avn, struct fid *fidp)
+int
+mp_afs_vptofh(struct vnode *avn, struct fid *fidp)
 {
     struct SmallFid Sfid;
     long addr[2];
@@ -288,13 +296,14 @@ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp)
        return EIO;
     }
 
-    if (afs_NFSRootOnly && (avc == afs_globalVp)) rootvp = 1;
+    if (afs_NFSRootOnly && (avc == afs_globalVp))
+       rootvp = 1;
     if (!afs_NFSRootOnly || rootvp) {
        tcell = afs_GetCell(avc->fid.Cell, READ_LOCK);
        Sfid.Volume = avc->fid.Fid.Volume;
        fidp->fid_reserved = avc->fid.Fid.Vnode;
-       Sfid.CellAndUnique = ((tcell->cellIndex << 24) +
-                             (avc->fid.Fid.Unique & 0xffffff));
+       Sfid.CellAndUnique =
+           ((tcell->cellIndex << 24) + (avc->fid.Fid.Unique & 0xffffff));
        afs_PutCell(tcell, READ_LOCK);
        if (avc->fid.Fid.Vnode > 0xffff)
            afs_fid_vnodeoverflow++;
@@ -312,26 +321,27 @@ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp)
     fidp->fid_len = AFS_SIZEOFSMALLFID;
     if (afs_NFSRootOnly) {
        if (rootvp) {
-           memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE);   
+           memcpy(fidp->fid_data, (caddr_t) & Sfid, AFS_FIDDATASIZE);
        } else {
-           memcpy(fidp->fid_data, (caddr_t)addr, AFS_FIDDATASIZE);   
+           memcpy(fidp->fid_data, (caddr_t) addr, AFS_FIDDATASIZE);
        }
     } else {
-       memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE);   
+       memcpy(fidp->fid_data, (caddr_t) & Sfid, AFS_FIDDATASIZE);
     }
     AFS_GUNLOCK();
     return 0;
 }
 
 
-int mp_Afs_init(void); /* vfs_init - defined below */
+int mp_Afs_init(void);         /* vfs_init - defined below */
 
 
 /* This is only called by vfs_mount when afs is going to be mounted as root.
  * Since we don't support diskless clients we shouldn't come here.
  */
-int afsmountroot=0;
-int mp_afs_mountroot(struct mount *afsp, struct vnode **vp)
+int afsmountroot = 0;
+int
+mp_afs_mountroot(struct mount *afsp, struct vnode **vp)
 {
     AFS_GLOCK();
     AFS_STATCNT(afs_mountroot);
@@ -344,8 +354,9 @@ int mp_afs_mountroot(struct mount *afsp, struct vnode **vp)
 /* It's called to setup swapping over the net for diskless clients; again
  * not for us.
  */
-int afsswapvp=0;
-int mp_afs_swapvp(void)
+int afsswapvp = 0;
+int
+mp_afs_swapvp(void)
 {
     AFS_GLOCK();
     AFS_STATCNT(afs_swapvp);
@@ -363,7 +374,7 @@ struct vfsops afs_vfsops = {
     mp_afs_quotactl,
     mp_afs_statfs,
     mp_afs_sync,
-    mp_afs_fhtovp,     /* afs_vget */
+    mp_afs_fhtovp,             /* afs_vget */
     mp_afs_vptofh,
     mp_Afs_init,
     mp_afs_mountroot,
@@ -379,16 +390,16 @@ struct vfsops afs_vfsops = {
  */
 #define NULL_FUNC          (int (*)(int))0
 
-int     (*afs_syscall_func)() = NULL_FUNC;
-int     (*afs_xsetgroups_func)() = NULL_FUNC;
-int     (*afs_xioctl_func)() = NULL_FUNC;
+int (*afs_syscall_func) () = NULL_FUNC;
+int (*afs_xsetgroups_func) () = NULL_FUNC;
+int (*afs_xioctl_func) () = NULL_FUNC;
 
 afssyscall(p, args, retval)
-    struct proc *p;
-    void *args;
-    long *retval;
+     struct proc *p;
+     void *args;
+     long *retval;
 {
-    int     (*func)();
+    int (*func) ();
     int code;
 
     AFS_GLOCK();
@@ -396,18 +407,18 @@ afssyscall(p, args, retval)
     if (func == NULL_FUNC) {
        code = nosys(p, args, retval);
     } else {
-       code = (*func)(p, args, retval);
+       code = (*func) (p, args, retval);
     }
     AFS_GUNLOCK();
     return code;
 }
 
 afsxsetgroups(p, args, retval)
-    struct proc *p;
-    void *args;
-    long *retval;
+     struct proc *p;
+     void *args;
+     long *retval;
 {
-    int     (*func)();
+    int (*func) ();
     int code;
 
     AFS_GLOCK();
@@ -415,18 +426,18 @@ afsxsetgroups(p, args, retval)
     if (func == NULL_FUNC) {
        code = nosys(p, args, retval);
     } else {
-       code = (*func)(p, args, retval);
+       code = (*func) (p, args, retval);
     }
     AFS_GUNLOCK();
     return code;
 }
 
 afsxioctl(p, args, retval)
-    struct proc *p;
-    void *args;
-    long *retval;
+     struct proc *p;
+     void *args;
+     long *retval;
 {
-    int     (*func)();
+    int (*func) ();
     int code;
 
     AFS_GLOCK();
@@ -434,7 +445,7 @@ afsxioctl(p, args, retval)
     if (func == NULL_FUNC) {
        code = nosys(p, args, retval);
     } else {
-       code = (*func)(p, args, retval);
+       code = (*func) (p, args, retval);
     }
     AFS_GUNLOCK();
     return code;
@@ -451,15 +462,16 @@ afs_unconfig()
 }
 
 
-cfg_subsys_attr_t afs_attributes[]  = {
+cfg_subsys_attr_t afs_attributes[] = {
     {"", 0, 0, 0, 0, 0, 0}     /* must be the last element */
 };
 
-afs_configure(cfg_op_t op, caddr_t indata, size_t indata_size, caddr_t outdata, size_t outdata_size)
+afs_configure(cfg_op_t op, caddr_t indata, size_t indata_size,
+             caddr_t outdata, size_t outdata_size)
 {
-    cfg_attr_t *attributes;
-    int        ret = ESUCCESS;
-    int        i, j, size;
+    cfg_attr_t *attributes;
+    int ret = ESUCCESS;
+    int i, j, size;
     caddr_t p;
 
     switch (op) {
@@ -469,11 +481,11 @@ afs_configure(cfg_op_t op, caddr_t indata, size_t indata_size, caddr_t outdata,
         * indata_size is the count of attributes.
         */
        if ((ret = vfssw_add_fsname(MOUNT_AFS, &afs_vfsops, "afs")) != 0)
-           return(ret);
+           return (ret);
        break;
     case CFG_OP_UNCONFIGURE:
        if ((ret = afs_unconfig()) != 0)
-           return(ret);
+           return (ret);
        break;
     default:
        ret = EINVAL;
@@ -483,22 +495,22 @@ afs_configure(cfg_op_t op, caddr_t indata, size_t indata_size, caddr_t outdata,
 }
 
 
-int mp_Afs_init(void)
+int
+mp_Afs_init(void)
 {
     extern int Afs_xsetgroups(), afs_xioctl(), afs3_syscall();
-    
+
     AFS_GLOCK();
-    ((struct sysent *) (&sysent[AFS_SYSCALL]))->sy_call = afs3_syscall;
+    ((struct sysent *)(&sysent[AFS_SYSCALL]))->sy_call = afs3_syscall;
 #ifdef SY_NARG
-    ((struct sysent *) (&sysent[AFS_SYSCALL]))->sy_info = 6;
+    ((struct sysent *)(&sysent[AFS_SYSCALL]))->sy_info = 6;
 #else
-    ((struct sysent *) (&sysent[AFS_SYSCALL]))->sy_parallel = 0;
-    ((struct sysent *) (&sysent[AFS_SYSCALL]))->sy_narg = 6;
+    ((struct sysent *)(&sysent[AFS_SYSCALL]))->sy_parallel = 0;
+    ((struct sysent *)(&sysent[AFS_SYSCALL]))->sy_narg = 6;
 #endif
 
-    ((struct sysent *) (&sysent[SYS_setgroups]))->sy_call =
-      Afs_xsetgroups;
-    afs_xioctl_func = afsxioctl;    
+    ((struct sysent *)(&sysent[SYS_setgroups]))->sy_call = Afs_xsetgroups;
+    afs_xioctl_func = afsxioctl;
     afs_xsetgroups_func = afsxsetgroups;
     afs_syscall_func = afssyscall;
     AFS_GUNLOCK();