From owner-svn-src-all@FreeBSD.ORG Mon Apr 28 20:38:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DEAC1F95; Mon, 28 Apr 2014 20:38:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEB771E82; Mon, 28 Apr 2014 20:38:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3SKc8Lv029141; Mon, 28 Apr 2014 20:38:08 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3SKc8Ug029140; Mon, 28 Apr 2014 20:38:08 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201404282038.s3SKc8Ug029140@svn.freebsd.org> From: Brooks Davis Date: Mon, 28 Apr 2014 20:38:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265060 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Apr 2014 20:38:09 -0000 Author: brooks Date: Mon Apr 28 20:38:08 2014 New Revision: 265060 URL: http://svnweb.freebsd.org/changeset/base/265060 Log: Revert r263754, re-adding support for hw.bus.devctl_disable. Breaking old devd's and thus hosts that get IP addresses from DHCP was too much of a POLA violation. The sysctl may be removed again after r263758 has been merged to at least stable/9 and stable/10, and releases have been cut from those branches. Discussed with: mjg Reported by: theraven, rwatson Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Mon Apr 28 18:54:12 2014 (r265059) +++ head/sys/kern/subr_bus.c Mon Apr 28 20:38:08 2014 (r265060) @@ -355,6 +355,13 @@ device_sysctl_fini(device_t dev) * tested since 3.4 or 2.2.8! */ +/* Deprecated way to adjust queue length */ +static int sysctl_devctl_disable(SYSCTL_HANDLER_ARGS); +/* XXX Need to support old-style tunable hw.bus.devctl_disable" */ +SYSCTL_PROC(_hw_bus, OID_AUTO, devctl_disable, CTLTYPE_INT | CTLFLAG_RW | + CTLFLAG_MPSAFE, NULL, 0, sysctl_devctl_disable, "I", + "devctl disable -- deprecated"); + #define DEVCTL_DEFAULT_QUEUE_LEN 1000 static int sysctl_devctl_queue(SYSCTL_HANDLER_ARGS); static int devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN; @@ -685,9 +692,9 @@ devctl_notify(const char *system, const * Common routine that tries to make sending messages as easy as possible. * We allocate memory for the data, copy strings into that, but do not * free it unless there's an error. The dequeue part of the driver should - * free the data. We don't send data when queue length is 0. We do send - * data, even when we have no listeners, because we wish to avoid races - * relating to startup and restart of listening applications. + * free the data. We don't send data when the device is disabled. We do + * send data, even when we have no listeners, because we wish to avoid + * races relating to startup and restart of listening applications. * * devaddq is designed to string together the type of event, with the * object of that event, plus the plug and play info and location info @@ -779,6 +786,33 @@ devnomatch(device_t dev) } static int +sysctl_devctl_disable(SYSCTL_HANDLER_ARGS) +{ + struct dev_event_info *n1; + int dis, error; + + dis = devctl_queue_length == 0; + error = sysctl_handle_int(oidp, &dis, 0, req); + if (error || !req->newptr) + return (error); + mtx_lock(&devsoftc.mtx); + if (dis) { + while (!TAILQ_EMPTY(&devsoftc.devq)) { + n1 = TAILQ_FIRST(&devsoftc.devq); + TAILQ_REMOVE(&devsoftc.devq, n1, dei_link); + free(n1->dei_data, M_BUS); + free(n1, M_BUS); + } + devsoftc.queued = 0; + devctl_queue_length = 0; + } else { + devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN; + } + mtx_unlock(&devsoftc.mtx); + return (0); +} + +static int sysctl_devctl_queue(SYSCTL_HANDLER_ARGS) { struct dev_event_info *n1;