76 return (ENOTDIR);
77
78 if (uap->flags & MS_REMOUNT)
79 return (EBUSY);
80
81 mutex_enter(&mvp->v_lock);
82 if ((uap->flags & MS_OVERLAY) == 0 &&
83 (mvp->v_count != 1 || (mvp->v_flag & VROOT))) {
84 mutex_exit(&mvp->v_lock);
85 return (EBUSY);
86 }
87 mutex_exit(&mvp->v_lock);
88
89 /*
90 * We indicate that the backing store is bootfs. We don't want to use
91 * swap, because folks might think that this is putting all the data
92 * into memory ala tmpfs. Rather these modules are always in memory and
93 * there's nothing to be done about that.
94 */
95 vfs_setresource(vfsp, bootfs_name, 0);
96 bfs = kmem_zalloc(sizeof (bootfs_t), KM_NOSLEEP | KM_NORMALPRI);
97 if (bfs == NULL)
98 return (ENOMEM);
99
100 ret = pn_get(uap->dir,
101 (uap->flags & MS_SYSSPACE) ? UIO_SYSSPACE : UIO_USERSPACE, &dpn);
102 if (ret != 0) {
103 kmem_free(bfs, sizeof (bfs));
104 return (ret);
105 }
106
107 bfs->bfs_minor = id_alloc(bootfs_idspace);
108 bfs->bfs_kstat = kstat_create_zone("bootfs", bfs->bfs_minor, "bootfs",
109 "fs", KSTAT_TYPE_NAMED,
110 sizeof (bootfs_stat_t) / sizeof (kstat_named_t),
111 KSTAT_FLAG_VIRTUAL, GLOBAL_ZONEID);
112 if (bfs->bfs_kstat == NULL) {
113 id_free(bootfs_idspace, bfs->bfs_minor);
114 pn_free(&dpn);
115 kmem_free(bfs, sizeof (bfs));
116 return (ENOMEM);
|
76 return (ENOTDIR);
77
78 if (uap->flags & MS_REMOUNT)
79 return (EBUSY);
80
81 mutex_enter(&mvp->v_lock);
82 if ((uap->flags & MS_OVERLAY) == 0 &&
83 (mvp->v_count != 1 || (mvp->v_flag & VROOT))) {
84 mutex_exit(&mvp->v_lock);
85 return (EBUSY);
86 }
87 mutex_exit(&mvp->v_lock);
88
89 /*
90 * We indicate that the backing store is bootfs. We don't want to use
91 * swap, because folks might think that this is putting all the data
92 * into memory ala tmpfs. Rather these modules are always in memory and
93 * there's nothing to be done about that.
94 */
95 vfs_setresource(vfsp, bootfs_name, 0);
96 bfs = kmem_zalloc(sizeof (bootfs_t), KM_NOSLEEP_LAZY);
97 if (bfs == NULL)
98 return (ENOMEM);
99
100 ret = pn_get(uap->dir,
101 (uap->flags & MS_SYSSPACE) ? UIO_SYSSPACE : UIO_USERSPACE, &dpn);
102 if (ret != 0) {
103 kmem_free(bfs, sizeof (bfs));
104 return (ret);
105 }
106
107 bfs->bfs_minor = id_alloc(bootfs_idspace);
108 bfs->bfs_kstat = kstat_create_zone("bootfs", bfs->bfs_minor, "bootfs",
109 "fs", KSTAT_TYPE_NAMED,
110 sizeof (bootfs_stat_t) / sizeof (kstat_named_t),
111 KSTAT_FLAG_VIRTUAL, GLOBAL_ZONEID);
112 if (bfs->bfs_kstat == NULL) {
113 id_free(bootfs_idspace, bfs->bfs_minor);
114 pn_free(&dpn);
115 kmem_free(bfs, sizeof (bfs));
116 return (ENOMEM);
|