91 /* Option name Cancel Opt Arg Flags Data */
92 { MNTOPT_XATTR, xattr_cancel, NULL, MO_DEFAULT, NULL},
93 { MNTOPT_NOXATTR, noxattr_cancel, NULL, NULL, NULL},
94 { "size", NULL, "0", MO_HASVALUE, NULL}
95 };
96
97
98 static mntopts_t tmpfs_proto_opttbl = {
99 sizeof (tmpfs_options) / sizeof (mntopt_t),
100 tmpfs_options
101 };
102
103 /*
104 * Module linkage information
105 */
106 static struct modlfs modlfs = {
107 &mod_fsops, "filesystem for tmpfs", &vfw
108 };
109
110 static struct modlinkage modlinkage = {
111 MODREV_1, &modlfs, NULL
112 };
113
114 int
115 _init()
116 {
117 return (mod_install(&modlinkage));
118 }
119
120 int
121 _fini()
122 {
123 int error;
124
125 error = mod_remove(&modlinkage);
126 if (error)
127 return (error);
128 /*
129 * Tear down the operations vectors
130 */
131 (void) vfs_freevfsops_by_type(tmpfsfstype);
155 *
156 * There is also a per mount limit on the amount of swap space
157 * (tmount.tm_anonmax) settable via a mount option.
158 */
159 size_t tmpfs_maxkmem = 0;
160 size_t tmpfs_minfree = 0;
161 size_t tmp_kmemspace; /* bytes of kernel heap used by all tmpfs */
162
163 static major_t tmpfs_major;
164 static minor_t tmpfs_minor;
165 static kmutex_t tmpfs_minor_lock;
166
167 /*
168 * initialize global tmpfs locks and such
169 * called when loading tmpfs module
170 */
171 static int
172 tmpfsinit(int fstype, char *name)
173 {
174 static const fs_operation_def_t tmp_vfsops_template[] = {
175 VFSNAME_MOUNT, { .vfs_mount = tmp_mount },
176 VFSNAME_UNMOUNT, { .vfs_unmount = tmp_unmount },
177 VFSNAME_ROOT, { .vfs_root = tmp_root },
178 VFSNAME_STATVFS, { .vfs_statvfs = tmp_statvfs },
179 VFSNAME_VGET, { .vfs_vget = tmp_vget },
180 NULL, NULL
181 };
182 int error;
183 extern void tmpfs_hash_init();
184
185 tmpfs_hash_init();
186 tmpfsfstype = fstype;
187 ASSERT(tmpfsfstype != 0);
188
189 error = vfs_setfsops(fstype, tmp_vfsops_template, NULL);
190 if (error != 0) {
191 cmn_err(CE_WARN, "tmpfsinit: bad vfs ops template");
192 return (error);
193 }
194
195 error = vn_make_ops(name, tmp_vnodeops_template, &tmp_vnodeops);
196 if (error != 0) {
197 (void) vfs_freevfsops_by_type(fstype);
198 cmn_err(CE_WARN, "tmpfsinit: bad vnode ops template");
199 return (error);
200 }
|
91 /* Option name Cancel Opt Arg Flags Data */
92 { MNTOPT_XATTR, xattr_cancel, NULL, MO_DEFAULT, NULL},
93 { MNTOPT_NOXATTR, noxattr_cancel, NULL, NULL, NULL},
94 { "size", NULL, "0", MO_HASVALUE, NULL}
95 };
96
97
98 static mntopts_t tmpfs_proto_opttbl = {
99 sizeof (tmpfs_options) / sizeof (mntopt_t),
100 tmpfs_options
101 };
102
103 /*
104 * Module linkage information
105 */
106 static struct modlfs modlfs = {
107 &mod_fsops, "filesystem for tmpfs", &vfw
108 };
109
110 static struct modlinkage modlinkage = {
111 MODREV_1, { &modlfs, NULL }
112 };
113
114 int
115 _init()
116 {
117 return (mod_install(&modlinkage));
118 }
119
120 int
121 _fini()
122 {
123 int error;
124
125 error = mod_remove(&modlinkage);
126 if (error)
127 return (error);
128 /*
129 * Tear down the operations vectors
130 */
131 (void) vfs_freevfsops_by_type(tmpfsfstype);
155 *
156 * There is also a per mount limit on the amount of swap space
157 * (tmount.tm_anonmax) settable via a mount option.
158 */
159 size_t tmpfs_maxkmem = 0;
160 size_t tmpfs_minfree = 0;
161 size_t tmp_kmemspace; /* bytes of kernel heap used by all tmpfs */
162
163 static major_t tmpfs_major;
164 static minor_t tmpfs_minor;
165 static kmutex_t tmpfs_minor_lock;
166
167 /*
168 * initialize global tmpfs locks and such
169 * called when loading tmpfs module
170 */
171 static int
172 tmpfsinit(int fstype, char *name)
173 {
174 static const fs_operation_def_t tmp_vfsops_template[] = {
175 { VFSNAME_MOUNT, { .vfs_mount = tmp_mount } },
176 { VFSNAME_UNMOUNT, { .vfs_unmount = tmp_unmount } },
177 { VFSNAME_ROOT, { .vfs_root = tmp_root } },
178 { VFSNAME_STATVFS, { .vfs_statvfs = tmp_statvfs } },
179 { VFSNAME_VGET, { .vfs_vget = tmp_vget } },
180 { NULL, { NULL } }
181 };
182 int error;
183 extern void tmpfs_hash_init();
184
185 tmpfs_hash_init();
186 tmpfsfstype = fstype;
187 ASSERT(tmpfsfstype != 0);
188
189 error = vfs_setfsops(fstype, tmp_vfsops_template, NULL);
190 if (error != 0) {
191 cmn_err(CE_WARN, "tmpfsinit: bad vfs ops template");
192 return (error);
193 }
194
195 error = vn_make_ops(name, tmp_vnodeops_template, &tmp_vnodeops);
196 if (error != 0) {
197 (void) vfs_freevfsops_by_type(fstype);
198 cmn_err(CE_WARN, "tmpfsinit: bad vnode ops template");
199 return (error);
200 }
|