summaryrefslogtreecommitdiff
path: root/fs/cachefiles/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cachefiles/main.c')
-rw-r--r--fs/cachefiles/main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/cachefiles/main.c b/fs/cachefiles/main.c
index 387d42c7185f..533e3067d80f 100644
--- a/fs/cachefiles/main.c
+++ b/fs/cachefiles/main.c
@@ -31,6 +31,12 @@ MODULE_DESCRIPTION("Mounted-filesystem based cache");
MODULE_AUTHOR("Red Hat, Inc.");
MODULE_LICENSE("GPL");
+static struct miscdevice cachefiles_dev = {
+ .minor = MISC_DYNAMIC_MINOR,
+ .name = "cachefiles",
+ .fops = &cachefiles_daemon_fops,
+};
+
/*
* initialise the fs caching module
*/
@@ -41,10 +47,15 @@ static int __init cachefiles_init(void)
ret = cachefiles_register_error_injection();
if (ret < 0)
goto error_einj;
+ ret = misc_register(&cachefiles_dev);
+ if (ret < 0)
+ goto error_dev;
pr_info("Loaded\n");
return 0;
+error_dev:
+ cachefiles_unregister_error_injection();
error_einj:
pr_err("failed to register: %d\n", ret);
return ret;
@@ -59,6 +70,7 @@ static void __exit cachefiles_exit(void)
{
pr_info("Unloading\n");
+ misc_deregister(&cachefiles_dev);
cachefiles_unregister_error_injection();
}