restructure readdir, add readdir_plus

Does not enable READDIR_AUTO. Might add in the future.
This commit is contained in:
Antonio SJ Musumeci 2019-06-14 08:59:04 -04:00
parent 10e8bd9fa3
commit d119807adb
29 changed files with 1081 additions and 364 deletions

View file

@ -24,6 +24,7 @@
#endif
#include "fuse_common.h"
#include "fuse_dirents.h"
#include <fcntl.h>
#include <time.h>
@ -47,22 +48,6 @@ struct fuse;
/** Structure containing a raw command */
struct fuse_cmd;
/** Function to add an entry in a readdir() operation
*
* @param buf the buffer passed to the readdir() operation
* @param name the file name of the directory entry
* @param stat file attributes, can be NULL
* @param off offset of the next entry or zero
* @return 1 if buffer is full, zero otherwise
*/
typedef int (*fuse_fill_dir_t) (void *buf, const char *name,
const struct stat *stbuf, off_t off);
/* Used by deprecated getdir() method */
typedef struct fuse_dirhandle *fuse_dirh_t;
typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
ino_t ino);
/**
* The file system operations:
*
@ -104,9 +89,6 @@ struct fuse_operations {
*/
int (*readlink) (const char *, char *, size_t);
/* Deprecated, use readdir() instead */
int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
/** Create a file node
*
* This is called for creation of all non-directory, non-symlink
@ -312,8 +294,12 @@ struct fuse_operations {
*
* Introduced in version 2.3
*/
int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
struct fuse_file_info *);
int (*readdir)(struct fuse_file_info *,
fuse_dirents_t *);
int (*readdir_plus)(struct fuse_file_info *,
fuse_dirents_t *);
/** Release directory
*
@ -898,9 +884,9 @@ int fuse_fs_flush(struct fuse_fs *fs, const char *path,
int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf);
int fuse_fs_opendir(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi);
int fuse_fs_readdir(struct fuse_fs *fs, const char *path, void *buf,
fuse_fill_dir_t filler, off_t off,
struct fuse_file_info *fi);
int fuse_fs_readdir(struct fuse_fs *fs,
struct fuse_file_info *fi,
fuse_dirents_t *buf);
int fuse_fs_fsyncdir(struct fuse_fs *fs, const char *path, int datasync,
struct fuse_file_info *fi);
int fuse_fs_releasedir(struct fuse_fs *fs, const char *path,