~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to hw/virtio-blk.h

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno, Aurelien Jarno
  • Date: 2009-03-22 10:13:17 UTC
  • mfrom: (1.2.1 upstream) (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090322101317-iigjtnu5qil35dtb
Tags: 0.10.1-1
[ Aurelien Jarno ]
* New upstream stable release:
  - patches/80_stable-branch.patch: remove.
* debian/control: 
  - Remove depends on proll.
  - Move depends on device-tree-compiler to build-depends.
  - Bump Standards-Version to 3.8.1 (no changes).
* patches/82_qemu-img_decimal.patch: new patch from upstream to make
  qemu-img accept sizes with decimal values (closes: bug#501400).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Virtio Block Device
 
3
 *
 
4
 * Copyright IBM, Corp. 2007
 
5
 *
 
6
 * Authors:
 
7
 *  Anthony Liguori   <aliguori@us.ibm.com>
 
8
 *
 
9
 * This work is licensed under the terms of the GNU GPL, version 2.  See
 
10
 * the COPYING file in the top-level directory.
 
11
 *
 
12
 */
 
13
 
 
14
#ifndef _QEMU_VIRTIO_BLK_H
 
15
#define _QEMU_VIRTIO_BLK_H
 
16
 
 
17
#include "virtio.h"
 
18
#include "block.h"
 
19
#include "pci.h"
 
20
 
 
21
/* from Linux's linux/virtio_blk.h */
 
22
 
 
23
/* The ID for virtio_block */
 
24
#define VIRTIO_ID_BLOCK 2
 
25
 
 
26
/* Feature bits */
 
27
#define VIRTIO_BLK_F_BARRIER    0       /* Does host support barriers? */
 
28
#define VIRTIO_BLK_F_SIZE_MAX   1       /* Indicates maximum segment size */
 
29
#define VIRTIO_BLK_F_SEG_MAX    2       /* Indicates maximum # of segments */
 
30
#define VIRTIO_BLK_F_GEOMETRY   4       /* Indicates support of legacy geometry */
 
31
 
 
32
struct virtio_blk_config
 
33
{
 
34
    uint64_t capacity;
 
35
    uint32_t size_max;
 
36
    uint32_t seg_max;
 
37
    uint16_t cylinders;
 
38
    uint8_t heads;
 
39
    uint8_t sectors;
 
40
} __attribute__((packed));
 
41
 
 
42
/* These two define direction. */
 
43
#define VIRTIO_BLK_T_IN         0
 
44
#define VIRTIO_BLK_T_OUT        1
 
45
 
 
46
/* This bit says it's a scsi command, not an actual read or write. */
 
47
#define VIRTIO_BLK_T_SCSI_CMD   2
 
48
 
 
49
/* Barrier before this op. */
 
50
#define VIRTIO_BLK_T_BARRIER    0x80000000
 
51
 
 
52
/* This is the first element of the read scatter-gather list. */
 
53
struct virtio_blk_outhdr
 
54
{
 
55
    /* VIRTIO_BLK_T* */
 
56
    uint32_t type;
 
57
    /* io priority. */
 
58
    uint32_t ioprio;
 
59
    /* Sector (ie. 512 byte offset) */
 
60
    uint64_t sector;
 
61
};
 
62
 
 
63
#define VIRTIO_BLK_S_OK         0
 
64
#define VIRTIO_BLK_S_IOERR      1
 
65
#define VIRTIO_BLK_S_UNSUPP     2
 
66
 
 
67
/* This is the first element of the write scatter-gather list */
 
68
struct virtio_blk_inhdr
 
69
{
 
70
    unsigned char status;
 
71
};
 
72
 
 
73
void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs);
 
74
 
 
75
#endif