github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/volume/local/local_windows.go (about)

     1  // Package local provides the default implementation for volumes. It
     2  // is used to mount data volume containers and directories local to
     3  // the host server.
     4  package local
     5  
     6  import (
     7  	"fmt"
     8  	"os"
     9  	"path/filepath"
    10  	"strings"
    11  	"syscall"
    12  	"time"
    13  )
    14  
    15  type optsConfig struct{}
    16  
    17  var validOpts map[string]bool
    18  
    19  // scopedPath verifies that the path where the volume is located
    20  // is under Docker's root and the valid local paths.
    21  func (r *Root) scopedPath(realPath string) bool {
    22  	if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) {
    23  		return true
    24  	}
    25  	return false
    26  }
    27  
    28  func setOpts(v *localVolume, opts map[string]string) error {
    29  	if len(opts) > 0 {
    30  		return fmt.Errorf("options are not supported on this platform")
    31  	}
    32  	return nil
    33  }
    34  
    35  func (v *localVolume) mount() error {
    36  	return nil
    37  }
    38  
    39  func (v *localVolume) CreatedAt() (time.Time, error) {
    40  	fileInfo, err := os.Stat(v.path)
    41  	if err != nil {
    42  		return time.Time{}, err
    43  	}
    44  	ft := fileInfo.Sys().(*syscall.Win32FileAttributeData).CreationTime
    45  	return time.Unix(0, ft.Nanoseconds()), nil
    46  }