Browse Source

pkg/mount: Mount: minor optimization

Eliminate double call to parseOptions() from Mount()

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Kir Kolyshkin 6 years ago
parent
commit
80fce834ad
1 changed files with 2 additions and 2 deletions
  1. 2 2
      pkg/mount/mount.go

+ 2 - 2
pkg/mount/mount.go

@@ -102,13 +102,13 @@ func Mounted(mountpoint string) (bool, error) {
 // specified like the mount or fstab unix commands: "opt1=val1,opt2=val2". See
 // specified like the mount or fstab unix commands: "opt1=val1,opt2=val2". See
 // flags.go for supported option flags.
 // flags.go for supported option flags.
 func Mount(device, target, mType, options string) error {
 func Mount(device, target, mType, options string) error {
-	flag, _ := parseOptions(options)
+	flag, data := parseOptions(options)
 	if flag&REMOUNT != REMOUNT {
 	if flag&REMOUNT != REMOUNT {
 		if mounted, err := Mounted(target); err != nil || mounted {
 		if mounted, err := Mounted(target); err != nil || mounted {
 			return err
 			return err
 		}
 		}
 	}
 	}
-	return ForceMount(device, target, mType, options)
+	return mount(device, target, mType, uintptr(flag), data)
 }
 }
 
 
 // ForceMount will mount a filesystem according to the specified configuration,
 // ForceMount will mount a filesystem according to the specified configuration,