History log of /system/core/init/import_parser.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
81f5d3ebef2c3789737bf718fc2a2cdd7b9e8b33 22-Jun-2017 Tom Cherry <tomcherry@google.com> init: create android::init:: namespace

With some small fixups along the way

Test: Boot bullhead
Test: init unit tests
Change-Id: I7beaa473cfa9397f845f810557d1631b4a462d6a
/system/core/init/import_parser.cpp
30a6f276fd8850b0a78689d7bff3cb06a18cb286 20-Apr-2017 Tom Cherry <tomcherry@google.com> init: clean up the SectionParser interface and Parser class

Remove the dependency on Action and Service from what should be a
generic Parser class.

Make ActionParser, ImportParser, and ServiceParser take a pointer to
their associated classes instead of accessing them through a
singleton.

Misc fixes to SectionParser Interface:
1) Make SectionParser::ParseLineSection() non-const as it always should
have been.
2) Use Rvalue references where appropriate
3) Remove extra std::string& filename in SectionParser::EndFile()
4) Only have SectionParser::ParseSection() as pure virtual

Document SectionParser.

Make ImportParser report the filename and line number of failed imports.

Make ServiceParser report the filename and line number of duplicated services.

Test: Boot bullhead

Change-Id: I86568a5b375fb4f27f4cb235ed1e37635f01d630
/system/core/init/import_parser.cpp
012c573e267b8dd70de14237cb470bd7301ee8ea 18-Apr-2017 Tom Cherry <tomcherry@google.com> init: Stop combining actions

In the past, I had thought it didn't make sense to have multiple
Action classes with identical triggers within ActionManager::actions_,
and opted to instead combine these into a single action. In theory,
it should reduce memory overhead as only one copy of the triggers
needs to be stored.

In practice, this ends up not being a good idea.

Most importantly, given a file with the below three sections in this
same order:

on boot
setprop a b

on boot && property:true=true
setprop c d

on boot
setprop e f

Assuming that property 'true' == 'true', when the `boot` event
happens, the order of the setprop commands will actually be:

setprop a b
setprop e f
setprop c d

instead of the more intuitive order of:

setprop a b
setprop c d
setprop e f

This is a mistake and this CL fixes it. It also documents this order.

Secondly, with a given 'Action' now spanning multiple files, in order
to keep track of which file a command is run from, the 'Command'
itself needs to store this. Ironically to the original intention,
this increases total ram usage. This change now only stores the file
name in each 'Action' instead of each 'Command'. All in all this is a
negligible trade off of ram usage.

Thirdly, this requires a bunch of extra code and assumptions that
don't help anything else. In particular it forces to keep property triggers
sorted for easy comparison, which I'm using an std::map for currently,
but that is not the best data structure to contain them.

Lastly, I added the filename and line number to the 'processing
action' LOG(INFO) message.

Test: Boot bullhead, observe above changes
Test: Boot sailfish, observe no change in boot time
Change-Id: I3fbcac4ee677351314e33012c758145be82346e9
/system/core/init/import_parser.cpp
3f5eaae526413a29de899270714469c76dc91ec8 07-Apr-2017 Tom Cherry <tomcherry@google.com> init: more header cleanup

Remove includes of "log.h" that really want <android-base/logging.h>
Fix header include order
Remove headers included in .cpp files that their associated .h already includes
Remove some unused headers

Test: boot bullhead
Change-Id: I2b415adfe86a5c8bbe4fb1ebc53c7b0ee2253824
/system/core/init/import_parser.cpp
f86b5a6b90619e02d1d034ef7b0adc3b439f4abb 25-Jun-2016 Elliott Hughes <enh@google.com> Move init to libbase logging.

Change-Id: Ibfbefeff587a69e948978a037c555fd12a5ade6a
/system/core/init/import_parser.cpp
b7349902a945903f9e36a569051f5131beb0bc24 26-Aug-2015 Tom Cherry <tomcherry@google.com> init: Use classes for parsing and clean up memory allocations

Create a Parser class that uses multiple SectionParser interfaces to
handle parsing the different sections of an init rc.

Create an ActionParser and ServiceParser that implement SectionParser
and parse the sections corresponding to Action and Service
classes.

Remove the legacy keyword structure and replace it with std::map's
that map keyword -> (minimum args, maximum args, function pointer) for
Commands and Service Options.

Create an ImportParser that implements SectionParser and handles the
import 'section'.

Clean up the unsafe memory handling of the Action class by using
std::unique_ptr.

Change-Id: Ic5ea5510cb956dbc3f78745a35096ca7d6da7085
/system/core/init/import_parser.cpp