fuse: Set fsname correctly

Also, add helpers for the fuse.bcachefs filesystem type; this means we
can now test the fuse version with fstests.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-08-11 18:16:14 -04:00
parent 0de1fb41b7
commit ae23e4541f
4 changed files with 21 additions and 1 deletions

View File

@ -155,6 +155,9 @@ install: bcachefs
$(INSTALL) -m0755 fsck.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
$(INSTALL) -m0755 mkfs.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
$(INSTALL) -m0755 mount.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
$(INSTALL) -m0755 fsck.bcachefs $(DESTDIR)$(ROOT_SBINDIR)/fsck.fuse.bcachefs
$(INSTALL) -m0755 mkfs.bcachefs $(DESTDIR)$(ROOT_SBINDIR)/mkfs.fuse.bcachefs
$(INSTALL) -m0755 mount.fuse.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
$(INSTALL) -m0644 -D bcachefs.8 -t $(DESTDIR)$(PREFIX)/share/man/man8/
$(INSTALL) -m0755 -D initramfs/script $(DESTDIR)$(INITRAMFS_SCRIPT)
$(INSTALL) -m0755 -D initramfs/hook $(DESTDIR)$(INITRAMFS_HOOK)

View File

@ -1217,6 +1217,17 @@ int cmd_fusemount(int argc, char *argv[])
}
tokenize_devices(&ctx);
struct printbuf fsname = PRINTBUF;
prt_printf(&fsname, "fsname=");
for (i = 0; i < ctx.nr_devices; ++i) {
if (i)
prt_str(&fsname, ":");
prt_str(&fsname, ctx.devices[i]);
}
fuse_opt_add_arg(&args, "-o");
fuse_opt_add_arg(&args, fsname.buf);
/* Open bch */
printf("Opening bcachefs filesystem on:\n");
for (i = 0; i < ctx.nr_devices; ++i)

3
mount.fuse.bcachefs Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
exec bcachefs fusemount "$@"

View File

@ -45,10 +45,13 @@ rm -f %{buildroot}/%{_datadir}/initramfs-tools/scripts/local-premount/bcachefs
rm -f %{buildroot}/usr/lib/libbcachefs.so
%files
%{_sbindir}/mount.bcachefs
%{_sbindir}/bcachefs
%{_sbindir}/mount.bcachefs
%{_sbindir}/fsck.bcachefs
%{_sbindir}/mkfs.bcachefs
%{_sbindir}/mount.fuse.bcachefs
%{_sbindir}/fsck.fuse.bcachefs
%{_sbindir}/mkfs.fuse.bcachefs
%{_mandir}/man8/bcachefs.8.gz
%changelog