func allPaths(ctx context.Context, t *testing.T, m *fs.MountNamespace, base string) ([]string, error) {
	var paths []string
	root := m.Root()
	defer root.DecRef()

	maxTraversals := uint(1)
	d, err := m.FindLink(ctx, root, nil, base, &maxTraversals)
	if err != nil {
		t.Logf("FindLink failed for %q", base)
		return paths, err
	}
	defer d.DecRef()

	if fs.IsDir(d.Inode.StableAttr) {
		dir, err := d.Inode.GetFile(ctx, d, fs.FileFlags{Read: true})
		if err != nil {
			return nil, fmt.Errorf("failed to open directory %q: %v", base, err)
		}
		iter, ok := dir.FileOperations.(fs.DirIterator)
		if !ok {
			return nil, fmt.Errorf("cannot directly iterate on host directory %q", base)
		}
		dirCtx := &fs.DirCtx{
			Serializer: noopDentrySerializer{},
		}
		if _, err := fs.DirentReaddir(ctx, d, iter, root, dirCtx, 0); err != nil {
			return nil, err
		}
		for name := range dirCtx.DentAttrs() {
			if name == "." || name == ".." {
				continue
			}

			fullName := path.Join(base, name)
			paths = append(paths, fullName)

			// Recurse.
			subpaths, err := allPaths(ctx, t, m, fullName)
			if err != nil {
				return paths, err
			}
			paths = append(paths, subpaths...)
		}
	}

	return paths, nil
}
// allPaths returns a slice of all paths of entries visible in the rootfs.
allPaths returns a slice of all paths of entries visible in the rootfs.
// allPaths returns a slice of all paths of entries visible in the rootfs .
func allPaths(ctx context.Context, t *testing.T, m *fs.MountNamespace, base string) ([]string, error) {
	var paths []string
	root := m.Root()
	defer root.DecRef()
	maxTraversals := uint(1)
	d, err := m.FindLink(ctx, root, nil, base, &maxTraversals)
	if err != nil {
		t.Logf("FindLink failed for %q", base)
		return paths, err
	}
	defer d.DecRef()
	if fs.IsDir(d.Inode.StableAttr) {
		dir, err := d.Inode.GetFile(ctx, d, fs.FileFlags{Read: true})
		if err != nil {
			return nil, fmt.Errorf("failed to open directory %q: %v", base, err)
		}
		iter, ok := dir.FileOperations.(fs.DirIterator)
		if !ok {
			return nil, fmt.Errorf("cannot directly iterate on host directory %q", base)
		}
		dirCtx := &fs.DirCtx{
			Serializer: noopDentrySerializer{},
		}
		if _, err := fs.DirentReaddir(ctx, d, iter, root, dirCtx, 0); err != nil {
			return nil, err
		}
		for name := range dirCtx.DentAttrs() {
			if name == "." || name == ".." {
				continue
			}
			fullName := path.Join(base, name)
			paths = append(paths, fullName)
			subpaths, err := allPaths(ctx, t, m, fullName)
			if err != nil {
				return paths, err
			}
			paths = append(paths, subpaths...)
		}
	}
	return paths, nil
}
func allPaths ( ctx context . Context , t * testing . T , m * fs . MountNamespace , base string ) ( [ ] string , error ) { var paths [ ] string root := m . Root ( ) defer root . DecRef ( ) maxTraversals := uint ( 1 ) d , err := m . FindLink ( ctx , root , nil , base , & maxTraversals ) if err != nil { t . Logf ( " " , base ) return paths , err } defer d . DecRef ( ) if fs . IsDir ( d . Inode . StableAttr ) { dir , err := d . Inode . GetFile ( ctx , d , fs . FileFlags { Read : true } ) if err != nil { return nil , fmt . Errorf ( " " , base , err ) } iter , ok := dir . FileOperations . ( fs . DirIterator ) if ! ok { return nil , fmt . Errorf ( " " , base ) } dirCtx := & fs . DirCtx { Serializer : noopDentrySerializer { } , } if _ , err := fs . DirentReaddir ( ctx , d , iter , root , dirCtx , 0 ) ; err != nil { return nil , err } for name := range dirCtx . DentAttrs ( ) { if name == " " || name == " " { continue } fullName := path . Join ( base , name ) paths = append ( paths , fullName ) subpaths , err := allPaths ( ctx , t , m , fullName ) if err != nil { return paths , err } paths = append ( paths , subpaths ... ) } } return paths , nil }
allPaths returns a slice of all paths of entries visible in the rootfs.
allPaths returns a slice of all paths of entries visible in the rootfs .
// Recurse.