// Root constructs the Root of the filesystem, a Root object.
430623
func (f *FileSystem) Root() (fs.Node, error) {
	log.Debug("filesystem, get root")
	return f.RootNode, nil
}
597275
func (document *XmlDocument) Root() (element *ElementNode) {
	nodePtr := C.xmlDocGetRootElement(document.Ptr)
	if nodePtr != nil {
		element = NewNode(unsafe.Pointer(nodePtr), document).(*ElementNode)
	}
	return
}
755927
func rootify(path, root string) string {
	if filepath.IsAbs(path) {
		return path
	}
	return filepath.Join(root, path)
}
156053
func (c *Client) Root(url *url.URL) (root *RootService) {
	root = &RootService{client: c, URL: url}
	return
}
1207960
func (m *IntSet) FindRoot(a int) int {
	if a == m.parent[a] {
		return a
	}
	m.parent[a] = m.FindRoot(m.parent[a])
	return m.parent[a]
}
539990
func (rfs *RootFS) Stat(filename string) (fi os.FileInfo, err error) {
	return rfs.Lstat(filename)
}
1136055
func (t *Tree) Root() (*File, error) {
	if !t.haveRaw {
		data, err := t.comp.scget(t.Score)
		if err != nil {
			return nil, err
		}
		if err := unpack(data, &t.raw); err != nil {
			return nil, err
		}
		t.haveRaw = true
	}

	dir := &File{
		t:   t,
		dir: &t.raw,
		n:   &nameNode{"/", node{IsTree: true}},
	}
	return dir, nil
}
988869
func (c *Context) Root() *Context {
	if c.Parent != nil {
		return c.Parent.Root()
	}
	return c
}
539350
func Root(root ...string) func(*Options) error {
	return func(opts *Options) error {
		opts.rootBucket = root
		return nil
	}
}
346614
func (gi Instance) RootDisk() *compute.AttachedDisk {
	if gi.spec == nil {
		return nil
	}
	return gi.spec.RootDisk()
}
1029944
func InitRootFS(ctx context.Context, name string, parent digest.Digest, readonly bool, snapshotter snapshots.Snapshotter, mounter Mounter) ([]mount.Mount, error) {
	_, err := snapshotter.Stat(ctx, name)
	if err == nil {
		return nil, errors.Errorf("rootfs already exists")
	}
	// TODO: ensure not exist error once added to snapshot package

	parentS := parent.String()

	initName := defaultInitializer
	initFn := initializers[initName]
	if initFn != nil {
		parentS, err = createInitLayer(ctx, parentS, initName, initFn, snapshotter, mounter)
		if err != nil {
			return nil, err
		}
	}

	if readonly {
		return snapshotter.View(ctx, name, parentS)
	}

	return snapshotter.Prepare(ctx, name, parentS)
}
790160
func (r *Store) Tree(ctx context.Context) (tree.Tree, error) {
	root := simple.New("gopass")
	addFileFunc := func(in ...string) {
		for _, f := range in {
			var ct string
			switch {
			case strings.HasSuffix(f, ".b64"):
				ct = "application/octet-stream"
			case strings.HasSuffix(f, ".yml"):
				ct = "text/yaml"
			case strings.HasSuffix(f, ".yaml"):
				ct = "text/yaml"
			default:
				ct = "text/plain"
			}
			if err := root.AddFile(f, ct); err != nil {
				out.Error(ctx, "Failed to add file %s to tree: %s", f, err)
				continue
			}
		}
	}
	addTplFunc := func(in ...string) {
		for _, f := range in {
			if err := root.AddTemplate(f); err != nil {
				out.Error(ctx, "Failed to add template %s to tree: %s", f, err)
				continue
			}
		}
	}

	sf, err := r.store.List(ctx, "")
	if err != nil {
		return nil, err
	}
	addFileFunc(sf...)
	addTplFunc(r.store.ListTemplates(ctx, "")...)

	mps := r.MountPoints()
	sort.Sort(store.ByPathLen(mps))
	for _, alias := range mps {
		substore := r.mounts[alias]
		if substore == nil {
			continue
		}
		if err := root.AddMount(alias, substore.Path()); err != nil {
			return nil, errors.Errorf("failed to add mount: %s", err)
		}
		sf, err := substore.List(ctx, "")
		if err != nil {
			return nil, errors.Errorf("failed to add file: %s", err)
		}
		addFileFunc(sf...)
		addTplFunc(substore.ListTemplates(ctx, alias)...)
	}

	return root, nil
}
1040868
func Init(root string, _ []string) (volume.Driver, error) {
	if !volume.IsBtrfsFilesystem(root) {
		return nil, ErrBtrfsInvalidFilesystem
	}
	// get the driver object id
	objectID := "5" // root driver is always 5 unless it is a subvolume
	raw, err := volume.RunBtrFSCmd(volume.IsSudoer(), "subvolume", "show", root)
	if err != nil {
		glog.Errorf("Could not initialize btrfs driver for %s: %s (%s)", root, raw, err)
		return nil, volume.ErrBtrfsCommand
	}
	if obidmatch := regexp.MustCompile("Object ID:\\s+(\\w+)").FindSubmatch(raw); len(obidmatch) == 2 {
		objectID = string(obidmatch[1])
	}
	driver := &BtrfsDriver{
		sudoer:   volume.IsSudoer(),
		root:     root,
		objectID: objectID,
	}
	// Create future metadata dir, into which we can put stuff, but for now is
	// used for detection of type
	if err := os.MkdirAll(driver.MetadataDir(), 0755); err != nil && !os.IsExist(err) {
		return nil, err
	}
	if err := volume.TouchFlagFile(driver.poolDir()); err != nil {
		return nil, err
	}
	return driver, nil
}
210799
func (r Root) Find(args ...string) Root {
	temp, ok := findOnce(r.Pointer, args, false, false)
	if ok == false {
		if debug {
			panic("Element `" + args[0] + "` with attributes `" + strings.Join(args[1:], " ") + "` not found")
		}
		return Root{nil, "", errors.New("element `" + args[0] + "` with attributes `" + strings.Join(args[1:], " ") + "` not found")}
	}
	return Root{temp, temp.Data, nil}
}
82765
func (r *RecordCompletion) Root(c context.Context) *ds.Key {
	return ds.KeyForObj(c, &model.BackDepGroup{Dependee: *r.For})
}
392991
func (a *ActivateExecution) Root(c context.Context) *datastore.Key {
	return model.AttemptKeyFromID(c, a.Auth.Id.AttemptID())
}
1096308
func NewTreeRootNode(t *Tree) noder.Noder {
	if t == nil {
		return &treeNoder{}
	}

	return &treeNoder{
		parent: t,
		name:   "",
		mode:   filemode.Dir,
		hash:   t.Hash,
	}
}