1 /*
2  * vhost-user-blk host device
3  * Copyright(C) 2017 Intel Corporation.
4  *
5  * Authors:
6  *  Changpeng Liu <changpeng.liu@intel.com>
7  *
8  * Based on vhost-scsi.h, Copyright IBM, Corp. 2011
9  *
10  * This work is licensed under the terms of the GNU LGPL, version 2 or later.
11  * See the COPYING.LIB file in the top-level directory.
12  *
13  */
14 
15 #ifndef VHOST_USER_BLK_H
16 #define VHOST_USER_BLK_H
17 
18 #include "standard-headers/linux/virtio_blk.h"
19 #include "qemu-common.h"
20 #include "hw/qdev.h"
21 #include "hw/block/block.h"
22 #include "chardev/char-fe.h"
23 #include "hw/virtio/vhost.h"
24 #include "hw/virtio/vhost-user.h"
25 
26 #define TYPE_VHOST_USER_BLK "vhost-user-blk"
27 #define VHOST_USER_BLK(obj) \
28         OBJECT_CHECK(VHostUserBlk, (obj), TYPE_VHOST_USER_BLK)
29 
30 typedef struct VHostUserBlk {
31     VirtIODevice parent_obj;
32     CharBackend chardev;
33     int32_t bootindex;
34     struct virtio_blk_config blkcfg;
35     uint16_t num_queues;
36     uint32_t queue_size;
37     uint32_t config_wce;
38     struct vhost_dev dev;
39     struct vhost_inflight *inflight;
40     VhostUserState vhost_user;
41     struct vhost_virtqueue *vqs;
42     guint watch;
43     bool connected;
44 } VHostUserBlk;
45 
46 #endif
47