]>
Commit | Line | Data |
---|---|---|
ba9e5e98 BH |
1 | /* |
2 | * Copyright (C) 2005, 2006 | |
27d2e149 | 3 | * Avishay Traeger (avishay@gmail.com) |
ba9e5e98 BH |
4 | * Copyright (C) 2008, 2009 |
5 | * Boaz Harrosh <bharrosh@panasas.com> | |
6 | * | |
7 | * Copyrights for code taken from ext2: | |
8 | * Copyright (C) 1992, 1993, 1994, 1995 | |
9 | * Remy Card (card@masi.ibp.fr) | |
10 | * Laboratoire MASI - Institut Blaise Pascal | |
11 | * Universite Pierre et Marie Curie (Paris VI) | |
12 | * from | |
13 | * linux/fs/minix/inode.c | |
14 | * Copyright (C) 1991, 1992 Linus Torvalds | |
15 | * | |
16 | * This file is part of exofs. | |
17 | * | |
18 | * exofs is free software; you can redistribute it and/or modify | |
19 | * it under the terms of the GNU General Public License as published by | |
20 | * the Free Software Foundation. Since it is based on ext2, and the only | |
21 | * valid version of GPL for the Linux kernel is version 2, the only valid | |
22 | * version of GPL for exofs is version 2. | |
23 | * | |
24 | * exofs is distributed in the hope that it will be useful, | |
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
27 | * GNU General Public License for more details. | |
28 | * | |
29 | * You should have received a copy of the GNU General Public License | |
30 | * along with exofs; if not, write to the Free Software | |
31 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
32 | */ | |
33 | ||
405f5571 | 34 | #include <linux/smp_lock.h> |
ba9e5e98 BH |
35 | #include <linux/string.h> |
36 | #include <linux/parser.h> | |
37 | #include <linux/vfs.h> | |
38 | #include <linux/random.h> | |
8cf74b39 | 39 | #include <linux/exportfs.h> |
ba9e5e98 BH |
40 | |
41 | #include "exofs.h" | |
42 | ||
43 | /****************************************************************************** | |
44 | * MOUNT OPTIONS | |
45 | *****************************************************************************/ | |
46 | ||
47 | /* | |
48 | * struct to hold what we get from mount options | |
49 | */ | |
50 | struct exofs_mountopt { | |
51 | const char *dev_name; | |
52 | uint64_t pid; | |
53 | int timeout; | |
54 | }; | |
55 | ||
56 | /* | |
57 | * exofs-specific mount-time options. | |
58 | */ | |
59 | enum { Opt_pid, Opt_to, Opt_mkfs, Opt_format, Opt_err }; | |
60 | ||
61 | /* | |
62 | * Our mount-time options. These should ideally be 64-bit unsigned, but the | |
63 | * kernel's parsing functions do not currently support that. 32-bit should be | |
64 | * sufficient for most applications now. | |
65 | */ | |
66 | static match_table_t tokens = { | |
67 | {Opt_pid, "pid=%u"}, | |
68 | {Opt_to, "to=%u"}, | |
69 | {Opt_err, NULL} | |
70 | }; | |
71 | ||
72 | /* | |
73 | * The main option parsing method. Also makes sure that all of the mandatory | |
74 | * mount options were set. | |
75 | */ | |
76 | static int parse_options(char *options, struct exofs_mountopt *opts) | |
77 | { | |
78 | char *p; | |
79 | substring_t args[MAX_OPT_ARGS]; | |
80 | int option; | |
81 | bool s_pid = false; | |
82 | ||
83 | EXOFS_DBGMSG("parse_options %s\n", options); | |
84 | /* defaults */ | |
85 | memset(opts, 0, sizeof(*opts)); | |
86 | opts->timeout = BLK_DEFAULT_SG_TIMEOUT; | |
87 | ||
88 | while ((p = strsep(&options, ",")) != NULL) { | |
89 | int token; | |
90 | char str[32]; | |
91 | ||
92 | if (!*p) | |
93 | continue; | |
94 | ||
95 | token = match_token(p, tokens, args); | |
96 | switch (token) { | |
97 | case Opt_pid: | |
98 | if (0 == match_strlcpy(str, &args[0], sizeof(str))) | |
99 | return -EINVAL; | |
100 | opts->pid = simple_strtoull(str, NULL, 0); | |
101 | if (opts->pid < EXOFS_MIN_PID) { | |
102 | EXOFS_ERR("Partition ID must be >= %u", | |
103 | EXOFS_MIN_PID); | |
104 | return -EINVAL; | |
105 | } | |
106 | s_pid = 1; | |
107 | break; | |
108 | case Opt_to: | |
109 | if (match_int(&args[0], &option)) | |
110 | return -EINVAL; | |
111 | if (option <= 0) { | |
112 | EXOFS_ERR("Timout must be > 0"); | |
113 | return -EINVAL; | |
114 | } | |
115 | opts->timeout = option * HZ; | |
116 | break; | |
117 | } | |
118 | } | |
119 | ||
120 | if (!s_pid) { | |
121 | EXOFS_ERR("Need to specify the following options:\n"); | |
122 | EXOFS_ERR(" -o pid=pid_no_to_use\n"); | |
123 | return -EINVAL; | |
124 | } | |
125 | ||
126 | return 0; | |
127 | } | |
128 | ||
129 | /****************************************************************************** | |
130 | * INODE CACHE | |
131 | *****************************************************************************/ | |
132 | ||
133 | /* | |
134 | * Our inode cache. Isn't it pretty? | |
135 | */ | |
136 | static struct kmem_cache *exofs_inode_cachep; | |
137 | ||
138 | /* | |
139 | * Allocate an inode in the cache | |
140 | */ | |
141 | static struct inode *exofs_alloc_inode(struct super_block *sb) | |
142 | { | |
143 | struct exofs_i_info *oi; | |
144 | ||
145 | oi = kmem_cache_alloc(exofs_inode_cachep, GFP_KERNEL); | |
146 | if (!oi) | |
147 | return NULL; | |
148 | ||
149 | oi->vfs_inode.i_version = 1; | |
150 | return &oi->vfs_inode; | |
151 | } | |
152 | ||
153 | /* | |
154 | * Remove an inode from the cache | |
155 | */ | |
156 | static void exofs_destroy_inode(struct inode *inode) | |
157 | { | |
158 | kmem_cache_free(exofs_inode_cachep, exofs_i(inode)); | |
159 | } | |
160 | ||
161 | /* | |
162 | * Initialize the inode | |
163 | */ | |
164 | static void exofs_init_once(void *foo) | |
165 | { | |
166 | struct exofs_i_info *oi = foo; | |
167 | ||
168 | inode_init_once(&oi->vfs_inode); | |
169 | } | |
170 | ||
171 | /* | |
172 | * Create and initialize the inode cache | |
173 | */ | |
174 | static int init_inodecache(void) | |
175 | { | |
176 | exofs_inode_cachep = kmem_cache_create("exofs_inode_cache", | |
177 | sizeof(struct exofs_i_info), 0, | |
178 | SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, | |
179 | exofs_init_once); | |
180 | if (exofs_inode_cachep == NULL) | |
181 | return -ENOMEM; | |
182 | return 0; | |
183 | } | |
184 | ||
185 | /* | |
186 | * Destroy the inode cache | |
187 | */ | |
188 | static void destroy_inodecache(void) | |
189 | { | |
190 | kmem_cache_destroy(exofs_inode_cachep); | |
191 | } | |
192 | ||
193 | /****************************************************************************** | |
194 | * SUPERBLOCK FUNCTIONS | |
195 | *****************************************************************************/ | |
196 | static const struct super_operations exofs_sops; | |
8cf74b39 | 197 | static const struct export_operations exofs_export_ops; |
ba9e5e98 BH |
198 | |
199 | /* | |
200 | * Write the superblock to the OSD | |
201 | */ | |
baaf94cd | 202 | int exofs_sync_fs(struct super_block *sb, int wait) |
ba9e5e98 BH |
203 | { |
204 | struct exofs_sb_info *sbi; | |
205 | struct exofs_fscb *fscb; | |
06886a5a | 206 | struct exofs_io_state *ios; |
80e09fb9 | 207 | int ret = -ENOMEM; |
ba9e5e98 | 208 | |
ebc1ac16 | 209 | lock_super(sb); |
ba9e5e98 | 210 | sbi = sb->s_fs_info; |
06886a5a BH |
211 | fscb = &sbi->s_fscb; |
212 | ||
213 | ret = exofs_get_io_state(sbi, &ios); | |
214 | if (ret) | |
215 | goto out; | |
216 | ||
217 | ios->length = sizeof(*fscb); | |
218 | memset(fscb, 0, ios->length); | |
ba9e5e98 BH |
219 | fscb->s_nextid = cpu_to_le64(sbi->s_nextid); |
220 | fscb->s_numfiles = cpu_to_le32(sbi->s_numfiles); | |
221 | fscb->s_magic = cpu_to_le16(sb->s_magic); | |
222 | fscb->s_newfs = 0; | |
223 | ||
06886a5a BH |
224 | ios->obj.id = EXOFS_SUPER_ID; |
225 | ios->offset = 0; | |
226 | ios->kern_buff = fscb; | |
227 | ios->cred = sbi->s_cred; | |
ba9e5e98 | 228 | |
06886a5a | 229 | ret = exofs_sbi_write(ios); |
ba9e5e98 | 230 | if (unlikely(ret)) { |
06886a5a | 231 | EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__); |
ba9e5e98 BH |
232 | goto out; |
233 | } | |
234 | sb->s_dirt = 0; | |
235 | ||
236 | out: | |
06886a5a BH |
237 | EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret); |
238 | exofs_put_io_state(ios); | |
ebc1ac16 | 239 | unlock_super(sb); |
80e09fb9 CH |
240 | return ret; |
241 | } | |
242 | ||
243 | static void exofs_write_super(struct super_block *sb) | |
244 | { | |
245 | if (!(sb->s_flags & MS_RDONLY)) | |
246 | exofs_sync_fs(sb, 1); | |
247 | else | |
248 | sb->s_dirt = 0; | |
ba9e5e98 BH |
249 | } |
250 | ||
19fe294f BH |
251 | static void _exofs_print_device(const char *msg, const char *dev_path, |
252 | struct osd_dev *od, u64 pid) | |
253 | { | |
254 | const struct osd_dev_info *odi = osduld_device_info(od); | |
255 | ||
256 | printk(KERN_NOTICE "exofs: %s %s osd_name-%s pid-0x%llx\n", | |
257 | msg, dev_path ?: "", odi->osdname, _LLU(pid)); | |
258 | } | |
259 | ||
ba9e5e98 BH |
260 | /* |
261 | * This function is called when the vfs is freeing the superblock. We just | |
262 | * need to free our own part. | |
263 | */ | |
264 | static void exofs_put_super(struct super_block *sb) | |
265 | { | |
266 | int num_pend; | |
267 | struct exofs_sb_info *sbi = sb->s_fs_info; | |
268 | ||
8c85e125 CH |
269 | if (sb->s_dirt) |
270 | exofs_write_super(sb); | |
271 | ||
ba9e5e98 BH |
272 | /* make sure there are no pending commands */ |
273 | for (num_pend = atomic_read(&sbi->s_curr_pending); num_pend > 0; | |
274 | num_pend = atomic_read(&sbi->s_curr_pending)) { | |
275 | wait_queue_head_t wq; | |
276 | init_waitqueue_head(&wq); | |
277 | wait_event_timeout(wq, | |
278 | (atomic_read(&sbi->s_curr_pending) == 0), | |
279 | msecs_to_jiffies(100)); | |
280 | } | |
281 | ||
19fe294f | 282 | _exofs_print_device("Unmounting", NULL, sbi->s_dev, sbi->s_pid); |
ba9e5e98 BH |
283 | osduld_put_device(sbi->s_dev); |
284 | kfree(sb->s_fs_info); | |
285 | sb->s_fs_info = NULL; | |
286 | } | |
287 | ||
288 | /* | |
289 | * Read the superblock from the OSD and fill in the fields | |
290 | */ | |
291 | static int exofs_fill_super(struct super_block *sb, void *data, int silent) | |
292 | { | |
293 | struct inode *root; | |
294 | struct exofs_mountopt *opts = data; | |
295 | struct exofs_sb_info *sbi; /*extended info */ | |
06886a5a | 296 | struct osd_dev *od; /* Master device */ |
ba9e5e98 | 297 | struct exofs_fscb fscb; /*on-disk superblock info */ |
ba9e5e98 BH |
298 | struct osd_obj_id obj; |
299 | int ret; | |
300 | ||
301 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | |
302 | if (!sbi) | |
303 | return -ENOMEM; | |
ba9e5e98 BH |
304 | |
305 | /* use mount options to fill superblock */ | |
06886a5a BH |
306 | od = osduld_path_lookup(opts->dev_name); |
307 | if (IS_ERR(od)) { | |
308 | ret = PTR_ERR(od); | |
ba9e5e98 BH |
309 | goto free_sbi; |
310 | } | |
311 | ||
06886a5a | 312 | sbi->s_dev = od; |
ba9e5e98 BH |
313 | sbi->s_pid = opts->pid; |
314 | sbi->s_timeout = opts->timeout; | |
315 | ||
316 | /* fill in some other data by hand */ | |
317 | memset(sb->s_id, 0, sizeof(sb->s_id)); | |
318 | strcpy(sb->s_id, "exofs"); | |
319 | sb->s_blocksize = EXOFS_BLKSIZE; | |
320 | sb->s_blocksize_bits = EXOFS_BLKSHIFT; | |
321 | sb->s_maxbytes = MAX_LFS_FILESIZE; | |
322 | atomic_set(&sbi->s_curr_pending, 0); | |
323 | sb->s_bdev = NULL; | |
324 | sb->s_dev = 0; | |
325 | ||
ba9e5e98 BH |
326 | obj.partition = sbi->s_pid; |
327 | obj.id = EXOFS_SUPER_ID; | |
328 | exofs_make_credential(sbi->s_cred, &obj); | |
329 | ||
06886a5a BH |
330 | ret = exofs_read_kern(od, sbi->s_cred, &obj, 0, &fscb, sizeof(fscb)); |
331 | if (unlikely(ret)) | |
ba9e5e98 | 332 | goto free_sbi; |
ba9e5e98 BH |
333 | |
334 | sb->s_magic = le16_to_cpu(fscb.s_magic); | |
335 | sbi->s_nextid = le64_to_cpu(fscb.s_nextid); | |
336 | sbi->s_numfiles = le32_to_cpu(fscb.s_numfiles); | |
337 | ||
338 | /* make sure what we read from the object store is correct */ | |
339 | if (sb->s_magic != EXOFS_SUPER_MAGIC) { | |
340 | if (!silent) | |
341 | EXOFS_ERR("ERROR: Bad magic value\n"); | |
342 | ret = -EINVAL; | |
343 | goto free_sbi; | |
344 | } | |
345 | ||
346 | /* start generation numbers from a random point */ | |
347 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); | |
348 | spin_lock_init(&sbi->s_next_gen_lock); | |
349 | ||
350 | /* set up operation vectors */ | |
06886a5a | 351 | sb->s_fs_info = sbi; |
ba9e5e98 | 352 | sb->s_op = &exofs_sops; |
8cf74b39 | 353 | sb->s_export_op = &exofs_export_ops; |
ba9e5e98 BH |
354 | root = exofs_iget(sb, EXOFS_ROOT_ID - EXOFS_OBJ_OFF); |
355 | if (IS_ERR(root)) { | |
356 | EXOFS_ERR("ERROR: exofs_iget failed\n"); | |
357 | ret = PTR_ERR(root); | |
358 | goto free_sbi; | |
359 | } | |
360 | sb->s_root = d_alloc_root(root); | |
361 | if (!sb->s_root) { | |
362 | iput(root); | |
363 | EXOFS_ERR("ERROR: get root inode failed\n"); | |
364 | ret = -ENOMEM; | |
365 | goto free_sbi; | |
366 | } | |
367 | ||
368 | if (!S_ISDIR(root->i_mode)) { | |
369 | dput(sb->s_root); | |
370 | sb->s_root = NULL; | |
371 | EXOFS_ERR("ERROR: corrupt root inode (mode = %hd)\n", | |
372 | root->i_mode); | |
373 | ret = -EINVAL; | |
374 | goto free_sbi; | |
375 | } | |
376 | ||
19fe294f | 377 | _exofs_print_device("Mounting", opts->dev_name, sbi->s_dev, sbi->s_pid); |
06886a5a | 378 | return 0; |
ba9e5e98 BH |
379 | |
380 | free_sbi: | |
06886a5a BH |
381 | EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n", |
382 | opts->dev_name, sbi->s_pid, ret); | |
ba9e5e98 BH |
383 | osduld_put_device(sbi->s_dev); /* NULL safe */ |
384 | kfree(sbi); | |
06886a5a | 385 | return ret; |
ba9e5e98 BH |
386 | } |
387 | ||
388 | /* | |
389 | * Set up the superblock (calls exofs_fill_super eventually) | |
390 | */ | |
391 | static int exofs_get_sb(struct file_system_type *type, | |
392 | int flags, const char *dev_name, | |
393 | void *data, struct vfsmount *mnt) | |
394 | { | |
395 | struct exofs_mountopt opts; | |
396 | int ret; | |
397 | ||
398 | ret = parse_options(data, &opts); | |
399 | if (ret) | |
400 | return ret; | |
401 | ||
402 | opts.dev_name = dev_name; | |
403 | return get_sb_nodev(type, flags, &opts, exofs_fill_super, mnt); | |
404 | } | |
405 | ||
406 | /* | |
407 | * Return information about the file system state in the buffer. This is used | |
408 | * by the 'df' command, for example. | |
409 | */ | |
410 | static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf) | |
411 | { | |
412 | struct super_block *sb = dentry->d_sb; | |
413 | struct exofs_sb_info *sbi = sb->s_fs_info; | |
06886a5a | 414 | struct exofs_io_state *ios; |
ba9e5e98 BH |
415 | struct osd_attr attrs[] = { |
416 | ATTR_DEF(OSD_APAGE_PARTITION_QUOTAS, | |
417 | OSD_ATTR_PQ_CAPACITY_QUOTA, sizeof(__be64)), | |
418 | ATTR_DEF(OSD_APAGE_PARTITION_INFORMATION, | |
419 | OSD_ATTR_PI_USED_CAPACITY, sizeof(__be64)), | |
420 | }; | |
421 | uint64_t capacity = ULLONG_MAX; | |
422 | uint64_t used = ULLONG_MAX; | |
ba9e5e98 BH |
423 | uint8_t cred_a[OSD_CAP_LEN]; |
424 | int ret; | |
425 | ||
06886a5a BH |
426 | ret = exofs_get_io_state(sbi, &ios); |
427 | if (ret) { | |
428 | EXOFS_DBGMSG("exofs_get_io_state failed.\n"); | |
429 | return ret; | |
ba9e5e98 BH |
430 | } |
431 | ||
06886a5a BH |
432 | exofs_make_credential(cred_a, &ios->obj); |
433 | ios->cred = sbi->s_cred; | |
434 | ios->in_attr = attrs; | |
435 | ios->in_attr_len = ARRAY_SIZE(attrs); | |
436 | ||
437 | ret = exofs_sbi_read(ios); | |
ba9e5e98 BH |
438 | if (unlikely(ret)) |
439 | goto out; | |
440 | ||
06886a5a | 441 | ret = extract_attr_from_ios(ios, &attrs[0]); |
cae012d8 | 442 | if (likely(!ret)) { |
ba9e5e98 | 443 | capacity = get_unaligned_be64(attrs[0].val_ptr); |
cae012d8 BH |
444 | if (unlikely(!capacity)) |
445 | capacity = ULLONG_MAX; | |
446 | } else | |
ba9e5e98 BH |
447 | EXOFS_DBGMSG("exofs_statfs: get capacity failed.\n"); |
448 | ||
06886a5a | 449 | ret = extract_attr_from_ios(ios, &attrs[1]); |
ba9e5e98 BH |
450 | if (likely(!ret)) |
451 | used = get_unaligned_be64(attrs[1].val_ptr); | |
452 | else | |
453 | EXOFS_DBGMSG("exofs_statfs: get used-space failed.\n"); | |
454 | ||
455 | /* fill in the stats buffer */ | |
456 | buf->f_type = EXOFS_SUPER_MAGIC; | |
457 | buf->f_bsize = EXOFS_BLKSIZE; | |
cae012d8 BH |
458 | buf->f_blocks = capacity >> 9; |
459 | buf->f_bfree = (capacity - used) >> 9; | |
ba9e5e98 BH |
460 | buf->f_bavail = buf->f_bfree; |
461 | buf->f_files = sbi->s_numfiles; | |
462 | buf->f_ffree = EXOFS_MAX_ID - sbi->s_numfiles; | |
463 | buf->f_namelen = EXOFS_NAME_LEN; | |
464 | ||
465 | out: | |
06886a5a | 466 | exofs_put_io_state(ios); |
ba9e5e98 BH |
467 | return ret; |
468 | } | |
469 | ||
470 | static const struct super_operations exofs_sops = { | |
471 | .alloc_inode = exofs_alloc_inode, | |
472 | .destroy_inode = exofs_destroy_inode, | |
473 | .write_inode = exofs_write_inode, | |
474 | .delete_inode = exofs_delete_inode, | |
475 | .put_super = exofs_put_super, | |
476 | .write_super = exofs_write_super, | |
80e09fb9 | 477 | .sync_fs = exofs_sync_fs, |
ba9e5e98 BH |
478 | .statfs = exofs_statfs, |
479 | }; | |
480 | ||
8cf74b39 BH |
481 | /****************************************************************************** |
482 | * EXPORT OPERATIONS | |
483 | *****************************************************************************/ | |
484 | ||
485 | struct dentry *exofs_get_parent(struct dentry *child) | |
486 | { | |
487 | unsigned long ino = exofs_parent_ino(child); | |
488 | ||
489 | if (!ino) | |
490 | return NULL; | |
491 | ||
492 | return d_obtain_alias(exofs_iget(child->d_inode->i_sb, ino)); | |
493 | } | |
494 | ||
495 | static struct inode *exofs_nfs_get_inode(struct super_block *sb, | |
496 | u64 ino, u32 generation) | |
497 | { | |
498 | struct inode *inode; | |
499 | ||
500 | inode = exofs_iget(sb, ino); | |
501 | if (IS_ERR(inode)) | |
502 | return ERR_CAST(inode); | |
503 | if (generation && inode->i_generation != generation) { | |
504 | /* we didn't find the right inode.. */ | |
505 | iput(inode); | |
506 | return ERR_PTR(-ESTALE); | |
507 | } | |
508 | return inode; | |
509 | } | |
510 | ||
511 | static struct dentry *exofs_fh_to_dentry(struct super_block *sb, | |
512 | struct fid *fid, int fh_len, int fh_type) | |
513 | { | |
514 | return generic_fh_to_dentry(sb, fid, fh_len, fh_type, | |
515 | exofs_nfs_get_inode); | |
516 | } | |
517 | ||
518 | static struct dentry *exofs_fh_to_parent(struct super_block *sb, | |
519 | struct fid *fid, int fh_len, int fh_type) | |
520 | { | |
521 | return generic_fh_to_parent(sb, fid, fh_len, fh_type, | |
522 | exofs_nfs_get_inode); | |
523 | } | |
524 | ||
525 | static const struct export_operations exofs_export_ops = { | |
526 | .fh_to_dentry = exofs_fh_to_dentry, | |
527 | .fh_to_parent = exofs_fh_to_parent, | |
528 | .get_parent = exofs_get_parent, | |
529 | }; | |
530 | ||
ba9e5e98 BH |
531 | /****************************************************************************** |
532 | * INSMOD/RMMOD | |
533 | *****************************************************************************/ | |
534 | ||
535 | /* | |
536 | * struct that describes this file system | |
537 | */ | |
538 | static struct file_system_type exofs_type = { | |
539 | .owner = THIS_MODULE, | |
540 | .name = "exofs", | |
541 | .get_sb = exofs_get_sb, | |
542 | .kill_sb = generic_shutdown_super, | |
543 | }; | |
544 | ||
545 | static int __init init_exofs(void) | |
546 | { | |
547 | int err; | |
548 | ||
549 | err = init_inodecache(); | |
550 | if (err) | |
551 | goto out; | |
552 | ||
553 | err = register_filesystem(&exofs_type); | |
554 | if (err) | |
555 | goto out_d; | |
556 | ||
557 | return 0; | |
558 | out_d: | |
559 | destroy_inodecache(); | |
560 | out: | |
561 | return err; | |
562 | } | |
563 | ||
564 | static void __exit exit_exofs(void) | |
565 | { | |
566 | unregister_filesystem(&exofs_type); | |
567 | destroy_inodecache(); | |
568 | } | |
569 | ||
570 | MODULE_AUTHOR("Avishay Traeger <avishay@gmail.com>"); | |
571 | MODULE_DESCRIPTION("exofs"); | |
572 | MODULE_LICENSE("GPL"); | |
573 | ||
574 | module_init(init_exofs) | |
575 | module_exit(exit_exofs) |