Annotation of sys/xfs/xfs_vfsops-openbsd.c, Revision 1.1.1.1
1.1 nbrk 1: /*
2: * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
3: * (Royal Institute of Technology, Stockholm, Sweden).
4: * All rights reserved.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: *
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: *
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: *
17: * 3. Neither the name of the Institute nor the names of its contributors
18: * may be used to endorse or promote products derived from this software
19: * without specific prior written permission.
20: *
21: * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: * SUCH DAMAGE.
32: */
33:
34: #include <xfs/xfs_locl.h>
35:
36: RCSID("$arla: xfs_vfsops-openbsd.c,v 1.16 2003/06/02 18:26:50 lha Exp $");
37:
38: #include <xfs/xfs_common.h>
39: #include <xfs/xfs_message.h>
40: #include <xfs/xfs_fs.h>
41: #include <xfs/xfs_dev.h>
42: #include <xfs/xfs_deb.h>
43: #include <xfs/xfs_vfsops.h>
44: #include <xfs/xfs_vfsops-bsd.h>
45: #include <xfs/xfs_vnodeops.h>
46:
47: static vop_t **xfs_dead_vnodeop_p;
48:
49: int
50: xfs_make_dead_vnode(struct mount *mp, struct vnode **vpp)
51: {
52: NNPFSDEB(XDEBNODE, ("make_dead_vnode mp = %lx\n",
53: (unsigned long)mp));
54:
55: return getnewvnode(VT_NON, mp, xfs_dead_vnodeop_p, vpp);
56: }
57:
58: static struct vnodeopv_entry_desc xfs_dead_vnodeop_entries[] = {
59: {&vop_default_desc, (vop_t *) xfs_eopnotsupp},
60: {&vop_lookup_desc, (vop_t *) xfs_dead_lookup},
61: {&vop_reclaim_desc, (vop_t *) xfs_returnzero},
62: {&vop_lock_desc, (vop_t *) vop_generic_lock},
63: {&vop_unlock_desc, (vop_t *) vop_generic_unlock},
64: {&vop_islocked_desc,(vop_t *) vop_generic_islocked},
65: {NULL, NULL}};
66:
67: static struct vnodeopv_desc xfs_dead_vnodeop_opv_desc =
68: {&xfs_dead_vnodeop_p, xfs_dead_vnodeop_entries};
69:
70: extern struct vnodeopv_desc xfs_vnodeop_opv_desc;
71:
72: static int
73: xfs_init(struct vfsconf *vfs)
74: {
75: NNPFSDEB(XDEBVFOPS, ("xfs_init\n"));
76: vfs_opv_init_explicit(&xfs_vnodeop_opv_desc);
77: vfs_opv_init_default(&xfs_vnodeop_opv_desc);
78: vfs_opv_init_explicit(&xfs_dead_vnodeop_opv_desc);
79: vfs_opv_init_default(&xfs_dead_vnodeop_opv_desc);
80: return 0;
81: }
82:
83: const struct vfsops xfs_vfsops = {
84: #ifdef HAVE_STRUCT_VFSOPS_VFS_MOUNT
85: xfs_mount_common,
86: #else
87: xfs_mount_caddr,
88: #endif
89: xfs_start,
90: xfs_unmount,
91: xfs_root,
92: xfs_quotactl,
93: xfs_statfs,
94: xfs_sync,
95: xfs_vget,
96: xfs_fhtovp,
97: xfs_vptofh,
98: xfs_init,
99: NULL,
100: #ifdef HAVE_STRUCT_VFSOPS_VFS_CHECKEXP
101: xfs_checkexp, /* checkexp */
102: #endif
103: };
104:
105: static struct vfsconf xfs_vfc = {
106: &xfs_vfsops,
107: "xfs",
108: 0,
109: 0,
110: 0,
111: NULL,
112: NULL
113: };
114:
115: #ifndef HAVE_KERNEL_VFS_REGISTER
116:
117: static int
118: vfs_register (struct vfsconf *vfs)
119: {
120: struct vfsconf *vfsp;
121: struct vfsconf **vfspp;
122:
123: /* Check if filesystem already known */
124: for (vfspp = &vfsconf, vfsp = vfsconf;
125: vfsp;
126: vfspp = &vfsp->vfc_next, vfsp = vfsp->vfc_next)
127: if (strcmp(vfsp->vfc_name, vfs->vfc_name) == 0)
128: return (EEXIST);
129:
130: maxvfsconf++;
131:
132: /* Add to the end of the list */
133: *vfspp = vfs;
134:
135: vfs->vfc_next = NULL;
136:
137: /* Call vfs_init() */
138: NNPFSDEB(XDEBVFOPS, ("calling vfs_init\n"));
139: (*(vfs->vfc_vfsops->vfs_init)) (vfs);
140:
141: /* done! */
142:
143: return 0;
144: }
145:
146: static int
147: vfs_unregister (struct vfsconf *vfs)
148: {
149: struct vfsconf *vfsp;
150: struct vfsconf **vfspp;
151:
152: /* Find our vfsconf struct */
153: for (vfspp = &vfsconf, vfsp = vfsconf;
154: vfsp;
155: vfspp = &vfsp->vfc_next, vfsp = vfsp->vfc_next)
156: if (strcmp(vfsp->vfc_name, vfs->vfc_name) == 0)
157: break;
158:
159: if (!vfsp) /* Not found */
160: return (ENOENT);
161:
162: if (vfsp->vfc_refcount) /* In use */
163: return (EBUSY);
164:
165: /* Remove from list and free */
166: *vfspp = vfsp->vfc_next;
167:
168: maxvfsconf--;
169:
170: return 0;
171: }
172:
173: #endif
174:
175: int
176: xfs_install_filesys(void)
177: {
178: return vfs_register (&xfs_vfc);
179: }
180:
181: int
182: xfs_uninstall_filesys(void)
183: {
184: return vfs_unregister (&xfs_vfc);
185: }
186:
187: int
188: xfs_stat_filesys (void)
189: {
190: return 0;
191: }
CVSweb