UBI: make debugging messages dynamic
This patch adds a possibility to dynamically select UBI debugging messages, instead of selecting them compile-time from the configuration menu. This is much more flexible, and consistent with UBIFS, and this also simplifies UBI Kconfig menu and the code. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
Родитель
6f9fdf62db
Коммит
b342efd4a4
|
@ -10,11 +10,6 @@ config MTD_UBI_DEBUG
|
|||
|
||||
if MTD_UBI_DEBUG
|
||||
|
||||
config MTD_UBI_DEBUG_MSG
|
||||
bool "UBI debugging messages"
|
||||
help
|
||||
This option enables UBI debugging messages.
|
||||
|
||||
config MTD_UBI_DEBUG_PARANOID
|
||||
bool "Extra self-checks"
|
||||
help
|
||||
|
@ -45,29 +40,4 @@ config MTD_UBI_DEBUG_EMULATE_ERASE_FAILURES
|
|||
This option emulates erase failures with probability 1/100. Useful for
|
||||
debugging and testing how UBI handlines errors.
|
||||
|
||||
comment "Additional UBI debugging messages"
|
||||
|
||||
config MTD_UBI_DEBUG_MSG_BLD
|
||||
bool "Additional UBI initialization and build messages"
|
||||
help
|
||||
This option enables detailed UBI initialization and device build
|
||||
debugging messages.
|
||||
|
||||
config MTD_UBI_DEBUG_MSG_EBA
|
||||
bool "Eraseblock association unit messages"
|
||||
help
|
||||
This option enables debugging messages from the UBI eraseblock
|
||||
association unit.
|
||||
|
||||
config MTD_UBI_DEBUG_MSG_WL
|
||||
bool "Wear-leveling unit messages"
|
||||
help
|
||||
This option enables debugging messages from the UBI wear-leveling
|
||||
unit.
|
||||
|
||||
config MTD_UBI_DEBUG_MSG_IO
|
||||
bool "Input/output unit messages"
|
||||
help
|
||||
This option enables debugging messages from the UBI input/output unit.
|
||||
|
||||
endif # MTD_UBI_DEBUG
|
||||
|
|
|
@ -27,6 +27,14 @@
|
|||
#ifdef CONFIG_MTD_UBI_DEBUG
|
||||
|
||||
#include "ubi.h"
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
|
||||
unsigned int ubi_msg_flags;
|
||||
|
||||
module_param_named(debug_msgs, ubi_msg_flags, uint, S_IRUGO | S_IWUSR);
|
||||
|
||||
MODULE_PARM_DESC(debug_msgs, "Debug message type flags");
|
||||
|
||||
/**
|
||||
* ubi_dbg_dump_ec_hdr - dump an erase counter header.
|
||||
|
|
|
@ -38,6 +38,11 @@
|
|||
printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \
|
||||
current->pid, __func__, ##__VA_ARGS__)
|
||||
|
||||
#define dbg_do_msg(typ, fmt, ...) do { \
|
||||
if (ubi_msg_flags & typ) \
|
||||
dbg_msg(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define ubi_dbg_dump_stack() dump_stack()
|
||||
|
||||
struct ubi_ec_hdr;
|
||||
|
@ -57,43 +62,42 @@ void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type);
|
|||
void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req);
|
||||
void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len);
|
||||
|
||||
extern unsigned int ubi_msg_flags;
|
||||
|
||||
/*
|
||||
* Debugging message type flags (must match msg_type_names in debug.c).
|
||||
*
|
||||
* UBI_MSG_GEN: general messages
|
||||
* UBI_MSG_EBA: journal messages
|
||||
* UBI_MSG_WL: mount messages
|
||||
* UBI_MSG_IO: commit messages
|
||||
* UBI_MSG_BLD: LEB find messages
|
||||
*/
|
||||
enum {
|
||||
UBI_MSG_GEN = 0x1,
|
||||
UBI_MSG_EBA = 0x2,
|
||||
UBI_MSG_WL = 0x4,
|
||||
UBI_MSG_IO = 0x8,
|
||||
UBI_MSG_BLD = 0x10,
|
||||
};
|
||||
|
||||
#define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \
|
||||
print_hex_dump(l, ps, pt, r, g, b, len, a)
|
||||
|
||||
#ifdef CONFIG_MTD_UBI_DEBUG_MSG
|
||||
/* General debugging messages */
|
||||
#define dbg_gen(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define dbg_gen(fmt, ...) ({})
|
||||
#endif
|
||||
#define dbg_gen(fmt, ...) dbg_do_msg(UBI_MSG_GEN, fmt, ##__VA_ARGS__)
|
||||
|
||||
#ifdef CONFIG_MTD_UBI_DEBUG_MSG_EBA
|
||||
/* Messages from the eraseblock association sub-system */
|
||||
#define dbg_eba(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define dbg_eba(fmt, ...) ({})
|
||||
#endif
|
||||
#define dbg_eba(fmt, ...) dbg_do_msg(UBI_MSG_EBA, fmt, ##__VA_ARGS__)
|
||||
|
||||
#ifdef CONFIG_MTD_UBI_DEBUG_MSG_WL
|
||||
/* Messages from the wear-leveling sub-system */
|
||||
#define dbg_wl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define dbg_wl(fmt, ...) ({})
|
||||
#endif
|
||||
#define dbg_wl(fmt, ...) dbg_do_msg(UBI_MSG_WL, fmt, ##__VA_ARGS__)
|
||||
|
||||
#ifdef CONFIG_MTD_UBI_DEBUG_MSG_IO
|
||||
/* Messages from the input/output sub-system */
|
||||
#define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define dbg_io(fmt, ...) ({})
|
||||
#endif
|
||||
#define dbg_io(fmt, ...) dbg_do_msg(UBI_MSG_IO, fmt, ##__VA_ARGS__)
|
||||
|
||||
#ifdef CONFIG_MTD_UBI_DEBUG_MSG_BLD
|
||||
/* Initialization and build messages */
|
||||
#define dbg_bld(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define dbg_bld(fmt, ...) ({})
|
||||
#endif
|
||||
#define dbg_bld(fmt, ...) dbg_do_msg(UBI_MSG_BLD, fmt, ##__VA_ARGS__)
|
||||
|
||||
#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
|
||||
int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len);
|
||||
|
|
Загрузка…
Ссылка в новой задаче