How to determine IORequest size?

7 posts / 0 new
Last post
hypex
hypex's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-09-09 16:20
How to determine IORequest size?
I'm wondering how to determine the correct IORequest size for a particular device driver? For eaxmple if one was opening a device that could be SCSI, IDE or USB how do you find out the correct IO block size? Is there a generic size? I've seen IOExtTD used but does this cover all bases? On a related note I wonder how the filesystem figures this out? Since it is given device and unit only AFAIK. I see no mention of IO block size. Since it can differ between devices I wonder what a safe size would be. :-)
thomas
thomas's picture
Offline
Last seen: 1 week 4 days ago
Joined: 2011-05-16 14:23
You have to consult the
You have to consult the documentation of the respective device for this information. Similar devices should be compatible to each other. For example SCSI, IDE, RamDrive etc. should all use the same size. USB might be different. Check the docs.
hypex
hypex's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-09-09 16:20
That was my first thought as
That was my first thought as well. However, looking up device includes I see no USB one on OS4 for example. I knew the TD one was standard for a while but HD or other types of drives is not a floppy! So I don't know how that cane about. There are some circumstances where I don't know what device is in use. Say a program that takes a device and unit as an argument. How then do I determine a compatible IORequest size from simply that? I could search in the device name for hints like "usb" but that is messy and not the way I would like to do it. Especially if there is no USB IO size to reference. Another example is being given a DOS device name and extracting the device and unit from that to work with. The end result is the same, a device and unit but no clue as to how long the IO block size should be. But, Amiga software has has to deal with this since time immemorial, so maybe I am making a bug fuss about nothing. Like DiskMonTools lets you select a DOS device, which it would then open as an Exec device to read and do speed tests. And that has had no problem on more modern devices like USB sticks. In the past I have used a max size, IIRC it can be 64K, and it seemed to be fine. Though I wondered if the size, though large enough, would affect it. Since it was higher than any other standard size.
thomas
thomas's picture
Offline
Last seen: 1 week 4 days ago
Joined: 2011-05-16 14:23
Well, NSD attempted to give
Well, NSD attempted to give you a means to ask the device what type it is. But it is henn-and-egg problem: you need to open the device in order to call this function. So your approach to use the biggest request type you can find is probably the best one. Although 64k is very big. You should check all the include files and measure their size. I think a printer request is the biggest, but not sure. Most massstorage devices should be fine with IOStdReq. With the slightly bigger IOExtTD trackdisk.device is happy, too, so you can use this for all massstorage devices. Don't know what you mean by USB hints. If you want to do some USB-specific stuff, it should be documented how to do this and which request size is needed. If you just want to accesss a massstorage device which is connected through USB, it is not USB-specific. Accessing usbscsi.device should be the same as accessing scsi.device (IOStdReq or IOExtTD). I am not entirely sure but I think that the extra fields begind the IOStdReq are only accessed if you use special commands (i.e. ETD_#?). So if you only use CMD_READ, CMD_WRITE and so on, a IOStdReq should be sufficient.
hypex
hypex's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-09-09 16:20
Thanks for your input on thus
Thanks for your input on thus discussion. I was also thinking of NSD and did look through the commands but yes once you open it too late to enquire of IORequest size! :-) 64K is big yes but I thought woukd be small by modern standards. Even if I could fit the entire RAM image of a C64 in there. ;-) IOStdReq did look good to me though I wondered if it was big enough. Still a good device driver wlll check the size and return error if too small. A bad one will crash. For USB hints I meant to search the device name for things like "usb" that would be found in usbdisk.device for example. But I think this would be unnecessary. And yes I would just want to access USB stick through its normal device driver. So if it's all the same to the OS then that is good if I can use an IOStdReq or similar. I do recall the extended command set though don' tthink I would really need to use it. A CMD_READ is all I really need. It pretty much covers all bases. No need to mess with SCSI commands by convention. And IDE drivers give SCSI errors in debug log. I see it a lot.
ssolie
ssolie's picture
Offline
Last seen: 5 years 10 months ago
Joined: 2011-02-03 06:55
I was also thinking of NSD
I was also thinking of NSD and did look through the commands but yes once you open it too late to enquire of IORequest size! :-)
You can find the NSD standard on the wiki. Here is the specific area you are probably thinking of: http://wiki.amigaos.net/index.php/NSD_Command_Specifications#New_Style_Check_in_C
hypex
hypex's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-09-09 16:20
Yes that does provide some
Yes that does provide some interesting info. Thanks.
Log in or register to post comments