1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
5 * Lustre filesystem abstraction routines
7 * Copyright (C) 2004 Cluster File Systems, Inc.
9 * This file is part of Lustre, http://www.lustre.org.
11 * Lustre is free software; you can redistribute it and/or
12 * modify it under the terms of version 2 of the GNU General Public
13 * License as published by the Free Software Foundation.
15 * Lustre is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Lustre; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #define DEBUG_SUBSYSTEM S_SM
27 #include <linux/config.h>
28 #include <linux/module.h>
29 #include <linux/kmod.h>
30 #include <linux/init.h>
32 #include <linux/string.h>
34 #include <linux/utime.h>
35 #include <linux/file.h>
36 #include <linux/slab.h>
37 #include <linux/dcache.h>
38 #include <linux/loop.h>
39 #include <linux/errno.h>
40 #include <linux/obd_class.h>
41 #include <linux/obd_support.h>
42 #include <linux/lustre_lib.h>
43 #include <linux/lustre_idl.h>
44 #include <linux/lustre_fsfilt.h>
45 #include <linux/lustre_smfs.h>
46 #include "smfs_internal.h"
48 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
49 static struct super_block *smfs_read_super(struct super_block *sb,
50 void *data, int silent)
54 err = smfs_fill_super(sb, data, silent);
61 static struct file_system_type smfs_type = {
64 .read_super = smfs_read_super,
67 struct super_block *smfs_get_super(struct file_system_type *fs_type,
68 int flags, const char *dev_name,
71 return get_sb_nodev(fs_type, flags, data, smfs_fill_super);
74 void smfs_kill_super(struct super_block *sb)
79 static struct file_system_type smfs_type = {
82 .get_sb = smfs_get_super,
83 .kill_sb = smfs_kill_super,
87 static int cleanup_smfs(void)
91 err = unregister_filesystem(&smfs_type);
93 CERROR("unregister_filesystem() failed, rc = %d\n", err);
97 static int init_smfs(void)
101 err = register_filesystem(&smfs_type);
103 CERROR("register_filesystem() failed, rc = %d\n", err);
107 static int __init smfs_init(void)
111 if ( (err = init_smfs_psdev()) ) {
112 printk("Error initializing smfs_psdev, %d\n", err);
116 if ( (err = init_smfs()) ) {
117 printk("Error initializing smfs, %d\n", err);
121 if ( (err = init_smfs_proc_sys()) ) {
122 printk("Error initializing smfs proc sys, %d\n", err);
129 static void __exit smfs_cleanup(void)
132 smfs_cleanup_psdev();
135 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
136 MODULE_DESCRIPTION("Smfs file system filters v0.01");
137 MODULE_LICENSE("GPL");
139 module_init(smfs_init);
140 module_exit(smfs_cleanup);