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


Golang fuse.Attr类代码示例

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


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

示例1: GetAttr

func (n *pathInode) GetAttr(out *fuse.Attr, file nodefs.File, context *fuse.Context) (code fuse.Status) {
	var fi *fuse.Attr
	if file == nil {
		// called on a deleted files.
		file = n.Inode().AnyFile()
	}

	if file != nil {
		code = file.GetAttr(out)
	}

	if file == nil || code == fuse.ENOSYS || code == fuse.EBADF {
		fi, code = n.fs.GetAttr(n.GetPath(), context)
	}

	if fi != nil {
		n.setClientInode(fi.Ino)
	}

	if fi != nil && !fi.IsDir() && fi.Nlink == 0 {
		fi.Nlink = 1
	}

	if fi != nil {
		*out = *fi
	}
	return code
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:28,代码来源:pathfs.go

示例2: GetAttr

func (n *defaultNode) GetAttr(out *fuse.Attr, file File, context *fuse.Context) (code fuse.Status) {
	if n.Inode().IsDir() {
		out.Mode = fuse.S_IFDIR | 0755
	} else {
		out.Mode = fuse.S_IFREG | 0644
	}
	return fuse.OK
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:8,代码来源:defaultnode.go

示例3: GetAttr

func (f *loopbackFile) GetAttr(a *fuse.Attr) fuse.Status {
	st := syscall.Stat_t{}
	f.lock.Lock()
	err := syscall.Fstat(int(f.File.Fd()), &st)
	f.lock.Unlock()
	if err != nil {
		return fuse.ToStatus(err)
	}
	a.FromStat(&st)

	return fuse.OK
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:12,代码来源:files.go

示例4: GetAttr

func (fs *FSetAttrFs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) {
	if name == "" {
		return &fuse.Attr{Mode: fuse.S_IFDIR | 0700}, fuse.OK
	}
	if name == "file" && fs.file != nil {
		var a fuse.Attr
		fs.file.getAttr(&a)
		a.Mode |= fuse.S_IFREG
		return &a, fuse.OK
	}
	return nil, fuse.ENOENT
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:12,代码来源:fsetattr_test.go

示例5: GetAttr

func (fs *unionFsFile) GetAttr(out *fuse.Attr) fuse.Status {
	code := fs.File.GetAttr(out)
	if code.Ok() {
		out.Mode |= 0200
	}
	return code
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:7,代码来源:unionfs.go

示例6: GetAttr

func (n *memNode) GetAttr(out *fuse.Attr, file nodefs.File, context *fuse.Context) fuse.Status {
	if n.Inode().IsDir() {
		out.Mode = fuse.S_IFDIR | 0777
		return fuse.OK
	}
	n.file.Stat(out)
	return fuse.OK
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:8,代码来源:memtree.go

示例7: lookupMountUpdate

func (c *FileSystemConnector) lookupMountUpdate(out *fuse.Attr, mount *fileSystemMount) (node *Inode, code fuse.Status) {
	code = mount.mountInode.Node().GetAttr(out, nil, nil)
	if !code.Ok() {
		log.Println("Root getattr should not return error", code)
		out.Mode = fuse.S_IFDIR | 0755
		return mount.mountInode, fuse.OK
	}

	return mount.mountInode, fuse.OK
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:10,代码来源:fsops.go

示例8: Create

func (fs *unionFS) Create(name string, flags uint32, mode uint32, context *fuse.Context) (fuseFile nodefs.File, code fuse.Status) {
	writable := fs.fileSystems[0]

	code = fs.promoteDirsTo(name)
	if code != fuse.OK {
		return nil, code
	}
	fuseFile, code = writable.Create(name, flags, mode, context)
	if code.Ok() {
		fuseFile = fs.newUnionFsFile(fuseFile, 0)
		fs.removeDeletion(name)

		now := time.Now()
		a := fuse.Attr{
			Mode: fuse.S_IFREG | mode,
		}
		a.SetTimes(nil, &now, &now)
		fs.branchCache.Set(name, branchResult{&a, fuse.OK, 0})
	}
	return fuseFile, code
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:21,代码来源:unionfs.go

示例9: HeaderToFileInfo

func HeaderToFileInfo(out *fuse.Attr, h *tar.Header) {
	out.Mode = uint32(h.Mode)
	out.Size = uint64(h.Size)
	out.Uid = uint32(h.Uid)
	out.Gid = uint32(h.Gid)
	out.SetTimes(&h.AccessTime, &h.ModTime, &h.ChangeTime)
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:7,代码来源:tarfs.go

示例10: findChild

func (n *pathInode) findChild(fi *fuse.Attr, name string, fullPath string) (out *pathInode) {
	if fi.Ino > 0 {
		unlock := n.RLockTree()
		v := n.pathFs.clientInodeMap[fi.Ino]
		if len(v) > 0 {
			out = v[0].node

			if fi.Nlink == 1 {
				log.Println("Found linked inode, but Nlink == 1", fullPath)
			}
		}
		unlock()
	}

	if out == nil {
		out = n.createChild(name, fi.IsDir())
		out.clientInode = fi.Ino
		n.addChild(name, out)
	} else {
		// should add 'out' as a child to n ?
	}
	return out
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:23,代码来源:pathfs.go

示例11: Stat

func (f *TarFile) Stat(out *fuse.Attr) {
	HeaderToFileInfo(out, &f.Header)
	out.Mode |= syscall.S_IFREG
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:4,代码来源:tarfs.go

示例12: Lookup

func (n *nodeReadNode) Lookup(out *fuse.Attr, name string, context *fuse.Context) (*Inode, fuse.Status) {
	out.Mode = fuse.S_IFREG | 0644
	out.Size = uint64(len(name))
	ch := n.Inode().NewChild(name, false, newNodeReadNode([]byte(name)))
	return ch, fuse.OK
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:6,代码来源:fileless_test.go

示例13: setOwner

func (m *fileSystemMount) setOwner(attr *fuse.Attr) {
	if m.options.Owner != nil {
		attr.Owner = *(*fuse.Owner)(m.options.Owner)
	}
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:5,代码来源:fsmount.go

示例14: GetAttr

func (f *dataFile) GetAttr(out *fuse.Attr) fuse.Status {
	log.Print("dataFile.GetAttr()", " ", out)
	out.Mode = fuse.S_IFREG | 0775
	out.Size = uint64(len(f.data))
	return fuse.OK
}
开发者ID:y-okubo,项目名称:nekofs,代码行数:6,代码来源:file.go

示例15: getAttr

func (f *MutableDataFile) getAttr(out *fuse.Attr) {
	*out = f.Attr
	out.Size = uint64(len(f.data))
}
开发者ID:y-okubo,项目名称:go-fuse,代码行数:4,代码来源:fsetattr_test.go


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