mirror of
https://github.com/octoleo/restic.git
synced 2024-12-24 20:00:21 +00:00
Merge pull request #447 from ckemper67/fix-442
Fix #442: set blocks and blocksize in fuse
This commit is contained in:
commit
517eff7e48
@ -15,6 +15,9 @@ import (
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// The default block size to report in stat
|
||||
const blockSize = 512
|
||||
|
||||
// Statically ensure that *file implements the given interface
|
||||
var _ = fs.HandleReader(&file{})
|
||||
var _ = fs.HandleReleaser(&file{})
|
||||
@ -67,6 +70,8 @@ func (f *file) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Inode = f.node.Inode
|
||||
a.Mode = f.node.Mode
|
||||
a.Size = f.node.Size
|
||||
a.Blocks = (f.node.Size / blockSize) + 1
|
||||
a.BlockSize = blockSize
|
||||
|
||||
if !f.ownerIsRoot {
|
||||
a.Uid = f.node.UID
|
||||
|
@ -132,6 +132,7 @@ func TestFuseFile(t *testing.T) {
|
||||
Equals(t, node.Inode, attr.Inode)
|
||||
Equals(t, node.Mode, attr.Mode)
|
||||
Equals(t, node.Size, attr.Size)
|
||||
Equals(t, (node.Size/uint64(attr.BlockSize))+1, attr.Blocks)
|
||||
|
||||
for i, test := range offsetReadsTests {
|
||||
b := memfile[test.offset : test.offset+test.length]
|
||||
|
Loading…
Reference in New Issue
Block a user