remove hotplug2-old
SVN-Revision: 16769
This commit is contained in:
		| @@ -1,44 +0,0 @@ | |||||||
| # |  | ||||||
| # Copyright (C) 2006-2009 OpenWrt.org |  | ||||||
| # |  | ||||||
| # This is free software, licensed under the GNU General Public License v2. |  | ||||||
| # See /LICENSE for more information. |  | ||||||
| # |  | ||||||
|  |  | ||||||
| include $(TOPDIR)/rules.mk |  | ||||||
|  |  | ||||||
| PKG_NAME:=hotplug2-old |  | ||||||
| PKG_VERSION:=0.9 |  | ||||||
| PKG_RELEASE:=3 |  | ||||||
|  |  | ||||||
| PKG_SOURCE:=hotplug2-$(PKG_VERSION).tar.gz |  | ||||||
| PKG_SOURCE_URL:=http://isteve.bofh.cz/~isteve/hotplug2 |  | ||||||
| PKG_MD5SUM:=ea2c01d027b4002e4e6b0ff266f51a51 |  | ||||||
|  |  | ||||||
| PKG_BUILD_DIR:=$(BUILD_DIR)/hotplug2-$(PKG_VERSION) |  | ||||||
|  |  | ||||||
| include $(INCLUDE_DIR)/package.mk |  | ||||||
|  |  | ||||||
| define Package/hotplug2-old |  | ||||||
|   SECTION:=base |  | ||||||
|   CATEGORY:=Base system |  | ||||||
|   VERSION:=0.9+r102-$(PKG_RELEASE) |  | ||||||
|   TITLE:=Dynamic device management subsystem for embedded systems |  | ||||||
|   URL:=http://isteve.bofh.cz/~isteve/hotplug2/ |  | ||||||
| endef |  | ||||||
|  |  | ||||||
| define Package/hotplug2-old/description |  | ||||||
|  Hotplug2 is a trivial replacement of some of the UDev functionality |  | ||||||
|  in a tiny pack, intended for Linux early userspace: Init RAM FS and InitRD. |  | ||||||
| endef |  | ||||||
|  |  | ||||||
| MAKE_FLAGS += CFLAGS="$(TARGET_CFLAGS) -DHAVE_RULES -I." |  | ||||||
|  |  | ||||||
| define Package/hotplug2-old/install |  | ||||||
| 	$(INSTALL_DIR) $(1)/etc |  | ||||||
| 	$(INSTALL_DATA) ./files/hotplug2.rules $(1)/etc/ |  | ||||||
| 	$(INSTALL_DIR) $(1)/sbin |  | ||||||
| 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hotplug2 $(1)/sbin/ |  | ||||||
| endef |  | ||||||
|  |  | ||||||
| $(eval $(call BuildPackage,hotplug2-old)) |  | ||||||
| @@ -1,10 +0,0 @@ | |||||||
| $include /etc/hotplug2-common.rules |  | ||||||
|  |  | ||||||
| SUBSYSTEM ~~ (net|button|usb|platform|ieee1394|block|atm) { |  | ||||||
| 	exec /sbin/hotplug-call %SUBSYSTEM%; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| DEVICENAME ~~ (watchdog) { |  | ||||||
| 	exec /sbin/watchdog -t 5 /dev/watchdog; |  | ||||||
| 	next |  | ||||||
| } |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,22 +0,0 @@ | |||||||
| Index: hotplug2-0.9/rules.c |  | ||||||
| =================================================================== |  | ||||||
| --- hotplug2-0.9.orig/rules.c	2007-07-18 09:15:38.968308540 +0200 |  | ||||||
| +++ hotplug2-0.9/rules.c	2007-07-18 09:18:52.135316499 +0200 |  | ||||||
| @@ -756,6 +756,7 @@ |  | ||||||
|  		ERROR("rules parse","Unable to parse rules file."); |  | ||||||
|  		return -1; |  | ||||||
|  	} |  | ||||||
| +	*return_rules = rules; |  | ||||||
|   |  | ||||||
|  	unmap_file(&filemap); |  | ||||||
|   |  | ||||||
| @@ -997,7 +998,8 @@ |  | ||||||
|  	 |  | ||||||
|  	if (!terminate) { |  | ||||||
|  		/* A little bit hacky cleanup */ |  | ||||||
| -		return_rules->rules_c--; |  | ||||||
| +		if (!nested) |  | ||||||
| +			return_rules->rules_c--; |  | ||||||
|  		return return_rules; |  | ||||||
|  	} else { |  | ||||||
|  		/* |  | ||||||
| @@ -1,138 +0,0 @@ | |||||||
| Index: hotplug2-0.9/hotplug2.c |  | ||||||
| =================================================================== |  | ||||||
| --- hotplug2-0.9.orig/hotplug2.c	2008-08-04 10:02:27.000000000 +0200 |  | ||||||
| +++ hotplug2-0.9/hotplug2.c	2008-08-04 10:03:04.000000000 +0200 |  | ||||||
| @@ -21,6 +21,7 @@ |  | ||||||
|  #include <sys/mman.h> |  | ||||||
|  #include <linux/types.h> |  | ||||||
|  #include <linux/netlink.h> |  | ||||||
| +#include <poll.h> |  | ||||||
|   |  | ||||||
|  #include "mem_utils.h" |  | ||||||
|  #include "filemap_utils.h" |  | ||||||
| @@ -492,6 +493,11 @@ |  | ||||||
|  	char *coldplug_command = NULL; |  | ||||||
|  	char *rules_file = HOTPLUG2_RULE_PATH; |  | ||||||
|  	sigset_t block_mask; |  | ||||||
| +	struct pollfd msg_poll; |  | ||||||
| + |  | ||||||
| +	struct hotplug2_event_t *backlog = NULL; |  | ||||||
| +	struct hotplug2_event_t *backlog_tail = NULL; |  | ||||||
| +	int n_backlog = 0; |  | ||||||
|  	 |  | ||||||
|  	struct rules_t *rules = NULL; |  | ||||||
|  	struct filemap_t filemap; |  | ||||||
| @@ -602,6 +608,8 @@ |  | ||||||
|  	 * Open netlink socket to read the uevents |  | ||||||
|  	 */ |  | ||||||
|  	netlink_socket = init_netlink_socket(NETLINK_BIND); |  | ||||||
| +	msg_poll.fd = netlink_socket; |  | ||||||
| +	msg_poll.events = POLLIN; |  | ||||||
|  	 |  | ||||||
|  	if (netlink_socket == -1) { |  | ||||||
|  		ERROR("netlink init","Unable to open netlink socket."); |  | ||||||
| @@ -642,20 +650,44 @@ |  | ||||||
|  	 * Main loop reading uevents |  | ||||||
|  	 */ |  | ||||||
|  	while (!terminate) { |  | ||||||
| -		/* |  | ||||||
| -		 * Read the uevent packet |  | ||||||
| -		 */ |  | ||||||
| -		size = recv(netlink_socket, &buffer, sizeof(buffer), 0); |  | ||||||
| -		recv_errno = errno; |  | ||||||
| +		if ((n_backlog > 0) && (child_c < max_child_c)) { |  | ||||||
| +			/* dequeue backlog message */ |  | ||||||
| +			tmpevent = backlog; |  | ||||||
| +			backlog = backlog->next; |  | ||||||
| +			n_backlog--; |  | ||||||
| +			if (backlog_tail == tmpevent) |  | ||||||
| +				backlog_tail = NULL; |  | ||||||
| +		} else { |  | ||||||
| +			/* |  | ||||||
| +			 * Read the uevent packet |  | ||||||
| +			 */ |  | ||||||
| +			if (n_backlog >= HOTPLUG2_MSG_BACKLOG) { |  | ||||||
| +				usleep(HOTPLUG2_THROTTLE_INTERVAL * 1000); |  | ||||||
| +				continue; |  | ||||||
| +			} |  | ||||||
| + |  | ||||||
| +			if ((n_backlog > 0) && (child_c >= max_child_c)) { |  | ||||||
| +				int fds; |  | ||||||
| +				msg_poll.revents = 0; |  | ||||||
| +				fds = poll(&msg_poll, 1, HOTPLUG2_THROTTLE_INTERVAL); |  | ||||||
| +				if (fds < 0) { |  | ||||||
| +					continue; |  | ||||||
| +				} |  | ||||||
| +				if (fds == 0) |  | ||||||
| +					continue; |  | ||||||
| +			} |  | ||||||
| +			size = recv(netlink_socket, &buffer, sizeof(buffer), 0); |  | ||||||
| +			recv_errno = errno; |  | ||||||
|  	 |  | ||||||
| -		/* |  | ||||||
| -		 * Parse the event into an event structure |  | ||||||
| -		 */ |  | ||||||
| -		tmpevent = get_hotplug2_event(buffer, size); |  | ||||||
| +			/* |  | ||||||
| +			 * Parse the event into an event structure |  | ||||||
| +			 */ |  | ||||||
| +			tmpevent = get_hotplug2_event(buffer, size); |  | ||||||
|  		 |  | ||||||
| -		if (tmpevent == NULL) { |  | ||||||
| -			ERROR("reading events", "Malformed event read (missing action prefix)."); |  | ||||||
| -			continue; |  | ||||||
| +			if (tmpevent == NULL) { |  | ||||||
| +				ERROR("reading events", "Malformed event read (missing action prefix)."); |  | ||||||
| +				continue; |  | ||||||
| +			} |  | ||||||
|  		} |  | ||||||
|  		 |  | ||||||
|  		/* |  | ||||||
| @@ -706,13 +738,16 @@ |  | ||||||
|  			 * Unless, of course, we've specified otherwise and no rules that match |  | ||||||
|  			 * need throttling. |  | ||||||
|  			 */ |  | ||||||
| -			if (!flags & FLAG_NOTHROTTLE) { |  | ||||||
| -				/* |  | ||||||
| -				 * Okay, throttle away! |  | ||||||
| -				 */ |  | ||||||
| -				while (child_c >= max_child_c) { |  | ||||||
| -					usleep(HOTPLUG2_THROTTLE_INTERVAL); |  | ||||||
| -				} |  | ||||||
| +			if (!(flags & FLAG_NOTHROTTLE) && (child_c >= max_child_c)) { |  | ||||||
| +				/* log the packet and process it later */ |  | ||||||
| +				if (backlog_tail) |  | ||||||
| +					backlog_tail->next = tmpevent; |  | ||||||
| +				else |  | ||||||
| +					backlog = tmpevent; |  | ||||||
| +				tmpevent->next = NULL; |  | ||||||
| +				backlog_tail = tmpevent; |  | ||||||
| +				n_backlog++; |  | ||||||
| +				continue; |  | ||||||
|  			} |  | ||||||
|  			 |  | ||||||
|  			sigemptyset(&block_mask); |  | ||||||
| Index: hotplug2-0.9/hotplug2.h |  | ||||||
| =================================================================== |  | ||||||
| --- hotplug2-0.9.orig/hotplug2.h	2008-08-04 10:02:27.000000000 +0200 |  | ||||||
| +++ hotplug2-0.9/hotplug2.h	2008-08-04 10:02:27.000000000 +0200 |  | ||||||
| @@ -45,9 +45,9 @@ |  | ||||||
|  #define DBG(action, fmt, arg...) |  | ||||||
|  #endif |  | ||||||
|   |  | ||||||
| +#define HOTPLUG2_MSG_BACKLOG	64 |  | ||||||
|  #define UEVENT_BUFFER_SIZE		2048 |  | ||||||
| -#define HOTPLUG2_POLL_INTERVAL		20000 |  | ||||||
| -#define HOTPLUG2_THROTTLE_INTERVAL	10000 |  | ||||||
| +#define HOTPLUG2_THROTTLE_INTERVAL	50 |  | ||||||
|  #define HOTPLUG2_RULE_PATH		"/etc/hotplug2.rules" |  | ||||||
|   |  | ||||||
|  #define ACTION_ADD			0 |  | ||||||
| @@ -76,6 +76,7 @@ |  | ||||||
|  	int env_vars_c; |  | ||||||
|  	char *plain; |  | ||||||
|  	int plain_s; |  | ||||||
| +	struct hotplug2_event_t *next; |  | ||||||
|  }; |  | ||||||
|   |  | ||||||
|  struct options_t { |  | ||||||
		Reference in New Issue
	
	Block a user
	 Felix Fietkau
					Felix Fietkau