Add FUSE_FILL_DIR_DEFAULTS enum (#903)

In order to use the fuse_fill_dir_t function in a C++ program, add the enum item:
FUSE_FILL_DIR_DEFAULTS

Without this change g++ compilation failed with
example/hello.c:94:35: error: invalid conversion from ‘int’ to ‘fuse_fill_dir_flags’ [-fpermissive]
   94 |         filler(buf, ".", NULL, 0, 0);
      |                                   ^
      |                                   |
      |                                   int
This commit is contained in:
FredyVia 2024-03-20 23:08:04 +08:00 committed by GitHub
parent 9a823df6d9
commit c021e910a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 12 additions and 10 deletions

View File

@ -91,9 +91,9 @@ static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
if (strcmp(path, "/") != 0)
return -ENOENT;
filler(buf, ".", NULL, 0, 0);
filler(buf, "..", NULL, 0, 0);
filler(buf, options.filename, NULL, 0, 0);
filler(buf, ".", NULL, 0, FUSE_FILL_DIR_DEFAULTS);
filler(buf, "..", NULL, 0, FUSE_FILL_DIR_DEFAULTS);
filler(buf, options.filename, NULL, 0, FUSE_FILL_DIR_DEFAULTS);
return 0;
}

View File

@ -117,9 +117,9 @@ static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
(void) buf;
struct stat file_stat;
xmp_getattr("/" TIME_FILE_NAME, &file_stat, NULL);
filler(buf, TIME_FILE_NAME, &file_stat, 0, 0);
filler(buf, TIME_FILE_NAME, &file_stat, 0, FUSE_FILL_DIR_DEFAULTS);
xmp_getattr("/" GROW_FILE_NAME, &file_stat, NULL);
filler(buf, GROW_FILE_NAME, &file_stat, 0, 0);
filler(buf, GROW_FILE_NAME, &file_stat, 0, FUSE_FILL_DIR_DEFAULTS);
return 0;
}
}

View File

@ -181,9 +181,9 @@ static int fioc_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
if (fioc_file_type(path) != FIOC_ROOT)
return -ENOENT;
filler(buf, ".", NULL, 0, 0);
filler(buf, "..", NULL, 0, 0);
filler(buf, FIOC_NAME, NULL, 0, 0);
filler(buf, ".", NULL, 0, FUSE_FILL_DIR_DEFAULTS);
filler(buf, "..", NULL, 0, FUSE_FILL_DIR_DEFAULTS);
filler(buf, FIOC_NAME, NULL, 0, FUSE_FILL_DIR_DEFAULTS);
return 0;
}

View File

@ -167,7 +167,7 @@ static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
while (1) {
struct stat st;
off_t nextoff;
enum fuse_fill_dir_flags fill_flags = 0;
enum fuse_fill_dir_flags fill_flags = FUSE_FILL_DIR_DEFAULTS;
if (!d->entry) {
d->entry = readdir(d->dp);

View File

@ -114,7 +114,7 @@ static int fsel_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
for (i = 0; i < FSEL_FILES; i++) {
name[0] = fsel_hex_map[i];
filler(buf, name, NULL, 0, 0);
filler(buf, name, NULL, 0, FUSE_FILL_DIR_DEFAULTS);
}
return 0;

View File

@ -48,6 +48,7 @@ enum fuse_readdir_flags {
* FUSE_FILL_DIR_FLAGS for the filler function. The filesystem may also
* just ignore this flag completely.
*/
FUSE_READDIR_DEFAULTS = 0,
FUSE_READDIR_PLUS = (1 << 0)
};
@ -64,6 +65,7 @@ enum fuse_fill_dir_flags {
* It is okay to set FUSE_FILL_DIR_PLUS if FUSE_READDIR_PLUS is not set
* and vice versa.
*/
FUSE_FILL_DIR_DEFAULTS = 0,
FUSE_FILL_DIR_PLUS = (1 << 1)
};