butterflyfs.c 878 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <linux/module.h>
  2. #include <linux/kernel.h>
  3. #include <linux/init.h>
  4. #include <linux/fs.h>
  5. #include "butterfly.h"
  6. static struct file_system_type butterfly_fs = {
  7. .owner = THIS_MODULE,
  8. .name = "butterflyfs",
  9. .fs_flags = FS_REQUIRES_DEV,
  10. .mount = butterfly_mount,
  11. .kill_sb = butterfly_unmount
  12. };
  13. struct dentry *butterfly_mount(
  14. struct file_system_type *fs,
  15. int flags,
  16. const char *devname,
  17. void *data)
  18. {
  19. return NULL;
  20. }
  21. void butterfly_unmount(struct super_block *sb)
  22. {
  23. kill_block_super(sb);
  24. }
  25. static int __init butterfly_init(void)
  26. {
  27. printk(KERN_INFO "INIT");
  28. return register_filesystem(&butterfly_fs);
  29. }
  30. static void __exit butterfly_cleanup(void)
  31. {
  32. unregister_filesystem(&butterfly_fs);
  33. }
  34. module_init(butterfly_init);
  35. module_exit(butterfly_cleanup);