// MkdirAll makes a directory and any intervening directories with the
// permissions specified by the core.sharedRepository setting.
358660
func MkdirAll(path string, config repositoryPermissionFetcher) error {
	umask := 0777 & ^config.RepositoryPermissions(true)
	return doWithUmask(int(umask), func() error {
		return os.MkdirAll(path, config.RepositoryPermissions(true))
	})
}
858994
func (r *Root) ReadDirAll(ctx context.Context) (res []fuse.Dirent, err error) {
	r.log().CDebugf(ctx, "FS ReadDirAll")
	defer func() { err = r.private.fs.processError(ctx, libkbfs.ReadMode, err) }()
	res = []fuse.Dirent{
		{
			Type: fuse.DT_Dir,
			Name: PrivateName,
		},
		{
			Type: fuse.DT_Dir,
			Name: PublicName,
		},
		fuse.Dirent{
			Type: fuse.DT_Dir,
			Name: TeamName,
		},
	}
	if r.private.fs.platformParams.shouldAppendPlatformRootDirs() {
		res = append(res, platformRootDirs...)
	}

	if name := r.private.fs.remoteStatus.ExtraFileName(); name != "" {
		res = append(res, fuse.Dirent{Type: fuse.DT_File, Name: name})
	}
	return res, nil
}
296481
func (c *Client) Mkdir(path string) error {
	id := c.nextID()
	typ, data, err := c.sendPacket(sshFxpMkdirPacket{
		ID:   id,
		Path: path,
	})
	if err != nil {
		return err
	}
	switch typ {
	case ssh_FXP_STATUS:
		return normaliseError(unmarshalStatus(id, data))
	default:
		return unimplementedPacketErr(typ)
	}
}
595847
func mkdir(am auth.AuthMode, children []blob.Ref) (blob.Ref, error) {
	cl, err := client.New(client.OptionAuthMode(am))
	if err != nil {
		return blob.Ref{}, err
	}
	var newdir blob.Ref
	ss := schema.NewStaticSet()
	subsets := ss.SetStaticSetMembers(children)
	for _, v := range subsets {
		// TODO(mpl): make them concurrent
		if _, err := cl.UploadBlob(context.TODO(), v); err != nil {
			return newdir, err
		}
	}
	ssb := ss.Blob()
	if _, err := cl.UploadBlob(context.TODO(), ssb); err != nil {
		return newdir, err
	}
	const fileNameLayout = "20060102150405"
	fileName := "shared-" + time.Now().Format(fileNameLayout)
	dir := schema.NewDirMap(fileName).PopulateDirectoryMap(ssb.BlobRef())
	dirBlob := dir.Blob()
	if _, err := cl.UploadBlob(context.TODO(), dirBlob); err != nil {
		return newdir, err
	}

	return dirBlob.BlobRef(), nil
}
978252
func (fs DummyFS) Mkdir(name string, perm os.FileMode) error {
	return fs.err
}
1177280
func (s *CreateUserInput) SetHomeDirectory(v string) *CreateUserInput {
	s.HomeDirectory = &v
	return s
}
451086
func MkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int) error {
	return mkdirAs(path, mode, ownerUID, ownerGID, false, true)
}
756364
func (d *initData) CertificateWriteDir() string {
	if d.dryRun {
		return d.dryRunDir
	}
	return d.certificatesDir
}
1017401
func (*Root) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
	log.Debug("read Root")
	return nil, fuse.EPERM
}
617785
func (m *MemStore) Mkdir(path string, ttl time.Duration) error {
	return m.Set(path, []byte(""), ttl)
}
557836
func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
	log.Debug("Node ReadDir")
	dir, err := uio.NewDirectoryFromNode(s.Ipfs.DAG, s.Nd)
	if err != nil {
		return nil, err
	}

	var entries []fuse.Dirent
	err = dir.ForEachLink(ctx, func(lnk *ipld.Link) error {
		n := lnk.Name
		if len(n) == 0 {
			n = lnk.Cid.String()
		}
		nd, err := s.Ipfs.DAG.Get(ctx, lnk.Cid)
		if err != nil {
			log.Warning("error fetching directory child node: ", err)
		}

		t := fuse.DT_Unknown
		switch nd := nd.(type) {
		case *mdag.RawNode:
			t = fuse.DT_File
		case *mdag.ProtoNode:
			if fsn, err := ft.FSNodeFromBytes(nd.Data()); err != nil {
				log.Warning("failed to unmarshal protonode data field:", err)
			} else {
				switch fsn.Type() {
				case ft.TDirectory, ft.THAMTShard:
					t = fuse.DT_Dir
				case ft.TFile, ft.TRaw:
					t = fuse.DT_File
				case ft.TSymlink:
					t = fuse.DT_Link
				case ft.TMetadata:
					log.Error("metadata object in fuse should contain its wrapped type")
				default:
					log.Error("unrecognized protonode data type: ", fsn.Type())
				}
			}
		}
		entries = append(entries, fuse.Dirent{Name: n, Type: t})
		return nil
	})
	if err != nil {
		return nil, err
	}

	if len(entries) > 0 {
		return entries, nil
	}
	return nil, fuse.ENOENT
}
1091393
func (kz *Kazoo) mkdirRecursive(node string) (err error) {
	parent := path.Dir(node)
	if parent != "/" {
		if err = kz.mkdirRecursive(parent); err != nil {
			return
		}
	}

	exists, _, err := kz.conn.Exists(node)
	if err != nil {
		return
	}

	if !exists {
		_, err = kz.conn.Create(node, nil, 0, zk.WorldACL(zk.PermAll))
		return
	}

	return
}
647857
func MkdirAllWithACL(path string, perm os.FileMode, sddl string) error {
	return mkdirall(path, true, sddl)
}
979890
func (fl *FolderList) ReadDirAll(ctx context.Context) (res []fuse.Dirent, err error) {
	fl.fs.vlog.CLogf(ctx, libkb.VLog1, "FL ReadDirAll")
	defer func() {
		err = fl.fs.processError(ctx, libkbfs.ReadMode, err)
	}()
	session, err := fl.fs.config.KBPKI().GetCurrentSession(ctx)
	isLoggedIn := err == nil

	var favs []favorites.Folder
	if isLoggedIn {
		favs, err = fl.fs.config.KBFSOps().GetFavorites(ctx)
		if err != nil {
			return nil, err
		}
	}

	res = make([]fuse.Dirent, 0, len(favs))
	for _, fav := range favs {
		if fav.Type != fl.tlfType {
			continue
		}
		pname, err := tlf.CanonicalToPreferredName(
			session.Name, tlf.CanonicalName(fav.Name))
		if err != nil {
			fl.fs.log.Errorf("CanonicalToPreferredName: %q %v", fav.Name, err)
			continue
		}
		res = append(res, fuse.Dirent{
			Type: fuse.DT_Dir,
			Name: string(pname),
		})
	}
	return res, nil
}
1162585
func mkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int, mkAll, chownExisting bool) error {
	if err := system.MkdirAll(path, mode, ""); err != nil && !os.IsExist(err) {
		return err
	}
	return nil
}
61671
func (fl *FolderList) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (_ fs.Node, err error) {
	fl.fs.vlog.CLogf(ctx, libkb.VLog1, "FL Mkdir")
	tlfName := tlf.CanonicalName(req.Name)
	defer func() { err = fl.processError(ctx, libkbfs.WriteMode, tlfName, err) }()
	return nil, libkbfs.NewWriteUnsupportedError(tlfhandle.BuildCanonicalPath(fl.PathType(), string(tlfName)))
}
911914
func (t *Trash) ReadDirAll(ctx context.Context) (res []fuse.Dirent, err error) {
	t.fs.log.CDebugf(ctx, "Trash ReadDirAll")
	defer func() { err = t.fs.processError(ctx, libkbfs.ReadMode, err) }()

	return []fuse.Dirent{
		{
			Type: fuse.DT_Link,
			Name: strconv.Itoa(os.Getuid()),
		},
	}, nil
}