summaryrefslogtreecommitdiffstats
path: root/init/devices_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Removing block device by-num symlinksBowgo Tsai2018-05-191-2/+0
| | | | | | | | | | | | | | | | | | | | The uevent.partition_num easily collides between partitions, for example: Both /dev/block/sda3 and /dev/block/sdd3 will generate the same symlink: /dev/block/platform/soc/1da4000.ufshc/by-num/p3 This change remove those by-num symlinks as there seems no effective user of it. Bug: 78613232 Test: m init_tests && \ adb push $OUT/data/nativetest64/init_tests/init_tests /data/. && \ adb shell /data/init_tests Change-Id: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de Merged-In: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de (cherry picked from commit 95591bd00e653826f25bfa705c3f50545f6b06a3)
* init: split security functions out of init.cppTom Cherry2017-08-111-3/+3
| | | | | | | | | | | | | | | | | | This change splits out the selinux initialization and supporting functionality into selinux.cpp and splits the security related initialization of the rng, etc to security.cpp. It also provides additional documentation for SEPolicy loading as this has been requested by some teams. It additionally cleans up sehandle and sehandle_prop. The former is static within selinux.cpp and new wrapper functions are created around selabel_lookup*() to better serve the users. The latter is moved to property_service.cpp as it is isolated to that file for its usage. Test: boot bullhead Merged-In: Idc95d493cebc681fbe686b5160502f36af149f60 Change-Id: Idc95d493cebc681fbe686b5160502f36af149f60 (cherry picked from commit 9afb86b25d8675927cb37c86119a7ecf19f74819)
* ueventd: remove character device symlinks (/dev/usb/*)Tom Cherry2017-06-261-104/+11
| | | | | | | | | | | | | While refactoring ueventd, I was looking for code the character device symlinks (/dev/usb/*) that ueventd creates, such that I could test it on a real device. I found none in our tree, and history showing Xoom, which was last supported years ago, was the last user. If this code is in fact obsolete, let's remove it. Test: boot bullhead Test: init unit tests Change-Id: I601f7165eb06d36b31b6dcf69ee9e0a449d81a96
* init: create android::init:: namespaceTom Cherry2017-06-231-0/+6
| | | | | | | | With some small fixups along the way Test: Boot bullhead Test: init unit tests Change-Id: I7beaa473cfa9397f845f810557d1631b4a462d6a
* Revert "Revert "ueventd: remove PlatformDeviceList""Sandeep Patil2017-06-211-44/+16
| | | | | | | | | | This reverts commit 516ff99711bbb533c4ca3970882ef376df6b044d. Bug: 62864413 Bug: 62864413 Change-Id: Ie3980cd536c2c83adace063f0950128f68561105 Signed-off-by: Sandeep Patil <sspatil@google.com>
* Revert "ueventd: remove PlatformDeviceList"Tom Cherry2017-06-211-16/+44
| | | | | | | | Bug: 62864413 This reverts commit c94ce7b130979317d9523ba0d175f0ad369fb1c4. Change-Id: I014360251e5cda89c87adfec46d8b1e5000f3a9c
* ueventd: remove PlatformDeviceListTom Cherry2017-06-201-44/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to create symlinks for USB and block devices, the path for their parent platform device must be known. Previously, ueventd would save each platform device that it encounters to a list and query this list when creating the symlinks. That, however, is racy because the uevent socket does not differentiate uevents from RegenerateUevents() and uevents sent by the kernel when probing a device first the first time. The below scenario is the faulty case: 1) Kernel probes parent platform device for a block device 2) ueventd calls RegenerateUevents() and starts processing uevents 3) Kernel probes block device and sends its uevents 4) ueventd picks up the block device uevent during its uevent processing, without yet regenerating the platform device uevent, causing improper symlinks to be created. This change stops storing the platform devices in a list, and instead traverses up the directory structure for each USB or block device until it reaches a platform device, defined as one whose subsystem is the platform bus. This fixes the race and simplifies the ueventd code. Bug: 62436493 Bug: 62681642 Test: Boot bullhead Test: Boot sailfish Test: Init unit tests Test: Boot hikey + hotplug/unplug sdcard Change-Id: I21636355d8e434f30e0cba568598a6cf139e67f9
* ueventd: Break devices.cpp into discrete classesTom Cherry2017-05-251-118/+139
| | | | | | | | | | | | | | | | | | | devices.cpp handles too many things for creating one class. This change breaks it up into various files and classes. * Parsing is moved to ueventd_parser.cpp * Reading from the uevent socket and Cold booting is moved to a UeventListener class, in uevent_listener.cpp * Firmware handling is moved to firmware_handler.cpp * The remaining contents form a DeviceHandler class within devices.cpp Bug: 33785894 Test: boot bullhead x40, observe no major differences in /dev and /sys Test: boot sailfish x40, observe no major differences in /dev and /sys Test: init unit tests Change-Id: I846a2e5995fbb344c7a8e349065c18a934fa6aba
* ueventd: create classes for dev and sys permissionsTom Cherry2017-04-171-0/+91
| | | | | | | | | | Create classes for dev and sys permissions and store these permissions in std::vector instead of the C list. Test: boot bullhead Test: init unit tests Change-Id: I874039a3db29b4c70149506da8e407123ab7eca2
* ueventd: convert platform_names from C list to std::vectorTom Cherry2017-04-141-2/+46
| | | | | | | | | | | | | | | | Also simplify this code a bit. There's only one consumer that removes the /devices/platform prefix, so have them handle it instead of storing two copies of the string. Remove an unneeded search for '/' in get_character_device_symlinks() as a / will always be the next character after a parent path, by nature of FindPlatformDevice(). Test: boot bullhead Test: init unit tests Change-Id: I9d0482d137b1342ae7509ae993ff99198be814f0
* ueventd: replace char* with std::string in struct ueventTom Cherry2017-04-141-9/+7
| | | | | | | | | | Bug: 36250207 Test: Boot bullhead Test: Boot sailfish, observe no boot time regression Test: init unit tests Change-Id: Ib82833bea56bdafbe1d7a045126aaa91a8725d98
* ueventd: replace char** links with std::vector<std::string>Tom Cherry2017-04-081-27/+33
| | | | | | | | | | Additionally replace the associated C string parsing with C++ and write unit tests. Bug: 33785894 Bug: 36250207 Test: Boot bullhead + unit tests Change-Id: Iee1f72d248bca3bd2e1227045628935b3dd6195a
* ueventd: Write tests for the get_*_symlinks() functionsTom Cherry2017-04-051-0/+270
Bug: 33785894 Bug: 36250207 Test: Boot bullhead + new unit tests Change-Id: Ia0f290542eb1cffce5ae876dfedb453dde960253