[PATCH 2/3] pstore: Add pstore back-end choice method in kconfig

From: Zhenguo Zhao
Date: Fri Oct 29 2021 - 02:53:33 EST


From: Zhenguo Zhao <Zhenguo.Zhao1@xxxxxxxxxx>

The pstore has one storage device for back-end,so it should be
use choice method to config.

When ramoops config,insmod pstore_blk.ko,it will print unexpected,the
module will insmod failed.

if (backend && strcmp(backend, psi->name)) {
pr_warn("ignoring unexpected backend '%s'\n", psi->name);
return -EPERM;
}

Signed-off-by: Zhenguo Zhao <Zhenguo.Zhao1@xxxxxxxxxx>
---
fs/pstore/Kconfig | 57 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 31 insertions(+), 26 deletions(-)

diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig
index 8adabde..288ed3c 100644
--- a/fs/pstore/Kconfig
+++ b/fs/pstore/Kconfig
@@ -146,21 +146,40 @@ config PSTORE_FTRACE

If unsure, say N.

-config PSTORE_RAM
- tristate "Log panic/oops to a RAM buffer"
+choice
+ prompt "Choice pstore device"
depends on PSTORE
- depends on HAS_IOMEM
- select REED_SOLOMON
- select REED_SOLOMON_ENC8
- select REED_SOLOMON_DEC8
+ default PSTORE_RAM
help
- This enables panic and oops messages to be logged to a circular
- buffer in RAM where it can be read back at some later point.
-
- Note that for historical reasons, the module will be named
- "ramoops.ko".
+ This option chooses ram or blk to use pstore device.
+ config PSTORE_RAM
+ tristate "Log panic/oops to a RAM buffer"
+ depends on HAS_IOMEM
+ select REED_SOLOMON
+ select REED_SOLOMON_ENC8
+ select REED_SOLOMON_DEC8
+ help
+ This enables panic and oops messages to be logged to a circular
+ buffer in RAM where it can be read back at some later point.
+
+ Note that for historical reasons, the module will be named
+ "ramoops.ko".
+
+ For more information, see Documentation/admin-guide/ramoops.rst.
+
+ config PSTORE_BLK
+ tristate "Log panic/oops to a block device"
+ depends on BLOCK
+ select PSTORE_ZONE
+ help
+ This enables panic and oops message to be logged to a block dev
+ where it can be read back at some later point.
+
+ For more information, see Documentation/admin-guide/pstore-blk.rst
+
+ If unsure, say N.

- For more information, see Documentation/admin-guide/ramoops.rst.
+endchoice

config PSTORE_ZONE
tristate
@@ -169,20 +188,6 @@ config PSTORE_ZONE
The common layer for pstore/blk (and pstore/ram in the future)
to manage storage in zones.

-config PSTORE_BLK
- tristate "Log panic/oops to a block device"
- depends on PSTORE
- depends on BLOCK
- select PSTORE_ZONE
- default n
- help
- This enables panic and oops message to be logged to a block dev
- where it can be read back at some later point.
-
- For more information, see Documentation/admin-guide/pstore-blk.rst
-
- If unsure, say N.
-
config PSTORE_BLK_BLKDEV
string "block device identifier"
depends on PSTORE_BLK
--
1.9.1