Mke2fs

Parses /etc/mke2fs.conf

Author: Raphael Pinson rap.nosp@m.hink@gmai.nosp@m.l.com

Summary
Mke2fsParses /etc/mke2fs.conf
ReferenceThis lens tries to keep as close as possible to `man 5 mke2fs.conf` where possible.
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration filesThis lens applies to /etc/mke2fs.conf.
USEFUL PRIMITIVES
comment
sep
empty
booleanThe configuration parser of e2fsprogs recognizes different values for booleans, so list all the recognized values
fspath
RECORD TYPES
entryA generic entry for lens lns
list_stoA list of values with given lens
entry_stoStore a regexp as entry value
COMMON ENTRIES
common_entries_listEntries with a list value
common_entries_intEntries with an integer value
common_entries_boolEntries with a boolean value
common_entries_stringEntries with a string value
common_entries_doubleEntries with a double value
common_entryEntries shared between defaults and fs_types sections
DEFAULTS SECTION
defaults_entryPossible entries under the defaults section
defaults_titleTitle for the defaults section
defaultsA defaults section
FS_TYPES SECTION
fs_types_recordFs group records under the fs_types section
fs_types_titleTitle for the fs_types section
fs_typesA fs_types section
OPTIONS SECTION
options_entries_intEntries with an integer value
options_entries_boolEntries with a boolean value
options_entryPossible entries under the options section
defaults_titleTitle for the options section
optionsA options section
LENS AND FILTER
lnsThe mke2fs lens
filter

Reference

This lens tries to keep as close as possible to `man 5 mke2fs.conf` where possible.

License

This file is licenced under the LGPL v2+, like the rest of Augeas.

Lens Usage

To be documented

Configuration files

This lens applies to /etc/mke2fs.conf.  See filter.

USEFUL PRIMITIVES

comment

let comment = IniFile.comment IniFile.comment_re IniFile.comment_default

sep

let sep = IniFile.sep /=[ \t]*/ "="

empty

let empty = IniFile.empty

boolean

let boolean = ("y"|"yes"|"true"|"t"|"1"|"on"|"n"|"no"|"false"|"nil"|"0"|"off")

The configuration parser of e2fsprogs recognizes different values for booleans, so list all the recognized values

fspath

let fspath = /[^ \t\n"]+/

RECORD TYPES

entry

let entry (kw:regexp) (lns:lens) = Build.key_value_line kw sep lns

A generic entry for lens lns

list_sto

let list_sto (kw:regexp) (lns:lens) = entry kw (Quote.do_dquote_opt_nil (Build.opt_list [lns] Sep.comma))

A list of values with given lens

entry_sto

let entry_sto (kw:regexp) (val:regexp) = entry kw (Quote.do_dquote_opt_nil (store val)) | entry kw (Util.del_str "\"\"")

Store a regexp as entry value

COMMON ENTRIES

common_entries_list

let common_entries_list = ("base_features"|"default_features"|"default_mntopts")

Entries with a list value

common_entries_int

let common_entries_int = ("cluster_size"|"flex_bg_size"|"force_undo" |"inode_ratio"|"inode_size"|"num_backup_sb")

Entries with an integer value

common_entries_bool

let common_entries_bool = ("auto_64-bit_support"|"discard" |"enable_periodic_fsck"|"lazy_itable_init" |"lazy_journal_init"|"packed_meta_blocks")

Entries with a boolean value

common_entries_string

let common_entries_string = ("encoding"|"journal_location")

Entries with a string value

common_entries_double

let common_entries_double = ("reserved_ratio")

Entries with a double value

common_entry

let common_entry = list_sto common_entries_list (key Rx.word) | entry_sto common_entries_int Rx.integer | entry_sto common_entries_bool boolean | entry_sto common_entries_string Rx.word | entry_sto common_entries_double Rx.decimal | entry_sto "blocksize" ("-"? . Rx.integer) | entry_sto "hash_alg" ("legacy"|"half_md4"|"tea") | entry_sto "errors" ("continue"|"remount-ro"|"panic") | list_sto "features" ([del /\^/ "^" . label "disable"]? . key Rx.word) | list_sto "options" (key Rx.word . Util.del_str "=" . store Rx.word)

Entries shared between defaults and fs_types sections

DEFAULTS SECTION

defaults_entry

let defaults_entry = entry_sto "fs_type" Rx.word | entry_sto "undo_dir" fspath

Possible entries under the defaults section

defaults_title

let defaults_title = IniFile.title "defaults"

Title for the defaults section

defaults

let defaults = IniFile.record defaults_title ((Util.indent . (defaults_entry|common_entry)) | comment)

A defaults section

FS_TYPES SECTION

fs_types_record

let fs_types_record = [ label "filesystem" . Util.indent . store Rx.word . del /[ \t]*=[ \t]*\{[ \t]*\n/ " = {\n" . ((Util.indent . common_entry) | empty | comment)* . del /[ \t]*\}[ \t]*\n/ " }\n" ]

Fs group records under the fs_types section

fs_types_title

let fs_types_title = IniFile.title "fs_types"

Title for the fs_types section

fs_types

let fs_types = IniFile.record fs_types_title (fs_types_record | comment)

A fs_types section

OPTIONS SECTION

options_entries_int

let options_entries_int = ("proceed_delay"|"sync_kludge")

Entries with an integer value

options_entries_bool

let options_entries_bool = ("old_bitmaps")

Entries with a boolean value

options_entry

let options_entry = entry_sto options_entries_int Rx.integer | entry_sto options_entries_bool boolean

Possible entries under the options section

defaults_title

Title for the options section

options

let options = IniFile.record options_title ((Util.indent . options_entry) | comment)

A options section

LENS AND FILTER

lns

let lns = (empty|comment)* . (defaults|fs_types|options)*

The mke2fs lens

filter

let comment = IniFile.comment IniFile.comment_re IniFile.comment_default
let sep = IniFile.sep /=[ \t]*/ "="
let empty = IniFile.empty
let boolean = ("y"|"yes"|"true"|"t"|"1"|"on"|"n"|"no"|"false"|"nil"|"0"|"off")
The configuration parser of e2fsprogs recognizes different values for booleans, so list all the recognized values
let fspath = /[^ \t\n"]+/
let entry (kw:regexp) (lns:lens) = Build.key_value_line kw sep lns
A generic entry for lens lns
let list_sto (kw:regexp) (lns:lens) = entry kw (Quote.do_dquote_opt_nil (Build.opt_list [lns] Sep.comma))
A list of values with given lens
let entry_sto (kw:regexp) (val:regexp) = entry kw (Quote.do_dquote_opt_nil (store val)) | entry kw (Util.del_str "\"\"")
Store a regexp as entry value
let common_entries_list = ("base_features"|"default_features"|"default_mntopts")
Entries with a list value
let common_entries_int = ("cluster_size"|"flex_bg_size"|"force_undo" |"inode_ratio"|"inode_size"|"num_backup_sb")
Entries with an integer value
let common_entries_bool = ("auto_64-bit_support"|"discard" |"enable_periodic_fsck"|"lazy_itable_init" |"lazy_journal_init"|"packed_meta_blocks")
Entries with a boolean value
let common_entries_string = ("encoding"|"journal_location")
Entries with a string value
let common_entries_double = ("reserved_ratio")
Entries with a double value
let common_entry = list_sto common_entries_list (key Rx.word) | entry_sto common_entries_int Rx.integer | entry_sto common_entries_bool boolean | entry_sto common_entries_string Rx.word | entry_sto common_entries_double Rx.decimal | entry_sto "blocksize" ("-"? . Rx.integer) | entry_sto "hash_alg" ("legacy"|"half_md4"|"tea") | entry_sto "errors" ("continue"|"remount-ro"|"panic") | list_sto "features" ([del /\^/ "^" . label "disable"]? . key Rx.word) | list_sto "options" (key Rx.word . Util.del_str "=" . store Rx.word)
Entries shared between defaults and fs_types sections
let defaults = IniFile.record defaults_title ((Util.indent . (defaults_entry|common_entry)) | comment)
A defaults section
let fs_types = IniFile.record fs_types_title (fs_types_record | comment)
A fs_types section
let defaults_entry = entry_sto "fs_type" Rx.word | entry_sto "undo_dir" fspath
Possible entries under the defaults section
let defaults_title = IniFile.title "defaults"
Title for the defaults section
let fs_types_record = [ label "filesystem" . Util.indent . store Rx.word . del /[ \t]*=[ \t]*\{[ \t]*\n/ " = {\n" . ((Util.indent . common_entry) | empty | comment)* . del /[ \t]*\}[ \t]*\n/ " }\n" ]
Fs group records under the fs_types section
let fs_types_title = IniFile.title "fs_types"
Title for the fs_types section
let options_entries_int = ("proceed_delay"|"sync_kludge")
Entries with an integer value
let options_entries_bool = ("old_bitmaps")
Entries with a boolean value
let options_entry = entry_sto options_entries_int Rx.integer | entry_sto options_entries_bool boolean
Possible entries under the options section
let options = IniFile.record options_title ((Util.indent . options_entry) | comment)
A options section
let lns = (empty|comment)* . (defaults|fs_types|options)*
The mke2fs lens
Close