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


Golang Attr.Uid方法代码示例

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


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

示例1: 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:niltonkummer,项目名称:go-fuse,代码行数:7,代码来源:tarfs.go

示例2: GetAttr

func (dn *DirNode) GetAttr(
	out *fuse.Attr,
	file nodefs.File,
	context *fuse.Context) (code fuse.Status) {
	out.Mode = 0755 | syscall.S_IFDIR
	out.Nlink = 2
	out.Size = 1
	out.Uid = dn.owner.Uid
	out.Gid = dn.owner.Gid
	out.SetTimes(&dn.time, &dn.time, &dn.time)
	return fuse.OK
}
开发者ID:philips,项目名称:goboardfs,代码行数:12,代码来源:dirnode.go

示例3: GetAttr

func (sn *StrNode) GetAttr(
	out *fuse.Attr,
	file nodefs.File,
	context *fuse.Context) (code fuse.Status) {
	out.Mode = 0444 | syscall.S_IFREG
	owner := getDefaultOwner()
	out.Uid = owner.Uid
	out.Gid = owner.Gid
	out.Nlink = 1
	out.Size = uint64(len(sn.s))
	return fuse.OK
}
开发者ID:philips,项目名称:goboardfs,代码行数:12,代码来源:strnode.go

示例4: fileAttr

// fileAttr constructs a generic file fuse.Attr with the given parameters.
func (kwfs KeywhizFs) fileAttr(size uint64, mode uint32) *fuse.Attr {
	created := uint64(kwfs.StartTime.Unix())
	attr := fuse.Attr{
		Size:  size,
		Atime: created,
		Mtime: created,
		Ctime: created,
		Mode:  fuse.S_IFREG | mode,
	}
	attr.Uid = kwfs.Ownership.Uid
	attr.Gid = kwfs.Ownership.Gid
	return &attr
}
开发者ID:rxacevedo,项目名称:keywhiz-fs,代码行数:14,代码来源:fs.go

示例5: GetAttr

func (tn *ThreadNode) GetAttr(
	out *fuse.Attr,
	file nodefs.File,
	context *fuse.Context) (code fuse.Status) {
	out.Mode = 0755 | syscall.S_IFDIR
	out.Nlink = 1
	owner := getDefaultOwner()
	out.Uid = owner.Uid
	out.Gid = owner.Gid
	out.Size = uint64(tn.thread.Size())
	t := tn.thread.Time()
	out.SetTimes(&t, &t, &t)
	return fuse.OK
}
开发者ID:philips,项目名称:goboardfs,代码行数:14,代码来源:thread.go

示例6: directoryAttr

// directoryAttr constructs a generic directory fuse.Attr with the given parameters.
func (kwfs KeywhizFs) directoryAttr(subdirCount, mode uint32) *fuse.Attr {
	// 4K is typically the minimum size of inode storage for a directory.
	const directoryInodeSize = 4096
	created := uint64(kwfs.StartTime.Unix())

	attr := fuse.Attr{
		Size:  directoryInodeSize,
		Atime: created,
		Mtime: created,
		Ctime: created,
		Mode:  fuse.S_IFDIR | mode,
		Nlink: 2 + subdirCount, // '.', '..', and any other subdirectories
	}
	attr.Uid = kwfs.Ownership.Uid
	attr.Gid = kwfs.Ownership.Gid
	return &attr
}
开发者ID:rxacevedo,项目名称:keywhiz-fs,代码行数:18,代码来源:fs.go

示例7: getGitAttrByPath

func (gitfs *GitFs) getGitAttrByPath(repoPath string, path string) (*fuse.Attr, fuse.Status) {
	repo, _, _, tree, err := gitfs.getMasterTreeFromRepo(repoPath)
	if err != nil {
		return nil, fuse.EPERM
	}

	repoInfo, err := os.Stat(repoPath)
	if err != nil {
		gitfs.logger.Debugf("Failed to Stat %s due to %s", repoPath, err)
		return nil, fuse.ToStatus(err)
	}

	if path == "" {
		attr := fuse.ToAttr(repoInfo)
		attr.Mode &= ^uint32(0222)
		attr.Nlink = 2 + gitfs.treeEntryCount(tree, repoPath)
		return attr, fuse.OK
	}

	entry, err := tree.EntryByPath(path)
	if err != nil {
		gitfs.logger.Debugf("Cannot find path %s from tree %s of Git Repository %s due to %s", path, tree.Id().String(), repoPath, err)
		return nil, fuse.ENOENT
	}
	gitfs.logger.Debugf("Found path %s from tree %s of Git Repository %s", path, tree.Id().String(), repoPath)

	var attr fuse.Attr
	attr.Mode = toFileMode(entry.Filemode)
	if stat, ok := repoInfo.Sys().(*syscall.Stat_t); ok {
		attr.Uid = stat.Uid
		attr.Gid = stat.Gid
		attr.Blksize = uint32(stat.Blksize)
		attr.Rdev = uint32(stat.Rdev)
	}
	attr.Ino = crc64.Checksum(entry.Id[:], crc64.MakeTable(crc64.ECMA))
	now := time.Now()
	attr.SetTimes(&now, &now, &now)

	switch entry.Type {
	case libgit2.ObjectTree:
		tree, err := repo.LookupTree(entry.Id)
		if err != nil {
			gitfs.logger.Errorf("Failed to find tree %s from Git Repository %s", entry.Id, repoPath)
			return nil, fuse.EPERM
		}
		defer tree.Free()
		gitfs.logger.Debugf("Found tree %s of Git Repository %s", tree.Id().String(), repoPath)
		attr.Size = 4096
		attr.Nlink = 2 + gitfs.treeEntryCount(tree, repoPath)
	case libgit2.ObjectBlob:
		blob, err := repo.LookupBlob(entry.Id)
		if err != nil {
			gitfs.logger.Errorf("Failed to find blob %s from Git Repository %s", entry.Id, repoPath)
			return nil, fuse.EPERM
		}
		defer blob.Free()
		gitfs.logger.Debugf("Found blob %s of Git Repository %s", blob.Id().String(), repoPath)
		attr.Nlink = 1
		attr.Size = uint64(blob.Size())
	default:
		gitfs.logger.Debugf("GetAttr: Unsupported object type %s of %s from Git Repository %s", entry.Type.String(), entry.Id, repoPath)
		return nil, fuse.ENOENT
	}
	attr.Blocks = (attr.Size + 511) / 512
	return &attr, fuse.OK
}
开发者ID:bachue,项目名称:pages,代码行数:66,代码来源:gitfuse.go


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