Tassa Sandro wrote:
>
> Hi all,
> I'm studing how and 'trying to write' a scsi driver.
> To test driver's performance now
> I'm working with sg_utils < of Gilbert >.
> When I use sg_dd512 all work fine!
> But (there's always a but)
> when I use sg_dd2048 (on the same device with the same driver)
> I see that it writes and correctly reads only the first 2048 byte
> after that, it doesn't behave as I think:
> it writes and reads rubbish!
>
> Questions:
> Is it correct using sg_dd2048 on devices with sector size = 512?
>
> I have seen that the difference between sg_dd512 and sg_dd2048 is
> in the scsi cmnd (in the 'transfert lenght' field),
> where sg_ddXXXX writes the number of blocks.
> Who have to handle this value?
Tassa,
No it is not correct to use sg_dd2048 on devices with a
sector size of 512 bytes. The number following the sg_dd
should be the block size (sector size) of the sg device you
are trying to read or write to. For disks this is normally
512 and for CDROMs it is either 512, 2048 or 2352 depending
on a variety of factors.
READ CAPACITY is only called on a sg device by sg_dd* when
no count is given. The sector size is not checked so if
mismatched there will be an overrun or underrun. Nothing nasty
should happen to the kernel and you should be able to work
out what will happen. BTW Using sg_dd2048 to read a CD_RW
with a block size of 2352 is probably what you want.
In the sg3_utils for the sg version 3 driver there is a utility
called sg_dd in which you use "bs=<block_size>" just like
a normal dd command. There is still the same requirement on
the user to match that block size to the device in question.
Doug Gilbert
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]