-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathxs_dev.h
More file actions
executable file
·67 lines (58 loc) · 2.2 KB
/
xs_dev.h
File metadata and controls
executable file
·67 lines (58 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Helpers to read/write values via Xenbus were borrowed from Qemu:
* hw/xen/xen_pvdev.c
*
* (c) 2008 Gerd Hoffmann <kraxel@redhat.com>
*
* Copyright (C) 2020 EPAM Systems Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>
*/
#ifndef _XS_DEV_H
#define _XS_DEV_H
#include <xenctrl.h>
#include <xen/io/xenbus.h>
#include <xenstore.h>
#include <sys/types.h>
#define XEN_BUFSIZE 1024
struct xs_dev {
struct xs_handle *xsh;
domid_t be_domid;
domid_t fe_domid;
const char *type;
const char *devid_str;
int devid;
char be[XEN_BUFSIZE];
char path[XEN_BUFSIZE];
char *fe;
enum xenbus_state be_state;
int (*connected_cb)(void *data);
void *data;
};
struct xs_dev *xenstore_create(char *type, char *devid_str);
void xenstore_destroy(struct xs_dev *dev);
uint64_t xenstore_get_dom_mem(struct xs_dev *dev, domid_t domid);
int xenstore_connect_dom(struct xs_dev *dev, domid_t be_domid, domid_t fe_domid,
int (*connected_cb)(void *data), void *data);
void xenstore_disconnect_dom(struct xs_dev *dev);
int xenstore_get_fd(struct xs_dev *dev);
int xenstore_poll_watches(struct xs_dev *dev);
int xenstore_get_be_domid(struct xs_dev *dev);
int xenstore_wait_fe_domid(struct xs_dev *dev);
char *xenstore_read_fe_str(struct xs_dev *dev, const char *node);
int xenstore_read_fe_int(struct xs_dev *dev, const char *node, int *ival);
char *xenstore_read_be_str(struct xs_dev *dev, const char *node);
int xenstore_read_be_int(struct xs_dev *dev, const char *node, int *ival);
int xenstore_write_be_int(struct xs_dev *dev, const char *node, int ival);
#endif /* _XS_DEV_H */