本文整理匯總了Golang中github.com/hanwen/go-fuse/fuse.Attr.Mode方法的典型用法代碼示例。如果您正苦於以下問題:Golang Attr.Mode方法的具體用法?Golang Attr.Mode怎麽用?Golang Attr.Mode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hanwen/go-fuse/fuse.Attr
的用法示例。
在下文中一共展示了Attr.Mode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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
}
示例2: GetAttr
func (n *nodeReadNode) GetAttr(out *fuse.Attr, file File, context *fuse.Context) (code fuse.Status) {
if n.dir {
out.Mode = fuse.S_IFDIR | 0755
} else {
out.Mode = fuse.S_IFREG | 0644
}
out.Size = uint64(len(n.data))
return fuse.OK
}
示例3: GetAttr
func (f *p4File) GetAttr(out *fuse.Attr, file nodefs.File, c *fuse.Context) fuse.Status {
if m, ok := modes[f.stat.HeadType]; ok {
out.Mode = m
} else {
out.Mode = fuse.S_IFREG | 0644
}
out.Mtime = uint64(f.stat.HeadTime)
out.Size = uint64(f.stat.FileSize)
return fuse.OK
}
示例4: GetAttr
func (m *MNode) GetAttr(out *fuse.Attr, file nodefs.File, context *fuse.Context) (code fuse.Status) {
/*if file!=nil {
return file.GetAttr(out)
}*/
reg,isReg := m.obj.Obj.(*joinf.JoinFile)
if isReg {
out.Mode = fuse.S_IFREG | 0666
out.Size = uint64(reg.F.FLength)
}else{
out.Mode = fuse.S_IFDIR | 0777
}
return fuse.OK
}
示例5: GetAttr
func (me *DropboxFs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) {
path := get_path(name)
log.Printf("GetAttr: '%s'\n", name)
attr := fuse.Attr{}
// XXX: handle this error
data, _ := Cache.Metadata.Get(path)
if data.IsDir {
attr.Mode = fuse.S_IFDIR | 0755
} else {
attr.Mode = fuse.S_IFREG | 0644
attr.Size = uint64(len(path))
}
return &attr, fuse.OK
}
示例6: GetAttr
func (n *fileNode) GetAttr(out *fuse.Attr, file fuse.File, context *fuse.Context) (code fuse.Status) {
if file != nil {
return file.GetAttr(out)
}
out.Mode = fuse.S_IFREG | 0644
f := n.File()
if n.backing != "" {
fi, err := os.Stat(n.backing)
if err != nil {
return fuse.ToStatus(err)
}
out.Size = uint64(fi.Size())
t := f.Mtime()
if n.dirty {
t = fi.ModTime()
}
out.SetTimes(&t, &t, &t)
} else if f != nil {
out.Size = uint64(f.filesize)
t := f.Mtime()
out.SetTimes(&t, &t, &t)
}
return fuse.OK
}
示例7: GetAttr
func (fs *unionFsFile) GetAttr(out *fuse.Attr) fuse.Status {
code := fs.File.GetAttr(out)
if code.Ok() {
out.Mode |= 0200
}
return code
}
示例8: 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)
}
示例9: 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
}
示例10: 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
}
示例11: GetAttr
func (n *mtpNodeImpl) GetAttr(out *fuse.Attr, file nodefs.File, context *fuse.Context) (code fuse.Status) {
out.Mode = fuse.S_IFREG | 0644
f := n.obj
if f != nil {
out.Size = uint64(n.Size)
t := f.ModificationDate
out.SetTimes(&t, &t, &t)
}
return fuse.OK
}
示例12: 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
}
示例13: 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
}
示例14: 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
}
示例15: GetAttr
func (f *file) GetAttr(out *fuse.Attr) fuse.Status {
logrus.Debugf("FGetAttr %s", f.kv.Key)
now := time.Now()
out.Mtime = uint64(now.Unix())
out.Mtimensec = uint32(now.UnixNano())
out.Atime = uint64(now.Unix())
out.Atimensec = uint32(now.UnixNano())
out.Ctime = uint64(now.Unix())
out.Ctimensec = uint32(now.UnixNano())
if f.kv == nil || strings.HasSuffix(f.kv.Key, "/") || f.kv.Key == "" {
out.Mode = fuse.S_IFDIR | 0755
return fuse.OK
}
if len(f.kv.Value) > 0 {
out.Mode = fuse.S_IFREG | 0644
out.Size = uint64(len(f.kv.Value))
}
return fuse.OK
}