UKERNEL: add uafs_statvfs
[openafs.git] / src / afs / UKERNEL / osi_vfsops.c
index 8ee58a9..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 */
 
+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,
@@ -40,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 *afsp, char *path, void *data)
 {
     AFS_STATCNT(afs_mount);
 
@@ -54,13 +47,13 @@ afs_mount(afsp, path, data)
     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[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;
@@ -68,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;
@@ -86,7 +78,7 @@ afs_root(OSI_VFS_ARG(afsp), avpp)
            afs_globalVp = NULL;
        }
 
-       if (!(code = afs_InitReq(&treq, u.u_cred))
+       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 */
@@ -109,32 +101,48 @@ 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;
     abp->f_bsize = afsp->vfs_bsize;
     abp->f_fsid.val[0] = AFS_VFSMAGIC; /* magic */
-    abp->f_fsid.val[1] = (afs_int32) AFS_VFSFSID;
+    abp->f_fsid.val[1] = (intptr_t)AFS_VFSFSID;
     return 0;
 }
 
-afs_mountroot()
+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;
+}
+
+int
+afs_mountroot(void)
 {
     AFS_STATCNT(afs_mountroot);
     return (EINVAL);
 }
 
-afs_swapvp()
+int
+afs_swapvp(void)
 {
     AFS_STATCNT(afs_swapvp);
     return (EINVAL);