buse/busexmp.c

32 lines
568 B
C
Raw Normal View History

#include <stdlib.h>
#include <string.h>
#include "buse.h"
2011-09-20 10:31:35 +02:00
2011-10-10 07:30:30 +02:00
static void *data;
static int xmp_read(void *buf, u_int32_t len, u_int64_t offset)
2011-09-20 10:31:35 +02:00
{
memcpy(buf, (char *)data + offset, len);
return 0;
}
2011-10-10 07:30:30 +02:00
static int xmp_write(const void *buf, u_int32_t len, u_int64_t offset)
{
memcpy((char *)data + offset, buf, len);
return 0;
}
static struct buse_operations aop = {
.read = xmp_read,
2011-10-10 07:30:30 +02:00
.write = xmp_write,
.size = 128 * 1024,
};
int main(int argc, char *argv[])
{
2011-10-10 07:30:30 +02:00
data = malloc(aop.size);
return buse_main(argc, argv, &aop, NULL);
2011-09-20 10:31:35 +02:00
}