|
@@ -237,6 +237,14 @@ static void allocate_buf_for_compression(void)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void free_buf_for_compression(void)
|
|
|
|
+{
|
|
|
|
+ kfree(stream.workspace);
|
|
|
|
+ stream.workspace = NULL;
|
|
|
|
+ kfree(big_oops_buf);
|
|
|
|
+ big_oops_buf = NULL;
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Called when compression fails, since the printk buffer
|
|
* Called when compression fails, since the printk buffer
|
|
* would be fetched for compression calling it again when
|
|
* would be fetched for compression calling it again when
|
|
@@ -358,6 +366,11 @@ static void pstore_register_kmsg(void)
|
|
kmsg_dump_register(&pstore_dumper);
|
|
kmsg_dump_register(&pstore_dumper);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void pstore_unregister_kmsg(void)
|
|
|
|
+{
|
|
|
|
+ kmsg_dump_unregister(&pstore_dumper);
|
|
|
|
+}
|
|
|
|
+
|
|
#ifdef CONFIG_PSTORE_CONSOLE
|
|
#ifdef CONFIG_PSTORE_CONSOLE
|
|
static void pstore_console_write(struct console *con, const char *s, unsigned c)
|
|
static void pstore_console_write(struct console *con, const char *s, unsigned c)
|
|
{
|
|
{
|
|
@@ -395,8 +408,14 @@ static void pstore_register_console(void)
|
|
{
|
|
{
|
|
register_console(&pstore_console);
|
|
register_console(&pstore_console);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+static void pstore_unregister_console(void)
|
|
|
|
+{
|
|
|
|
+ unregister_console(&pstore_console);
|
|
|
|
+}
|
|
#else
|
|
#else
|
|
static void pstore_register_console(void) {}
|
|
static void pstore_register_console(void) {}
|
|
|
|
+static void pstore_unregister_console(void) {}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
static int pstore_write_compat(enum pstore_type_id type,
|
|
static int pstore_write_compat(enum pstore_type_id type,
|
|
@@ -467,12 +486,28 @@ int pstore_register(struct pstore_info *psi)
|
|
*/
|
|
*/
|
|
backend = psi->name;
|
|
backend = psi->name;
|
|
|
|
|
|
|
|
+ module_put(owner);
|
|
|
|
+
|
|
pr_info("Registered %s as persistent store backend\n", psi->name);
|
|
pr_info("Registered %s as persistent store backend\n", psi->name);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(pstore_register);
|
|
EXPORT_SYMBOL_GPL(pstore_register);
|
|
|
|
|
|
|
|
+void pstore_unregister(struct pstore_info *psi)
|
|
|
|
+{
|
|
|
|
+ pstore_unregister_pmsg();
|
|
|
|
+ pstore_unregister_ftrace();
|
|
|
|
+ pstore_unregister_console();
|
|
|
|
+ pstore_unregister_kmsg();
|
|
|
|
+
|
|
|
|
+ free_buf_for_compression();
|
|
|
|
+
|
|
|
|
+ psinfo = NULL;
|
|
|
|
+ backend = NULL;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(pstore_unregister);
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Read all the records from the persistent store. Create
|
|
* Read all the records from the persistent store. Create
|
|
* files in our filesystem. Don't warn about -EEXIST errors
|
|
* files in our filesystem. Don't warn about -EEXIST errors
|