reindent-20030715
[openafs.git] / src / afs / AIX / osi_config.c
index 4fd3533..c1ebc3f 100644 (file)
@@ -36,7 +36,8 @@
 #include <afsconfig.h>
 #include "afs/param.h"
 
-RCSID("$Header$");
+RCSID
+    ("$Header$");
 
 #include "sys/limits.h"
 #include "sys/types.h"
@@ -50,14 +51,14 @@ RCSID("$Header$");
 #include "sys/gfs.h"
 #include "sys/uio.h"
 #include "sys/pri.h"
-#include "sys/priv.h"  /* XXX */
+#include "sys/priv.h"          /* XXX */
 #include "sys/lockl.h"
 #include "sys/malloc.h"
-#include <sys/syspest.h>/* to define the assert and ASSERT macros      */
-#include <sys/timer.h> /* For the timer related defines                */
-#include <sys/intr.h>  /* for the serialization defines                */
-#include <sys/malloc.h>        /* for the parameters to xmalloc()              */
-#include "afs/afs_osi.h"    /* pick up osi_timeval_t for afs_stats.h */
+#include <sys/syspest.h>       /* to define the assert and ASSERT macros       */
+#include <sys/timer.h>         /* For the timer related defines                */
+#include <sys/intr.h>          /* for the serialization defines                */
+#include <sys/malloc.h>                /* for the parameters to xmalloc()              */
+#include "afs/afs_osi.h"       /* pick up osi_timeval_t for afs_stats.h */
 #include "afs/afs_stats.h"
 #include "export.h"
 
@@ -66,9 +67,12 @@ RCSID("$Header$");
 #else
 #define KOFF_PRESENT   0
 #endif
+
 #if !KOFF_PRESENT
-_db_trace() { ; }
+_db_trace()
+{;
+}
+
 long db_tflags = 0;
 #endif
 
@@ -94,69 +98,70 @@ extern Simple_lock afs_callout_lock;
  *     uiop    -       uio vector describing any config params
  */
 afs_config(cmd, uiop)
-struct uio *uiop; {
-       int     err;
-       extern struct vnodeops *afs_ops;
-
-       AFS_STATCNT(afs_config);
-
-       err  = 0;
-       AFS_GLOCK();
-       if (cmd == CFG_INIT) {                  /* add AFS gfs          */
-               /*
-                * init any vrmix mandated kluges
-                */
-               if (err = kluge_init())
-                       goto out;
-               /*
-                * make sure that we pin everything
-                */
-               if (err = pincode(afs_config))
-                       goto out;
-               err = gfsadd(AFS_MOUNT_AFS, &afs_gfs);
-               /*
-                * ok, if already installed
-                */
-               if (err == EBUSY)
-                       err = 0;
-               if (!err) {
-                   pin(&afs_callout_lock, sizeof(afs_callout_lock));
-                   lock_alloc(&afs_callout_lock, LOCK_ALLOC_PIN, 0, 5);
-                   simple_lock_init(&afs_callout_lock);
-                   afs_ops = &locked_afs_gn_vnodeops;
-                   timeoutcf(AFS_CALLOUT_TBL_SIZE);
-               } else {
-                   unpincode(afs_config);
-                   goto out;
-               }
-               if (KOFF_PRESENT) {
-                   extern void *db_syms[];
-                   extern db_nsyms;
-                   
-                   koff_addsyms(db_syms, db_nsyms);
-               }
-       } else if (cmd == CFG_TERM) {           /* delete AFS gfs       */
-               err = gfsdel(AFS_MOUNT_AFS);
-               /*
-                * ok, if already deleted
-                */
-               if (err == ENOENT)
-                       err = 0;
-               else if (!err) {
-                       if (err = unpincode(afs_config))
-                               err = 0;
-
-                       timeoutcf(-AFS_CALLOUT_TBL_SIZE);
-               }
-       } else                                  /* unknown command */
-               err = EINVAL;
-
-    out:
-       AFS_GUNLOCK();
-       if ( !err && (cmd == CFG_INIT) )
-               osi_Init();
-
-       return err;
+     struct uio *uiop;
+{
+    int err;
+    extern struct vnodeops *afs_ops;
+
+    AFS_STATCNT(afs_config);
+
+    err = 0;
+    AFS_GLOCK();
+    if (cmd == CFG_INIT) {     /* add AFS gfs          */
+       /*
+        * init any vrmix mandated kluges
+        */
+       if (err = kluge_init())
+           goto out;
+       /*
+        * make sure that we pin everything
+        */
+       if (err = pincode(afs_config))
+           goto out;
+       err = gfsadd(AFS_MOUNT_AFS, &afs_gfs);
+       /*
+        * ok, if already installed
+        */
+       if (err == EBUSY)
+           err = 0;
+       if (!err) {
+           pin(&afs_callout_lock, sizeof(afs_callout_lock));
+           lock_alloc(&afs_callout_lock, LOCK_ALLOC_PIN, 0, 5);
+           simple_lock_init(&afs_callout_lock);
+           afs_ops = &locked_afs_gn_vnodeops;
+           timeoutcf(AFS_CALLOUT_TBL_SIZE);
+       } else {
+           unpincode(afs_config);
+           goto out;
+       }
+       if (KOFF_PRESENT) {
+           extern void *db_syms[];
+           extern db_nsyms;
+
+           koff_addsyms(db_syms, db_nsyms);
+       }
+    } else if (cmd == CFG_TERM) {      /* delete AFS gfs       */
+       err = gfsdel(AFS_MOUNT_AFS);
+       /*
+        * ok, if already deleted
+        */
+       if (err == ENOENT)
+           err = 0;
+       else if (!err) {
+           if (err = unpincode(afs_config))
+               err = 0;
+
+           timeoutcf(-AFS_CALLOUT_TBL_SIZE);
+       }
+    } else                     /* unknown command */
+       err = EINVAL;
+
+  out:
+    AFS_GUNLOCK();
+    if (!err && (cmd == CFG_INIT))
+       osi_Init();
+
+    return err;
 }
 
 /*
@@ -170,7 +175,8 @@ struct uio *uiop; {
  * Seems we can't make up our mind what to call these
  */
 char *
-mem_getbytes(size) {
+mem_getbytes(size)
+{
 
     return malloc(size);
 }
@@ -179,33 +185,38 @@ mem_getbytes(size) {
  * mem_freebytes       -       memory deallocator
  */
 mem_freebytes(p, size)
-char *p; {
+     char *p;
+{
 
     free(p);
 }
 
 char *
-kmem_alloc(size) {
+kmem_alloc(size)
+{
 
-       return malloc(size);
+    return malloc(size);
 }
 
 kmem_free(p, size)
-char *p; {
+     char *p;
+{
 
-       free(p);
+    free(p);
 }
 
 VN_RELE(vp)
-register struct vnode *vp; {
+     register struct vnode *vp;
+{
 
-       VNOP_RELE(vp);
+    VNOP_RELE(vp);
 }
 
 VN_HOLD(vp)
-register struct vnode *vp; {
+     register struct vnode *vp;
+{
 
-       VNOP_HOLD(vp);
+    VNOP_HOLD(vp);
 }
 
 /*
@@ -213,48 +224,48 @@ register struct vnode *vp; {
  * from the kernel isn't, so we must be devious.
  */
 
-int (*kluge_ufdalloc)();
-int (*kluge_fpalloc)();
-void *(*kluge_ufdfree)();
-void *(*kluge_ffree)();
-int (*kluge_iptovp)();
-int (*kluge_dev_ialloc)();
-int (*kluge_iget)();
-int (*kluge_iput)();
-int (*kluge_commit)();
-void *(*kluge_ksettimer)();
-void *(*kluge_fsSimpleLock)();
-void *(*kluge_fsSimpleUnlock)();
-void *(*kluge_fsReadLock)();
-void *(*kluge_fsWriteLock)();
-void *(*kluge_fsCxUnlock)();
+int (*kluge_ufdalloc) ();
+int (*kluge_fpalloc) ();
+void *(*kluge_ufdfree) ();
+void *(*kluge_ffree) ();
+int (*kluge_iptovp) ();
+int (*kluge_dev_ialloc) ();
+int (*kluge_iget) ();
+int (*kluge_iput) ();
+int (*kluge_commit) ();
+void *(*kluge_ksettimer) ();
+void *(*kluge_fsSimpleLock) ();
+void *(*kluge_fsSimpleUnlock) ();
+void *(*kluge_fsReadLock) ();
+void *(*kluge_fsWriteLock) ();
+void *(*kluge_fsCxUnlock) ();
 
 /*
  * kernel function import list
  */
 
 struct k_func kfuncs[] = {
-       { (void *(**)()) &kluge_ufdalloc,       ".ufdalloc"     },
-       { (void *(**)()) &kluge_fpalloc,        ".fpalloc"      },
-       {                &kluge_ufdfree,        ".ufdfree"      },
-       {                &kluge_ffree,          ".ffree"        },
-       { (void *(**)()) &kluge_iptovp,         ".iptovp"       },
-       { (void *(**)()) &kluge_dev_ialloc,     ".dev_ialloc"   },
-       { (void *(**)()) &kluge_iget,           ".iget"         },
-       { (void *(**)()) &kluge_iput,           ".iput"         },
-       { (void *(**)()) &kluge_commit,         ".commit"       },
-       {                &kluge_ksettimer,      ".ksettimer"    },
+    {(void *(**)())&kluge_ufdalloc, ".ufdalloc"},
+    {(void *(**)())&kluge_fpalloc, ".fpalloc"},
+    {&kluge_ufdfree, ".ufdfree"},
+    {&kluge_ffree, ".ffree"},
+    {(void *(**)())&kluge_iptovp, ".iptovp"},
+    {(void *(**)())&kluge_dev_ialloc, ".dev_ialloc"},
+    {(void *(**)())&kluge_iget, ".iget"},
+    {(void *(**)())&kluge_iput, ".iput"},
+    {(void *(**)())&kluge_commit, ".commit"},
+    {&kluge_ksettimer, ".ksettimer"},
 #ifdef _FSDEBUG
-       {                &kluge_fsSimpleLock,   ".fs_simple_lock"       },
-       {                &kluge_fsSimpleUnlock, ".fs_simple_unlock"     },
-       {                &kluge_fsReadLock,     ".fs_read_lock"         },
-       {                &kluge_fsWriteLock,    ".fs_write_lock"        },
-       {                &kluge_fsCxUnlock,     ".fs_complex_unlock"    },
+    {&kluge_fsSimpleLock, ".fs_simple_lock"},
+    {&kluge_fsSimpleUnlock, ".fs_simple_unlock"},
+    {&kluge_fsReadLock, ".fs_read_lock"},
+    {&kluge_fsWriteLock, ".fs_write_lock"},
+    {&kluge_fsCxUnlock, ".fs_complex_unlock"},
 #endif
-       { 0,                    0               },
+    {0, 0},
 };
 
-void *vnodefops;       /* dummy vnodeops       */
+void *vnodefops;               /* dummy vnodeops       */
 struct ifnet *ifnet;
 Simple_lock jfs_icache_lock;
 Simple_lock proc_tbl_lock;
@@ -263,135 +274,148 @@ Simple_lock proc_tbl_lock;
  * kernel variable import list
  */
 struct k_var kvars[] = {
-       { (void *) &vnodefops,          "vnodefops"             },
-       { (void *) &ifnet,              "ifnet"                 },
-       { (void *) &jfs_icache_lock,    "jfs_icache_lock"       },
+    {(void *)&vnodefops, "vnodefops"},
+    {(void *)&ifnet, "ifnet"},
+    {(void *)&jfs_icache_lock, "jfs_icache_lock"},
 #ifndef AFS_AIX51_ENV
-       { (void *) &proc_tbl_lock,      "proc_tbl_lock"         },
+    {(void *)&proc_tbl_lock, "proc_tbl_lock"},
 #endif
-       { 0,                            0                       },
+    {0, 0},
 };
 
 /*
  * kluge_init -        initialise the kernel imports kluge
  */
-kluge_init() {
-       register struct k_func *kf;
-       register struct k_var  *kv;
+kluge_init()
+{
+    register struct k_func *kf;
+    register struct k_var *kv;
 #ifdef __64BIT__
-        register afs_uint64  toc;
+    register afs_uint64 toc;
 #else
-       register afs_uint32  toc;
+    register afs_uint32 toc;
 #endif
-       register err = 0;
+    register err = 0;
 
-       toc = get_toc();
-       for (kf = kfuncs; !err && kf->name; ++kf) {
-           err = import_kfunc(kf);
-       }
-       for (kv = kvars; !err && kv->name; ++kv) {
-           err = import_kvar(kv, toc);
-       }
+    toc = get_toc();
+    for (kf = kfuncs; !err && kf->name; ++kf) {
+       err = import_kfunc(kf);
+    }
+    for (kv = kvars; !err && kv->name; ++kv) {
+       err = import_kvar(kv, toc);
+    }
 
-       return err;
+    return err;
 }
 
 ufdalloc(i, fdp)
-int *fdp; {
+     int *fdp;
+{
 
-    return (*kluge_ufdalloc)(i, fdp);
+    return (*kluge_ufdalloc) (i, fdp);
 }
 
 fpalloc(vp, flag, type, ops, fpp)
-struct vnode *vp;
-struct fileops *ops;
-struct file **fpp; {
+     struct vnode *vp;
+     struct fileops *ops;
+     struct file **fpp;
+{
 
-       return (*kluge_fpalloc)(vp, flag, type, ops, fpp);
+    return (*kluge_fpalloc) (vp, flag, type, ops, fpp);
 }
 
 void
-ufdfree(fd) {
+ufdfree(fd)
+{
 
-    (void) (*kluge_ufdfree)(fd);
+    (void)(*kluge_ufdfree) (fd);
 }
 
 void
 ffree(fp)
-struct file *fp; {
+     struct file *fp;
+{
 
-    (void) (*kluge_ffree)(fp);
+    (void)(*kluge_ffree) (fp);
 }
 
 iptovp(vfsp, ip, vpp)
-struct vfs     *vfsp;
-struct inode   *ip, **vpp; {
+     struct vfs *vfsp;
+     struct inode *ip, **vpp;
+{
 
-       return (*kluge_iptovp)(vfsp, ip, vpp);
+    return (*kluge_iptovp) (vfsp, ip, vpp);
 }
 
 dev_ialloc(pip, ino, mode, vfsp, ipp)
-struct inode *pip;
-ino_t  ino;
-mode_t mode;
-struct vfs *vfsp;
-struct inode **ipp; {
+     struct inode *pip;
+     ino_t ino;
+     mode_t mode;
+     struct vfs *vfsp;
+     struct inode **ipp;
+{
 
-    return (*kluge_dev_ialloc)(pip, ino, mode, vfsp, ipp);
+    return (*kluge_dev_ialloc) (pip, ino, mode, vfsp, ipp);
 
 }
 
 iget(dev, ino, ipp, doscan, vfsp)
-dev_t dev;
-ino_t ino;
+     dev_t dev;
+     ino_t ino;
 #ifdef __64BIT__
-afs_size_t doscan;
+     afs_size_t doscan;
 #endif
-struct vfs *vfsp;
-struct inode **ipp; {
+     struct vfs *vfsp;
+     struct inode **ipp;
+{
 #ifdef __64BIT__
     afs_int64 dummy[10];
     dummy[0] = doscan;
 
-    return (*kluge_iget)(dev, ino, ipp, (afs_size_t) doscan, vfsp, &dummy);
+    return (*kluge_iget) (dev, ino, ipp, (afs_size_t) doscan, vfsp, &dummy);
 #else
-    return (*kluge_iget)(dev, ino, ipp, doscan, vfsp);
+    return (*kluge_iget) (dev, ino, ipp, doscan, vfsp);
 #endif
 }
 
 iput(ip, vfsp)
-struct vfs *vfsp;
-struct inode *ip; {
-    return (*kluge_iput)(ip, vfsp);
+     struct vfs *vfsp;
+     struct inode *ip;
+{
+    return (*kluge_iput) (ip, vfsp);
 }
 
 commit(n, i0, i1, i2)
-struct inode *i0, *i1, *i2; {
+     struct inode *i0, *i1, *i2;
+{
 
-    return (*kluge_commit)(n, i0, i1, i2);
+    return (*kluge_commit) (n, i0, i1, i2);
 }
 
 
 #ifdef _FSDEBUG
-fs_simple_lock(void *lp, int type) {
-    return (*kluge_fsSimpleLock)(lp, type);
+fs_simple_lock(void *lp, int type)
+{
+    return (*kluge_fsSimpleLock) (lp, type);
 }
 
-fs_simple_unlock(void *lp, int type) {
-    return (*kluge_fsSimpleUnlock)(lp, type);
+fs_simple_unlock(void *lp, int type)
+{
+    return (*kluge_fsSimpleUnlock) (lp, type);
 }
 
-fs_read_lock(complex_lock_t lp, int type) {
-     return (*kluge_fsReadLock)(lp, type);
+fs_read_lock(complex_lock_t lp, int type)
+{
+    return (*kluge_fsReadLock) (lp, type);
 }
 
-fs_write_lock(complex_lock_t lp, int type) {
-     return (*kluge_fsWriteLock)(lp, type);
+fs_write_lock(complex_lock_t lp, int type)
+{
+    return (*kluge_fsWriteLock) (lp, type);
 }
 
-fs_complex_unlock(complex_lock_t lp, int type) {
-    return (*kluge_fsCxUnlock)(lp, type);
+fs_complex_unlock(complex_lock_t lp, int type)
+{
+    return (*kluge_fsCxUnlock) (lp, type);
 }
 #endif
-
-