// ListN - lists atmost N files from the directory.
432065
func (store *QueueStore) ListN(n int) []string {
	store.RLock()
	defer store.RUnlock()
	return store.listN(n)
}
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
}
1319850
func (api *subnetsAPI) ListSubnets(args params.SubnetsFilters) (results params.ListSubnetsResults, err error) {
	if err := api.checkCanRead(); err != nil {
		return params.ListSubnetsResults{}, err
	}

	return networkingcommon.ListSubnets(api.backing, args)
}
548139
func (s *NetworkOfferingService) ListNetworkOfferings(p *ListNetworkOfferingsParams) (*ListNetworkOfferingsResponse, error) {
	resp, err := s.cs.newRequest("listNetworkOfferings", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListNetworkOfferingsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1029340
func (self *InvoiceClient) CustomerListN(id string, count int, offset int) ([]*Invoice, error) {
	return self.list(id, count, offset)
}
210876
func (v *Vibranium) ListNetworks(ctx context.Context, opts *pb.ListNetworkOptions) (*pb.Networks, error) {
	networks, err := v.cluster.ListNetworks(ctx, opts.Podname, opts.Driver)
	if err != nil {
		return nil, err
	}

	ns := []*pb.Network{}
	for _, n := range networks {
		ns = append(ns, toRPCNetwork(n))
	}
	return &pb.Networks{Networks: ns}, nil
}
1238257
func (c *Client) ListNetworkOfferings(p *ListNetworkOfferingsParameter) ([]*NetworkOffering, error) {
	obj, err := c.Request("listNetworkOfferings", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.([]*NetworkOffering), err
}
404626
func (s *Storage) ListFilterAny(fns ...relutil.FilterFunc) ([]*rspb.Release, error) {
	s.Log("listing any releases with filter")
	return s.Driver.List(func(rls *rspb.Release) bool {
		return relutil.Any(fns...).Check(rls)
	})
}
713470
func ListFiles(dir string) ([]string, error) {
	var files []string
	err := filepath.Walk(dir, func(active string, info os.FileInfo, err error) error {
		// ignore directories
		if info.IsDir() {
			return nil
		}
		if err != nil {
			return err
		}
		rel, err := filepath.Rel(dir, active)
		files = append(files, rel)
		return nil
	})
	return files, err
}
826785
func (d *FileDepot) List() []*Tag {
	var tags = make([]*Tag, 0)

	filepath.Walk(d.dirPath, func(path string, info os.FileInfo, err error) error {
		if err != nil {
			return nil
		}
		if info.IsDir() {
			return nil
		}
		rel, err := filepath.Rel(d.dirPath, path)
		if err != nil {
			return nil
		}
		if rel != info.Name() {
			return nil
		}
		tags = append(tags, &Tag{info.Name(), info.Mode()})
		return nil
	})

	return tags
}
569867
func (image *Image) ListChildren() (pools []string, images []string, err error) {
	if image.image == nil {
		return nil, nil, RbdErrorImageNotOpen
	}

	var c_pools_len, c_images_len C.size_t

	ret := C.rbd_list_children(image.image,
		nil, &c_pools_len,
		nil, &c_images_len)
	if ret == 0 {
		return nil, nil, nil
	}
	if ret < 0 && ret != -C.ERANGE {
		return nil, nil, RBDError(ret)
	}

	pools_buf := make([]byte, c_pools_len)
	images_buf := make([]byte, c_images_len)

	ret = C.rbd_list_children(image.image,
		(*C.char)(unsafe.Pointer(&pools_buf[0])),
		&c_pools_len,
		(*C.char)(unsafe.Pointer(&images_buf[0])),
		&c_images_len)
	if ret < 0 {
		return nil, nil, RBDError(ret)
	}

	tmp := bytes.Split(pools_buf[:c_pools_len-1], []byte{0})
	for _, s := range tmp {
		if len(s) > 0 {
			name := C.GoString((*C.char)(unsafe.Pointer(&s[0])))
			pools = append(pools, name)
		}
	}

	tmp = bytes.Split(images_buf[:c_images_len-1], []byte{0})
	for _, s := range tmp {
		if len(s) > 0 {
			name := C.GoString((*C.char)(unsafe.Pointer(&s[0])))
			images = append(images, name)
		}
	}

	return pools, images, nil
}
740448
func (s *NicService) ListNics(p *ListNicsParams) (*ListNicsResponse, error) {
	resp, err := s.cs.newRequest("listNics", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListNicsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
854377
func List(args ...cty.Value) (cty.Value, error) {
	return ListFunc.Call(args)
}
460329
func (*Service) ListNICs(c context.Context, req *crimson.ListNICsRequest) (*crimson.ListNICsResponse, error) {
	nics, err := listNICs(c, database.Get(c), req)
	if err != nil {
		return nil, err
	}
	return &crimson.ListNICsResponse{
		Nics: nics,
	}, nil
}
26714
func (a *StorageAPI) ListFilesystems(filters params.FilesystemFilters) (params.FilesystemDetailsListResults, error) {
	results := params.FilesystemDetailsListResults{
		Results: make([]params.FilesystemDetailsListResult, len(filters.Filters)),
	}
	if err := a.checkCanRead(); err != nil {
		return results, errors.Trace(err)
	}

	stFileAccess := a.storageAccess.FilesystemAccess()
	for i, filter := range filters.Filters {
		filesystems, filesystemAttachments, err := filterFilesystems(stFileAccess, filter)
		if err != nil {
			results.Results[i].Error = common.ServerError(err)
			continue
		}
		details, err := createFilesystemDetailsList(
			a.backend, a.storageAccess, filesystems, filesystemAttachments,
		)
		if err != nil {
			results.Results[i].Error = common.ServerError(err)
			continue
		}
		results.Results[i].Result = details
	}
	return results, nil
}
723821
func (s *RemoteStore) ListFiles() []string {
	logrus.Infof("listing files from %s", s.location)
	ctx, cancel := s.getContext()
	defer cancel()
	fl, err := s.client.ListFiles(ctx, &google_protobuf.Empty{})
	if err != nil {
		logrus.Errorf("error listing files from %s: %s", s.location, err.Error())
		return nil
	}
	return fl.FileNames
}
424188
func ListFilesInDir(dir string, recursive bool) []string {
	files := make([]string, 0)
	filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
		if err != nil {
			return err
		}
		isDir, err := PathIsDir(path)
		if err != nil {
			return err
		}
		if isDir {
			if recursive || path == dir {
				return nil
			}
			return filepath.SkipDir
		}
		files = append(files, path)
		return nil
	})
	return files
}