diff --git a/mounted_file_system.go b/mounted_file_system.go index 24bfb90..ce36e1d 100644 --- a/mounted_file_system.go +++ b/mounted_file_system.go @@ -65,6 +65,11 @@ type MountConfig struct { // should inherit. If nil, context.Background() will be used. OpContext context.Context + // If non-empty, the name of the file system as displayed by e.g. `mount`. + // This is important because the `umount` command requires root privileges if + // it doesn't agree with /etc/fstab. + FSName string + // Mount the file system in read-only mode. File modes will appear as normal, // but opening a file for writing and metadata operations like chmod, // chtimes, etc. will fail. @@ -94,6 +99,11 @@ func (c *MountConfig) bazilfuseOptions() (opts []bazilfuse.MountOption) { // InodeAttributes.Mode. opts = append(opts, bazilfuse.SetOption("default_permissions", "")) + // Special file system name? + if c.FSName != "" { + opts = append(opts, bazilfuse.FSName(c.FSName)) + } + // Read only? if c.ReadOnly { opts = append(opts, bazilfuse.ReadOnly())