Skip to content

Example passthrough, fuse_fill_dir_flags and default value in cpp/c #629

Closed

Description

@latot

Hi hi, I was trying to start a project in c++ using the passthrough example, and I notice something very curious, I'll put the different sections of code for context:

From fuse.h

enum fuse_fill_dir_flags {
	FUSE_FILL_DIR_PLUS = (1 << 1)
};
...
typedef int (*fuse_fill_dir_t) (void *buf, const char *name,
				const struct stat *stbuf, off_t off,
				enum fuse_fill_dir_flags flags);

From passthrough.c (only lines of interest)

static int fill_dir_plus = 0;
....
		if (!strcmp(argv[i], "--plus")) {
			fill_dir_plus = FUSE_FILL_DIR_PLUS;
		} else {

Now, this type of line is used very common:

fuse_fill_dir_t filler (declared in function)
(filler(buf, de->d_name, &st, 0, fill_dir_plus))

Is mixing types everywhere the example, fill_dir_plus var, should have the type fuse_fill_dir_flags not int, but at the same time, the enum fuse_fill_dir_flags only have one value, so we can't run the first line of the example where is set to 0.

I still don't know very well how fuse works internally, but I think fuse_fill_dir_flags should have one more flag for the 0 value.

Thx.

Activity

  1. Nikratio commented on Nov 7, 2021

    @Nikratio
    Contributor

    In C, enum types are int. This is why "mixing" types this way is fine. Still, if there is a way to change this so that it also compiles without warnings in C++, then I'm happy to accept pull requests.

    I do not understand what you mean with "use_fill_dir_flags should have one more flag for the 0 value" - could you elaborate?

  2. latot commented on Nov 7, 2021

    @latot
    Author

    Hi, enum estore values as int, but declaring enum fuse_fill_dir_flags flags, even parsing an int can fail, depending of the compiler and the project (I test this with a C++ project), the passthrough example don't store a fuse_fill_dir_flags flags, store int.

    The user_full_dir_flags only have one definition, FUSE_FILL_DIR_PLUS, with the value 2 (1<<1), in the passthrough example the value is set to 0, so I can't change the integer type to enum.

    So, to pull a request, for the fuse_fill_dir_flags flags, what would means the 0 value? maybe FUSE_READDIR_NOT_PLUS?

  3. Nikratio commented on May 2, 2022

    @Nikratio
    Contributor

    Let's use FUSE_READDIR_DEFAULTS.

  4. Nikratio commented on Jul 2, 2022

    @Nikratio
    Contributor

    I'm closing this issue for now. Please note that this isn't meant to imply that you haven't found a real bug or worthwhile potential improvement - you most likely have and I'm grateful that you took the time to report it.

    Unfortunately, this project does not currently have any active, regular contributors. As the maintainer, I try to review pull requests and make regular releases, but unfortunately I have no capacity to do significant development beyond that.
    Issue reports that do not come with a pull request or clearly have high impact on a large number of users are therefore likely to languish.

    I understand that this is frustrating for users, but I hope you can also understand that any development work that I do on this project has to compete with spending time with my family, doing work that I get paid for, doing something recreational without a computer, or working on features/bugs that affect me personally. Most bugs and ideas - unfortunately including this one - loose out in this competition.

    In other words, unless you plan to work on this yourself or can recruit someone who will, it's unlikely that anyone is going to do anything about it anytime soon.

    Still, you may wonder why I am closing the issue rather than keeping it open.

    In short, I want the issue tracker to show the most important issues that users should be aware of and where prospective contributors could make the biggest difference. I do not think there is much value in using it as an exhaustive database of every idea or glitch that someone has ever encountered - especially if no one is intending to address/implement it.

    For this reason, I am closing most issues when it becomes clear that they're unlikely to see any activity in the near future - and this seems to be the case here.

    I understand that you have invested time and effort in reporting this, and I am very sorry that currently there is no way to build upon this. I wish the situation was different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions