b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright 2018 Google LLC |
| 4 | */ |
| 5 | #include <linux/fs.h> |
| 6 | #include <linux/init.h> |
| 7 | #include <linux/module.h> |
| 8 | |
| 9 | #include <uapi/linux/incrementalfs.h> |
| 10 | |
| 11 | #include "sysfs.h" |
| 12 | #include "vfs.h" |
| 13 | |
| 14 | static struct file_system_type incfs_fs_type = { |
| 15 | .owner = THIS_MODULE, |
| 16 | .name = INCFS_NAME, |
| 17 | .mount = incfs_mount_fs, |
| 18 | .kill_sb = incfs_kill_sb, |
| 19 | .fs_flags = 0 |
| 20 | }; |
| 21 | |
| 22 | static int __init init_incfs_module(void) |
| 23 | { |
| 24 | int err = 0; |
| 25 | |
| 26 | err = incfs_init_sysfs(); |
| 27 | if (err) |
| 28 | return err; |
| 29 | |
| 30 | err = register_filesystem(&incfs_fs_type); |
| 31 | if (err) |
| 32 | incfs_cleanup_sysfs(); |
| 33 | |
| 34 | return err; |
| 35 | } |
| 36 | |
| 37 | static void __exit cleanup_incfs_module(void) |
| 38 | { |
| 39 | incfs_cleanup_sysfs(); |
| 40 | unregister_filesystem(&incfs_fs_type); |
| 41 | } |
| 42 | |
| 43 | module_init(init_incfs_module); |
| 44 | module_exit(cleanup_incfs_module); |
| 45 | |
| 46 | MODULE_LICENSE("GPL v2"); |
| 47 | MODULE_AUTHOR("Eugene Zemtsov <ezemtsov@google.com>"); |
| 48 | MODULE_DESCRIPTION("Incremental File System"); |