// NewnfsMounter returns a Mounter specific to parse NFS mounts. This can work
// VFS also if 'servers' is nil. Use NFSAllServers if the destination server
// is unknown.
493806
func NewNFSMounter(servers []string,
	mountImpl MountImpl,
	allowedDirs []string,
) (Manager, error) {
	m := &nfsMounter{
		servers: servers,
		Mounter: Mounter{
			mountImpl:   mountImpl,
			mounts:      make(DeviceMap),
			paths:       make(PathMap),
			allowedDirs: allowedDirs,
			kl:          keylock.New(),
		},
	}
	err := m.Load([]string{""})
	if err != nil {
		return nil, err
	}
	return m, nil
}
506283
func (u *FakeVolumeUtil) AddNewDirEntries(mountDir string, dirFiles map[string][]*FakeDirEntry) {
	for dir, files := range dirFiles {
		mountedPath := filepath.Join(mountDir, dir)
		curFiles := u.directoryFiles[mountedPath]
		if curFiles == nil {
			curFiles = []*FakeDirEntry{}
		}
		glog.Infof("Adding to directory %q: files %v\n", dir, files)
		u.directoryFiles[mountedPath] = append(curFiles, files...)
	}
}
250161
func NewNSEnter(mounter mount.Interface, ne *nsenter.Nsenter, rootDir string) Interface {
	return &subpathNSE{
		mounter: mounter,
		ne:      ne,
		rootDir: rootDir,
	}
}
1181286
func NewMDServerDir(
	config mdServerLocalConfig, dirPath string) (*MDServerDisk, error) {
	return newMDServerDisk(config, dirPath, nil)
}
947754
func NewAllocDir(logger hclog.Logger, allocDir string) *AllocDir {
	logger = logger.Named("alloc_dir")
	return &AllocDir{
		AllocDir:  allocDir,
		SharedDir: filepath.Join(allocDir, SharedAllocName),
		TaskDirs:  make(map[string]*TaskDir),
		logger:    logger,
	}
}
968298
func NewVolume(name, path string, pathType *v1.HostPathType) v1.Volume {
	return v1.Volume{
		Name: name,
		VolumeSource: v1.VolumeSource{
			HostPath: &v1.HostPathVolumeSource{
				Path: path,
				Type: pathType,
			},
		},
	}
}
258075
func NewNFSAPI(client *Client) *NFSAPI {
	return &NFSAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "appliance"
			},
			FuncBaseSearchCondition: func() *sacloud.Request {
				res := &sacloud.Request{}
				res.AddFilter("Class", "nfs")
				return res
			},
		},
	}
}
344038
func Create(rootFS vfs.Filesystem) *MountFS {
	return &MountFS{
		rootFS:  rootFS,
		mounts:  make(map[string]vfs.Filesystem),
		parents: make(map[string][]string),
	}
}
211117
func GetNFSVolumeInfo(mountpoint string) (*NFSMountInfo, error) {
	minfo, err := GetMountInfo(mountpoint)
	if err != nil {
		return nil, err
	}

	if !strings.HasPrefix(minfo.FSType, "nfs") {
		return nil, fmt.Errorf("%s is not nfs; uses %s", minfo.LocalPath, minfo.FSType)
	}

	info := NFSMountInfo{
		MountInfo: *minfo,
	}

	return &info, nil
}
412970
func (m *nfsMounter) Reload(source string) error {
	newNFSm, err := NewNFSMounter([]string{NFSAllServers},
		m.mountImpl,
		m.Mounter.allowedDirs,
	)
	if err != nil {
		return err
	}
	newNFSmounter, ok := newNFSm.(*nfsMounter)
	if !ok {
		return fmt.Errorf("Internal error failed to convert %T",
			newNFSmounter)
	}

	return m.reload(source, newNFSmounter.mounts[source])
}
1193358
func (plugin *flexVolumePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
	return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName()), plugin.runner)
}
333628
func (p *sioPlugin) NewUnmounter(specName string, podUID types.UID) (volume.Unmounter, error) {
	klog.V(4).Info(log("Unmounter for %s", specName))

	return &sioVolume{
		podUID:      podUID,
		volSpecName: specName,
		plugin:      p,
	}, nil
}
158631
func NewUploader(cfg UploaderConfig) (*Uploader, error) {
	if err := cfg.CheckAndSetDefaults(); err != nil {
		return nil, trace.Wrap(err)
	}

	ctx, cancel := context.WithCancel(cfg.Context)
	uploader := &Uploader{
		UploaderConfig: cfg,
		Entry: log.WithFields(log.Fields{
			trace.Component: teleport.ComponentAuditLog,
		}),
		cancel:    cancel,
		ctx:       ctx,
		semaphore: make(chan struct{}, cfg.ConcurrentUploads),
		scanDir:   filepath.Join(cfg.DataDir, cfg.ServerID, SessionLogsDir, cfg.Namespace),
	}
	return uploader, nil
}
1315635
func (s *NFSFileShareInfo) SetNFSFileShareDefaults(v *NFSFileShareDefaults) *NFSFileShareInfo {
	s.NFSFileShareDefaults = v
	return s
}
626089
func NewXfrmStat() (XfrmStat, error) {
	fs, err := NewFS(DefaultMountPoint)
	if err != nil {
		return XfrmStat{}, err
	}

	return fs.NewXfrmStat()
}
1225681
func (sa *StorageAuthority) NewOrder(_ context.Context, order *corepb.Order) (*corepb.Order, error) {
	return order, nil
}
601361
func NewVolumeUnmountOptions(options map[string]string) *api.SdkVolumeUnmountOptions {
	return &api.SdkVolumeUnmountOptions{
		DeleteMountPath:                IsBoolOptionSet(options, OptionsDeleteAfterUnmount),
		NoDelayBeforeDeletingMountPath: IsBoolOptionSet(options, OptionsWaitBeforeDelete),
	}
}