Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Feb 2001 07:33:36 -0600
From:      "Jacques A. Vidrine" <n@nectar.com>
To:        freebsd-scsi@freebsd.org
Subject:   umass-sim device
Message-ID:  <20010202073336.C58832@spawn.nectar.com>

next in thread | raw e-mail | index | archive | help
Hi All,

I recently got a SanDisk Imagemate USB.  Works great!

However, the next time I rebooted my machine, it was picked as `da0',
and so file system mounts failed, etc.  I figured ``no problem, I'll
just wire these bad boys down''.  The problem is that the umass-sim
device has a dash in it, and config can't deal with it (it generates
identifiers that aren't valid e.g. umass-sim0_resources).

I worked around it for now by editing ioconf.c directly.

What say we make DEVNAME_SIM "umass_sim" or even "umasssim"?

Or perhaps the following (untested, and perhaps naive) patch to config
is in order?

--- mkioconf.c.orig	Wed Jan 24 11:17:19 2001
+++ mkioconf.c	Wed Jan 24 11:33:30 2001
@@ -60,13 +60,25 @@
 	return dp->d_name;
 }
 
+static char *
+sdevstr(struct device *dp)
+{
+    char *p, *q;
+    
+    p = devstr(dp);
+    for (q = p; *q; q++)
+	    if (!isalnum(*q) && *q != '_')
+		    *q = '_';
+    return p;
+}
+
 static void
 write_device_resources(FILE *fp, struct device *dp)
 {
     int count = 0;
     char buf[80];
 
-    fprintf(fp, "struct config_resource %s_resources[] = {\n", devstr(dp));
+    fprintf(fp, "struct config_resource %s_resources[] = {\n", sdevstr(dp));
     if (dp->d_conn) {
 	if (dp->d_connunit >= 0)
 	    snprintf(buf, sizeof(buf), "%s%d", dp->d_conn, dp->d_connunit);
@@ -124,7 +136,7 @@
 	count++;
     }
     fprintf(fp, "};\n");
-    fprintf(fp, "#define %s_count %d\n", devstr(dp), count);
+    fprintf(fp, "#define %s_count %d\n", sdevstr(dp), count);
 }
 
 static void
@@ -152,7 +164,7 @@
 	count = 0;
 	fprintf(fp, "struct config_device config_devtab[] = {\n");
 	for (dp = dtab; dp != 0; dp = dp->d_next) {
-		char* n = devstr(dp);
+		char* n = sdevstr(dp);
 		if (dp->d_type != DEVICE)
 			continue;
 		if (dp->d_unit == UNKNOWN)



Cheers,
-- 
Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010202073336.C58832>