Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Introduce genfs_statvfs() as pretty much a no-info statv...
details: https://anonhg.NetBSD.org/src/rev/233b2bc946b9
branches: trunk
changeset: 749463:233b2bc946b9
user: pooka <pooka%NetBSD.org@localhost>
date: Mon Nov 30 10:59:19 2009 +0000
description:
Introduce genfs_statvfs() as pretty much a no-info statvfs and
convert several pseudo file systems to use it.
diffstat:
sys/fs/ptyfs/ptyfs_vfsops.c | 26 +++-----------------------
sys/miscfs/fdesc/fdesc_vfsops.c | 25 +++----------------------
sys/miscfs/genfs/genfs.h | 4 +++-
sys/miscfs/genfs/genfs_vfsops.c | 31 +++++++++++++++++++++++++------
sys/miscfs/kernfs/kernfs_vfsops.c | 25 +++----------------------
sys/miscfs/procfs/procfs_vfsops.c | 14 ++++++--------
6 files changed, 43 insertions(+), 82 deletions(-)
diffs (274 lines):
diff -r d2a28d667e34 -r 233b2bc946b9 sys/fs/ptyfs/ptyfs_vfsops.c
--- a/sys/fs/ptyfs/ptyfs_vfsops.c Mon Nov 30 10:26:36 2009 +0000
+++ b/sys/fs/ptyfs/ptyfs_vfsops.c Mon Nov 30 10:59:19 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptyfs_vfsops.c,v 1.40 2009/03/21 01:11:53 christos Exp $ */
+/* $NetBSD: ptyfs_vfsops.c,v 1.41 2009/11/30 10:59:19 pooka Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.40 2009/03/21 01:11:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.41 2009/11/30 10:59:19 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -323,26 +323,6 @@
/*ARGSUSED*/
int
-ptyfs_statvfs(struct mount *mp, struct statvfs *sbp)
-{
- sbp->f_bsize = DEV_BSIZE;
- sbp->f_frsize = DEV_BSIZE;
- sbp->f_iosize = DEV_BSIZE;
- sbp->f_blocks = 2; /* 1K to keep df happy */
- sbp->f_bfree = 0;
- sbp->f_bavail = 0;
- sbp->f_bresvd = 0;
- sbp->f_files = 1024; /* XXX lie */
- sbp->f_ffree = 128; /* XXX lie */
- sbp->f_favail = 128; /* XXX lie */
- sbp->f_fresvd = 0;
- sbp->f_namemax = MAXNAMLEN;
- copy_statvfs_info(sbp, mp);
- return 0;
-}
-
-/*ARGSUSED*/
-int
ptyfs_sync(struct mount *mp, int waitfor,
kauth_cred_t uc)
{
@@ -376,7 +356,7 @@
ptyfs_unmount,
ptyfs_root,
(void *)eopnotsupp, /* vfs_quotactl */
- ptyfs_statvfs,
+ genfs_statvfs,
ptyfs_sync,
ptyfs_vget,
(void *)eopnotsupp, /* vfs_fhtovp */
diff -r d2a28d667e34 -r 233b2bc946b9 sys/miscfs/fdesc/fdesc_vfsops.c
--- a/sys/miscfs/fdesc/fdesc_vfsops.c Mon Nov 30 10:26:36 2009 +0000
+++ b/sys/miscfs/fdesc/fdesc_vfsops.c Mon Nov 30 10:59:19 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdesc_vfsops.c,v 1.82 2009/07/31 19:47:47 pooka Exp $ */
+/* $NetBSD: fdesc_vfsops.c,v 1.83 2009/11/30 10:59:20 pooka Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.82 2009/07/31 19:47:47 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.83 2009/11/30 10:59:20 pooka Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -153,25 +153,6 @@
return (0);
}
-int
-fdesc_statvfs(struct mount *mp, struct statvfs *sbp)
-{
-
- sbp->f_bsize = DEV_BSIZE;
- sbp->f_frsize = DEV_BSIZE;
- sbp->f_iosize = DEV_BSIZE;
- sbp->f_blocks = 2; /* 1K to keep df happy */
- sbp->f_bfree = 0;
- sbp->f_bavail = 0;
- sbp->f_bresvd = 0;
- sbp->f_files = 0;
- sbp->f_ffree = 0;
- sbp->f_favail = 0;
- sbp->f_fresvd = 0;
- copy_statvfs_info(sbp, mp);
- return (0);
-}
-
/*ARGSUSED*/
int
fdesc_sync(struct mount *mp, int waitfor,
@@ -208,7 +189,7 @@
fdesc_unmount,
fdesc_root,
(void *)eopnotsupp, /* vfs_quotactl */
- fdesc_statvfs,
+ genfs_statvfs,
fdesc_sync,
fdesc_vget,
(void *)eopnotsupp, /* vfs_fhtovp */
diff -r d2a28d667e34 -r 233b2bc946b9 sys/miscfs/genfs/genfs.h
--- a/sys/miscfs/genfs/genfs.h Mon Nov 30 10:26:36 2009 +0000
+++ b/sys/miscfs/genfs/genfs.h Mon Nov 30 10:59:19 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs.h,v 1.27 2009/06/23 19:36:38 elad Exp $ */
+/* $NetBSD: genfs.h,v 1.28 2009/11/30 10:59:20 pooka Exp $ */
#ifndef _MISCFS_GENFS_GENFS_H_
#define _MISCFS_GENFS_GENFS_H_
@@ -33,6 +33,8 @@
int genfs_do_putpages(struct vnode *, off_t, off_t, int, struct vm_page **);
+int genfs_statvfs(struct mount *, struct statvfs *);
+
int genfs_renamelock_enter(struct mount *);
void genfs_renamelock_exit(struct mount *);
diff -r d2a28d667e34 -r 233b2bc946b9 sys/miscfs/genfs/genfs_vfsops.c
--- a/sys/miscfs/genfs/genfs_vfsops.c Mon Nov 30 10:26:36 2009 +0000
+++ b/sys/miscfs/genfs/genfs_vfsops.c Mon Nov 30 10:59:19 2009 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: genfs_vfsops.c,v 1.2 2008/04/28 20:24:08 martin Exp $ */
+/* $NetBSD: genfs_vfsops.c,v 1.3 2009/11/30 10:59:20 pooka Exp $ */
/*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,18 +27,37 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.2 2008/04/28 20:24:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.3 2009/11/30 10:59:20 pooka Exp $");
#include <sys/types.h>
#include <sys/mount.h>
-
-/* required by genfs.h */
-#include <uvm/uvm.h>
+#include <sys/statvfs.h>
+#include <sys/vnode.h>
#include <miscfs/genfs/genfs.h>
#include <miscfs/genfs/genfs_node.h>
int
+genfs_statvfs(struct mount *mp, struct statvfs *sbp)
+{
+
+ sbp->f_bsize = DEV_BSIZE;
+ sbp->f_frsize = DEV_BSIZE;
+ sbp->f_iosize = DEV_BSIZE;
+ sbp->f_blocks = 2; /* 1k to keep df happy */
+ sbp->f_bfree = 0;
+ sbp->f_bavail = 0;
+ sbp->f_bresvd = 0;
+ sbp->f_files = 0;
+ sbp->f_ffree = 0;
+ sbp->f_favail = 0;
+ sbp->f_fresvd = 0;
+ copy_statvfs_info(sbp, mp);
+
+ return 0;
+}
+
+int
genfs_renamelock_enter(struct mount *mp)
{
mutex_enter(&mp->mnt_renamelock);
diff -r d2a28d667e34 -r 233b2bc946b9 sys/miscfs/kernfs/kernfs_vfsops.c
--- a/sys/miscfs/kernfs/kernfs_vfsops.c Mon Nov 30 10:26:36 2009 +0000
+++ b/sys/miscfs/kernfs/kernfs_vfsops.c Mon Nov 30 10:59:19 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kernfs_vfsops.c,v 1.89 2009/03/15 17:22:38 cegger Exp $ */
+/* $NetBSD: kernfs_vfsops.c,v 1.90 2009/11/30 10:59:20 pooka Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.89 2009/03/15 17:22:38 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.90 2009/11/30 10:59:20 pooka Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -195,25 +195,6 @@
return (kernfs_allocvp(mp, vpp, KFSkern, &kern_targets[0], 0));
}
-int
-kernfs_statvfs(struct mount *mp, struct statvfs *sbp)
-{
-
- sbp->f_bsize = DEV_BSIZE;
- sbp->f_frsize = DEV_BSIZE;
- sbp->f_iosize = DEV_BSIZE;
- sbp->f_blocks = 2; /* 1K to keep df happy */
- sbp->f_bfree = 0;
- sbp->f_bavail = 0;
- sbp->f_bresvd = 0;
- sbp->f_files = 1024; /* XXX lie */
- sbp->f_ffree = 128; /* XXX lie */
- sbp->f_favail = 128; /* XXX lie */
- sbp->f_fresvd = 0;
- copy_statvfs_info(sbp, mp);
- return (0);
-}
-
/*ARGSUSED*/
int
kernfs_sync(struct mount *mp, int waitfor,
@@ -250,7 +231,7 @@
kernfs_unmount,
kernfs_root,
(void *)eopnotsupp, /* vfs_quotactl */
- kernfs_statvfs,
+ genfs_statvfs,
kernfs_sync,
kernfs_vget,
(void *)eopnotsupp, /* vfs_fhtovp */
diff -r d2a28d667e34 -r 233b2bc946b9 sys/miscfs/procfs/procfs_vfsops.c
--- a/sys/miscfs/procfs/procfs_vfsops.c Mon Nov 30 10:26:36 2009 +0000
+++ b/sys/miscfs/procfs/procfs_vfsops.c Mon Nov 30 10:59:19 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_vfsops.c,v 1.84 2009/10/02 23:00:02 elad Exp $ */
+/* $NetBSD: procfs_vfsops.c,v 1.85 2009/11/30 10:59:20 pooka Exp $ */
/*
* Copyright (c) 1993
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.84 2009/10/02 23:00:02 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.85 2009/11/30 10:59:20 pooka Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -219,18 +219,16 @@
procfs_statvfs(struct mount *mp, struct statvfs *sbp)
{
+ genfs_statvfs(mp, sbp);
+
sbp->f_bsize = PAGE_SIZE;
sbp->f_frsize = PAGE_SIZE;
sbp->f_iosize = PAGE_SIZE;
- sbp->f_blocks = 1; /* avoid divide by zero in some df's */
- sbp->f_bfree = 0;
- sbp->f_bavail = 0;
- sbp->f_bresvd = 0;
+ sbp->f_blocks = 1;
sbp->f_files = maxproc; /* approx */
sbp->f_ffree = maxproc - nprocs; /* approx */
sbp->f_favail = maxproc - nprocs; /* approx */
- sbp->f_fresvd = 0;
- copy_statvfs_info(sbp, mp);
+
return (0);
}
Home |
Main Index |
Thread Index |
Old Index