#include #include #include #include #include #include "butterfly.h" static struct file_system_type butterfly_fs = { .owner = THIS_MODULE, .name = "butterflyfs", .fs_flags = FS_REQUIRES_DEV, .mount = butterfly_mount, .kill_sb = butterfly_unmount }; static struct dentry_operations dirOperations = { }; static struct file_operations fileOperations = { }; int butterfly_fill_super(struct super_block *sb, void *data, int silent) { struct tree_descr treeDescr[] = { { }, // Skip { .name = "", .ops = NULL, .mode = 0 } // End }; return simple_fill_super(sb, BUTTERFLY_MAGIC, treeDescr); } struct dentry *butterfly_mount( struct file_system_type *fs, int flags, const char *devname, void *data) { return mount_bdev(fs, flags, devname, data, butterfly_fill_super); } void butterfly_unmount(struct super_block *sb) { kill_block_super(sb); } static int __init butterfly_init(void) { printk(KERN_INFO "INIT"); return register_filesystem(&butterfly_fs); } static void __exit butterfly_cleanup(void) { unregister_filesystem(&butterfly_fs); } module_init(butterfly_init); module_exit(butterfly_cleanup);