aboutsummaryrefslogtreecommitdiffstats
path: root/main/mkinitfs/0001-nlplug-findfs-increase-max-delay.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/mkinitfs/0001-nlplug-findfs-increase-max-delay.patch')
-rw-r--r--main/mkinitfs/0001-nlplug-findfs-increase-max-delay.patch125
1 files changed, 0 insertions, 125 deletions
diff --git a/main/mkinitfs/0001-nlplug-findfs-increase-max-delay.patch b/main/mkinitfs/0001-nlplug-findfs-increase-max-delay.patch
deleted file mode 100644
index e341103137..0000000000
--- a/main/mkinitfs/0001-nlplug-findfs-increase-max-delay.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From 7389119f3283687adb521aec1397f8db996207fb Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Fri, 10 Jun 2016 14:11:01 +0000
-Subject: [PATCH] nlplug-findfs: increase max delay
-
-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.c | 31 +++++++++++++++++++++----------
- 1 file changed, 21 insertions(+), 10 deletions(-)
-
-diff --git a/nlplug-findfs.c b/nlplug-findfs.c
-index b11b7b8..7a3a136 100644
---- a/nlplug-findfs.c
-+++ b/nlplug-findfs.c
-@@ -40,6 +40,7 @@
-
- #include "arg.h"
-
-+#define MAX_EVENT_TIMEOUT 5000
- #define DEFAULT_EVENT_TIMEOUT 250
- /* usb mass storage needs 1 sec to settle */
- #define USB_STORAGE_TIMEOUT 1000
-@@ -204,6 +205,7 @@ struct ueventconf {
- char *bootrepos;
- char *apkovls;
- int timeout;
-+ int usb_storage_timeout;
- int efd;
- unsigned running_threads;
- pthread_t cryptsetup_tid;
-@@ -682,8 +684,6 @@ static int searchdev(struct uevent *ev, const char *searchdev, char *bootrepos,
-
- static int dispatch_uevent(struct uevent *ev, struct ueventconf *conf)
- {
-- static int timeout_increment = USB_STORAGE_TIMEOUT;
--
- if (conf->subsystem_filter && ev->subsystem
- && strcmp(ev->subsystem, conf->subsystem_filter) != 0) {
- dbg("subsystem '%s' filtered out (by '%s').",
-@@ -701,10 +701,8 @@ static int dispatch_uevent(struct uevent *ev, struct ueventconf *conf)
- conf->modalias_count++;
-
- /* increase timeout so usb drives gets time to settle */
-- if (strcmp(buf, "usb_storage") == 0) {
-- conf->timeout += timeout_increment;
-- timeout_increment = 0;
-- }
-+ if (strcmp(buf, "usb_storage") == 0)
-+ conf->usb_storage_timeout = USB_STORAGE_TIMEOUT;
-
- } else if (ev->devname != NULL) {
- if (conf->program_argv[0] != NULL) {
-@@ -842,6 +840,7 @@ int main(int argc, char *argv[])
- size_t total_bytes = 0;
- int found = 0;
- int not_found_is_ok = 0;
-+ int timeout = DEFAULT_EVENT_TIMEOUT;
- char *program_argv[2] = {0,0};
- pthread_t tid;
- sigset_t sigchldmask;
-@@ -853,7 +852,8 @@ int main(int argc, char *argv[])
-
- memset(&conf, 0, sizeof(conf));
- conf.program_argv = program_argv;
-- conf.timeout = DEFAULT_EVENT_TIMEOUT;
-+ conf.timeout = MAX_EVENT_TIMEOUT;
-+ conf.usb_storage_timeout = 0;
- use_lvm = access(LVM_PATH, X_OK) == 0;
- use_mdadm = access(MDADM_PATH, X_OK) == 0;
-
-@@ -890,7 +890,7 @@ int main(int argc, char *argv[])
- conf.program_argv[0] = EARGF(usage(1));
- break;
- case 't':
-- conf.timeout = atoi(EARGF(usage(1)));
-+ timeout = atoi(EARGF(usage(1)));
- break;
- default:
- usage(1);
-@@ -921,14 +921,15 @@ int main(int argc, char *argv[])
- conf.running_threads |= TRIGGER_THREAD;
-
- while (1) {
-- r = poll(fds, numfds, (spawn_active(&spawnmgr) || conf.running_threads) ? -1 : conf.timeout);
-+ int t = conf.timeout + conf.usb_storage_timeout;
-+ r = poll(fds, numfds, (spawn_active(&spawnmgr) || conf.running_threads) ? -1 : t);
- if (r == -1) {
- if (errno == EINTR || errno == ERESTART)
- continue;
- err(1, "poll");
- }
- if (r == 0) {
-- dbg("exit due to timeout (%i)", conf.timeout);
-+ dbg("exit due to timeout (%i)", t);
- break;
- }
-
-@@ -977,9 +978,19 @@ int main(int argc, char *argv[])
- if ((found & FOUND_DEVICE)
- || ((found & FOUND_BOOTREPO) &&
- (found & FOUND_APKOVL))) {
-+ /* we have found everything we need, so no
-+ no need to wait for anything new event */
- if (conf.timeout)
- dbg("FOUND! setting timeout to 0");
- conf.timeout = 0;
-+ conf.usb_storage_timeout= 0;
-+ } else if ((found & FOUND_BOOTREPO) && conf.timeout) {
-+ /* we have found boot repo, but not apkovl
-+ we reduce timeout to default timeout */
-+ if (conf.timeout != timeout)
-+ dbg("Setting timeout to %d",
-+ timeout);
-+ conf.timeout = timeout;
- }
- }
-
---
-2.8.4
-