206 sbp->f_frsize = PAGESIZE;
207
208 sbp->f_blocks = bfs->bfs_stat.bfss_nbytes.value.ui64 >> PAGESHIFT;
209 sbp->f_bfree = 0;
210 sbp->f_bavail = 0;
211
212 sbp->f_files = bfs->bfs_stat.bfss_nfiles.value.ui32 +
213 bfs->bfs_stat.bfss_ndirs.value.ui32;
214 sbp->f_ffree = 0;
215 sbp->f_favail = 0;
216
217 (void) cmpldev(&d32, vfsp->vfs_dev);
218 sbp->f_fsid = d32;
219 (void) strlcpy(sbp->f_basetype, bootfs_name, FSTYPSZ);
220 bzero(sbp->f_fstr, sizeof (sbp->f_fstr));
221
222 return (0);
223 }
224
225 static const fs_operation_def_t bootfs_vfsops_tmpl[] = {
226 VFSNAME_MOUNT, { .vfs_mount = bootfs_mount },
227 VFSNAME_UNMOUNT, { .vfs_unmount = bootfs_unmount },
228 VFSNAME_ROOT, { .vfs_root = bootfs_root },
229 VFSNAME_STATVFS, { .vfs_statvfs = bootfs_statvfs },
230 NULL, NULL
231 };
232
233 static int
234 bootfs_init(int fstype, char *name)
235 {
236 int ret;
237
238 bootfs_fstype = fstype;
239 ASSERT(bootfs_fstype != 0);
240
241 ret = vfs_setfsops(fstype, bootfs_vfsops_tmpl, NULL);
242 if (ret != 0)
243 return (ret);
244
245 ret = vn_make_ops(name, bootfs_vnodeops_template, &bootfs_vnodeops);
246 if (ret != 0) {
247 (void) vfs_freevfsops_by_type(bootfs_fstype);
248 return (ret);
249 }
250
258 return (0);
259 }
260
261 static mntopts_t bootfs_mntopts = {
262 0, NULL
263 };
264
265 static vfsdef_t bootfs_vfsdef = {
266 VFSDEF_VERSION,
267 "bootfs",
268 bootfs_init,
269 VSW_HASPROTO|VSW_STATS,
270 &bootfs_mntopts
271 };
272
273 static struct modlfs bootfs_modlfs = {
274 &mod_fsops, "boot-time modules file system", &bootfs_vfsdef
275 };
276
277 static struct modlinkage bootfs_modlinkage = {
278 MODREV_1, &bootfs_modlfs, NULL
279 };
280
281 int
282 _init(void)
283 {
284 bootfs_node_cache = kmem_cache_create("bootfs_node_cache",
285 sizeof (bootfs_node_t), 0, bootfs_node_constructor,
286 bootfs_node_destructor, NULL, NULL, NULL, 0);
287 bootfs_idspace = id_space_create("bootfs_minors", 1, INT32_MAX);
288 mutex_init(&bootfs_lock, NULL, MUTEX_DEFAULT, NULL);
289
290 return (mod_install(&bootfs_modlinkage));
291 }
292
293 int
294 _info(struct modinfo *modinfop)
295 {
296 return (mod_info(&bootfs_modlinkage, modinfop));
297 }
298
|
206 sbp->f_frsize = PAGESIZE;
207
208 sbp->f_blocks = bfs->bfs_stat.bfss_nbytes.value.ui64 >> PAGESHIFT;
209 sbp->f_bfree = 0;
210 sbp->f_bavail = 0;
211
212 sbp->f_files = bfs->bfs_stat.bfss_nfiles.value.ui32 +
213 bfs->bfs_stat.bfss_ndirs.value.ui32;
214 sbp->f_ffree = 0;
215 sbp->f_favail = 0;
216
217 (void) cmpldev(&d32, vfsp->vfs_dev);
218 sbp->f_fsid = d32;
219 (void) strlcpy(sbp->f_basetype, bootfs_name, FSTYPSZ);
220 bzero(sbp->f_fstr, sizeof (sbp->f_fstr));
221
222 return (0);
223 }
224
225 static const fs_operation_def_t bootfs_vfsops_tmpl[] = {
226 { VFSNAME_MOUNT, { .vfs_mount = bootfs_mount } },
227 { VFSNAME_UNMOUNT, { .vfs_unmount = bootfs_unmount } },
228 { VFSNAME_ROOT, { .vfs_root = bootfs_root } },
229 { VFSNAME_STATVFS, { .vfs_statvfs = bootfs_statvfs } },
230 { NULL, { NULL } }
231 };
232
233 static int
234 bootfs_init(int fstype, char *name)
235 {
236 int ret;
237
238 bootfs_fstype = fstype;
239 ASSERT(bootfs_fstype != 0);
240
241 ret = vfs_setfsops(fstype, bootfs_vfsops_tmpl, NULL);
242 if (ret != 0)
243 return (ret);
244
245 ret = vn_make_ops(name, bootfs_vnodeops_template, &bootfs_vnodeops);
246 if (ret != 0) {
247 (void) vfs_freevfsops_by_type(bootfs_fstype);
248 return (ret);
249 }
250
258 return (0);
259 }
260
261 static mntopts_t bootfs_mntopts = {
262 0, NULL
263 };
264
265 static vfsdef_t bootfs_vfsdef = {
266 VFSDEF_VERSION,
267 "bootfs",
268 bootfs_init,
269 VSW_HASPROTO|VSW_STATS,
270 &bootfs_mntopts
271 };
272
273 static struct modlfs bootfs_modlfs = {
274 &mod_fsops, "boot-time modules file system", &bootfs_vfsdef
275 };
276
277 static struct modlinkage bootfs_modlinkage = {
278 MODREV_1, { &bootfs_modlfs, NULL }
279 };
280
281 int
282 _init(void)
283 {
284 bootfs_node_cache = kmem_cache_create("bootfs_node_cache",
285 sizeof (bootfs_node_t), 0, bootfs_node_constructor,
286 bootfs_node_destructor, NULL, NULL, NULL, 0);
287 bootfs_idspace = id_space_create("bootfs_minors", 1, INT32_MAX);
288 mutex_init(&bootfs_lock, NULL, MUTEX_DEFAULT, NULL);
289
290 return (mod_install(&bootfs_modlinkage));
291 }
292
293 int
294 _info(struct modinfo *modinfop)
295 {
296 return (mod_info(&bootfs_modlinkage, modinfop));
297 }
298
|