xen/9pfs: introduce Xen 9pfs backend
[qemu.git] / hw / 9pfs / xen-9p-backend.c
1 /*
2 * Xen 9p backend
3 *
4 * Copyright Aporeto 2017
5 *
6 * Authors:
7 * Stefano Stabellini <stefano@aporeto.com>
8 *
9 */
10
11 #include "qemu/osdep.h"
12
13 #include "hw/hw.h"
14 #include "hw/9pfs/9p.h"
15 #include "hw/xen/xen_backend.h"
16 #include "hw/9pfs/xen-9pfs.h"
17 #include "qemu/config-file.h"
18 #include "fsdev/qemu-fsdev.h"
19
20 typedef struct Xen9pfsDev {
21 struct XenDevice xendev; /* must be first */
22 } Xen9pfsDev;
23
24 static ssize_t xen_9pfs_pdu_vmarshal(V9fsPDU *pdu,
25 size_t offset,
26 const char *fmt,
27 va_list ap)
28 {
29 return 0;
30 }
31
32 static ssize_t xen_9pfs_pdu_vunmarshal(V9fsPDU *pdu,
33 size_t offset,
34 const char *fmt,
35 va_list ap)
36 {
37 return 0;
38 }
39
40 static void xen_9pfs_init_out_iov_from_pdu(V9fsPDU *pdu,
41 struct iovec **piov,
42 unsigned int *pniov)
43 {
44 }
45
46 static void xen_9pfs_init_in_iov_from_pdu(V9fsPDU *pdu,
47 struct iovec **piov,
48 unsigned int *pniov,
49 size_t size)
50 {
51 }
52
53 static void xen_9pfs_push_and_notify(V9fsPDU *pdu)
54 {
55 }
56
57 static const struct V9fsTransport xen_9p_transport = {
58 .pdu_vmarshal = xen_9pfs_pdu_vmarshal,
59 .pdu_vunmarshal = xen_9pfs_pdu_vunmarshal,
60 .init_in_iov_from_pdu = xen_9pfs_init_in_iov_from_pdu,
61 .init_out_iov_from_pdu = xen_9pfs_init_out_iov_from_pdu,
62 .push_and_notify = xen_9pfs_push_and_notify,
63 };
64
65 static int xen_9pfs_init(struct XenDevice *xendev)
66 {
67 return 0;
68 }
69
70 static int xen_9pfs_free(struct XenDevice *xendev)
71 {
72 return -1;
73 }
74
75 static int xen_9pfs_connect(struct XenDevice *xendev)
76 {
77 return 0;
78 }
79
80 static void xen_9pfs_alloc(struct XenDevice *xendev)
81 {
82 }
83
84 static void xen_9pfs_disconnect(struct XenDevice *xendev)
85 {
86 }
87
88 struct XenDevOps xen_9pfs_ops = {
89 .size = sizeof(Xen9pfsDev),
90 .flags = DEVOPS_FLAG_NEED_GNTDEV,
91 .alloc = xen_9pfs_alloc,
92 .init = xen_9pfs_init,
93 .initialise = xen_9pfs_connect,
94 .disconnect = xen_9pfs_disconnect,
95 .free = xen_9pfs_free,
96 };