forked from virtualopensystems/vapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvhost_server.h
39 lines (31 loc) · 865 Bytes
/
vhost_server.h
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
/*
* vhost_server.h
*/
#ifndef VHOST_SERVER_H_
#define VHOST_SERVER_H_
#include "server.h"
#include "vring.h"
#include "stat.h"
typedef struct VhostServerMemoryRegion {
uint64_t guest_phys_addr;
uint64_t memory_size;
uint64_t userspace_addr;
uint64_t mmap_addr;
} VhostServerMemoryRegion;
typedef struct VhostServerMemory {
uint32_t nregions;
VhostServerMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS];
} VhostServerMemory;
typedef struct VhostServer {
Server* server;
VhostServerMemory memory;
VringTable vring_table;
int is_polling;
uint8_t buffer[BUFFER_SIZE];
uint32_t buffer_size;
Stat stat;
} VhostServer;
VhostServer* new_vhost_server(const char* path, int is_listen);
int end_vhost_server(VhostServer* vhost_server);
int run_vhost_server(VhostServer* vhost_server);
#endif /* VHOST_SERVER_H_ */