aboutsummaryrefslogtreecommitdiffstats
path: root/nlplug-findfs.c
Commit message (Collapse)AuthorAgeFilesLines
* nlplug-findfs: speed up and simplify boot media findingtteras-workTimo Teräs2016-11-231-116/+105
|
* nlplug-findfs: fix cold plug triggeringTimo Teräs2016-11-231-92/+190
|
* nlplug-findfs: improve logging about spawned commandsTimo Teräs2016-11-211-13/+39
|
* nlplug-findfs: handle uevent strictly after mdev executionTimo Teräs2016-11-211-52/+101
|
* nlplug-findfs: convert to kernel style linked lists and track spawned pidsTimo Teräs2016-11-211-32/+116
|
* nlplug-findfs: improve debugging, make device finding asyncTimo Teräs2016-11-211-53/+59
|
* nlplug-findfs: accept passphrase of non-zero slotsTimo Teräs2016-11-211-1/+1
| | | | ref #6473
* nlplug-findfs: fix erratic behavior and SIGSEGV7heo2016-09-281-1/+1
| | | | | Likely introduced in the major rehaul done in e4af128b30855b2b29a27c2fd7580b62059bbe51
* nlplug-findfs: refacor crypt device to its own structNatanael Copa2016-07-041-15/+19
| | | | makes things a bit cleaner
* nlplug-findfs: increase max delayNatanael Copa2016-06-101-10/+21
| | | | | | | | | Increase timeout to 5sec if we have not found anything so we don't get error too early. If boot repos are found then reduce the event timeout to 250ms. If usb_storage is found, then always add 1 second of delay in addition, to let the usb host settle.
* nlplug-findfs: increase the /sys recursion limitTimo Teräs2016-03-211-2/+2
| | | | | certain platform and usb devices expose things deep down the tree, increase the recursion limit
* nlplug-findfs: scan block devices on changeTimo Teräs2016-03-111-1/+1
| | | | | | | | raid disks are created zero sized. when mdadm has found all the disks it finally enables it. this causes md devices to be zero sized for some time after their creation, and blkid will not detect them. catch the 'change' notification and rescan block devices for updated blkid.
* nlplug-findfs: limit recursion depthTimo Teräs2016-03-111-7/+8
| | | | | | | Based on patch by donoban. Limit recursion depth for repository search to 2 levels (shell script had -maxdepth 3 for finding the file entry, so it's maximum of 2 levels of directories). For sysfs entries deeper search is allowed. ref #5192
* nlplug-findfs: allow success even if nothing foundNatanael Copa2016-01-181-1/+5
| | | | | add -n option to allow return success even if nothing was found. This is useful for net boot, where apkovl and repositories are on network.
* nlplug-findfs: fix usb settle delayNatanael Copa2015-12-161-10/+14
| | | | | | | kernel does not set any "DRIVER" env var in uevent from netlink so we use kmod to find usb_storage driver. We also reduce the timeout to 1 sec, which should be enough.
* nlplug-findfs: do not try execute programs that does not existsNatanael Copa2015-11-251-4/+13
| | | | | Avoid printing error message if there are lvm devices but root is not on any of those.
* nlplug-findfs: print device name user expectsNatanael Copa2015-11-251-1/+2
| | | | | | | we want print the device name that user is looking for when we prompt for cryptsetup password instead of the devname from kernel uevent. If user specified UUID, then we print kernel provided name.
* nlplug-findfs: make lvm more silentNatanael Copa2015-11-251-1/+1
| | | | | we want avoid lvm messages be printed after password prompt for cryptsetup is displayed.
* nlplug-findfs: fix cryptsetup race conditionNatanael Copa2015-11-251-18/+115
| | | | | | | | | | | | | | | | | | | We need run cryptsetup in parallel so that keyboard drivers are loaded while waiting for password input. But cryptsetup will recreate the device which means that the uevent for new device node will first be added then changed and finally will it create the /dev/mapper/* device node. We handle the first generated uevent and while handling, the device node might have disappeared causeing blkid not find any UUID, and the /dev/mapper/* does not yet exist. This means that we need to: - handle uevents in parallel while waiting for password input - block uevent handling while actually setting up the crypt device So we use libcryptsetup and add a mutex while setting up the crypt device.
* nlplug-findfs: use bit mask to indicate running threadNatanael Copa2015-11-251-5/+12
| | | | | Use a bit mask to indicate trigger thread. This is so we can have more threads in future.
* nlplug-findfs: compare device node major/minorNatanael Copa2015-11-241-15/+29
| | | | | | | | | Fix issue where /dev/vg0/lv_device is used as crypt device. We compare the major/minor of the event with the device we are searching for. That way we can find the device we are looking for regardless of the name it gets. ref #4863
* nlplug-findfs: improve debug infoNatanael Copa2015-11-231-2/+3
| | | | | | | - print only once when we reset timeout - print what the timeout was set to on exit This helps to show if what we were looking for was found or not
* nlplug-findfs: asynchronously fork child processesTimo Teräs2015-10-241-82/+185
| | | | | | | | instead of waiting each child to run end before continuing, fork or queue each command allowing up to CPU count concurrent childs. this enables full use of SMP cores, and allows loading of modules after a blocking command is started; fixing e.g. keyboard driver to load even if crypto disk command is waiting keyboard input.
* nlplug-findfs: check for valid key value pair in uevent processingTimo Teräs2015-10-241-1/+1
| | | | just to be on the safe side
* nlplug-findfs: make all functions staticTimo Teräs2015-10-231-16/+14
|
* nlplug-findfs: maintain environment for exec's in arrayTimo Teräs2015-10-231-22/+30
| | | | | | Using clearenv and setenv is slow, non-thread safe and problematic. This makes PATH inherited from parent environment, and explicitly constructs the rest of the environment for mdev.
* nlplug-findfs: support search for /dev/<devname>Natanael Copa2015-10-221-2/+3
| | | | this is so we also can specify cryptroot=/dev/sdaX at boot prompt
* nlplug-findfs: make sure we handle all events in queueNatanael Copa2015-10-191-1/+7
| | | | | | | | | | we want handle all the events in queue, even if we find the devices we are looking for. This is so we load kernel module for framebuffer even if the apkvol and bootrepo are found first. This means that the only valid exit condition is a poll timeout and that we can set the timeout to 0 once we found all the things we are looking for.
* nlplug-findfs: wait indefinitively til trigger thread is completeNatanael Copa2015-10-191-11/+14
| | | | | | make sure that we dont exit before the trigger thread is complete, regardless if we find the devices/bootrepo/apkovl we are looking for or not.
* nlplug-findfs: use DT_UNKNOWN to detect if lstat is to be usedNatanael Copa2015-10-191-10/+4
|
* nlplug-findfs: dont exit before trigger thread is completeNatanael Copa2015-10-141-1/+1
|
* nlplug-findfs: avoid lstat syscall wen scanning /sys if possibleNatanael Copa2015-10-091-5/+18
| | | | | | | There are ~10k entries in /sys so we want be fast. Not all filesystems supports dirent filed d_type, (iso9660 for example) so we need use lstat to find directories. However, we know that sysfs supports it, so we can avoid 10k lstat syscalls. This might be noticiable difference on rpi.
* nlplug-findfs: increase timeout if usb-storage was foundNatanael Copa2015-10-091-1/+11
| | | | | usb storage need some time to settle, we increase the timeout with 2 seconds if we detext usb-storage.
* nlplug-findfs: allow user to override timeout with -t optionNatanael Copa2015-10-091-2/+8
|
* nlplug-findfs: fix exit codeNatanael Copa2015-10-081-5/+3
| | | | retun success if anything of what we searched for was found.
* nlplug-findfs: save stackspace while recursing dir treeNatanael Copa2015-10-081-12/+26
| | | | | avoid allocate PATH_MAX on stack for every dir. Instead reuse the path buffer.
* nlplug-findfs: fix recursing dirs on isofsNatanael Copa2015-10-081-3/+12
| | | | | the dirent d_type is not supported on isofs apparently. Use lstat instead.
* nlplug-findfs: clean up netlink socketNatanael Copa2015-10-081-2/+6
| | | | we set CLOEXEC with socket create
* nlplug-findfs: remove mountdir optionNatanael Copa2015-10-081-17/+6
| | | | | We will need set optional mount options, so we better do the mount from script.
* nlplug-findfs: add -a option to find apkovlNatanael Copa2015-10-081-29/+82
| | | | | when both apkovl and boot repository are found, then we should have what we need to setup up a working tmpfs root so we exit at that point.
* nlplug-findfs: add help text for -bNatanael Copa2015-10-081-0/+1
|
* nlplug-findfs: search for .boot_repositoryNatanael Copa2015-10-071-44/+137
| | | | | add option -b OUTFILE which will create OUTFILE and add first found boot repository
* nlplug-findfs: refactor recursing dir treeNatanael Copa2015-09-241-15/+28
| | | | | we need a more general recurse function so we can search for boot repos and similar.
* nlplug-findfs: run trigger in threadNatanael Copa2015-09-231-13/+33
|
* nlplug-findfs: fix usage helpNatanael Copa2015-09-231-15/+28
|
* nlplug-findfs: do not depend on external trigger scriptNatanael Copa2015-09-231-7/+35
| | | | We recursively scan /sys and trigger the events ourselves.
* add new tool nlplug-findfsNatanael Copa2015-09-231-0/+511
nlplug-findfs is a tool that will help us to find a given filesystem using coldplug. The only reason that initramfs exist in first place is to set up a rootfs and switch to it. The nlplug-findfs will handle coldplug events til a given filesystem/device is found and then mount it.