// List all the volumes from diskPath.
424721
func listVols(dirPath string) ([]VolInfo, error) {
	if err := checkPathLength(dirPath); err != nil {
		return nil, err
	}
	entries, err := readDir(dirPath)
	if err != nil {
		return nil, errDiskNotFound
	}
	var volsInfo []VolInfo
	for _, entry := range entries {
		if !hasSuffix(entry, slashSeparator) || !isValidVolname(slashpath.Clean(entry)) {
			// Skip if entry is neither a directory not a valid volume name.
			continue
		}
		var fi os.FileInfo
		fi, err = os.Stat(pathJoin(dirPath, entry))
		if err != nil {
			// If the file does not exist, skip the entry.
			if os.IsNotExist(err) {
				continue
			} else if isSysErrIO(err) {
				return nil, errFaultyDisk
			}
			return nil, err
		}
		volsInfo = append(volsInfo, VolInfo{
			Name: fi.Name(),
			// As os.Stat() doesn't carry other than ModTime(), use
			// ModTime() as CreatedTime.
			Created: fi.ModTime(),
		})
	}
	return volsInfo, nil
}
614561
func (fs *HdfsFileSystem) List(fl *FileLocation) (fileLocations []*FileLocation, err error) {
	namenode, path, err := splitLocationToParts(fl.Location)
	if err != nil {
		return
	}

	client, err := hdfs.New(namenode)
	if err != nil {
		return nil, fmt.Errorf("failed to create client to %s:%v\n", namenode, err)
	}

	fileInfos, err := client.ReadDir("/" + path)
	if err != nil {
		return nil, fmt.Errorf("failed to list files under /%s:%v\n", path, err)
	}

	for _, fi := range fileInfos {
		fileLocations = append(fileLocations, &FileLocation{fl.Location + "/" + fi.Name()})
	}

	return
}
516203
func (b *Box) List() []string {
	var keys []string

	b.Walk(func(path string, info File) error {
		if info == nil {
			return nil
		}
		finfo, _ := info.FileInfo()
		if !finfo.IsDir() {
			keys = append(keys, path)
		}
		return nil
	})
	sort.Strings(keys)
	return keys
}
1078208
func (d *driver) List(ctx context.Context, subPath string) ([]string, error) {
	fullPath := d.fullPath(subPath)

	dir, err := os.Open(fullPath)
	if err != nil {
		if os.IsNotExist(err) {
			return nil, storagedriver.PathNotFoundError{Path: subPath}
		}
		return nil, err
	}

	defer dir.Close()

	fileNames, err := dir.Readdirnames(0)
	if err != nil {
		return nil, err
	}

	keys := make([]string, 0, len(fileNames))
	for _, fileName := range fileNames {
		keys = append(keys, path.Join(subPath, fileName))
	}

	return keys, nil
}
35628
func (d *Parallels9Driver) DiskPath(name string) (string, error) {
	out, err := exec.Command(d.PrlctlPath, "list", "-i", name).Output()
	if err != nil {
		return "", err
	}

	HDDRe := regexp.MustCompile("hdd0.* image='(.*)' type=*")
	matches := HDDRe.FindStringSubmatch(string(out))
	if matches == nil {
		return "", fmt.Errorf(
			"Could not determine hdd image path in the output:\n%s", string(out))
	}

	HDDPath := matches[1]
	return HDDPath, nil
}
1310527
func (d *driver) List(context context.Context, path string) ([]string, error) {
	var query *storage.Query
	query = &storage.Query{}
	query.Delimiter = "/"
	query.Prefix = d.pathToDirKey(path)
	list := make([]string, 0, 64)
	for {
		objects, err := storageListObjects(d.context(context), d.bucket, query)
		if err != nil {
			return nil, err
		}
		for _, object := range objects.Results {
			// GCS does not guarantee strong consistency between
			// DELETE and LIST operations. Check that the object is not deleted,
			// and filter out any objects with a non-zero time-deleted
			if object.Deleted.IsZero() && object.ContentType != uploadSessionContentType {
				list = append(list, d.keyToPath(object.Name))
			}
		}
		for _, subpath := range objects.Prefixes {
			subpath = d.keyToPath(subpath)
			list = append(list, subpath)
		}
		query = objects.Next
		if query == nil {
			break
		}
	}
	if path != "/" && len(list) == 0 {
		// Treat empty response as missing directory, since we don't actually
		// have directories in Google Cloud Storage.
		return nil, storagedriver.PathNotFoundError{Path: path}
	}
	return list, nil
}
820800
func (cnf *Mycnf) directoryList() []string {
	return []string{
		cnf.DataDir,
		cnf.InnodbDataHomeDir,
		cnf.InnodbLogGroupHomeDir,
		cnf.TmpDir,
		path.Dir(cnf.RelayLogPath),
		path.Dir(cnf.BinLogPath),
	}
}
230104
func (f FilesystemStore) ListFiles() []string {
	files := make([]string, 0, 0)
	filepath.Walk(f.baseDir, func(fp string, fi os.FileInfo, err error) error {
		// If there are errors, ignore this particular file
		if err != nil {
			return nil
		}
		// Ignore if it is a directory
		if fi.IsDir() {
			return nil
		}

		// If this is a symlink, ignore it
		if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
			return nil
		}

		// Only allow matches that end with our certificate extension (e.g. *.crt)
		matched, _ := filepath.Match("*"+f.ext, fi.Name())

		if matched {
			// Find the relative path for this file relative to the base path.
			fp, err = filepath.Rel(f.baseDir, fp)
			if err != nil {
				return err
			}
			trimmed := strings.TrimSuffix(fp, f.ext)
			files = append(files, trimmed)
		}
		return nil
	})
	return files
}
251956
func VolumeList(name string, pageIndex, pageSize int) (volumes []*types.Volume, totalCount int, err error) {
	var (
		ctx  context.Context
		cli  *client.Client
		resp volume.VolumeListOKBody
	)

	ctx, cli, err = mgr.Client()
	if err != nil {
		return
	}

	f := filters.NewArgs()
	//f.Add("dangling", "true")
	//f.Add("driver", "xx")
	if name != "" {
		f.Add("name", name)
	}
	resp, err = cli.VolumeList(ctx, f)
	if err != nil {
		return
	}
	sort.Slice(resp.Volumes, func(i, j int) bool {
		return resp.Volumes[i].Name < resp.Volumes[j].Name
	})

	totalCount = len(resp.Volumes)
	start, end := misc.Page(totalCount, pageIndex, pageSize)
	volumes = resp.Volumes[start:end]
	return
}
1001179
func (s *VolumeSource) ListVolumes(ctx context.ProviderCallContext) ([]string, error) {
	s.MethodCall(s, "ListVolumes", ctx)
	if s.ListVolumesFunc != nil {
		return s.ListVolumesFunc(ctx)
	}
	return nil, nil
}
360962
func (d *driver) List(ctx context.Context, path string) ([]string, error) {
	d.mutex.RLock()
	defer d.mutex.RUnlock()

	normalized := normalize(path)

	found := d.root.find(normalized)

	if !found.isdir() {
		return nil, fmt.Errorf("not a directory") // TODO(stevvooe): Need error type for this...
	}

	entries, err := found.(*dir).list(normalized)

	if err != nil {
		switch err {
		case errNotExists:
			return nil, storagedriver.PathNotFoundError{Path: path}
		case errIsNotDir:
			return nil, fmt.Errorf("not a directory")
		default:
			return nil, err
		}
	}

	return entries, nil
}
672790
func (g *Globber) filepaths(list []string, dir string, tree bool) (r []string) {
	var dirsep string
	if dir != "" {
		dirsep = dir + string(g.config.Separator)
		i := sort.SearchStrings(list, dirsep)
		if i >= len(list) {
			return
		}
		list = list[i:]
	}
	found := map[string]struct{}{}
	for _, path := range list {
		if dirsep != "" && !strings.HasPrefix(path, dirsep) {
			break
		}
		for j := len(dirsep); j < len(path); j++ {
			for j < len(path) && path[j] != g.config.Separator {
				j++
			}
			path := path[:j]
			if _, ok := found[path]; !ok {
				found[path] = struct{}{}
				r = append(r, path)
			}
			if !tree {
				break
			}
		}
	}
	return
}
559414
func ListFiles(fs fs.FileSystem, spec api.VolumeSpec) ([]string, error) {
	result := []string{}
	if _, err := os.Stat(spec.Source); err != nil {
		return nil, err
	}
	err := fs.Walk(spec.Source, func(path string, f os.FileInfo, err error) error {
		if err != nil {
			return err
		}

		// Detected files will be truncated. k8s' AtomicWriter creates
		// directories and symlinks to directories in order to inject files.
		// An attempt to truncate either a dir or symlink to a dir will fail.
		// Thus, we need to dereference symlinks to see if they might point
		// to a directory.
		// Do not try to simplify this logic to simply return nil if a symlink
		// is detected. During the tar transfer to an assemble image, symlinked
		// files are turned concrete (i.e. they will be turned into regular files
		// containing the content of their target). These newly concrete files
		// need to be truncated as well.

		if f.Mode()&os.ModeSymlink != 0 {
			linkDest, err := filepath.EvalSymlinks(path)
			if err != nil {
				return fmt.Errorf("unable to evaluate symlink [%v]: %v", path, err)
			}
			// Evaluate the destination of the link.
			f, err = os.Lstat(linkDest)
			if err != nil {
				// This is not a fatal error. If AtomicWrite tried multiple times, a symlink might not point
				// to a valid destination.
				glog.Warningf("Unable to lstat symlink destination [%s]->[%s]. err: %v. Partial atomic write?", path, linkDest, err)
				return nil
			}
		}

		if f.IsDir() {
			return nil
		}

		newPath := filepath.ToSlash(filepath.Join(spec.Destination, strings.TrimPrefix(path, spec.Source)))
		result = append(result, newPath)
		return nil
	})
	if err != nil {
		return nil, err
	}
	return result, nil
}
156233
func (r *Root) List() ([]volume.Volume, error) {
	var ls []volume.Volume
	r.m.Lock()
	for _, v := range r.volumes {
		ls = append(ls, v)
	}
	r.m.Unlock()
	return ls, nil
}
115423
func (d *BtrfsDriver) List() (result []string) {
	glog.Infof("Checking volumes at %s", d.root)
	raw, err := volume.RunBtrFSCmd(d.sudoer, "subvolume", "list", d.root)
	if err != nil {
		glog.Warningf("Could not list subvolumes at %s: %s (%s)", d.root, raw, err)
		return
	}
	rows := regexp.MustCompile(fmt.Sprintf("top level %s path (\\w+)", d.objectID)).FindAllSubmatch(raw, -1)
	for _, row := range rows {
		result = append(result, string(row[1]))
	}
	return
}
620706
func (lvs *loopVolumeSource) ListVolumes(ctx context.ProviderCallContext) ([]string, error) {
	// TODO(axw) implement this when we need it.
	return nil, errors.NotImplementedf("ListVolumes")
}
529874
func (dfs *DistributedFilesystem) List(tenantID string) ([]string, error) {
	vol, err := dfs.disk.Get(tenantID)
	if err != nil {
		glog.Errorf("Could not get volume for tenant %s: %s", tenantID, err)
		return nil, err
	}
	snapshots, err := vol.Snapshots()
	if err != nil {
		glog.Errorf("Could not get snapshots for tenant %s: %s", tenantID, err)
		return nil, err
	}
	return snapshots, nil
}