tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Implement mode_select for atapi tape drives

On Sat, Aug 08, 2009 at 05:28:37AM -0700, Paul Goyette wrote:
> On Sat, 8 Aug 2009, Marc Balmer wrote:
>>> The attached patch implements the mode_select operation for atapi 
>>> tape drives.  It is enabled only via a new quirk setting, so existing 
>>> drives that haven't explicitly been determined to support this op 
>>> won't even attempt it.  (This is essentially the same patch as in PR 
>>> kern/34832.)
>>> I've been running this in my own systems for about 3 1/2 years now, 
>>> with my Seagate STT3401A (Travan 20/40GB) drive.  I'll submit a 
>>> separate patch later with a cleaned-up quick setting for this drive.
>>> This patch is actually required for the above tape drive to operate  
>>> properly under NetBSD.  The drive supports both 512-byte and 
>>> 1024-byte block sizes, but defaults to 1024-bytes.  Without this 
>>> patch there it isn't possible to write 512-byte records to the tape!
>>> Any objections to committing this?
>> Why do you use
>> memset(&atapi_select, 0, atapi_select_len);
>> instead of
>> memset(&atapi_select, 0, sizeof(atapi_select));
>> and zap the u_int atapi_select_len variable?
> Good question!
> Basically, this whole routine was copied almost verbatim from the  
> equivalent code in sys/dev/scsipi/st_scsi.c which also calculates the  
> number of bytes to clear.  Since it worked, I never looked any further.

Why haven't you extracted the code from sys/dev/atapi/ and from
sys/dev/scsipi/ for reuse in both places?  Sounds like it will save you
some trouble:

> If I change my patch, I'd want to update the calculation in st_scsi.c as  
> well, to keep them in sync.


David Young             OJC Technologies      Urbana, IL * (217) 278-3933

Home | Main Index | Thread Index | Old Index