1) our dirent entries are now 8 byte aligned
2) d_type isn't the file's st_mode, but rather a type that can be derived
from the file's mode
3) the readdir callback should be setting d_off, but to what? this diff
just assumes fuse-based filesystems can operate with length based
offsets (even though the padding of them is changed by (1) above!); is
this a bug in the FUSE API?
4) (no binary change) if the file type is unknown, use DT_UNKNOWN
explictly instead of assuming that's equal to zero
(Do FUSE filesystems just not support telldir/seekdir?)
oks?
Philip
Index: fuse_ops.c
===================================================================
RCS file: /cvs/src/lib/libfuse/fuse_ops.c,v
retrieving revision 1.7
diff -u -p -r1.7 fuse_ops.c
--- fuse_ops.c 10 Aug 2013 00:30:43 -0000 1.7
+++ fuse_ops.c 7 Oct 2013 03:58:22 -0000
@@ -210,7 +210,7 @@ ifuse_ops_opendir(struct fuse *f, struct
}
#define GENERIC_DIRSIZ(NLEN) \
-((sizeof (struct dirent) - (MAXNAMLEN+1)) + ((NLEN+1 + 3) &~ 3))
+((sizeof (struct dirent) - (MAXNAMLEN+1)) + ((NLEN+1 + 7) &~ 7))
static int
ifuse_fill_readdir(void *dh, const char *name, const struct stat *stbuf,
@@ -244,13 +244,14 @@ ifuse_fill_readdir(void *dh, const char
if (stbuf) {
dir->d_fileno = stbuf->st_ino;
- dir->d_type = stbuf->st_mode;
+ dir->d_type = IFTODT(stbuf->st_mode);
} else {
dir->d_fileno = 0xffffffff;
- dir->d_type = 0;
+ dir->d_type = DT_UNKNOWN;
}
dir->d_namlen = namelen;
dir->d_reclen = len;
+ dir->d_off = off + len; /* XXX */
memcpy(dir->d_name, name, namelen);
fbuf->fb_len += len;