The type of dxfer_direction is int. This is required to be one of the following:
SG_DXFER_NONE /* e.g. a SCSI Test Unit Ready command */
SG_DXFER_TO_DEV /* e.g. a SCSI WRITE command */
SG_DXFER_FROM_DEV /* e.g. a SCSI READ command */
SG_DXFER_TO_FROM_DEV
SG_DXFER_UNKNOWN
The value SG_DXFER_TO_FROM_DEV is only relevant to indirect IO (otherwise it is treated like SG_DXFER_FROM_DEV). Data is moved from the user space to the kernel buffers. The command is then performed and most likely a READ-like command transfers data from the device into the kernel buffers. Finally the kernel buffers are copied back into the user space. This technique allows application writers to initialize the buffer and perhaps deduce the number of bytes actually read from the device (i.e. detect underrun). This is better done by using 'resid' if it is supported.
The value SG_DXFER_UNKNOWN is for those (rare) situations where the data direction is not known. It may be useful for backward compatibility of existing applications when the relevant direction information is not available in the sg interface layer. There is a (minor) performance "hit" associated with choosing this option (e.g. on the PCI bus). Some recent pseudo device drivers (e.g. USB mass storage) may have problems handling this value (especially on vendor-specific SCSI commands).
N.B. 'dxfer_direction' must have one of the five indicated values and cannot be uninitialized or zero.
If 'dxfer_len' is zero then all values are treated like SG_DXFER_NONE.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |