Skip to content

Commit

Permalink
pstore/ram: Set pstore flags dynamically
Browse files Browse the repository at this point in the history
The ramoops can be configured to enable each pstore type by setting
their size.  In that case, it'd be better not to register disabled types
in the first place.

Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Namhyung Kim authored and Kees Cook committed Sep 8, 2016
1 parent c950fd6 commit 79d955a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 7 additions & 1 deletion fs/pstore/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,13 @@ static int ramoops_probe(struct platform_device *pdev)
goto fail_clear;
}

cxt->pstore.flags = PSTORE_FLAGS_ALL;
cxt->pstore.flags = PSTORE_FLAGS_DMESG;
if (cxt->console_size)
cxt->pstore.flags |= PSTORE_FLAGS_CONSOLE;
if (cxt->ftrace_size)
cxt->pstore.flags |= PSTORE_FLAGS_FTRACE;
if (cxt->pmsg_size)
cxt->pstore.flags |= PSTORE_FLAGS_PMSG;

err = pstore_register(&cxt->pstore);
if (err) {
Expand Down
2 changes: 0 additions & 2 deletions include/linux/pstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ struct pstore_info {
#define PSTORE_FLAGS_FTRACE (1 << 2)
#define PSTORE_FLAGS_PMSG (1 << 3)

#define PSTORE_FLAGS_ALL ((1 << 4) - 1)

extern int pstore_register(struct pstore_info *);
extern void pstore_unregister(struct pstore_info *);
extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
Expand Down

0 comments on commit 79d955a

Please sign in to comment.