OSDN Git Service

31dbc98fe0fcae6e16b84dd6435d1c80bfb67ec1
[qmiga/qemu.git] / hw / i386 / kvm / xenstore_impl.c
1 /*
2  * QEMU Xen emulation: The actual implementation of XenStore
3  *
4  * Copyright © 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5  *
6  * Authors: David Woodhouse <dwmw2@infradead.org>, Paul Durrant <paul@xen.org>
7  *
8  * This work is licensed under the terms of the GNU GPL, version 2 or later.
9  * See the COPYING file in the top-level directory.
10  */
11
12 #include "qemu/osdep.h"
13
14 #include "xen_xenstore.h"
15 #include "xenstore_impl.h"
16
17 struct XenstoreImplState {
18 };
19
20 int xs_impl_read(XenstoreImplState *s, unsigned int dom_id,
21                  xs_transaction_t tx_id, const char *path, GByteArray *data)
22 {
23     /*
24      * The data GByteArray shall exist, and will be freed by caller.
25      * Just g_byte_array_append() to it.
26      */
27     return ENOENT;
28 }
29
30 int xs_impl_write(XenstoreImplState *s, unsigned int dom_id,
31                   xs_transaction_t tx_id, const char *path, GByteArray *data)
32 {
33     /*
34      * The data GByteArray shall exist, will be freed by caller. You are
35      * free to use g_byte_array_steal() and keep the data.
36      */
37     return ENOSYS;
38 }
39
40 int xs_impl_directory(XenstoreImplState *s, unsigned int dom_id,
41                       xs_transaction_t tx_id, const char *path,
42                       uint64_t *gencnt, GList **items)
43 {
44     /*
45      * The items are (char *) to be freed by caller. Although it's consumed
46      * immediately so if you want to change it to (const char *) and keep
47      * them, go ahead and change the caller.
48      */
49     return ENOENT;
50 }
51
52 int xs_impl_transaction_start(XenstoreImplState *s, unsigned int dom_id,
53                               xs_transaction_t *tx_id)
54 {
55     return ENOSYS;
56 }
57
58 int xs_impl_transaction_end(XenstoreImplState *s, unsigned int dom_id,
59                             xs_transaction_t tx_id, bool commit)
60 {
61     return ENOSYS;
62 }
63
64 int xs_impl_rm(XenstoreImplState *s, unsigned int dom_id,
65                xs_transaction_t tx_id, const char *path)
66 {
67     return ENOSYS;
68 }
69
70 int xs_impl_get_perms(XenstoreImplState *s, unsigned int dom_id,
71                       xs_transaction_t tx_id, const char *path, GList **perms)
72 {
73     /*
74      * The perms are (char *) in the <perm-as-string> wire format to be
75      * freed by the caller.
76      */
77     return ENOSYS;
78 }
79
80 int xs_impl_set_perms(XenstoreImplState *s, unsigned int dom_id,
81                       xs_transaction_t tx_id, const char *path, GList *perms)
82 {
83     /*
84      * The perms are (const char *) in the <perm-as-string> wire format.
85      */
86     return ENOSYS;
87 }
88
89 int xs_impl_watch(XenstoreImplState *s, unsigned int dom_id, const char *path,
90                   const char *token, xs_impl_watch_fn fn, void *opaque)
91 {
92     /*
93      * When calling the callback @fn, note that the path should
94      * precisely match the relative path that the guest provided, even
95      * if it was a relative path which needed to be prefixed with
96      * /local/domain/${domid}/
97      */
98     return ENOSYS;
99 }
100
101 int xs_impl_unwatch(XenstoreImplState *s, unsigned int dom_id,
102                     const char *path, const char *token,
103                     xs_impl_watch_fn fn, void *opaque)
104 {
105     /* Remove the watch that matches all four criteria */
106     return ENOSYS;
107 }
108
109 int xs_impl_reset_watches(XenstoreImplState *s, unsigned int dom_id)
110 {
111     return ENOSYS;
112 }
113
114 XenstoreImplState *xs_impl_create(void)
115 {
116     return g_new0(XenstoreImplState, 1);
117 }