Added support for setting the OS X volume name.
While I was at it, added tests for fsname. I can't figure out how to test the volume name. For GoogleCloudPlatform/gcsfuse#125.geesefs-0-30-9
parent
aa1fe8b2de
commit
e59a45f154
|
@ -129,6 +129,12 @@ type MountConfig struct {
|
|||
// entries will be cached for an arbitrarily long time.
|
||||
EnableVnodeCaching bool
|
||||
|
||||
// OS X only.
|
||||
//
|
||||
// The name of the mounted volume, as displayed in the Finder. If empty, a
|
||||
// default name involving the string 'osxfuse' is used.
|
||||
VolumeName string
|
||||
|
||||
// Additional key=value options to pass unadulterated to the underlying mount
|
||||
// command. See `man 8 mount`, the fuse documentation, etc. for
|
||||
// system-specific information.
|
||||
|
@ -172,9 +178,16 @@ func (c *MountConfig) toMap() (opts map[string]string) {
|
|||
opts["ro"] = ""
|
||||
}
|
||||
|
||||
// OS X: set novncache when appropriate.
|
||||
if isDarwin && !c.EnableVnodeCaching {
|
||||
opts["novncache"] = ""
|
||||
// Handle OS X options.
|
||||
if isDarwin {
|
||||
if !c.EnableVnodeCaching {
|
||||
opts["novncache"] = ""
|
||||
}
|
||||
|
||||
if c.VolumeName != "" {
|
||||
// Cf. https://github.com/osxfuse/osxfuse/wiki/Mount-options#volname
|
||||
opts["volname"] = c.VolumeName
|
||||
}
|
||||
}
|
||||
|
||||
// OS X: disable the use of "Apple Double" (._foo and .DS_Store) files, which
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
"syscall"
|
||||
|
||||
"github.com/jacobsa/fuse/fuseops"
|
||||
. "github.com/jacobsa/oglematchers"
|
||||
. "github.com/jacobsa/ogletest"
|
||||
)
|
||||
|
||||
|
@ -72,9 +71,7 @@ func (t *StatFSTest) Syscall_ZeroValues() {
|
|||
ExpectEq(0, stat.Ffree)
|
||||
ExpectEq("osxfusefs", convertName(stat.Fstypename[:]))
|
||||
ExpectEq(t.canonicalDir, convertName(stat.Mntonname[:]))
|
||||
ExpectThat(
|
||||
convertName(stat.Mntfromname[:]),
|
||||
MatchesRegexp(`mount_osxfusefs@osxfuse\d+`))
|
||||
ExpectEq(fsName, convertName(stat.Mntfromname[:]))
|
||||
}
|
||||
|
||||
func (t *StatFSTest) Syscall_NonZeroValues() {
|
||||
|
@ -108,9 +105,7 @@ func (t *StatFSTest) Syscall_NonZeroValues() {
|
|||
ExpectEq(canned.InodesFree, stat.Ffree)
|
||||
ExpectEq("osxfusefs", convertName(stat.Fstypename[:]))
|
||||
ExpectEq(t.canonicalDir, convertName(stat.Mntonname[:]))
|
||||
ExpectThat(
|
||||
convertName(stat.Mntfromname[:]),
|
||||
MatchesRegexp(`mount_osxfusefs@osxfuse\d+`))
|
||||
ExpectEq(fsName, convertName(stat.Mntfromname[:]))
|
||||
}
|
||||
|
||||
func (t *StatFSTest) UnsupportedBlockSizes() {
|
||||
|
|
|
@ -34,6 +34,9 @@ import (
|
|||
|
||||
func TestStatFS(t *testing.T) { RunTests(t) }
|
||||
|
||||
const fsName = "some_fs_name"
|
||||
const volumeName = "Some volume"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Helpers
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -117,6 +120,10 @@ func (t *StatFSTest) SetUp(ti *TestInfo) {
|
|||
// being issued from the client.
|
||||
t.MountConfig.DisableWritebackCaching = true
|
||||
|
||||
// Configure names.
|
||||
t.MountConfig.FSName = fsName
|
||||
t.MountConfig.VolumeName = volumeName
|
||||
|
||||
// Create the file system.
|
||||
t.fs = statfs.New()
|
||||
t.Server = fuseutil.NewFileSystemServer(t.fs)
|
||||
|
|
Loading…
Reference in New Issue