本文整理汇总了Golang中github.com/jacobsa/fuse/fuseops.GetInodeAttributesOp.Attributes方法的典型用法代码示例。如果您正苦于以下问题:Golang GetInodeAttributesOp.Attributes方法的具体用法?Golang GetInodeAttributesOp.Attributes怎么用?Golang GetInodeAttributesOp.Attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jacobsa/fuse/fuseops.GetInodeAttributesOp
的用法示例。
在下文中一共展示了GetInodeAttributesOp.Attributes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetInodeAttributes
// LOCKS_EXCLUDED(fs.mu)
func (fs *cachingFS) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
// Figure out which inode the request is for.
var attrs fuseops.InodeAttributes
switch {
case op.Inode == fuseops.RootInodeID:
attrs = fs.rootAttrs()
case op.Inode%numInodes == fooOffset:
attrs = fs.fooAttrs()
case op.Inode%numInodes == dirOffset:
attrs = fs.dirAttrs()
case op.Inode%numInodes == barOffset:
attrs = fs.barAttrs()
}
// Fill in the response.
op.Attributes = attrs
op.AttributesExpiration = time.Now().Add(fs.getattrTimeout)
return
}
示例2: GetInodeAttributes
func (fs *statFS) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
switch op.Inode {
case fuseops.RootInodeID:
op.Attributes = dirAttrs()
case childInodeID:
op.Attributes = fileAttrs()
default:
err = fuse.ENOENT
}
return
}
示例3: GetInodeAttributes
func (fs *InterruptFS) GetInodeAttributes(
op *fuseops.GetInodeAttributesOp) (err error) {
switch op.Inode {
case fuseops.RootInodeID:
op.Attributes = rootAttrs
case fooID:
op.Attributes = fooAttrs
default:
err = fmt.Errorf("Unexpected inode ID: %v", op.Inode)
return
}
return
}
示例4: GetInodeAttributes
// GetInodeAttributes set attributes for a specified Node.
//
// Required for fuse.FileSystem.
func (k *KodingNetworkFS) GetInodeAttributes(ctx context.Context, op *fuseops.GetInodeAttributesOp) error {
entry, err := k.getEntry(ctx, op.Inode)
if err != nil {
return err
}
op.Attributes = *entry.GetAttrs()
return nil
}
示例5: GetInodeAttributes
func (fs *Goofys) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
inode := fs.getInodeOrDie(op.Inode)
fs.mu.Unlock()
attr, err := inode.GetAttributes(fs)
op.Attributes = *attr
op.AttributesExpiration = time.Now().Add(365 * 24 * time.Hour)
return
}
示例6: GetInodeAttributes
func (fs *flushFS) GetInodeAttributes(
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
switch op.Inode {
case fuseops.RootInodeID:
op.Attributes = fs.rootAttributes()
return
case fooID:
op.Attributes = fs.fooAttributes()
return
case barID:
op.Attributes = fs.barAttributes()
return
default:
err = fuse.ENOENT
return
}
}
示例7: GetInodeAttributes
func (fs *fsImpl) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
// Find the inode, verifying that it has not been forgotten.
in := fs.findInodeByID(op.Inode)
// Return appropriate attributes.
op.Attributes = in.attributes
return
}
示例8: GetInodeAttributes
func (fs *memFS) GetInodeAttributes(
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
// Grab the inode.
inode := fs.getInodeOrDie(op.Inode)
// Fill in the response.
op.Attributes = inode.attrs
// We don't spontaneously mutate, so the kernel can cache as long as it wants
// (since it also handles invalidation).
op.AttributesExpiration = fs.clock.Now().Add(365 * 24 * time.Hour)
return
}
示例9: GetInodeAttributes
func (fs *helloFS) GetInodeAttributes(
op *fuseops.GetInodeAttributesOp) (err error) {
// Find the info for this inode.
info, ok := gInodeInfo[op.Inode]
if !ok {
err = fuse.ENOENT
return
}
// Copy over its attributes.
op.Attributes = info.attributes
// Patch attributes.
fs.patchAttributes(&op.Attributes)
return
}