android_system_core/fs_mgr/libfstab
Yi-Yo Chiang 79ad1e2e9b init: Unify kernel bootconfig parser with libfs_mgr
Right now there are two bootconfig parsers that gets linked into `init`.
One is from libinit itself and the other is from libfs_mgr.

The one in libinit removes all space characters between list elements,
so `key = "val1", "val2"` gets unquoted and squeezed into:
  `key=val1,val2`
The one in libfs_mgr doesn't remove spaces, it only unquotes:
  `key=val1, val2`

The libinit behavior is due to existing systems (such as sysprop)
expect the config value to be in the same format as kernel cmdline.
(aosp/1757971)
THe libfs_mgr behavior is due to the `androidboot.boot_device[s]`
format explicitly allows quoted comma appear in its list value, thus
relies on space, not comma, as the list value delimeter.

This commit merges the two parsers into libfs_mgr. Since all usages in
libfs_mgr besides `boot_device[s]` do not care about how list value are
delimited, and most usages in init expects the bootconfig value format
to be the same format as cmdline. We just special case the
`boot_device` scenario.

Also harden the test cases to cover all the different config value
format and expected result.

Note:
The format of kernel bootconfig is described here
https://docs.kernel.org/admin-guide/bootconfig.html

Bug: 293695109
Test: CtsFsMgrTestCases
Change-Id: I42b9bf626e8de38a60e8e09fac0693126b7efd91
2023-08-02 09:57:37 +00:00
..
fuzz fs_mgr: Split libfs_mgr and libfstab 2023-08-01 04:56:41 +00:00
include/fstab init: Unify kernel bootconfig parser with libfs_mgr 2023-08-02 09:57:37 +00:00
Android.bp fs_mgr: Split libfs_mgr and libfstab 2023-08-01 04:56:41 +00:00
boot_config.cpp init: Unify kernel bootconfig parser with libfs_mgr 2023-08-02 09:57:37 +00:00
fstab.cpp init: Unify kernel bootconfig parser with libfs_mgr 2023-08-02 09:57:37 +00:00
fstab_priv.h init: Unify kernel bootconfig parser with libfs_mgr 2023-08-02 09:57:37 +00:00
logging_macros.h fs_mgr: Split libfs_mgr and libfstab 2023-08-01 04:56:41 +00:00
slotselect.cpp fs_mgr: Split libfs_mgr and libfstab 2023-08-01 04:56:41 +00:00