diff options
Diffstat (limited to 'example')
-rw-r--r-- | example/hello_ll.c | 2 | ||||
-rw-r--r-- | example/null.c | 26 |
2 files changed, 19 insertions, 9 deletions
diff --git a/example/hello_ll.c b/example/hello_ll.c index 9f70865..3a6ea09 100644 --- a/example/hello_ll.c +++ b/example/hello_ll.c @@ -78,7 +78,7 @@ static void dirbuf_add(struct dirbuf *b, const char *name, fuse_ino_t ino) struct stat stbuf; size_t oldsize = b->size; b->size += fuse_dirent_size(strlen(name)); - b->p = realloc(b->p, b->size); + b->p = (char *) realloc(b->p, b->size); memset(&stbuf, 0, sizeof(stbuf)); stbuf.st_ino = ino; fuse_add_dirent(b->p + oldsize, name, &stbuf, b->size); diff --git a/example/null.c b/example/null.c index d58feab..d9539ab 100644 --- a/example/null.c +++ b/example/null.c @@ -12,8 +12,6 @@ #include <time.h> #include <errno.h> -#define UNUSED(x) x __attribute__((unused)) - static int null_getattr(const char *path, struct stat *stbuf) { if(strcmp(path, "/") != 0) @@ -30,34 +28,46 @@ static int null_getattr(const char *path, struct stat *stbuf) return 0; } -static int null_truncate(const char *path, off_t UNUSED(size)) +static int null_truncate(const char *path, off_t size) { + (void) size; + if(strcmp(path, "/") != 0) return -ENOENT; return 0; } -static int null_open(const char *path, struct fuse_file_info *UNUSED(fi)) +static int null_open(const char *path, struct fuse_file_info *fi) { + (void) fi; + if(strcmp(path, "/") != 0) return -ENOENT; return 0; } -static int null_read(const char *path, char *UNUSED(buf), size_t size, - off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi)) +static int null_read(const char *path, char *buf, size_t size, + off_t offset, struct fuse_file_info *fi) { + (void) buf; + (void) offset; + (void) fi; + if(strcmp(path, "/") != 0) return -ENOENT; return size; } -static int null_write(const char *path, const char *UNUSED(buf), size_t size, - off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi)) +static int null_write(const char *path, const char *buf, size_t size, + off_t offset, struct fuse_file_info *fi) { + (void) buf; + (void) offset; + (void) fi; + if(strcmp(path, "/") != 0) return -ENOENT; |