Esempio n. 1
0
func listMounts() error {
	log.Info(2, "retrieving mount table.")

	mt, err := vfs.GetMountTable()
	if err != nil {
		return fmt.Errorf("could not get mount table: %v", err)
	}

	if len(mt) == 0 {
		log.Info(2, "mount table is empty.")
	}

	for _, mount := range mt {
		fmt.Printf("'%v' at '%v'\n", mount.DatabasePath, mount.MountPath)
	}

	return nil
}
Esempio n. 2
0
func alreadyMounted(path string) bool {
	absPath, err := filepath.Abs(path)
	if err != nil {
		return false
	}

	mt, err := vfs.GetMountTable()
	if err != nil {
		return false
	}

	for _, mount := range mt {
		if mount.MountPath == absPath {
			return true
		}
	}

	return false
}
Esempio n. 3
0
func unmountAll() error {
	log.Info(2, "retrieving mount table.")

	mt, err := vfs.GetMountTable()
	if err != nil {
		return fmt.Errorf("could not get mount table: %v", err)
	}

	if len(mt) == 0 {
		log.Info(2, "mount table is empty.")
	}

	for _, mount := range mt {
		err = unmount(mount.MountPath)
		if err != nil {
			return err
		}
	}

	return nil
}
Esempio n. 4
0
func (command UnmountCommand) unmountAll() error {
	if command.verbose {
		log.Info("retrieving mount table.")
	}

	mt, err := vfs.GetMountTable()
	if err != nil {
		return fmt.Errorf("could not get mount table: %v", err)
	}

	if command.verbose && len(mt) == 0 {
		log.Info("mount table is empty.")
	}

	for _, mount := range mt {
		err = command.unmount(mount.MountPath)
		if err != nil {
			return err
		}
	}

	return nil
}