forked from wheelcomplex/nbd-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnbd-client.h
44 lines (31 loc) · 1.41 KB
/
nbd-client.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
40
41
42
43
44
#ifndef _NBD_CLIENT_H_
#define _NBD_CLIENT_H_
#include <sys/types.h>
struct addrinfo;
typedef struct nbd_client *nbd_client_t;
nbd_client_t nbd_client_alloc();
void nbd_client_free(nbd_client_t client);
int nbd_client_init(nbd_client_t client);
void nbd_client_close(nbd_client_t client);
int nbd_client_rights_limit(nbd_client_t client);
uint64_t nbd_client_get_size(nbd_client_t client);
bool nbd_client_get_disconnect(nbd_client_t client);
void nbd_client_set_disconnect(nbd_client_t client, bool disconnect);
void nbd_client_disable_trim(nbd_client_t client);
int nbd_client_connect(nbd_client_t client, struct addrinfo *ai);
void nbd_client_shutdown(nbd_client_t client);
int nbd_client_list(nbd_client_t client);
int nbd_client_negotiate(nbd_client_t client);
int nbd_client_send_read(nbd_client_t client, uint64_t handle,
off_t offset, size_t length);
int nbd_client_send_write(nbd_client_t client, uint64_t handle,
off_t offset, size_t length,
size_t datalen, uint8_t *data);
int nbd_client_send_flush(nbd_client_t client, uint64_t handle);
int nbd_client_send_trim(nbd_client_t client, uint64_t handle,
off_t offset, size_t length);
int nbd_client_send_disconnect(nbd_client_t client);
int nbd_client_recv_reply_header(nbd_client_t client, uint64_t *handle);
int nbd_client_recv_reply_data(nbd_client_t client, size_t length,
size_t buflen, uint8_t *buf);
#endif /* #ifndef _NBD_CLIENT_H_ */