]> git.baikalelectronics.ru Git - kernel.git/commit
tools/bootconfig: Show line and column in parse error
authorMasami Hiramatsu <mhiramat@kernel.org>
Tue, 3 Mar 2020 11:24:50 +0000 (20:24 +0900)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 3 Mar 2020 22:38:42 +0000 (17:38 -0500)
commitb0f0010ca34c630d4ac5c566220da1b2d6fa15a6
treed13cb370aedac7bbb7b9d67f7194de31ad01d5da
parent33c9f02de5c317c629fffce0a178e92044c3e7e8
tools/bootconfig: Show line and column in parse error

Show line and column when we got a parse error in bootconfig tool.
Current lib/bootconfig shows the parse error with byte offset, but
that is not human readable.
This makes xbc_init() not showing error message itself but able to
pass the error message and position to caller, so that the caller
can decode it and show the error message with line number and columns.

With this patch, bootconfig tool shows an error with line:column as
below.

  $ cat samples/bad-dotword.bconf
  # do not start keyword with .
  key {
    .word = 1
  }
  $ ./bootconfig -a samples/bad-dotword.bconf initrd
  Parse Error: Invalid keyword at 3:3

Link: http://lkml.kernel.org/r/158323469002.10560.4023923847704522760.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
include/linux/bootconfig.h
init/main.c
lib/bootconfig.c
tools/bootconfig/main.c