• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang fuse.EntryOut类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Lookup

func (c *rawBridge) Lookup(header *fuse.InHeader, name string, out *fuse.EntryOut) (code fuse.Status) {
	parent := c.toInode(header.NodeId)
	if !parent.IsDir() {
		log.Printf("Lookup %q called on non-Directory node %d", name, header.NodeId)
		return fuse.ENOTDIR
	}
	outAttr := (*fuse.Attr)(&out.Attr)
	child, code := c.fsConn().internalLookup(outAttr, parent, name, header)
	if code == fuse.ENOENT && parent.mount.negativeEntry(out) {
		return fuse.OK
	}
	if !code.Ok() {
		return code
	}
	if child == nil {
		log.Println("Lookup returned fuse.OK with nil child", name)
	}

	child.mount.fillEntry(out)
	out.NodeId = c.fsConn().lookupUpdate(child)
	out.Generation = child.generation
	out.Ino = out.NodeId

	return fuse.OK
}
开发者ID:newblue,项目名称:go-fuse,代码行数:25,代码来源:fsops.go


示例2: ReadDirPlus

func (constor *Constor) ReadDirPlus(input *fuse.ReadIn, fuseout *fuse.DirEntryList) fuse.Status {
	constor.log("")
	constor.log("%d", input.Offset)
	ptr := uintptr(input.Fh)
	offset := input.Offset
	entryOut := fuse.EntryOut{}
	out := (*DirEntryList)(unsafe.Pointer(fuseout))

	F := constor.getfd(ptr)
	stream := F.stream
	if stream == nil {
		return fuse.EIO
	}
	if offset > uint64(len(stream)) {
		return fuse.EINVAL
	}
	todo := F.stream[offset:]
	for _, e := range todo {
		if e.Name == "" {
			continue
		}
		attr := (*fuse.Attr)(&entryOut.Attr)
		attr.FromStat(&e.Stat)
		entryOut.NodeId = attr.Ino
		entryOut.Ino = attr.Ino
		ok, _ := out.AddDirLookupEntry(e, &entryOut)
		if !ok {
			break
		}
	}
	return fuse.OK
}
开发者ID:krishnasrinivas,项目名称:constor,代码行数:32,代码来源:main.go


示例3: childLookup

// childLookup fills entry information for a newly created child inode
func (c *rawBridge) childLookup(out *fuse.EntryOut, n *Inode, context *fuse.Context) {
	n.Node().GetAttr((*fuse.Attr)(&out.Attr), nil, context)
	n.mount.fillEntry(out)
	out.Ino = c.fsConn().lookupUpdate(n)
	out.NodeId = out.Ino
	if out.Nlink == 0 {
		// With Nlink == 0, newer kernels will refuse link
		// operations.
		out.Nlink = 1
	}
}
开发者ID:jordie,项目名称:go-fuse,代码行数:12,代码来源:fsconnector.go


示例4: Lookup

func (constor *Constor) Lookup(header *fuse.InHeader, name string, out *fuse.EntryOut) fuse.Status {
	var stat syscall.Stat_t
	if len(name) > 255 {
		constor.error("name too long : %s", name)
		return fuse.Status(syscall.ENAMETOOLONG)
	}
	li := -1
	parent := constor.inodemap.findInodePtr(header.NodeId)
	if parent == nil {
		constor.error("Unable to find parent inode : %d", header.NodeId)
		return fuse.ENOENT
	}
	constor.log("%s(%s)", parent.id, name)
	id, err := constor.getid(-1, parent.id, name)
	if err != nil {
		// logging this error will produce too many logs as there will be too many
		// lookps on non-existant files
		return fuse.ToStatus(err)
	}
	inode := constor.inodemap.findInodeId(id)
	if inode != nil {
		li = inode.layer
	} else {
		li = constor.getLayer(id)
	}
	if li == -1 {
		constor.error("Unable to find inode for %s(%s) id %s", parent.id, name, id)
		return fuse.ENOENT
	}
	err = constor.Lstat(li, id, &stat)
	if err != nil {
		constor.error("Unable to Lstat inode for %s(%s) id %s", parent.id, name, id)
		return fuse.ToStatus(err)
	}
	if inode == nil {
		inode = NewInode(constor, id)
		inode.layer = li
		constor.inodemap.hashInode(inode)
	} else {
		inode.lookup()
	}
	attr := (*fuse.Attr)(&out.Attr)
	attr.FromStat(&stat)
	out.NodeId = uint64(uintptr(unsafe.Pointer(inode)))
	out.Ino = attr.Ino
	out.EntryValid = 1000
	out.AttrValid = 1000
	constor.log("%s", id)
	return fuse.OK
}
开发者ID:krishnasrinivas,项目名称:confs,代码行数:50,代码来源:main.go


示例5: Lookup

func (constor *Constor) Lookup(header *fuse.InHeader, name string, out *fuse.EntryOut) fuse.Status {
	constor.log("%d %s", header.NodeId, name)
	var stat syscall.Stat_t
	parent, err := constor.inodemap.findInode(header.NodeId)
	if err != nil {
		return fuse.ToStatus(err)
	}
	path, err := constor.dentrymap.getPathName(parent.ino, name)
	if err != nil {
		return fuse.ToStatus(err)
	}
	li := constor.getLayer(path)
	if li == -1 {
		return fuse.ENOENT
	}
	pathl := Path.Join(constor.layers[li], path)
	if constor.isdeleted(pathl) {
		return fuse.ENOENT
	}
	err = constor.Lstat(path, &stat)
	if err != nil {
		return fuse.ToStatus(err)
	}
	constor.log("%s(%d) %d", path, li, stat.Ino)
	inode, err := constor.inodemap.findInode(stat.Ino)
	if err != nil {
		inode = NewInode(constor, stat.Ino)
		inode.mode = stat.Mode
		inode.layer = li
		constor.inodemap.hashInode(inode)
	} else {
		inode.layer = li
		inode.lookup()
	}
	if dentry, err := constor.dentrymap.findDentry(parent.ino, inode.ino); err != nil {
		dentry = new(Dentry)
		dentry.ino = inode.ino
		dentry.name = name
		dentry.parentino = parent.ino
		constor.dentrymap.hashDentry(dentry)
	}
	attr := (*fuse.Attr)(&out.Attr)
	attr.FromStat(&stat)
	out.NodeId = attr.Ino
	out.Ino = attr.Ino
	constor.log("%d", out.Ino)
	return fuse.OK
}
开发者ID:krishnasrinivas,项目名称:constor,代码行数:48,代码来源:main.go


示例6: fillEntry

func (m *fileSystemMount) fillEntry(out *fuse.EntryOut) {
	splitDuration(m.options.EntryTimeout, &out.EntryValid, &out.EntryValidNsec)
	splitDuration(m.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec)
	m.setOwner(&out.Attr)
	if out.Mode&fuse.S_IFDIR == 0 && out.Nlink == 0 {
		out.Nlink = 1
	}
}
开发者ID:kleopatra999,项目名称:go-fuse,代码行数:8,代码来源:fsmount.go


示例7: negativeEntry

// Creates a return entry for a non-existent path.
func (m *fileSystemMount) negativeEntry(out *fuse.EntryOut) bool {
	if m.options.NegativeTimeout > 0.0 {
		out.NodeId = 0
		splitDuration(m.options.NegativeTimeout, &out.EntryValid, &out.EntryValidNsec)
		return true
	}
	return false
}
开发者ID:kleopatra999,项目名称:go-fuse,代码行数:9,代码来源:fsmount.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang fuse.File类代码示例发布时间:2022-05-23
下一篇:
Golang fuse.DirEntryList类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap