2011-10-10 08:20:39 +02:00
|
|
|
#ifndef BUSE_H_INCLUDED
|
|
|
|
#define BUSE_H_INCLUDED
|
2011-09-20 10:26:10 +02:00
|
|
|
|
2012-12-07 07:13:43 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-12-07 12:58:26 +01:00
|
|
|
/* Most of this file was copied from nbd.h in the nbd distribution. */
|
2011-11-23 23:34:43 +01:00
|
|
|
#include <linux/types.h>
|
2011-09-20 11:30:00 +02:00
|
|
|
#include <sys/types.h>
|
2013-06-27 19:27:40 +02:00
|
|
|
#include <linux/nbd.h>
|
2011-11-23 23:34:43 +01:00
|
|
|
|
2012-12-07 12:58:26 +01:00
|
|
|
struct buse_operations {
|
|
|
|
int (*read)(void *buf, u_int32_t len, u_int64_t offset, void *userdata);
|
|
|
|
int (*write)(const void *buf, u_int32_t len, u_int64_t offset, void *userdata);
|
|
|
|
void (*disc)(void *userdata);
|
|
|
|
int (*flush)(void *userdata);
|
|
|
|
int (*trim)(u_int64_t from, u_int32_t len, void *userdata);
|
2011-09-20 11:30:00 +02:00
|
|
|
|
2017-05-24 19:09:37 +02:00
|
|
|
// either set size, OR set both blksize and size_blocks
|
2011-09-20 11:30:00 +02:00
|
|
|
u_int64_t size;
|
2017-05-24 19:09:37 +02:00
|
|
|
u_int32_t blksize;
|
|
|
|
u_int64_t size_blocks;
|
2012-12-07 12:58:26 +01:00
|
|
|
};
|
2011-09-20 10:26:10 +02:00
|
|
|
|
2012-12-07 12:58:26 +01:00
|
|
|
int buse_main(const char* dev_file, const struct buse_operations *bop, void *userdata);
|
2011-09-20 10:31:35 +02:00
|
|
|
|
2012-12-07 07:13:43 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-10-10 08:20:39 +02:00
|
|
|
#endif /* BUSE_H_INCLUDED */
|