hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/linux/pstore.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Persistent Storage - pstore.h
34 *
....@@ -5,19 +6,6 @@
56 *
67 * This code is the generic layer to export data records from platform
78 * level persistent storage via a file system.
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
219 */
2210 #ifndef _LINUX_PSTORE_H
2311 #define _LINUX_PSTORE_H
....@@ -32,13 +20,19 @@
3220
3321 struct module;
3422
35
-/* pstore record types (see fs/pstore/inode.c for filename templates) */
23
+/*
24
+ * pstore record types (see fs/pstore/platform.c for pstore_type_names[])
25
+ * These values may be written to storage (see EFI vars backend), so
26
+ * they are kind of an ABI. Be careful changing the mappings.
27
+ */
3628 enum pstore_type_id {
29
+ /* Frontend storage types */
3730 PSTORE_TYPE_DMESG = 0,
3831 PSTORE_TYPE_MCE = 1,
3932 PSTORE_TYPE_CONSOLE = 2,
4033 PSTORE_TYPE_FTRACE = 3,
41
- /* PPC64 partition types */
34
+
35
+ /* PPC64-specific partition types */
4236 PSTORE_TYPE_PPC_RTAS = 4,
4337 PSTORE_TYPE_PPC_OF = 5,
4438 PSTORE_TYPE_PPC_COMMON = 6,
....@@ -47,8 +41,13 @@
4741 #ifdef CONFIG_PSTORE_BOOT_LOG
4842 PSTORE_TYPE_BOOT_LOG = 9,
4943 #endif
50
- PSTORE_TYPE_UNKNOWN = 255
44
+
45
+ /* End of the list */
46
+ PSTORE_TYPE_MAX
5147 };
48
+
49
+const char *pstore_type_to_name(enum pstore_type_id type);
50
+enum pstore_type_id pstore_name_to_type(const char *name);
5251
5352 struct pstore_info;
5453 /**
....@@ -88,7 +87,7 @@
8887 /**
8988 * struct pstore_info - backend pstore driver structure
9089 *
91
- * @owner: module which is repsonsible for this backend driver
90
+ * @owner: module which is responsible for this backend driver
9291 * @name: name of the backend driver
9392 *
9493 * @buf_lock: semaphore to serialize access to @buf
....@@ -100,6 +99,12 @@
10099 *
101100 * @read_mutex: serializes @open, @read, @close, and @erase callbacks
102101 * @flags: bitfield of frontends the backend can accept writes for
102
+ * @max_reason: Used when PSTORE_FLAGS_DMESG is set. Contains the
103
+ * kmsg_dump_reason enum value. KMSG_DUMP_UNDEF means
104
+ * "use existing kmsg_dump() filtering, based on the
105
+ * printk.always_kmsg_dump boot param" (which is either
106
+ * KMSG_DUMP_OOPS when false, or KMSG_DUMP_MAX when
107
+ * true); see printk.always_kmsg_dump for more details.
103108 * @data: backend-private pointer passed back during callbacks
104109 *
105110 * Callbacks:
....@@ -174,7 +179,7 @@
174179 */
175180 struct pstore_info {
176181 struct module *owner;
177
- char *name;
182
+ const char *name;
178183
179184 struct semaphore buf_lock;
180185 char *buf;
....@@ -183,6 +188,7 @@
183188 struct mutex read_mutex;
184189
185190 int flags;
191
+ int max_reason;
186192 void *data;
187193
188194 int (*open)(struct pstore_info *psi);
....@@ -195,13 +201,14 @@
195201 };
196202
197203 /* Supported frontends */
198
-#define PSTORE_FLAGS_DMESG (1 << 0)
199
-#define PSTORE_FLAGS_CONSOLE (1 << 1)
200
-#define PSTORE_FLAGS_FTRACE (1 << 2)
201
-#define PSTORE_FLAGS_PMSG (1 << 3)
204
+#define PSTORE_FLAGS_DMESG BIT(0)
205
+#define PSTORE_FLAGS_CONSOLE BIT(1)
206
+#define PSTORE_FLAGS_FTRACE BIT(2)
207
+#define PSTORE_FLAGS_PMSG BIT(3)
202208 #ifdef CONFIG_PSTORE_BOOT_LOG
203
-#define PSTORE_FLAGS_BOOT_LOG (1 << 4)
209
+#define PSTORE_FLAGS_BOOT_LOG BIT(4)
204210 #endif
211
+
205212 extern int pstore_register(struct pstore_info *);
206213 extern void pstore_unregister(struct pstore_info *);
207214