virtio_blk.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _LINUX_VIRTIO_BLK_H
  2. #define _LINUX_VIRTIO_BLK_H
  3. #include <linux/virtio_config.h>
  4. /* The ID for virtio_block */
  5. #define VIRTIO_ID_BLOCK 2
  6. /* Feature bits */
  7. #define VIRTIO_CONFIG_BLK_F 0x40
  8. #define VIRTIO_BLK_F_BARRIER 1 /* Does host support barriers? */
  9. /* The capacity (in 512-byte sectors). */
  10. #define VIRTIO_CONFIG_BLK_F_CAPACITY 0x41
  11. /* The maximum segment size. */
  12. #define VIRTIO_CONFIG_BLK_F_SIZE_MAX 0x42
  13. /* The maximum number of segments. */
  14. #define VIRTIO_CONFIG_BLK_F_SEG_MAX 0x43
  15. /* These two define direction. */
  16. #define VIRTIO_BLK_T_IN 0
  17. #define VIRTIO_BLK_T_OUT 1
  18. /* This bit says it's a scsi command, not an actual read or write. */
  19. #define VIRTIO_BLK_T_SCSI_CMD 2
  20. /* Barrier before this op. */
  21. #define VIRTIO_BLK_T_BARRIER 0x80000000
  22. /* This is the first element of the read scatter-gather list. */
  23. struct virtio_blk_outhdr
  24. {
  25. /* VIRTIO_BLK_T* */
  26. __u32 type;
  27. /* io priority. */
  28. __u32 ioprio;
  29. /* Sector (ie. 512 byte offset) */
  30. __u64 sector;
  31. /* Where to put reply. */
  32. __u64 id;
  33. };
  34. #define VIRTIO_BLK_S_OK 0
  35. #define VIRTIO_BLK_S_IOERR 1
  36. #define VIRTIO_BLK_S_UNSUPP 2
  37. /* This is the first element of the write scatter-gather list */
  38. struct virtio_blk_inhdr
  39. {
  40. unsigned char status;
  41. };
  42. #endif /* _LINUX_VIRTIO_BLK_H */