This message is from the T13 list server.
> > Seeing that C/D I/O = x02 DataIn or x00 DataOut > > is the only way a > > host can discover which way the device wants to move data for a > > command not standardised before both the host and the device > > shipped. > I do not know of any host > that can function properly > if it does not know the direction of data transfer > for a command BEFORE the command is issued to the device. This sounds like old ground? Microsoft Windows, for example, actually does work this way. The software that constructs the Cdb sends it down with an expected direction for data to move. The layers below report back up how much data did move which way. Actual layers vary in quality. The best stuff refuses to move more than the expected amount of data and refuses to move data in any but the expected direction. > If a host doesn't know the command is a "write" > then where will it find the data the device will request. C language APIs for i/o commonly distinguish block read, block write, and other, aka ioctl, aka "the rubbish bin of Unix". The ioctl API then often includes a "void *" parameter. People commonly don't do the work to separate the ioctl API into "void *" for moving data in and "void const *" for moving data out. When some low layer lets data move unexpectedly in, then the "void *" buffer gets written, no matter if the upper layer thought of that buffer as a "void const *". Consequently, for i/o other than block read/write, it's Good Practice to decide the content of your data buffer even before writes, and the paranoid have been seen to check the content afterwards. Pat LaVarre Subscribe/Unsubscribe instructions can be found at www.t13.org.
