本文整理汇总了Golang中github.com/jacobsa/fuse/fuseops.SetInodeAttributesOp类的典型用法代码示例。如果您正苦于以下问题:Golang SetInodeAttributesOp类的具体用法?Golang SetInodeAttributesOp怎么用?Golang SetInodeAttributesOp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SetInodeAttributesOp类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: SetInodeAttributes
func (fs *Goofys) SetInodeAttributes(
ctx context.Context,
op *fuseops.SetInodeAttributesOp) (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
}
开发者ID:x5u,项目名称:goofys,代码行数:13,代码来源:goofys.go
示例2: SetInodeAttributes
// SetInodeAttributes sets specified attributes to file or directory.
//
// Required for fuse.FileSystem.
func (k *KodingNetworkFS) SetInodeAttributes(ctx context.Context, op *fuseops.SetInodeAttributesOp) error {
entry, err := k.getEntry(ctx, op.Inode)
if err != nil {
return err
}
attrs := entry.GetAttrs()
// optionally update attrs
if op.Mode != nil {
attrs.Mode = *op.Mode
}
if op.Atime != nil {
attrs.Atime = *op.Atime
}
// optionally update attrs only if entry is a file
if file, isFile := entry.(*File); isFile {
if op.Mtime != nil {
attrs.Mtime = *op.Mtime
}
if op.Size != nil {
if err := file.TruncateTo(*op.Size); err != nil {
return err
}
attrs.Size = *op.Size
}
}
entry.SetAttrs(attrs)
op.Attributes = *attrs
return nil
}
开发者ID:koding,项目名称:koding,代码行数:38,代码来源:kodingnetworkfs.go
示例3: SetInodeAttributes
func (fs *memFS) SetInodeAttributes(
op *fuseops.SetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
// Grab the inode.
inode := fs.getInodeOrDie(op.Inode)
// Handle the request.
inode.SetAttributes(op.Size, op.Mode, op.Mtime)
// 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
}
开发者ID:BanzaiMan,项目名称:gcsfuse,代码行数:20,代码来源:memfs.go
示例4: SetInodeAttributes
// LOCKS_EXCLUDED(fs.mu)
func (fs *fileSystem) SetInodeAttributes(
op *fuseops.SetInodeAttributesOp) (err error) {
// Find the inode.
fs.mu.Lock()
in := fs.inodes[op.Inode]
fs.mu.Unlock()
in.Lock()
defer in.Unlock()
// The only thing we support changing is size, and then only for directories.
if op.Mode != nil || op.Atime != nil || op.Mtime != nil {
err = fuse.ENOSYS
return
}
file, ok := in.(*inode.FileInode)
if !ok {
err = fuse.ENOSYS
return
}
// Set the size, if specified.
if op.Size != nil {
if err = file.Truncate(op.Context(), int64(*op.Size)); err != nil {
err = fmt.Errorf("Truncate: %v", err)
return
}
}
// Fill in the response.
op.Attributes, err = in.Attributes(op.Context())
if err != nil {
return
}
return
}
开发者ID:mbookman,项目名称:gcsfuse,代码行数:39,代码来源:fs.go
注:本文中的github.com/jacobsa/fuse/fuseops.SetInodeAttributesOp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论