changeset 13208:aecca69fdd0e

260 some drivers erroneously discount a major of 0 Reviewed by: garrett@nexenta.com, gwr@nexenta.com Approved by: garrett@nexenta.com
author Richard Lowe <richlowe@richlowe.net>
date Mon, 11 Oct 2010 18:41:37 -0400
parents 4f482eb481b3
children fb2a6c8baa25
files usr/src/cmd/modload/drvsubr.c usr/src/uts/common/ktli/t_kopen.c
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/modload/drvsubr.c	Tue Oct 12 19:37:15 2010 +0400
+++ b/usr/src/cmd/modload/drvsubr.c	Mon Oct 11 18:41:37 2010 -0400
@@ -2316,8 +2316,15 @@
 			return (ERROR);
 	}
 
-	/* find first free major number */
-	for (i = 0; i < max_dev; i++) {
+	/*
+	 * Find the first free major number.
+	 *
+	 * Note that we begin searching from 1, as drivers have developer the
+	 * erroneous assumption that a dev_t of 0 is invalid, and since we no
+	 * longer include system devices in the base files, a major number of
+	 * 0 may now be given to arbitrary devices.
+	 */
+	for (i = 1; i < max_dev; i++) {
 		if (num_list[i] != 1) {
 			new_maj = i;
 			break;
--- a/usr/src/uts/common/ktli/t_kopen.c	Tue Oct 12 19:37:15 2010 +0400
+++ b/usr/src/uts/common/ktli/t_kopen.c	Mon Oct 11 18:41:37 2010 -0400
@@ -36,8 +36,6 @@
  * contributors.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * Kernel TLI-like function to initialize a transport
  * endpoint using the protocol specified.
@@ -94,7 +92,7 @@
 	error = 0;
 	retval = 0;
 	if (fp == NULL) {
-		if (rdev == 0 || rdev == NODEV) {
+		if (rdev == NODEV) {
 			KTLILOG(1, "t_kopen: null device\n", 0);
 			return (EINVAL);
 		}