linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Markus Elfring <Markus.Elfring@web.de>
Subject: [PATCH 2/2] Documentation: bootconfig: Add EBNF syntax file
Date: Thu, 27 Feb 2020 16:26:02 +0900	[thread overview]
Message-ID: <158278836196.14966.3881489301852781521.stgit@devnote2> (raw)
In-Reply-To: <158278834245.14966.6179457011671073018.stgit@devnote2>

Add an extended Backus–Naur form (EBNF) syntax file for
bootconfig so that user can logically understand how they
can write correct boot configuration file.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 Documentation/admin-guide/bootconfig.ebnf |   41 +++++++++++++++++++++++++++++
 Documentation/admin-guide/bootconfig.rst  |    8 ++++++
 MAINTAINERS                               |    1 +
 3 files changed, 50 insertions(+)
 create mode 100644 Documentation/admin-guide/bootconfig.ebnf

diff --git a/Documentation/admin-guide/bootconfig.ebnf b/Documentation/admin-guide/bootconfig.ebnf
new file mode 100644
index 000000000000..fe27007dc23f
--- /dev/null
+++ b/Documentation/admin-guide/bootconfig.ebnf
@@ -0,0 +1,41 @@
+# Boot Configuration Syntax in EBNF
+
+# Characters
+digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
+alphabet = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k"
+	| "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v"
+	| "w" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G"
+	| "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R"
+	| "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" ;
+white space = ? white space characters (isspace() compatible ) ? ;
+all characters = ? all visible characters (isprint() compatible ) ? ;
+
+# Value definition
+value delimiter = "," | ";" | "\n" | "}" | "#" ;
+value string = { all characters - value delimiter } ;
+single quoted string = "'" , { all characters - "'" } , "'" ;
+double quoted string = '"' , { all characters - '"' } , '"' ;
+quoted string = double quoted string | single quoted string ;
+value = { white space }, quoted string | value string , { white space } ;
+
+# Non array value is equal to one-element array
+comment = "#" , { all characters - "\n" } , "\n" ;
+array delimiter = "," , { { white space }, ( comment | "\n" ) } ;
+array = { value , array delimiter } , value ;
+
+# Key definition
+key word character = alphabet | digit | "-" | "_" ;
+key word = { key word character } , key word character ;
+key = { white space } , { key word , "." } , key word , { white space } ;
+
+# Assignment definitions
+delimiter = { white space } , ( comment | ";" | "\n" ) ;
+assign operator = [ "+" ] , "=" ;
+assignment = key , [ assign operator , array ] ;
+assignment tree = key , "{" , { assignment sequence } , [ assignment ] , "}" ;
+assignment sequence = ( assignment , delimiter ) | assignment tree
+	| delimiter | white space ;
+
+# Boot configuration definition
+configuration = { assignment sequence } , (assignment | assignment tree)
+	, { delimiter | white space } ;
diff --git a/Documentation/admin-guide/bootconfig.rst b/Documentation/admin-guide/bootconfig.rst
index 4bac98250bc0..8d336af948a8 100644
--- a/Documentation/admin-guide/bootconfig.rst
+++ b/Documentation/admin-guide/bootconfig.rst
@@ -188,6 +188,14 @@ Note that you can not put a comment between value and delimiter(``,`` or
  key = 1 # !ERROR! comment is not allowed before delimiter
        ,2
 
+Syntax in EBNF
+--------------
+
+Here is the boot configuration file syntax written in EBNF.
+
+.. include:: bootconfig.ebnf
+   :literal:
+
 
 /proc/bootconfig
 ================
diff --git a/MAINTAINERS b/MAINTAINERS
index 47873f2e6696..3e792f0a2237 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15778,6 +15778,7 @@ F:	fs/proc/bootconfig.c
 F:	include/linux/bootconfig.h
 F:	tools/bootconfig/*
 F:	Documentation/admin-guide/bootconfig.rst
+F:	Documentation/admin-guide/bootconfig.ebnf
 
 SUN3/3X
 M:	Sam Creasey <sammy@sammy.net>


  parent reply	other threads:[~2020-02-27  7:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27  7:25 [PATCH 0/2] Documentation: bootconfig: Documentaiton updates Masami Hiramatsu
2020-02-27  7:25 ` [PATCH 1/2] Documentation: bootconfig: Update boot configuration documentation Masami Hiramatsu
2020-02-27 19:12   ` Markus Elfring
2020-02-28  4:36     ` Randy Dunlap
2020-02-28  5:35     ` Masami Hiramatsu
2020-02-28  8:30       ` [1/2] " Markus Elfring
2020-02-28 13:11         ` Masami Hiramatsu
2020-02-28 13:35           ` Markus Elfring
2020-02-28  4:50   ` [PATCH 1/2] " Randy Dunlap
2020-02-28  6:12     ` Masami Hiramatsu
2020-02-27  7:26 ` Masami Hiramatsu [this message]
2020-02-27 19:53   ` [PATCH 2/2] Documentation: bootconfig: Add EBNF syntax file Markus Elfring
2020-02-28  3:15     ` Masami Hiramatsu
2020-02-28  8:46   ` Markus Elfring
2020-02-29  9:00   ` Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158278836196.14966.3881489301852781521.stgit@devnote2 \
    --to=mhiramat@kernel.org \
    --cc=Markus.Elfring@web.de \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).