223
224 if (secpolicy_fs_mount(cr, mvp, vfsp) != 0)
225 return (EPERM);
226
227 if (mvp->v_type != VDIR)
228 return (ENOTDIR);
229
230 if ((uap->flags & MS_OVERLAY) == 0 &&
231 (mvp->v_count > 1 || (mvp->v_flag & VROOT)))
232 return (EBUSY);
233
234 data = kmem_alloc(sizeof (ctfs_vfs_t), KM_SLEEP);
235
236 /*
237 * Initialize vfs fields not initialized by VFS_INIT/domount
238 */
239 vfsp->vfs_bsize = DEV_BSIZE;
240 vfsp->vfs_fstype = ctfs_fstype;
241 do {
242 dev = makedevice(ctfs_major,
243 atomic_add_32_nv(&ctfs_minor, 1) & L_MAXMIN32);
244 } while (vfs_devismounted(dev));
245 vfs_make_fsid(&vfsp->vfs_fsid, dev, ctfs_fstype);
246 vfsp->vfs_data = data;
247 vfsp->vfs_dev = dev;
248
249 /*
250 * Dynamically create gfs_dirent_t array for the root directory.
251 */
252 dirent = kmem_zalloc((ct_ntypes + 2) * sizeof (gfs_dirent_t), KM_SLEEP);
253 for (i = 0; i < ct_ntypes; i++) {
254 dirent[i].gfse_name = (char *)ct_types[i]->ct_type_name;
255 dirent[i].gfse_ctor = ctfs_create_tdirnode;
256 dirent[i].gfse_flags = GFS_CACHE_VNODE;
257 }
258 dirent[i].gfse_name = "all";
259 dirent[i].gfse_ctor = ctfs_create_adirnode;
260 dirent[i].gfse_flags = GFS_CACHE_VNODE;
261 dirent[i+1].gfse_name = NULL;
262
263 /*
|
223
224 if (secpolicy_fs_mount(cr, mvp, vfsp) != 0)
225 return (EPERM);
226
227 if (mvp->v_type != VDIR)
228 return (ENOTDIR);
229
230 if ((uap->flags & MS_OVERLAY) == 0 &&
231 (mvp->v_count > 1 || (mvp->v_flag & VROOT)))
232 return (EBUSY);
233
234 data = kmem_alloc(sizeof (ctfs_vfs_t), KM_SLEEP);
235
236 /*
237 * Initialize vfs fields not initialized by VFS_INIT/domount
238 */
239 vfsp->vfs_bsize = DEV_BSIZE;
240 vfsp->vfs_fstype = ctfs_fstype;
241 do {
242 dev = makedevice(ctfs_major,
243 atomic_inc_32_nv(&ctfs_minor) & L_MAXMIN32);
244 } while (vfs_devismounted(dev));
245 vfs_make_fsid(&vfsp->vfs_fsid, dev, ctfs_fstype);
246 vfsp->vfs_data = data;
247 vfsp->vfs_dev = dev;
248
249 /*
250 * Dynamically create gfs_dirent_t array for the root directory.
251 */
252 dirent = kmem_zalloc((ct_ntypes + 2) * sizeof (gfs_dirent_t), KM_SLEEP);
253 for (i = 0; i < ct_ntypes; i++) {
254 dirent[i].gfse_name = (char *)ct_types[i]->ct_type_name;
255 dirent[i].gfse_ctor = ctfs_create_tdirnode;
256 dirent[i].gfse_flags = GFS_CACHE_VNODE;
257 }
258 dirent[i].gfse_name = "all";
259 dirent[i].gfse_ctor = ctfs_create_adirnode;
260 dirent[i].gfse_flags = GFS_CACHE_VNODE;
261 dirent[i+1].gfse_name = NULL;
262
263 /*
|