本文整理匯總了Golang中github.com/hanwen/go-fuse/fuse.Attr.FromStat方法的典型用法代碼示例。如果您正苦於以下問題:Golang Attr.FromStat方法的具體用法?Golang Attr.FromStat怎麽用?Golang Attr.FromStat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hanwen/go-fuse/fuse.Attr
的用法示例。
在下文中一共展示了Attr.FromStat方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetAttr
func (f *AzukiFile) 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
}
示例2: GetAttr
func (f *file) GetAttr(a *fuse.Attr) fuse.Status {
cryptfs.Debug.Printf("file.GetAttr()\n")
st := syscall.Stat_t{}
f.lock.Lock()
err := syscall.Fstat(int(f.fd.Fd()), &st)
f.lock.Unlock()
if err != nil {
return fuse.ToStatus(err)
}
a.FromStat(&st)
a.Size = f.cfs.PlainSize(a.Size)
return fuse.OK
}
示例3: GetAttr
// GetAttr - FUSE call
func (f *virtualFile) GetAttr(a *fuse.Attr) fuse.Status {
var st syscall.Stat_t
err := syscall.Lstat(f.parentFile, &st)
if err != nil {
fmt.Printf("Lstat %q: %v\n", f.parentFile, err)
return fuse.ToStatus(err)
}
st.Ino = f.ino
st.Size = int64(len(f.content))
st.Mode = syscall.S_IFREG | 0400
st.Nlink = 1
a.FromStat(&st)
return fuse.OK
}
示例4: GetAttr
func (o *ObjectFile) GetAttr(a *fuse.Attr) fuse.Status {
log.Debugf("[objectfile] GetAttr(obj) %s", o.name)
stat, err := o.localfile.Stat()
if err != nil {
return fuse.EIO
}
st, ok := stat.Sys().(*syscall.Stat_t)
if !ok {
return fuse.ENODEV
}
a.FromStat(st)
return fuse.OK
}
示例5: GetAttr
func (f *file) GetAttr(a *fuse.Attr) fuse.Status {
f.fdLock.RLock()
defer f.fdLock.RUnlock()
tlog.Debug.Printf("file.GetAttr()")
st := syscall.Stat_t{}
err := syscall.Fstat(int(f.fd.Fd()), &st)
if err != nil {
return fuse.ToStatus(err)
}
a.FromStat(&st)
a.Size = f.contentEnc.CipherSizeToPlainSize(a.Size)
return fuse.OK
}