Module Name: src
Committed By: pooka
Date: Fri Jul 31 19:47:47 UTC 2009
Modified Files:
src/sys/miscfs/fdesc: fdesc.h fdesc_vfsops.c
Log Message:
Get rid of dependency on M_UFSMNT. Since we need storage only for
one pointer, simply hang that off of mnt_data instead of allocating
storage.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/miscfs/fdesc/fdesc.h
cvs rdiff -u -r1.81 -r1.82 src/sys/miscfs/fdesc/fdesc_vfsops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/miscfs/fdesc/fdesc.h
diff -u src/sys/miscfs/fdesc/fdesc.h:1.19 src/sys/miscfs/fdesc/fdesc.h:1.20
--- src/sys/miscfs/fdesc/fdesc.h:1.19 Sat Jun 28 01:34:06 2008
+++ src/sys/miscfs/fdesc/fdesc.h Fri Jul 31 19:47:47 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: fdesc.h,v 1.19 2008/06/28 01:34:06 rumble Exp $ */
+/* $NetBSD: fdesc.h,v 1.20 2009/07/31 19:47:47 pooka Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -37,9 +37,6 @@
*/
#ifdef _KERNEL
-struct fdescmount {
- struct vnode *f_root; /* Root node */
-};
#define FD_ROOT 2
#define FD_DEVFD 3
@@ -67,7 +64,6 @@
int fd_ix; /* filesystem index */
};
-#define VFSTOFDESC(mp) ((struct fdescmount *)((mp)->mnt_data))
#define VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)
extern dev_t devctty;
Index: src/sys/miscfs/fdesc/fdesc_vfsops.c
diff -u src/sys/miscfs/fdesc/fdesc_vfsops.c:1.81 src/sys/miscfs/fdesc/fdesc_vfsops.c:1.82
--- src/sys/miscfs/fdesc/fdesc_vfsops.c:1.81 Fri Jul 31 18:44:58 2009
+++ src/sys/miscfs/fdesc/fdesc_vfsops.c Fri Jul 31 19:47:47 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: fdesc_vfsops.c,v 1.81 2009/07/31 18:44:58 pooka Exp $ */
+/* $NetBSD: fdesc_vfsops.c,v 1.82 2009/07/31 19:47:47 pooka Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.81 2009/07/31 18:44:58 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.82 2009/07/31 19:47:47 pooka Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -79,7 +79,6 @@
{
struct lwp *l = curlwp;
int error = 0;
- struct fdescmount *fmp;
struct vnode *rvp;
if (mp->mnt_flag & MNT_GETARGS) {
@@ -96,14 +95,11 @@
if (error)
return (error);
- fmp = (struct fdescmount *)malloc(sizeof(struct fdescmount),
- M_UFSMNT, M_WAITOK); /* XXX */
rvp->v_type = VDIR;
rvp->v_vflag |= VV_ROOT;
- fmp->f_root = rvp;
mp->mnt_stat.f_namemax = MAXNAMLEN;
mp->mnt_flag |= MNT_LOCAL;
- mp->mnt_data = fmp;
+ mp->mnt_data = rvp;
vfs_getnewfsid(mp);
error = set_statvfs_info(path, UIO_USERSPACE, "fdesc", UIO_SYSSPACE,
@@ -123,7 +119,7 @@
{
int error;
int flags = 0;
- struct vnode *rtvp = VFSTOFDESC(mp)->f_root;
+ struct vnode *rtvp = mp->mnt_data;
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
@@ -137,10 +133,6 @@
* Blow it away for future re-use
*/
vgone(rtvp);
- /*
- * Finally, throw away the fdescmount structure
- */
- free(mp->mnt_data, M_UFSMNT); /* XXX */
mp->mnt_data = NULL;
return (0);
@@ -154,7 +146,7 @@
/*
* Return locked reference to root.
*/
- vp = VFSTOFDESC(mp)->f_root;
+ vp = mp->mnt_data;
VREF(vp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
*vpp = vp;