From johne@zang.com  Mon Feb  9 10:39:30 2004
Return-Path: <johne@zang.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1307B16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  9 Feb 2004 10:39:30 -0800 (PST)
Received: from new.zang.com (unknown [205.150.102.81])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E782B43D31
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  9 Feb 2004 10:39:29 -0800 (PST)
	(envelope-from johne@zang.com)
Received: from localhost (localhost.zang.com [127.0.0.1])
	by new.zang.com (Postfix) with ESMTP id 4F8C23914AC
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  9 Feb 2004 13:39:29 -0500 (EST)
Received: from new.zang.com ([127.0.0.1])
 by localhost (new.zang.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 01824-09 for <FreeBSD-gnats-submit@freebsd.org>;
 Mon,  9 Feb 2004 13:39:28 -0500 (EST)
Received: by new.zang.com (Postfix, from userid 1001)
	id B5C423914A4; Mon,  9 Feb 2004 13:39:27 -0500 (EST)
Message-Id: <20040209183927.B5C423914A4@new.zang.com>
Date: Mon,  9 Feb 2004 13:39:27 -0500 (EST)
From: John Engelhart <johne@zang.com>
Reply-To: John Engelhart <johne@zang.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: asr /dev/rdpti# patch
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         62597
>Category:       kern
>Synopsis:       [asr] [patch] /dev/rdpti# patch
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    scottl
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 09 10:40:18 PST 2004
>Closed-Date:    Wed Jun 01 07:21:07 GMT 2005
>Last-Modified:  Wed Jun 01 07:21:07 GMT 2005
>Originator:     John Engelhart
>Release:        FreeBSD 5.2-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD new.zang.com 5.2-RELEASE-p2 FreeBSD 5.2-RELEASE-p2 #1: Mon Feb 9 10:51:29 EST 2004 johne@new.zang.com:/usr/src/sys/i386/compile/new i386


	
>Description:
The utilities for the Adaptec RAID cards that use the asr driver (ie,
Adaptect 2100s, 3210S, 3410S, etc) open the device /dev/rdpti# to communicate
with the HBA.  The asr device driver creates a device /dev/rasr#.  The
utilities, such as raidtuil, fork a 'dpteng' process to do all the
communications. In FreeBSD's prior to 5, dpteng would call
mknod("/dev/rdpti#",154,0); if the rdpti device wasn't there.

These mknod() calls are failing in FreeBSD 5 w/ "No such file or directory"
error code.  Not sure what changed in the devfs symantics, but I'm of the
opinion that dpteng shouldn't be calling mknod like this anyways.

One way to fix this is to create a symlink, ln -s /dev/rasr0 /dev/rdpti0.

This patch creates that symlink automagically from within the asr driver.
It uses make_dev_alias() to do so.  Therefore the Adaptec supplied
RAID utils will continue to work without having to manually ln -s
the rdpti device.

Prior to patch:
[root@new] /dev# /usr/local/dpt/raidutil -L all

Engine connect failed: COMPATILITY number
osdIOrequest : File /dev/rdptr17 Could Not Be Opened

[disregard the device it says it can't open, it actually walks 0-17 and
has a few names for it: dpti, rdpti, rdptir, etc..]
>How-To-Repeat:
 
>Fix:
--- asr.c~      Fri Sep 26 11:56:42 2003
+++ asr.c       Mon Feb  9 10:48:54 2004
@@ -2782,6 +2782,7 @@
 {
        Asr_softc_t              * sc;
        struct scsi_inquiry_data * iq;
+       dev_t                      dev;
        ATTACH_SET();
 
        if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) ==
@@ -3127,8 +3128,11 @@
        /*
         *      Generate the device node information
         */
-       (void)make_dev(&asr_cdevsw, unit, UID_ROOT, GID_OPERATOR, 0640,
+       dev = make_dev(&asr_cdevsw, unit, UID_ROOT, GID_OPERATOR, 0640,
            "rasr%d", unit);
+       if(dev) {
+         (void)make_dev_alias(dev,"rdpti%d",unit);
+       }
        ATTACH_RETURN(0);
 } /* asr_attach */
 
	


>Release-Note:
>Audit-Trail:

From: "Patrick M. Hausen" <hausen@punkt.de>
To: freebsd-gnats-submit@FreeBSD.org, johne@zang.com
Cc:  
Subject: Re: kern/62597: asr /dev/rdpti# patch
Date: Mon, 16 Feb 2004 09:22:59 +0100 (CET)

 Hello!
 
 Instead of the kernel patch why not simply enter
 
 	link    rasr0   rdpti0
 
 into /etc/devfs.conf?
 
 Regards,
 
 Patrick M. Hausen
 Leiter Netzwerke und Sicherheit
 -- 
 punkt.de GmbH         Internet - Dienstleistungen - Beratung
 Vorholzstr. 25        Tel. 0721 9109 -0 Fax: -100
 76137 Karlsruhe       http://punkt.de

From: John Engelhart <johne@zang.com>
To: "Patrick M. Hausen" <hausen@punkt.de>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/62597: asr /dev/rdpti# patch
Date: Mon, 16 Feb 2004 11:05:44 -0500

 Huh.  New 5.2 feature, I take it?  I didn't know about that, but if it 
 accomplishes the same thing, probably a better place to put it.
 
 The only thing I can think of is, and I'm not familiar with devfs.conf 
 syntax, is:
 
 Would devfs.conf iterate over all the available rasr# that are 
 installed?  Or would you have to make a link for 0 - 15, and then those 
 that aren't installed would just fail?
 
 Doesn't particularly matter which way it gets done, I'd defer to the 
 'cleanest' method.
 
 On Feb 16, 2004, at 3:22 AM, Patrick M. Hausen wrote:
 
 > Hello!
 >
 > Instead of the kernel patch why not simply enter
 >
 > 	link    rasr0   rdpti0
 >
 > into /etc/devfs.conf?
 >
 > Regards,
 >
 > Patrick M. Hausen
 > Leiter Netzwerke und Sicherheit
 > -- 
 > punkt.de GmbH         Internet - Dienstleistungen - Beratung
 > Vorholzstr. 25        Tel. 0721 9109 -0 Fax: -100
 > 76137 Karlsruhe       http://punkt.de
 >
 
Responsible-Changed-From-To: freebsd-bugs->scottl 
Responsible-Changed-By: green 
Responsible-Changed-When: Thu Apr 28 19:49:55 GMT 2005 
Responsible-Changed-Why:  
Over to scottl to try to get this closed -- a link from asr%d to dpti%d 
is a perfectly workable solution, and belongs in the driver.  With that 
and ports/72520, asr-tools work. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62597 

From: Scott Long <scottl@samsco.org>
To: bug-followup@FreeBSD.org, johne@zang.com
Cc:  
Subject: Re: kern/62597: [asr] [patch] /dev/rdpti# patch
Date: Thu, 28 Apr 2005 14:16:52 -0600

 The cleanest method is to create the device alias in the driver.
 6-CURRENT already has this, though it originated from me, not from the
 PR.  6-CURRENT also has the correct fix for the engine version number
 problem.  I will merge these fixes to RELENG_5 and hopefully to 5.4.
 
 Scott
State-Changed-From-To: open->closed 
State-Changed-By: scottl 
State-Changed-When: Wed Jun 1 07:19:18 GMT 2005 
State-Changed-Why:  
Now that 5-STABLE and 6-CURRENT both have working /dev entries and ioctls, 
this can be closed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62597 
>Unformatted:
