UKERNEL: add uafs_statvfs
[openafs.git] / src / afs / UKERNEL / osi_vfsops.c
index db1fcdc..7ffa4da 100644 (file)
 #include <afsconfig.h>
 #include "afs/param.h"
 
-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 */
 
+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,
@@ -39,43 +35,42 @@ 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 *afsp, char *path, void *data)
 {
     AFS_STATCNT(afs_mount);
 
     if (afs_globalVFS) {
        /* Don't allow remounts since some system (like AIX) don't handle it well */
-       return (setuerror(EBUSY));
+       return (setuerror(EBUSY));
     }
     afs_globalVFS = afsp;
     afsp->vfs_bsize = 8192;
-    afsp->vfs_fsid.val[0] = AFS_VFSMAGIC; /* magic */
-    afsp->vfs_fsid.val[1] = (afs_int32) AFS_VFSFSID; 
+    afsp->vfs_fsid.val[0] = AFS_VFSMAGIC;      /* magic */
+    afsp->vfs_fsid.val[1] = (intptr_t)AFS_VFSFSID;
 
     return 0;
 }
 
-afs_unmount (afsp)
-    struct vfs *afsp; {
+int
+afs_unmount(struct vfs *afsp)
+{
     AFS_STATCNT(afs_unmount);
     afs_globalVFS = 0;
     afs_shutdown();
     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;
-    register struct vcache *tvp=0;
-    OSI_VFS_CONVERT(afsp)
+    register struct vcache *tvp = 0;
+    OSI_VFS_CONVERT(afsp);
 
     AFS_STATCNT(afs_root);
-    if (afs_globalVp && (afs_globalVp->states & CStatd)) {
+    if (afs_globalVp && (afs_globalVp->f.states & CStatd)) {
        tvp = afs_globalVp;
     } else {
        if (afs_globalVp) {
@@ -83,8 +78,8 @@ afs_root (OSI_VFS_ARG(afsp), avpp)
            afs_globalVp = NULL;
        }
 
-       if (!(code = afs_InitReq(&treq, u.u_cred)) &&
-           !(code = afs_CheckInit())) {
+       if (!(code = afs_InitReq(&treq, get_user_struct()->u_cred))
+           && !(code = afs_CheckInit())) {
            tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
            /* we really want this to stay around */
            if (tvp) {
@@ -96,7 +91,7 @@ afs_root (OSI_VFS_ARG(afsp), avpp)
     if (tvp) {
        VN_HOLD(AFSTOV(tvp));
 
-       AFSTOV(tvp)->v_flag |= VROOT;       /* No-op on Ultrix 2.2 */
+       AFSTOV(tvp)->v_flag |= VROOT;   /* No-op on Ultrix 2.2 */
        afs_globalVFS = afsp;
        *avpp = AFSTOV(tvp);
     }
@@ -106,33 +101,49 @@ 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;
- {
-       AFS_STATCNT(afs_statfs);
-       abp->f_type = 0;
-       abp->f_bsize = afsp->vfs_bsize;
-       abp->f_fsid.val[0] = AFS_VFSMAGIC; /* magic */
-       abp->f_fsid.val[1] = (afs_int32) AFS_VFSFSID;
-       return 0;
+int
+afs_statfs(register struct vfs *afsp, struct statfs *abp)
+{
+    AFS_STATCNT(afs_statfs);
+    abp->f_type = 0;
+    abp->f_bsize = afsp->vfs_bsize;
+    abp->f_fsid.val[0] = AFS_VFSMAGIC; /* magic */
+    abp->f_fsid.val[1] = (intptr_t)AFS_VFSFSID;
+    return 0;
+}
+
+int
+afs_statvfs(struct vfs *afsp, struct statvfs *abp)
+{
+    AFS_STATCNT(afs_statfs);
+
+    abp->f_frsize = 1024;
+    abp->f_favail = 9000000;
+    abp->f_bsize = afsp->vfs_bsize;
+    abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
+      abp->f_ffree = 9000000;
+    abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
+
+    return 0;
 }
 
-afs_mountroot()
+int
+afs_mountroot(void)
 {
     AFS_STATCNT(afs_mountroot);
-    return(EINVAL);
+    return (EINVAL);
 }
 
-afs_swapvp() 
+int
+afs_swapvp(void)
 {
     AFS_STATCNT(afs_swapvp);
-    return(EINVAL);
+    return (EINVAL);
 }