-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for file filtering (hiding) #108
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks useful and well thought out, thanks! I'll try to find time to review the code in detail later this week.
If a filename contains a colon, type token part must be specified | ||
to distinguish specifier parts, e.g. \fIa:pci:0000:00:00/...\fP, | ||
where \fIa\fP is an "any type" specifier and \fIpci:0000:00:00\fP is | ||
a file name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we reserve /
as the separator, we can't support filtering by paths later (without changing the flag name).
Does FUSE's option parser support reading multiple instances of the same flag? Then we wouldn't need a separator.
I'd also suggest a more verbose but more extensible and arguably clearer syntax like
--file-filter=type=socket,name-glob=*.sock --file-filter=type=symlink,name=something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing options syntax, such as --map and permission stuff tends to be concise (and I'd like it), I'll try to follow this style. Maybe better just escape forward slashes?
src/bindfs.1
Outdated
.B \-\-delete\-filtered | ||
When removing a directory, also transparently remove hidden with | ||
\fB\-\-file\-filter\fP files in it. If this option not active, | ||
such directories won't remove with \fBENOEMPTY\fP error. If a directory | ||
contains hidden directories, they will be deleted recursively, as with | ||
\fBrm -rf\fP command. If \fB\-\-resolve\-symlinks\fP is active, hidden | ||
files in resolved directories will not be removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is intended to, returning to my QEMU use case, delete directories which contains hidden metadata dirs from resulting share, otherwise rmdir() fails with ENOTEMPTY
aef8c5e
to
b6d7614
Compare
I'm sorry I've still not found the time for this. It's still on my list. |
This new feature allows to hide files specified by a slash-separated list, --file-filter=r:*.png/d:dir1/junkfile/..., optionally POSIX globs and matching file modes can be specified. Files not appears in all directories, any access-by-path ops fails with ENOENT, any "write" ops, such as rename and link, fails with EPERM, even if specified files not exists.
Developed this feature for QEMU shared filesystems: bindfs is very useful for mapping owners and permissions when QEMU runs unprivileged and can't chown, but with "mapped-file" option (https://wiki.qemu.org/Documentation/9psetup#Starting_the_Guest_directly) which is only option for tmpfs since it can't store xattrs metadata is stored in target path in ".virtfs_metadata" dir created in each directory, makes it very inconvenient to delete them while copying files from guest to host. With filtering feature, we can just filter metadata dirs in resulting share.