loopback.c, busexmp.c: get rid of compiler warnings

This commit is contained in:
Pete Nelson 2013-06-27 16:47:27 -04:00
parent c322c1035f
commit e4fd3b729f
2 changed files with 14 additions and 4 deletions

View File

@ -5,33 +5,40 @@
#include "buse.h"
static void *data;
static int xmpl_debug = 1;
static int xmp_read(void *buf, u_int32_t len, u_int64_t offset, void *userdata)
{
fprintf(stderr, "R - %lu, %u\n", offset, len);
if (*(int *)userdata)
fprintf(stderr, "R - %lu, %u\n", offset, len);
memcpy(buf, (char *)data + offset, len);
return 0;
}
static int xmp_write(const void *buf, u_int32_t len, u_int64_t offset, void *userdata)
{
fprintf(stderr, "W - %lu, %u\n", offset, len);
if (*(int *)userdata)
fprintf(stderr, "W - %lu, %u\n", offset, len);
memcpy((char *)data + offset, buf, len);
return 0;
}
static void xmp_disc(void *userdata)
{
(void)(userdata);
fprintf(stderr, "Received a disconnect request.\n");
}
static int xmp_flush(void *userdata)
{
(void)(userdata);
fprintf(stderr, "Received a flush request.\n");
return 0;
}
static int xmp_trim(u_int64_t from, u_int32_t len, void *userdata){
static int xmp_trim(u_int64_t from, u_int32_t len, void *userdata)
{
(void)(userdata);
fprintf(stderr, "T - %lu, %u\n", from, len);
return 0;
}
@ -48,7 +55,8 @@ static struct buse_operations aop = {
int main(int argc, char *argv[])
{
(void)(argc);
data = malloc(aop.size);
return buse_main(argv[1], &aop, NULL);
return buse_main(argv[1], &aop, (void *)&xmpl_debug);
}

View File

@ -21,6 +21,7 @@ static void usage(void)
static int loopback_read(void *buf, u_int32_t len, u_int64_t offset, void *userdata)
{
int bytes_read;
(void)(userdata);
lseek64(fd, offset, SEEK_SET);
while (len > 0) {
@ -36,6 +37,7 @@ static int loopback_read(void *buf, u_int32_t len, u_int64_t offset, void *userd
static int loopback_write(const void *buf, u_int32_t len, u_int64_t offset, void *userdata)
{
int bytes_written;
(void)(userdata);
lseek64(fd, offset, SEEK_SET);
while (len > 0) {