summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/fem.c
diff options
context:
space:
mode:
authorrsb <none@none>2006-05-02 13:03:35 -0700
committerrsb <none@none>2006-05-02 13:03:35 -0700
commitddfcde867cfcf679df9c2825a008d604634c1193 (patch)
tree6d9983830f731983dddf1c503415ed2379b7d3a0 /usr/src/uts/common/fs/fem.c
parent9129170ada39d6c7a0cf249048ae65df8f924524 (diff)
downloadillumos-gate-ddfcde867cfcf679df9c2825a008d604634c1193.tar.gz
PSARC 2006/270 vfs_femhead change to vfs_implp
6418270 RFE: Need implementation private data for vfs 6419029 sys/vnode.h pollutes the userland namespace
Diffstat (limited to 'usr/src/uts/common/fs/fem.c')
-rw-r--r--usr/src/uts/common/fs/fem.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/usr/src/uts/common/fs/fem.c b/usr/src/uts/common/fs/fem.c
index 0c2b4eb37f..fb87ac524e 100644
--- a/usr/src/uts/common/fs/fem.c
+++ b/usr/src/uts/common/fs/fem.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -1633,6 +1632,8 @@ fshead_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
void *arg0;
int errc;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (int (*)()) vfsp->vfs_op->vfs_mount;
fem_unlock(vfsp->vfs_femhead);
@@ -1659,6 +1660,8 @@ fshead_unmount(vfs_t *vfsp, int flag, cred_t *cr)
void *arg0;
int errc;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (int (*)()) vfsp->vfs_op->vfs_unmount;
fem_unlock(vfsp->vfs_femhead);
@@ -1685,6 +1688,8 @@ fshead_root(vfs_t *vfsp, vnode_t **vpp)
void *arg0;
int errc;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (int (*)()) vfsp->vfs_op->vfs_root;
fem_unlock(vfsp->vfs_femhead);
@@ -1710,6 +1715,8 @@ fshead_statvfs(vfs_t *vfsp, statvfs64_t *sp)
void *arg0;
int errc;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (int (*)()) vfsp->vfs_op->vfs_statvfs;
fem_unlock(vfsp->vfs_femhead);
@@ -1736,6 +1743,8 @@ fshead_sync(vfs_t *vfsp, short flag, cred_t *cr)
void *arg0;
int errc;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (int (*)()) vfsp->vfs_op->vfs_sync;
fem_unlock(vfsp->vfs_femhead);
@@ -1761,6 +1770,8 @@ fshead_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp)
void *arg0;
int errc;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (int (*)()) vfsp->vfs_op->vfs_vget;
fem_unlock(vfsp->vfs_femhead);
@@ -1786,6 +1797,8 @@ fshead_mountroot(vfs_t *vfsp, enum whymountroot reason)
void *arg0;
int errc;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (int (*)()) vfsp->vfs_op->vfs_mountroot;
fem_unlock(vfsp->vfs_femhead);
@@ -1811,6 +1824,8 @@ fshead_freevfs(vfs_t *vfsp)
void (*func)();
void *arg0;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (void (*)()) vfsp->vfs_op->vfs_freevfs;
fem_unlock(vfsp->vfs_femhead);
@@ -1836,6 +1851,8 @@ fshead_vnstate(vfs_t *vfsp, vnode_t *vp, vntrans_t nstate)
void *arg0;
int errc;
+ ASSERT(vfsp->vfs_implp);
+
if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) {
func = (int (*)()) vfsp->vfs_op->vfs_vnstate;
fem_unlock(vfsp->vfs_femhead);
@@ -3275,6 +3292,9 @@ fsem_is_installed(struct vfs *v, fsem_t *mon, void *arg)
{
struct fem_list *fl;
+ if (v->vfs_implp == NULL)
+ return (0);
+
fl = fem_get(v->vfs_femhead);
if (fl != NULL) {
int e;
@@ -3297,6 +3317,10 @@ fsem_install(
int error;
struct fem_node nnode;
+ /* If this vfs hasn't been properly initialized, fail the install */
+ if (vfsp->vfs_implp == NULL)
+ return (EINVAL);
+
nnode.fn_available = arg;
nnode.fn_op.fsem = mon;
nnode.fn_av_hold = arg_hold;
@@ -3322,6 +3346,10 @@ int
fsem_uninstall(struct vfs *v, fsem_t *mon, void *arg)
{
int e;
+
+ if (v->vfs_implp == NULL)
+ return (EINVAL);
+
e = fem_remove_node(v->vfs_femhead, (void **)&v->vfs_op,
(void *)mon, arg);
return (e);
@@ -3334,6 +3362,7 @@ fsem_setvfsops(vfs_t *v, vfsops_t *newops)
ASSERT(v != NULL);
ASSERT(newops != NULL);
+ ASSERT(v->vfs_implp);
do {
r = v->vfs_op;
@@ -3356,6 +3385,7 @@ fsem_getvfsops(vfs_t *v)
vfsops_t *r;
ASSERT(v != NULL);
+ ASSERT(v->vfs_implp);
r = v->vfs_op;
membar_consumer();