aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-04 21:56:45 +0200
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-04 22:42:22 +0200
commitc36e7d528e87f2327bdb56ea2b1ada9e05cb08ac (patch)
tree8467467fe12350e951268fe4f6716bab356be337 /example
parent0f1fdd2205f80164565a41b9d2252514aa7b05dc (diff)
passthrough_ll: added more debugging output
Diffstat (limited to 'example')
-rw-r--r--example/passthrough_ll.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c
index 2d7d4b5..0175363 100644
--- a/example/passthrough_ll.c
+++ b/example/passthrough_ll.c
@@ -46,6 +46,7 @@
#include <assert.h>
#include <errno.h>
#include <err.h>
+#include <inttypes.h>
/* We are re-using pointers to our `struct lo_inode` and `struct
lo_dirp` elements as inodes. This means that we must be able to
@@ -233,6 +234,10 @@ static void lo_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
struct fuse_entry_param e;
int err;
+ if (lo_debug(req))
+ fprintf(stderr, "lo_lookup(parent=%" PRIu64 ", name=%s)\n",
+ parent, name);
+
err = lo_do_lookup(req, parent, name, &e);
if (err)
fuse_reply_err(req, err);
@@ -436,6 +441,10 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
struct fuse_entry_param e;
int err;
+ if (lo_debug(req))
+ fprintf(stderr, "lo_create(parent=%" PRIu64 ", name=%s)\n",
+ parent, name);
+
fd = openat(lo_fd(req, parent), name,
(fi->flags | O_CREAT) & ~O_NOFOLLOW, mode);
if (fd == -1)
@@ -456,6 +465,10 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino,
int fd;
char buf[64];
+ if (lo_debug(req))
+ fprintf(stderr, "lo_open(ino=%" PRIu64 ", flags=%d)\n",
+ ino, fi->flags);
+
sprintf(buf, "/proc/self/fd/%i", lo_fd(req, ino));
fd = open(buf, fi->flags & ~O_NOFOLLOW);
if (fd == -1)
@@ -478,7 +491,9 @@ static void lo_read(fuse_req_t req, fuse_ino_t ino, size_t size,
{
struct fuse_bufvec buf = FUSE_BUFVEC_INIT(size);
- (void) ino;
+ if (lo_debug(req))
+ fprintf(stderr, "lo_read(ino=%" PRIu64 ", size=%zd, "
+ "off=%lu)\n", ino, size, (unsigned long) offset);
buf.buf[0].flags = FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK;
buf.buf[0].fd = fi->fh;
@@ -499,6 +514,10 @@ static void lo_write_buf(fuse_req_t req, fuse_ino_t ino,
out_buf.buf[0].fd = fi->fh;
out_buf.buf[0].pos = off;
+ if (lo_debug(req))
+ fprintf(stderr, "lo_write(ino=%" PRIu64 ", size=%zd, off=%lu)\n",
+ ino, out_buf.buf[0].size, (unsigned long) off);
+
res = fuse_buf_copy(&out_buf, in_buf, 0);
if(res < 0)
fuse_reply_err(req, -res);