From a96539bf8fe1e0dc029212e72b66891f3edda344 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Thu, 28 Jun 2007 02:36:41 +0000 Subject: [PATCH] Staticify most of fifo/vn operations, they should not be directly exposed outside. Approved by: re (tmpfs blanket) --- sys/fs/tmpfs/tmpfs_fifoops.c | 32 +++++----- sys/fs/tmpfs/tmpfs_fifoops.h | 3 - sys/fs/tmpfs/tmpfs_vnops.c | 119 ++++++++++++++++++----------------- sys/fs/tmpfs/tmpfs_vnops.h | 21 ------- 4 files changed, 76 insertions(+), 99 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_fifoops.c b/sys/fs/tmpfs/tmpfs_fifoops.c index 2ce15d2a6c7e..4b95275d1299 100644 --- a/sys/fs/tmpfs/tmpfs_fifoops.c +++ b/sys/fs/tmpfs/tmpfs_fifoops.c @@ -57,21 +57,7 @@ /* --------------------------------------------------------------------- */ -/* - * vnode operations vector used for fifos stored in a tmpfs file system. - */ -struct vop_vector tmpfs_fifoop_entries = { - .vop_default = &fifo_specops, - .vop_close = tmpfs_fifo_close, - .vop_reclaim = tmpfs_reclaim, - .vop_access = tmpfs_access, - .vop_getattr = tmpfs_getattr, - .vop_setattr = tmpfs_setattr, - .vop_kqfilter = tmpfs_fifo_kqfilter, -}; - - -int +static int tmpfs_fifo_kqfilter(struct vop_kqfilter_args *ap) { struct vnode *vp; @@ -94,7 +80,7 @@ tmpfs_fifo_kqfilter(struct vop_kqfilter_args *ap) /* --------------------------------------------------------------------- */ -int +static int tmpfs_fifo_close(struct vop_close_args *v) { struct tmpfs_node *node; @@ -104,3 +90,17 @@ tmpfs_fifo_close(struct vop_close_args *v) tmpfs_update(v->a_vp); return fifo_specops.vop_close(v); } + +/* + * vnode operations vector used for fifos stored in a tmpfs file system. + */ +struct vop_vector tmpfs_fifoop_entries = { + .vop_default = &fifo_specops, + .vop_close = tmpfs_fifo_close, + .vop_reclaim = tmpfs_reclaim, + .vop_access = tmpfs_access, + .vop_getattr = tmpfs_getattr, + .vop_setattr = tmpfs_setattr, + .vop_kqfilter = tmpfs_fifo_kqfilter, +}; + diff --git a/sys/fs/tmpfs/tmpfs_fifoops.h b/sys/fs/tmpfs/tmpfs_fifoops.h index 33719713aa87..49d4e9599794 100644 --- a/sys/fs/tmpfs/tmpfs_fifoops.h +++ b/sys/fs/tmpfs/tmpfs_fifoops.h @@ -56,8 +56,5 @@ extern struct vop_vector tmpfs_fifoop_entries; -vop_close_t tmpfs_fifo_close; -vop_kqfilter_t tmpfs_fifo_kqfilter; - /* --------------------------------------------------------------------- */ #endif /* _FS_TMPFS_TMPFS_FIFOOPS_H_ */ diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 3527261da038..7c38995a722d 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_vnops.c,v 1.20 2006/01/26 20:07:34 jmmv Exp $ */ +/* $NetBSD: tmpfs_vnops.c,v 1.35 2007/01/04 15:42:37 elad Exp $ */ /* * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -69,42 +69,7 @@ __FBSDID("$FreeBSD$"); /* --------------------------------------------------------------------- */ -/* - * vnode operations vector used for files stored in a tmpfs file system. - */ -struct vop_vector tmpfs_vnodeop_entries = { - .vop_default = &default_vnodeops, - .vop_lookup = vfs_cache_lookup, - .vop_cachedlookup = tmpfs_lookup, - .vop_create = tmpfs_create, - .vop_mknod = tmpfs_mknod, - .vop_open = tmpfs_open, - .vop_close = tmpfs_close, - .vop_access = tmpfs_access, - .vop_getattr = tmpfs_getattr, - .vop_setattr = tmpfs_setattr, - .vop_read = tmpfs_read, - .vop_write = tmpfs_write, - .vop_fsync = tmpfs_fsync, - .vop_remove = tmpfs_remove, - .vop_link = tmpfs_link, - .vop_rename = tmpfs_rename, - .vop_mkdir = tmpfs_mkdir, - .vop_rmdir = tmpfs_rmdir, - .vop_symlink = tmpfs_symlink, - .vop_readdir = tmpfs_readdir, - .vop_readlink = tmpfs_readlink, - .vop_inactive = tmpfs_inactive, - .vop_reclaim = tmpfs_reclaim, - .vop_print = tmpfs_print, - .vop_pathconf = tmpfs_pathconf, - .vop_advlock = tmpfs_advlock, - .vop_bmap = VOP_EOPNOTSUPP, -}; - -/* --------------------------------------------------------------------- */ - -int +static int tmpfs_lookup(struct vop_cachedlookup_args *v) { struct vnode *dvp = v->a_dvp; @@ -232,7 +197,7 @@ tmpfs_lookup(struct vop_cachedlookup_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_create(struct vop_create_args *v) { struct vnode *dvp = v->a_dvp; @@ -246,7 +211,7 @@ tmpfs_create(struct vop_create_args *v) } /* --------------------------------------------------------------------- */ -int +static int tmpfs_mknod(struct vop_mknod_args *v) { struct vnode *dvp = v->a_dvp; @@ -263,7 +228,7 @@ tmpfs_mknod(struct vop_mknod_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_open(struct vop_open_args *v) { struct vnode *vp = v->a_vp; @@ -296,7 +261,7 @@ tmpfs_open(struct vop_open_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_close(struct vop_close_args *v) { struct vnode *vp = v->a_vp; @@ -528,7 +493,7 @@ tmpfs_uio_xfer(struct tmpfs_mount *tmp, struct tmpfs_node *node, return error; } -int +static int tmpfs_read(struct vop_read_args *v) { struct vnode *vp = v->a_vp; @@ -563,7 +528,7 @@ tmpfs_read(struct vop_read_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_write(struct vop_write_args *v) { struct vnode *vp = v->a_vp; @@ -638,7 +603,7 @@ tmpfs_write(struct vop_write_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_fsync(struct vop_fsync_args *v) { struct vnode *vp = v->a_vp; @@ -652,7 +617,7 @@ tmpfs_fsync(struct vop_fsync_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_remove(struct vop_remove_args *v) { struct vnode *dvp = v->a_dvp; @@ -706,7 +671,7 @@ tmpfs_remove(struct vop_remove_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_link(struct vop_link_args *v) { struct vnode *dvp = v->a_tdvp; @@ -767,14 +732,14 @@ tmpfs_link(struct vop_link_args *v) tmpfs_update(vp); error = 0; -out: +out: return error; } /* --------------------------------------------------------------------- */ -int +static int tmpfs_rename(struct vop_rename_args *v) { struct vnode *fdvp = v->a_fdvp; @@ -968,7 +933,7 @@ tmpfs_rename(struct vop_rename_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_mkdir(struct vop_mkdir_args *v) { struct vnode *dvp = v->a_dvp; @@ -983,7 +948,7 @@ tmpfs_mkdir(struct vop_mkdir_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_rmdir(struct vop_rmdir_args *v) { struct vnode *dvp = v->a_dvp; @@ -1002,7 +967,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) dnode = VP_TO_TMPFS_DIR(dvp); node = VP_TO_TMPFS_DIR(vp); - /* Directories with more than two entries ('.' and '..') cannot be * removed. */ if (node->tn_size > 0) { @@ -1066,7 +1030,7 @@ tmpfs_rmdir(struct vop_rmdir_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_symlink(struct vop_symlink_args *v) { struct vnode *dvp = v->a_dvp; @@ -1086,7 +1050,7 @@ tmpfs_symlink(struct vop_symlink_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_readdir(struct vop_readdir_args *v) { struct vnode *vp = v->a_vp; @@ -1187,7 +1151,7 @@ tmpfs_readdir(struct vop_readdir_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_readlink(struct vop_readlink_args *v) { struct vnode *vp = v->a_vp; @@ -1210,7 +1174,7 @@ tmpfs_readlink(struct vop_readlink_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_inactive(struct vop_inactive_args *v) { struct vnode *vp = v->a_vp; @@ -1257,7 +1221,7 @@ tmpfs_reclaim(struct vop_reclaim_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_print(struct vop_print_args *v) { struct vnode *vp = v->a_vp; @@ -1283,7 +1247,7 @@ tmpfs_print(struct vop_print_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_pathconf(struct vop_pathconf_args *v) { int name = v->a_name; @@ -1335,7 +1299,7 @@ tmpfs_pathconf(struct vop_pathconf_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_advlock(struct vop_advlock_args *v) { struct vnode *vp = v->a_vp; @@ -1349,7 +1313,7 @@ tmpfs_advlock(struct vop_advlock_args *v) /* --------------------------------------------------------------------- */ -int +static int tmpfs_vptofh(struct vop_vptofh_args *ap) { struct tmpfs_fid *tfhp; @@ -1364,3 +1328,40 @@ tmpfs_vptofh(struct vop_vptofh_args *ap) return (0); } + +/* --------------------------------------------------------------------- */ + +/* + * vnode operations vector used for files stored in a tmpfs file system. + */ +struct vop_vector tmpfs_vnodeop_entries = { + .vop_default = &default_vnodeops, + .vop_lookup = vfs_cache_lookup, + .vop_cachedlookup = tmpfs_lookup, + .vop_create = tmpfs_create, + .vop_mknod = tmpfs_mknod, + .vop_open = tmpfs_open, + .vop_close = tmpfs_close, + .vop_access = tmpfs_access, + .vop_getattr = tmpfs_getattr, + .vop_setattr = tmpfs_setattr, + .vop_read = tmpfs_read, + .vop_write = tmpfs_write, + .vop_fsync = tmpfs_fsync, + .vop_remove = tmpfs_remove, + .vop_link = tmpfs_link, + .vop_rename = tmpfs_rename, + .vop_mkdir = tmpfs_mkdir, + .vop_rmdir = tmpfs_rmdir, + .vop_symlink = tmpfs_symlink, + .vop_readdir = tmpfs_readdir, + .vop_readlink = tmpfs_readlink, + .vop_inactive = tmpfs_inactive, + .vop_reclaim = tmpfs_reclaim, + .vop_print = tmpfs_print, + .vop_pathconf = tmpfs_pathconf, + .vop_advlock = tmpfs_advlock, + .vop_vptofh = tmpfs_vptofh, + .vop_bmap = VOP_EOPNOTSUPP, +}; + diff --git a/sys/fs/tmpfs/tmpfs_vnops.h b/sys/fs/tmpfs/tmpfs_vnops.h index dec3b05f8ea2..ee83b2bb8e21 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.h +++ b/sys/fs/tmpfs/tmpfs_vnops.h @@ -54,31 +54,10 @@ extern struct vop_vector tmpfs_vnodeop_entries; -vop_cachedlookup_t tmpfs_lookup; -vop_create_t tmpfs_create; -vop_mknod_t tmpfs_mknod; -vop_open_t tmpfs_open; -vop_close_t tmpfs_close; vop_access_t tmpfs_access; vop_getattr_t tmpfs_getattr; vop_setattr_t tmpfs_setattr; -vop_read_t tmpfs_read; -vop_write_t tmpfs_write; -vop_fsync_t tmpfs_fsync; -vop_remove_t tmpfs_remove; -vop_link_t tmpfs_link; -vop_rename_t tmpfs_rename; -vop_mkdir_t tmpfs_mkdir; -vop_rmdir_t tmpfs_rmdir; -vop_symlink_t tmpfs_symlink; -vop_readdir_t tmpfs_readdir; -vop_readlink_t tmpfs_readlink; -vop_inactive_t tmpfs_inactive; vop_reclaim_t tmpfs_reclaim; -vop_print_t tmpfs_print; -vop_pathconf_t tmpfs_pathconf; -vop_advlock_t tmpfs_advlock; -vop_vptofh_t tmpfs_vptofh; /* --------------------------------------------------------------------- */