loopback.c, busexmp.c: get rid of compiler warnings
This commit is contained in:
parent
c322c1035f
commit
e4fd3b729f
16
busexmp.c
16
busexmp.c
|
@ -5,33 +5,40 @@
|
||||||
#include "buse.h"
|
#include "buse.h"
|
||||||
|
|
||||||
static void *data;
|
static void *data;
|
||||||
|
static int xmpl_debug = 1;
|
||||||
|
|
||||||
static int xmp_read(void *buf, u_int32_t len, u_int64_t offset, void *userdata)
|
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);
|
memcpy(buf, (char *)data + offset, len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xmp_write(const void *buf, u_int32_t len, u_int64_t offset, void *userdata)
|
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);
|
memcpy((char *)data + offset, buf, len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmp_disc(void *userdata)
|
static void xmp_disc(void *userdata)
|
||||||
{
|
{
|
||||||
|
(void)(userdata);
|
||||||
fprintf(stderr, "Received a disconnect request.\n");
|
fprintf(stderr, "Received a disconnect request.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xmp_flush(void *userdata)
|
static int xmp_flush(void *userdata)
|
||||||
{
|
{
|
||||||
|
(void)(userdata);
|
||||||
fprintf(stderr, "Received a flush request.\n");
|
fprintf(stderr, "Received a flush request.\n");
|
||||||
return 0;
|
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);
|
fprintf(stderr, "T - %lu, %u\n", from, len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +55,8 @@ static struct buse_operations aop = {
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
(void)(argc);
|
||||||
data = malloc(aop.size);
|
data = malloc(aop.size);
|
||||||
|
|
||||||
return buse_main(argv[1], &aop, NULL);
|
return buse_main(argv[1], &aop, (void *)&xmpl_debug);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ static void usage(void)
|
||||||
static int loopback_read(void *buf, u_int32_t len, u_int64_t offset, void *userdata)
|
static int loopback_read(void *buf, u_int32_t len, u_int64_t offset, void *userdata)
|
||||||
{
|
{
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
|
(void)(userdata);
|
||||||
|
|
||||||
lseek64(fd, offset, SEEK_SET);
|
lseek64(fd, offset, SEEK_SET);
|
||||||
while (len > 0) {
|
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)
|
static int loopback_write(const void *buf, u_int32_t len, u_int64_t offset, void *userdata)
|
||||||
{
|
{
|
||||||
int bytes_written;
|
int bytes_written;
|
||||||
|
(void)(userdata);
|
||||||
|
|
||||||
lseek64(fd, offset, SEEK_SET);
|
lseek64(fd, offset, SEEK_SET);
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
|
|
Loading…
Reference in New Issue