From 1bf64f48067728cc470c3779f7eec78a0ffbd2c5 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 17 Feb 2006 15:49:25 +0000 Subject: fix --- example/hello_ll.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'example/hello_ll.c') diff --git a/example/hello_ll.c b/example/hello_ll.c index 7682f4e..2213285 100644 --- a/example/hello_ll.c +++ b/example/hello_ll.c @@ -75,15 +75,17 @@ struct dirbuf { size_t size; }; -static void dirbuf_add(struct dirbuf *b, const char *name, fuse_ino_t ino) +static void dirbuf_add(fuse_req_t req, 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->size += fuse_add_direntry(req, NULL, 0, name, NULL, 0); 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); + fuse_add_direntry(req, b->p + oldsize, b->size - oldsize, name, &stbuf, + b->size); } #define min(x, y) ((x) < (y) ? (x) : (y)) @@ -108,9 +110,9 @@ static void hello_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, struct dirbuf b; memset(&b, 0, sizeof(b)); - dirbuf_add(&b, ".", 1); - dirbuf_add(&b, "..", 1); - dirbuf_add(&b, hello_name, 2); + dirbuf_add(req, &b, ".", 1); + dirbuf_add(req, &b, "..", 1); + dirbuf_add(req, &b, hello_name, 2); reply_buf_limited(req, b.p, b.size, off, size); free(b.p); } -- cgit v1.2.3