+2004-11-08 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Add ino argument to 'fuse_dirfil_t'. NOTE: this is a backward
+ compatible change (if "use_ino" mount option is not specified),
+ but causes a warning when compiling filesystems not converted to
+ the new type.
+
2004-11-02 Miklos Szeredi <miklos@szeredi.hu>
* Added "use_ino" mount option. This enables the filesystems to
}
-static int xmp_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
+static int xmp_getdir(const char *path, fuse_dirh_t h, fuse_dirfil2_t filler)
{
DIR *dp;
struct dirent *de;
return -errno;
while((de = readdir(dp)) != NULL) {
- res = filler(h, de->d_name, de->d_type);
+ res = filler(h, de->d_name, de->d_type, de->d_ino);
if(res != 0)
break;
}
return res;
}
-static int hello_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
+static int hello_getdir(const char *path, fuse_dirh_t h, fuse_dirfil2_t filler)
{
if(strcmp(path, "/") != 0)
return -ENOENT;
- filler(h, ".", 0);
- filler(h, "..", 0);
- filler(h, hello_path + 1, 0);
+ filler(h, ".", 0, 0);
+ filler(h, "..", 0, 0);
+ filler(h, hello_path + 1, 0, 0);
return 0;
}
#include <sys/statfs.h>
#include <utime.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* ----------------------------------------------------------- *
* Basic FUSE API *
* ----------------------------------------------------------- */
* @param h the handle passed to the getdir() operation
* @param name the file name of the directory entry
* @param type the file type (0 if unknown) see <dirent.h>
+ * @param ino the inode number, ignored if "use_ino" mount option is
+ * not specified
* @return 0 on success, -errno on error
*/
+typedef int (*fuse_dirfil2_t) (fuse_dirh_t h, const char *name, int type,
+ ino_t ino);
+
+/** Obsolete version of the above function */
typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type);
/**
struct fuse_operations {
int (*getattr) (const char *, struct stat *);
int (*readlink) (const char *, char *, size_t);
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
+ int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil2_t);
int (*mknod) (const char *, mode_t, dev_t);
int (*mkdir) (const char *, mode_t);
int (*unlink) (const char *);
uid_t uid;
gid_t gid;
pid_t pid;
+ void *private_data;
};
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*
* Main function of FUSE.
*
*/
int fuse_is_lib_option(const char *opt);
-
/* ----------------------------------------------------------- *
* Advanced API for event handling, don't worry about this... *
* ----------------------------------------------------------- */
#endif
}
-static int fill_dir(struct fuse_dirhandle *dh, char *name, int type)
+static int fill_dir(struct fuse_dirhandle *dh, const char *name, int type,
+ ino_t ino)
{
struct fuse_dirent dirent;
size_t reclen;
size_t res;
- dirent.ino = (unsigned long) -1;
+ if ((dh->fuse->flags & FUSE_USE_INO))
+ dirent.ino = ino;
+ else
+ dirent.ino = (unsigned long) -1;
dirent.namelen = strlen(name);
strncpy(dirent.name, name, sizeof(dirent.name));
dirent.type = type;
if (path != NULL) {
res = -ENOSYS;
if (f->op.getdir)
- res = f->op.getdir(path, &dh, (fuse_dirfil_t) fill_dir);
+ res = f->op.getdir(path, &dh, fill_dir);
free(path);
}
fflush(dh.fp);