当前位置: 首页>>代码示例>>Golang>>正文


Golang nodefs.NewDefaultFile函数代码示例

本文整理汇总了Golang中github.com/hanwen/go-fuse/fuse/nodefs.NewDefaultFile函数的典型用法代码示例。如果您正苦于以下问题:Golang NewDefaultFile函数的具体用法?Golang NewDefaultFile怎么用?Golang NewDefaultFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewDefaultFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: NewCFile

func NewCFile(client *client.Client, name string) nodefs.File {
	f := new(CFile)
	f.client = client
	f.File = nodefs.NewDefaultFile()
	f.name = name
	return f
}
开发者ID:c-fs,项目名称:cfuse,代码行数:7,代码来源:main.go

示例2: newVirtualFile

func (rfs *ReverseFS) newVirtualFile(content []byte, parentFile string) (nodefs.File, fuse.Status) {
	return &virtualFile{
		File:       nodefs.NewDefaultFile(),
		content:    content,
		parentFile: parentFile,
		ino:        rfs.inoGen.next(),
	}, fuse.OK
}
开发者ID:rfjakob,项目名称:gocryptfs,代码行数:8,代码来源:virtualfile.go

示例3: LoadMemory

func (n *blobNode) LoadMemory() (nodefs.File, error) {
	blob, err := n.fs.repo.LookupBlob(n.id)
	if err != nil {
		return nil, err
	}
	return &memoryFile{
		File: nodefs.NewDefaultFile(),
		blob: blob,
	}, nil
}
开发者ID:hanwen,项目名称:gitfs,代码行数:10,代码来源:fs.go

示例4: Create

func (n *folderNode) Create(name string, flags uint32, mode uint32, context *fuse.Context) (nodefs.File, *nodefs.Inode, fuse.Status) {
	if !n.fetch() {
		return nil, nil, fuse.EIO
	}

	obj := mtp.ObjectInfo{
		StorageID:        n.StorageID(),
		Filename:         name,
		ObjectFormat:     mtp.OFC_Undefined,
		ModificationDate: time.Now(),
		ParentObject:     n.Handle(),
		CompressedSize:   0,
	}

	var file nodefs.File
	var fsNode nodefs.Node
	if n.fs.options.Android {
		_, _, handle, err := n.fs.dev.SendObjectInfo(n.StorageID(), n.Handle(), &obj)
		if err != nil {
			log.Println("SendObjectInfo failed", err)
			return nil, nil, fuse.EIO
		}

		err = n.fs.dev.SendObject(&bytes.Buffer{}, 0)
		if err != nil {
			log.Println("SendObject failed:", err)
			return nil, nil, fuse.EIO
		}

		aNode := &androidNode{
			mtpNodeImpl: mtpNodeImpl{
				Node:   nodefs.NewDefaultNode(),
				obj:    &obj,
				fs:     n.fs,
				handle: handle,
			},
		}

		if !aNode.startEdit() {
			return nil, nil, fuse.EIO
		}
		file = &androidFile{
			File: nodefs.NewDefaultFile(),
			node: aNode,
		}
		fsNode = aNode
	} else {
		var err error
		file, fsNode, err = n.fs.createClassicFile(obj)
		if err != nil {
			return nil, nil, fuse.ToStatus(err)
		}
	}
	return file, n.Inode().NewChild(name, false, fsNode), fuse.OK
}
开发者ID:sithmakak,项目名称:go-mtpfs,代码行数:55,代码来源:fs.go

示例5: Open

func (m *MNode) Open(flags uint32, context *fuse.Context) (file nodefs.File, code fuse.Status) {
	m.obj.Lock()
	defer m.obj.Unlock()
	j,ok := m.obj.Obj.(*joinf.JoinFile)
	if !ok { return nil,fuse.EINVAL }
	if (flags&uint32(os.O_TRUNC))!=0 {
		e := j.Truncate(0)
		if e!=nil { return nil,fuse.ToStatus(e) }
	}
	return &MFile{nodefs.NewDefaultFile(),m.obj,j},fuse.OK
}
开发者ID:maxymania,项目名称:metaclusterfs,代码行数:11,代码来源:node.go

示例6: NewAdbFile

// NewAdbFile returns a File that reads and writes to name on the device.
// perms should be set from the existing file if it exists, or to the desired new permissions if new.
func NewAdbFile(opts AdbFileOpenOptions) nodefs.File {
	logEntry := StartFileOperation("New", opts.FileBuffer.Path, fmt.Sprint(opts))
	defer logEntry.FinishOperation()

	adbFile := &AdbFile{
		// Log all the operations we don't implement.
		File:               newLoggingFile(nodefs.NewDefaultFile(), opts.FileBuffer.Path),
		AdbFileOpenOptions: opts,
	}

	return nodefs.NewReadOnlyFile(adbFile)
}
开发者ID:freakmac,项目名称:adbfs,代码行数:14,代码来源:adb_file.go

示例7: NewObjectFile

func NewObjectFile(name string, obj mapper.Object) *ObjectFile {
	f := &ObjectFile{
		name:       name,
		object:     obj,
		lock:       sync.Mutex{},
		needUpload: false,

		File: nodefs.NewDefaultFile(),
	}

	return f
}
开发者ID:hironobu-s,项目名称:swiftfs,代码行数:12,代码来源:objectfile.go

示例8: Open

func (fs *nomsFS) Open(path string, flags uint32, context *fuse.Context) (nodefs.File, fuse.Status) {
	fs.mdLock.Lock()
	defer fs.mdLock.Unlock()
	np, code := fs.getPath(path)
	if code != fuse.OK {
		return nil, code
	}

	nfile := nomsFile{
		File: nodefs.NewDefaultFile(),

		fs:   fs,
		node: np,
	}

	return nfile, fuse.OK
}
开发者ID:Richardphp,项目名称:noms,代码行数:17,代码来源:nomsfs.go

示例9: Create

func (fs *nomsFS) Create(path string, flags uint32, mode uint32, context *fuse.Context) (nodefs.File, fuse.Status) {
	fs.mdLock.Lock()
	defer fs.mdLock.Unlock()
	np, code := fs.createCommon(path, mode, func() types.Value {
		blob := types.NewEmptyBlob()
		return types.NewStructWithType(fileType, types.ValueSlice{fs.ds.Database().WriteValue(blob)})
	})
	if code != fuse.OK {
		return nil, code
	}

	nfile := nomsFile{
		File: nodefs.NewDefaultFile(),

		fs:   fs,
		node: np,
	}
	return nfile, fuse.OK
}
开发者ID:Richardphp,项目名称:noms,代码行数:19,代码来源:nomsfs.go

示例10: createClassicFile

func (fs *deviceFS) createClassicFile(obj mtp.ObjectInfo) (file nodefs.File, node nodefs.Node, err error) {
	backingFile, err := ioutil.TempFile(fs.options.Dir, "")
	cl := &classicNode{
		mtpNodeImpl: mtpNodeImpl{
			Node: nodefs.NewDefaultNode(),
			obj:  &obj,
			fs:   fs,
		},
		dirty:   true,
		backing: backingFile.Name(),
	}
	file = &pendingFile{
		loopback: nodefs.NewLoopbackFile(backingFile),
		node:     cl,
		File:     nodefs.NewDefaultFile(),
	}

	node = cl
	return
}
开发者ID:YoshikuniShiku,项目名称:go-mtpfs,代码行数:20,代码来源:classic.go

示例11: Create

func (fs *objectFileSystem) Create(name string, flags uint32, mode uint32, context *fuse.Context) (nodefs.File, fuse.Status) {
	log.Debugf("Create: %s, flags: %d", name, flags)

	fs.lock.Lock()
	defer fs.lock.Unlock()

	// Add to mapper
	obj, err := fs.mapper.Create(name)
	if err != nil {
		log.Warnf("Can't append to mapper %v", err)
		return nodefs.NewDefaultFile(), fuse.EIO
	}

	file := NewObjectFile(name, obj)
	if err := file.OpenLocalFile(flags, mode); err != nil {
		log.Warnf("Create: OpenLocalFile() error %v", err)
		return file, fuse.EIO
	}

	return file, fuse.OK
}
开发者ID:hironobu-s,项目名称:swiftfs,代码行数:21,代码来源:filesystem.go

示例12: newFile

func (rfs *ReverseFS) newFile(relPath string, flags uint32) (nodefs.File, fuse.Status) {
	absPath, err := rfs.abs(rfs.decryptPath(relPath))
	if err != nil {
		return nil, fuse.ToStatus(err)
	}
	fd, err := os.OpenFile(absPath, int(flags), 0666)
	if err != nil {
		return nil, fuse.ToStatus(err)
	}
	id := derivePathIV(relPath, ivPurposeFileID)
	header := contentenc.FileHeader{
		Version: contentenc.CurrentVersion,
		ID:      id,
	}
	return &reverseFile{
		File:       nodefs.NewDefaultFile(),
		fd:         fd,
		header:     header,
		block0IV:   derivePathIV(relPath, ivPurposeBlock0IV),
		contentEnc: rfs.contentEnc,
	}, fuse.OK
}
开发者ID:rfjakob,项目名称:gocryptfs,代码行数:22,代码来源:rfile.go

示例13: Open

func (n *androidNode) Open(flags uint32, context *fuse.Context) (file nodefs.File, code fuse.Status) {
	return &androidFile{
		node: n,
		File: nodefs.NewDefaultFile(),
	}, fuse.OK
}
开发者ID:YoshikuniShiku,项目名称:go-mtpfs,代码行数:6,代码来源:android.go

示例14: NewOssFile

func NewOssFile(bucket string, fileName string, ossClient *oss.Client, lock *sync.Mutex, size int64, bufFile *BufFile) (ossFile *OssFile) {
	ossFile = &OssFile{bucket: bucket, fileName: fileName, ossClient: ossClient, lock: lock, size: size, bufFile: bufFile}
	ossFile.File = nodefs.NewDefaultFile()
	return ossFile
}
开发者ID:fantasycool,项目名称:gz-oss,代码行数:5,代码来源:file.go

示例15: Open

func (n *classicNode) Open(flags uint32, context *fuse.Context) (file nodefs.File, code fuse.Status) {
	return &pendingFile{
		File: nodefs.NewDefaultFile(),
		node: n,
	}, fuse.OK
}
开发者ID:YoshikuniShiku,项目名称:go-mtpfs,代码行数:6,代码来源:classic.go


注:本文中的github.com/hanwen/go-fuse/fuse/nodefs.NewDefaultFile函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。