aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2021-01-24 09:34:19 +0200
committerMartin Pärtel <martin.partel@gmail.com>2021-01-24 09:35:41 +0200
commit1aec434177a70c65d5449455eaedcad8a3a96eaf (patch)
tree68ec498d633b3d973480c08212c05977ad80ac67 /src
parent87f17506747d84bc2caeebb6184a75bcc3016fa0 (diff)
downloadbindfs-1aec434177a70c65d5449455eaedcad8a3a96eaf.tar.gz
Added support for `-o fsname`
For #94
Diffstat (limited to 'src')
-rw-r--r--src/bindfs.15
-rw-r--r--src/bindfs.c14
2 files changed, 16 insertions, 3 deletions
diff --git a/src/bindfs.1 b/src/bindfs.1
index c1450f2..b681e44 100644
--- a/src/bindfs.1
+++ b/src/bindfs.1
@@ -414,6 +414,11 @@ more efficent mount with \fBmount \-\-bind\fP and then \fBmount \-o remount,ro\f
Enable debug output (implies \-f).
.TP
+.B \-o fsname=\fIname\fP
+Sets the source directory name in /proc/mounts (returned by \fBmount\fP).
+This is automatically set as long as the source path has no special characters.
+
+.TP
.B \-f
Foreground operation.
diff --git a/src/bindfs.c b/src/bindfs.c
index ecb158a..8868c29 100644
--- a/src/bindfs.c
+++ b/src/bindfs.c
@@ -2155,11 +2155,14 @@ int main(int argc, char *argv[])
char *forward_odirect;
char *uid_offset;
char *gid_offset;
+ char *fsname;
} od;
#define OPT2(one, two, key) \
FUSE_OPT_KEY(one, key), \
FUSE_OPT_KEY(two, key)
+ #define OPT_OFFSET(opt, offset, key) \
+ {opt, offsetof(struct OptionData, offset), key}
#define OPT_OFFSET2(one, two, offset, key) \
{one, offsetof(struct OptionData, offset), key}, \
{two, offsetof(struct OptionData, offset), key}
@@ -2228,8 +2231,9 @@ int main(int argc, char *argv[])
OPT2("--enable-ioctl", "enable-ioctl", OPTKEY_ENABLE_IOCTL),
OPT_OFFSET2("--multithreaded", "multithreaded", multithreaded, -1),
OPT_OFFSET2("--forward-odirect=%s", "forward-odirect=%s", forward_odirect, -1),
- OPT_OFFSET2("--uid-offset=%s", "uid-offset=%s", uid_offset, 0),
- OPT_OFFSET2("--gid-offset=%s", "gid-offset=%s", gid_offset, 0),
+ OPT_OFFSET2("--uid-offset=%s", "uid-offset=%s", uid_offset, -1),
+ OPT_OFFSET2("--gid-offset=%s", "gid-offset=%s", gid_offset, -1),
+ OPT_OFFSET("fsname=%s", fsname, -1),
FUSE_OPT_END
};
@@ -2535,7 +2539,11 @@ int main(int argc, char *argv[])
(issue #47). The character blacklist is likely not complete, which is
acceptable since this is not a security check. The aim is to avoid giving
the user a confusing error. */
- if (strpbrk(settings.mntsrc, ", \t\n") == NULL) {
+ if (od.fsname != NULL) {
+ char *tmp = sprintf_new("-ofsname=%s", od.fsname);
+ fuse_opt_add_arg(&args, tmp);
+ free(tmp);
+ } else if (strpbrk(settings.mntsrc, ", \t\n") == NULL) {
char *tmp = sprintf_new("-ofsname=%s", settings.mntsrc);
fuse_opt_add_arg(&args, tmp);
free(tmp);