6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright 2016 Nexenta Systems, Inc.
26 */
27
28 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 /*
32 * University Copyright- Copyright (c) 1982, 1986, 1988
33 * The Regents of the University of California
34 * All Rights Reserved
35 *
36 * University Acknowledgment- Portions of this document are derived from
37 * software developed by the University of California, Berkeley, and its
38 * contributors.
39 */
40
41 #include <sys/types.h>
42 #include <sys/t_lock.h>
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/bitmap.h>
179 (void *)0 },
180 { MNTOPT_NOATIME, NULL, NULL, 0,
181 (void *)UFSMNT_NOATIME },
182 { MNTOPT_DFRATIME, dfratime_cancel, NULL, 0,
183 (void *)0 },
184 { MNTOPT_NODFRATIME, nodfratime_cancel, NULL,
185 MO_NODISPLAY|MO_DEFAULT, (void *)UFSMNT_NODFRATIME },
186 { MNTOPT_ONERROR, NULL, UFSMNT_ONERROR_PANIC_STR,
187 MO_DEFAULT|MO_HASVALUE, (void *)0 },
188 };
189
190 static mntopts_t ufs_mntopts = {
191 sizeof (mntopts) / sizeof (mntopt_t),
192 mntopts
193 };
194
195 static vfsdef_t vfw = {
196 VFSDEF_VERSION,
197 "ufs",
198 ufsinit,
199 VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI,
200 &ufs_mntopts
201 };
202
203 /*
204 * Module linkage information for the kernel.
205 */
206 extern struct mod_ops mod_fsops;
207
208 static struct modlfs modlfs = {
209 &mod_fsops, "filesystem for ufs", &vfw
210 };
211
212 static struct modlinkage modlinkage = {
213 MODREV_1, (void *)&modlfs, NULL
214 };
215
216 /*
217 * An attempt has been made to make this module unloadable. In order to
218 * test it, we need a system in which the root fs is NOT ufs. THIS HAS NOT
219 * BEEN DONE
242 return (EBUSY);
243 }
244
245 int
246 _info(struct modinfo *modinfop)
247 {
248 return (mod_info(&modlinkage, modinfop));
249 }
250
251 extern struct vnode *makespecvp(dev_t dev, vtype_t type);
252
253 extern kmutex_t ufs_scan_lock;
254
255 static int mountfs(struct vfs *, enum whymountroot, struct vnode *, char *,
256 struct cred *, int, void *, int);
257
258
259 static int
260 ufs_mount(struct vfs *vfsp, struct vnode *mvp, struct mounta *uap,
261 struct cred *cr)
262
263 {
264 char *data = uap->dataptr;
265 int datalen = uap->datalen;
266 dev_t dev;
267 struct vnode *lvp = NULL;
268 struct vnode *svp = NULL;
269 struct pathname dpn;
270 int error;
271 enum whymountroot why = ROOT_INIT;
272 struct ufs_args args;
273 int oflag, aflag;
274 int fromspace = (uap->flags & MS_SYSSPACE) ?
275 UIO_SYSSPACE : UIO_USERSPACE;
276
277 if ((error = secpolicy_fs_mount(cr, mvp, vfsp)) != 0)
278 return (error);
279
280 if (mvp->v_type != VDIR)
281 return (ENOTDIR);
282
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright 2016 Nexenta Systems, Inc.
26 * Copyright (c) 2017 by Delphix. All rights reserved.
27 */
28
29 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
30 /* All Rights Reserved */
31
32 /*
33 * University Copyright- Copyright (c) 1982, 1986, 1988
34 * The Regents of the University of California
35 * All Rights Reserved
36 *
37 * University Acknowledgment- Portions of this document are derived from
38 * software developed by the University of California, Berkeley, and its
39 * contributors.
40 */
41
42 #include <sys/types.h>
43 #include <sys/t_lock.h>
44 #include <sys/param.h>
45 #include <sys/systm.h>
46 #include <sys/bitmap.h>
180 (void *)0 },
181 { MNTOPT_NOATIME, NULL, NULL, 0,
182 (void *)UFSMNT_NOATIME },
183 { MNTOPT_DFRATIME, dfratime_cancel, NULL, 0,
184 (void *)0 },
185 { MNTOPT_NODFRATIME, nodfratime_cancel, NULL,
186 MO_NODISPLAY|MO_DEFAULT, (void *)UFSMNT_NODFRATIME },
187 { MNTOPT_ONERROR, NULL, UFSMNT_ONERROR_PANIC_STR,
188 MO_DEFAULT|MO_HASVALUE, (void *)0 },
189 };
190
191 static mntopts_t ufs_mntopts = {
192 sizeof (mntopts) / sizeof (mntopt_t),
193 mntopts
194 };
195
196 static vfsdef_t vfw = {
197 VFSDEF_VERSION,
198 "ufs",
199 ufsinit,
200 VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI|VSW_MOUNTDEV,
201 &ufs_mntopts
202 };
203
204 /*
205 * Module linkage information for the kernel.
206 */
207 extern struct mod_ops mod_fsops;
208
209 static struct modlfs modlfs = {
210 &mod_fsops, "filesystem for ufs", &vfw
211 };
212
213 static struct modlinkage modlinkage = {
214 MODREV_1, (void *)&modlfs, NULL
215 };
216
217 /*
218 * An attempt has been made to make this module unloadable. In order to
219 * test it, we need a system in which the root fs is NOT ufs. THIS HAS NOT
220 * BEEN DONE
243 return (EBUSY);
244 }
245
246 int
247 _info(struct modinfo *modinfop)
248 {
249 return (mod_info(&modlinkage, modinfop));
250 }
251
252 extern struct vnode *makespecvp(dev_t dev, vtype_t type);
253
254 extern kmutex_t ufs_scan_lock;
255
256 static int mountfs(struct vfs *, enum whymountroot, struct vnode *, char *,
257 struct cred *, int, void *, int);
258
259
260 static int
261 ufs_mount(struct vfs *vfsp, struct vnode *mvp, struct mounta *uap,
262 struct cred *cr)
263 {
264 char *data = uap->dataptr;
265 int datalen = uap->datalen;
266 dev_t dev;
267 struct vnode *lvp = NULL;
268 struct vnode *svp = NULL;
269 struct pathname dpn;
270 int error;
271 enum whymountroot why = ROOT_INIT;
272 struct ufs_args args;
273 int oflag, aflag;
274 int fromspace = (uap->flags & MS_SYSSPACE) ?
275 UIO_SYSSPACE : UIO_USERSPACE;
276
277 if ((error = secpolicy_fs_mount(cr, mvp, vfsp)) != 0)
278 return (error);
279
280 if (mvp->v_type != VDIR)
281 return (ENOTDIR);
282
|