2 * QEMU Xen emulation: The actual implementation of XenStore
4 * Copyright © 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 * Authors: David Woodhouse <dwmw2@infradead.org>
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.
12 #ifndef QEMU_XENSTORE_IMPL_H
13 #define QEMU_XENSTORE_IMPL_H
15 #include "hw/xen/xen_backend_ops.h"
17 typedef struct XenstoreImplState XenstoreImplState
;
19 XenstoreImplState
*xs_impl_create(unsigned int dom_id
);
21 char *xs_perm_as_string(unsigned int perm
, unsigned int domid
);
24 * These functions return *positive* error numbers. This is a little
25 * unconventional but it helps to keep us honest because there is
26 * also a very limited set of error numbers that they are permitted
27 * to return (those in xsd_errors).
30 int xs_impl_read(XenstoreImplState
*s
, unsigned int dom_id
,
31 xs_transaction_t tx_id
, const char *path
, GByteArray
*data
);
32 int xs_impl_write(XenstoreImplState
*s
, unsigned int dom_id
,
33 xs_transaction_t tx_id
, const char *path
, GByteArray
*data
);
34 int xs_impl_directory(XenstoreImplState
*s
, unsigned int dom_id
,
35 xs_transaction_t tx_id
, const char *path
,
36 uint64_t *gencnt
, GList
**items
);
37 int xs_impl_transaction_start(XenstoreImplState
*s
, unsigned int dom_id
,
38 xs_transaction_t
*tx_id
);
39 int xs_impl_transaction_end(XenstoreImplState
*s
, unsigned int dom_id
,
40 xs_transaction_t tx_id
, bool commit
);
41 int xs_impl_rm(XenstoreImplState
*s
, unsigned int dom_id
,
42 xs_transaction_t tx_id
, const char *path
);
43 int xs_impl_get_perms(XenstoreImplState
*s
, unsigned int dom_id
,
44 xs_transaction_t tx_id
, const char *path
, GList
**perms
);
45 int xs_impl_set_perms(XenstoreImplState
*s
, unsigned int dom_id
,
46 xs_transaction_t tx_id
, const char *path
, GList
*perms
);
48 /* This differs from xs_watch_fn because it has the token */
49 typedef void(xs_impl_watch_fn
)(void *opaque
, const char *path
,
51 int xs_impl_watch(XenstoreImplState
*s
, unsigned int dom_id
, const char *path
,
52 const char *token
, xs_impl_watch_fn fn
, void *opaque
);
53 int xs_impl_unwatch(XenstoreImplState
*s
, unsigned int dom_id
,
54 const char *path
, const char *token
, xs_impl_watch_fn fn
,
56 int xs_impl_reset_watches(XenstoreImplState
*s
, unsigned int dom_id
);
58 GByteArray
*xs_impl_serialize(XenstoreImplState
*s
);
59 int xs_impl_deserialize(XenstoreImplState
*s
, GByteArray
*bytes
,
60 unsigned int dom_id
, xs_impl_watch_fn watch_fn
,
63 #endif /* QEMU_XENSTORE_IMPL_H */