Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 May 2001 01:38:04 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        Clemens Hermann <haribeau@gmx.de>
Cc:        Mike Smith <msmith@freebsd.org>, freebsd-scsi@freebsd.org, msmeyer@gmx.net
Subject:   Re: quick mly hack 
Message-ID:  <200105240838.f4O8c4N01021@mass.dis.org>
In-Reply-To: Your message of "Thu, 24 May 2001 12:09:31 %2B0200." <20010524120931.A931@ramses.local> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Am 23.05.2001 um 23:48:57 schrieb Mike Smith:
> Hi Mike,
> 
> > We should probably lie about anything that might be an enclosure, such that 
> > it looks like it never actually responded in the first place.
> 
> yes, but I do not know how to check if a device is a disk or somthing
> else :-(. Could you give me a snippet or a hint how this could be done?

Sure.  In mly_cam.c, something like this:

*** /sys/dev/mly/mly_cam.c	Sat Mar  3 01:40:26 2001
--- mly_cam.c	Thu May 24 01:36:11 2001
***************
*** 509,536 ****
      csio->scsi_status = mc->mc_status;
      switch(mc->mc_status) {
      case SCSI_STATUS_OK:
  	/*
! 	 * In order to report logical device type and status, we overwrite
! 	 * the result of the INQUIRY command to logical devices.
  	 */
! 	bus = csio->ccb_h.sim_priv.entries[0].field;
! 	if (bus >= sc->mly_controllerinfo->physical_channels_present) {
! 	    if (csio->ccb_h.flags & CAM_CDB_POINTER) {
! 		cmd = *csio->cdb_io.cdb_ptr;
! 	    } else {
! 		cmd = csio->cdb_io.cdb_bytes[0];
! 	    }
! 	    if (cmd == INQUIRY) {
  		target = csio->ccb_h.target_id;
  		btl = &sc->mly_btl[bus][target];
  		padstr(inq->vendor, mly_describe_code(mly_table_device_type, btl->mb_type), 8);
  		padstr(inq->product, mly_describe_code(mly_table_device_state, btl->mb_state), 16);
  		padstr(inq->revision, "", 4);
  	    }
  	}
  
- 	debug(2, "SCSI_STATUS_OK");
- 	csio->ccb_h.status = CAM_REQ_CMP;
  	break;
  
      case SCSI_STATUS_CHECK_COND:
--- 509,546 ----
      csio->scsi_status = mc->mc_status;
      switch(mc->mc_status) {
      case SCSI_STATUS_OK:
+ 	debug(2, "SCSI_STATUS_OK");
+ 	csio->ccb_h.status = CAM_REQ_CMP;
  	/*
! 	 * We handle the result of INQUIRY commands specially in several cases.
  	 */
! 	if (csio->ccb_h.flags & CAM_CDB_POINTER) {
! 	    cmd = *csio->cdb_io.cdb_ptr;
! 	} else {
! 	    cmd = csio->cdb_io.cdb_bytes[0];
! 	}
! 	if (cmd == INQUIRY) {
! 	    /*
! 	     * In order to report logical device type and status, we overwrite
! 	     * the result of the INQUIRY command to logical devices.
! 	     */
! 	    bus = csio->ccb_h.sim_priv.entries[0].field;
! 	    if (bus >= sc->mly_controllerinfo->physical_channels_present) {
  		target = csio->ccb_h.target_id;
  		btl = &sc->mly_btl[bus][target];
  		padstr(inq->vendor, mly_describe_code(mly_table_device_type, btl->mb_type), 8);
  		padstr(inq->product, mly_describe_code(mly_table_device_state, btl->mb_state), 16);
  		padstr(inq->revision, "", 4);
  	    }
+ 	    /*
+ 	     * In order to hide enclosure devices, we fail the INQUIRY command.
+ 	     */
+ 	    if ((inq->device & 0x1f) == T_ENCLOSURE) {
+ 		csio->ccb_h.status = CAM_SEL_TIMEOUT;
+ 		break;
+ 	    }
  	}
  
  	break;
  
      case SCSI_STATUS_CHECK_COND:

Hope this helps; let me know how you go because I'd like to commit 
something useful, and I don't have any enclosure controllers.

Regards,
Mike
-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E



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?200105240838.f4O8c4N01021>