summaryrefslogtreecommitdiffstats
path: root/init/action.cpp
Commit message (Collapse)AuthorAgeFilesLines
* init: Use classes for parsing and clean up memory allocationsTom Cherry2015-09-011-135/+151
| | | | | | | | | | | | | | | | | | | | | 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
* init: Queue Triggers instead of ActionsTom Cherry2015-08-211-43/+77
| | | | | | | | | | | | | | | | | When init queues a trigger, it actually enqueues all of the Actions that match with that given trigger. This works currently because all init scripts are loaded and therefore all Actions are available before init starts queueing any triggers. To support loading init scripts after init has started queueing triggers, this change enqueues Trigger objects instead of their matching Actions. Each Trigger object then matches its associated Actions during its execution. Additionally, this makes a few cosmetic clean ups related to triggers. Bug: 23186545 Change-Id: I5d177458e6df1c4b32b1072cf77e87ef952c87e4
* init: use std::vector<std::string> for argument passingTom Cherry2015-07-311-15/+10
| | | | Change-Id: Ie7a64e65de3a20d0c7f7d8efc0f7c1ba121d07fe
* init: Create classes for Action and CommandTom Cherry2015-07-301-0/+383
This creates the concept of 'event_trigger' vs 'property_trigger' Previously these were merged into one, such that 'on property:a=b && property:b=c' is triggered when properties a=b and b=c as expected, however combinations such as 'on early-boot && boot' would trigger during both early-boot and boot. Similarly, 'on early-boot && property:a=b' would trigger on both early-boot and again when property a equals b. The event trigger distinction ensures that the first example fails to parse and the second example only triggers on early-boot if property a equals b. This coalesces Actions with the same triggers into a single Action object Change-Id: I8f661d96e8a2d40236f252301bfe10979d663ea6