Re: Disable root mount waiting for USB

From: Olivier SMEDTS <olivier_at_gid0.org>
Date: Tue, 28 Jul 2009 18:08:57 +0200
On Tue, Jul 28, 2009 at 05:18:54PM +0300, Andriy Gapon wrote:
> on 28/07/2009 16:52 Robert Noland said the following:
> > Ok, Apparently I'm incorrect here... The man page is misleading... It
> > seems that you do need to declare the TUNABLE_INT as well as change the
> > CTLFLAG_RW to CTLFLAG_RDTUN.

Attached patch tested, works as expected.

> 
> Yes, the former change is "cosmetics" (very useful variety) that turns the sysctl
> into read-only one (because changing it after boot would have no effect either
> way) and provides a hint to sysctl(1) to print much friendlier and useful error
> message when a user would attempt to change the value.
> 
> -- 
> Andriy Gapon

-- 
Olivier Smedts                                              _
                          ASCII ribbon campaign            ( )
e-mail: olivier_at_gid0.org - against HTML email & vCards      X
www: http://www.gid0.org - against proprietary attachments / \

 "Il y a seulement 10 sortes de gens dans le monde :
 ceux qui comprennent le binaire,
 et ceux qui ne le comprennent pas."

Index: sys/dev/usb/controller/usb_controller.c
===================================================================
--- sys/dev/usb/controller/usb_controller.c	(révision 195918)
+++ sys/dev/usb/controller/usb_controller.c	(copie de travail)
_at__at_ -79,6 +79,11 _at__at_
     "Debug level");
 #endif
 
+static int usb_no_boot_wait = 0;
+SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boot_wait, 0,
+    "No device enumerate waiting at boot.");
+TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wait);
+
 static uint8_t usb_post_init_called = 0;
 
 static devclass_t usb_devclass;
_at__at_ -132,8 +137,10 _at__at_
 		return (ENXIO);
 	}
 
-	/* delay vfs_mountroot until the bus is explored */
-	bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
+	if (usb_no_boot_wait == 0) {
+		/* delay vfs_mountroot until the bus is explored */
+		bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
+	}
 
 	if (usb_post_init_called) {
 		mtx_lock(&Giant);
Received on Tue Jul 28 2009 - 14:26:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:52 UTC