diff options
| author | jmmv <jmmv@NetBSD.org> | 2005-09-23 12:10:31 +0000 |
|---|---|---|
| committer | jmmv <jmmv@NetBSD.org> | 2005-09-23 12:10:31 +0000 |
| commit | 2a3e5eeb7c33daf98dff2ff04f324a4d0dac3f8f (patch) | |
| tree | 342a37e6145db64e2c8df120aeb2f5fc5c387f69 /sys/fs/tmpfs | |
| parent | 992367dcfc1c1310e9196564c7569c5263f01004 (diff) | |
Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.
Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
Diffstat (limited to 'sys/fs/tmpfs')
| -rw-r--r-- | sys/fs/tmpfs/tmpfs.h | 11 | ||||
| -rw-r--r-- | sys/fs/tmpfs/tmpfs_vfsops.c | 41 |
2 files changed, 3 insertions, 49 deletions
diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 4f98f11e12e..0aaa22e3637 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs.h,v 1.4 2005/09/15 12:34:35 yamt Exp $ */ +/* $NetBSD: tmpfs.h,v 1.5 2005/09/23 12:10:32 jmmv Exp $ */ /* * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -149,7 +149,6 @@ struct tmpfs_mount { size_t tm_pages_used; struct tmpfs_node * tm_root; - struct netexport tm_export; ino_t tm_nodes_max; ino_t tm_nodes_last; @@ -344,12 +343,4 @@ struct tmpfs_args { uid_t ta_root_uid; gid_t ta_root_gid; mode_t ta_root_mode; - - /* Used to update NFS export properties. Due to the way these - * fields are used by mountd(8), they must come first, but as - * I would like to remove this restriction, I'm placing them - * here (there is no problem in doing so because, ATM, mountd(8) - * does not recognize tmpfs). XXX */ - const char * ta_fspec; - struct export_args ta_export; }; diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 568161227d5..10aea3df5b3 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_vfsops.c,v 1.3 2005/09/13 21:30:52 jmmv Exp $ */ +/* $NetBSD: tmpfs_vfsops.c,v 1.4 2005/09/23 12:10:32 jmmv Exp $ */ /* * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.3 2005/09/13 21:30:52 jmmv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.4 2005/09/23 12:10:32 jmmv Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -70,8 +70,6 @@ static int tmpfs_statvfs(struct mount *, struct statvfs *, struct proc *); static int tmpfs_sync(struct mount *, int, struct ucred *, struct proc *); static void tmpfs_init(void); static void tmpfs_done(void); -static int tmpfs_checkexp(struct mount *, struct mbuf *, int *, - struct ucred **); static int tmpfs_snapshot(struct mount *, struct vnode *, struct timespec *); @@ -95,7 +93,6 @@ tmpfs_mount(struct mount *mp, const char *path, void *data, tmp = VFS_TO_TMPFS(mp); args.ta_version = TMPFS_ARGS_VERSION; - args.ta_fspec = NULL; args.ta_nodes_max = tmp->tm_nodes_max; args.ta_size_max = tmp->tm_pages_max * PAGE_SIZE; @@ -104,8 +101,6 @@ tmpfs_mount(struct mount *mp, const char *path, void *data, args.ta_root_gid = root->tn_gid; args.ta_root_mode = root->tn_mode; - vfs_showexport(mp, &args, &tmp->tm_export); - return copyout(&args, data, sizeof(args)); } @@ -119,15 +114,6 @@ tmpfs_mount(struct mount *mp, const char *path, void *data, return error; if (mp->mnt_flag & MNT_UPDATE) { - if (mp->mnt_data == NULL) - return EIO; - tmp = VFS_TO_TMPFS(mp); - - if (args.ta_fspec == NULL) { - /* Update NFS export information. */ - return vfs_export(mp, &tmp->tm_export, &args.ta_export); - } - /* XXX: There is no support yet to update file system * settings. Should be added. */ @@ -174,7 +160,6 @@ tmpfs_mount(struct mount *mp, const char *path, void *data, tmpfs_pool_init(&tmp->tm_node_pool, sizeof(struct tmpfs_node), "node", tmp); tmpfs_str_pool_init(&tmp->tm_str_pool, tmp); - bzero(&tmp->tm_export, sizeof(struct netexport)); /* Allocate the root node. */ error = tmpfs_alloc_node(tmp, VDIR, args.ta_root_uid, @@ -423,26 +408,6 @@ tmpfs_done(void) /* --------------------------------------------------------------------- */ static int -tmpfs_checkexp(struct mount *mp, struct mbuf *mb, int *wh, - struct ucred **anon) -{ - struct netcred *np; - struct tmpfs_mount *tmp; - - tmp = VFS_TO_TMPFS(mp); - - np = vfs_export_lookup(mp, &tmp->tm_export, mb); - if (np != NULL) { - *wh = np->netc_exflags; - *anon = &np->netc_anon; - } - - return np == NULL ? EACCES : 0; -} - -/* --------------------------------------------------------------------- */ - -static int tmpfs_snapshot(struct mount *mp, struct vnode *vp, struct timespec *ctime) { @@ -481,9 +446,7 @@ struct vfsops tmpfs_vfsops = { tmpfs_init, /* vfs_init */ NULL, /* vfs_reinit */ tmpfs_done, /* vfs_done */ - NULL, /* vfs_wassysctl: deprecated */ NULL, /* vfs_mountroot */ - tmpfs_checkexp, /* vfs_checkexp */ tmpfs_snapshot, /* vfs_snapshot */ vfs_stdextattrctl, /* vfs_extattrctl */ tmpfs_vnodeopv_descs, |
