[PATCH 2/2] Documentation: bootconfig: Add EBNF syntax file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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@xxxxxxxxx>




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux