Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
5690be47
Commit
5690be47
authored
Jun 09, 2017
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Populate Block count in GetAttr result.
This fixes 'du'. Fixes #159.
parent
26b2eb35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
zipfs/memtree.go
zipfs/memtree.go
+1
-0
zipfs/zipfs_test.go
zipfs/zipfs_test.go
+5
-0
No files found.
zipfs/memtree.go
View file @
5690be47
...
@@ -114,6 +114,7 @@ func (n *memNode) GetAttr(out *fuse.Attr, file nodefs.File, context *fuse.Contex
...
@@ -114,6 +114,7 @@ func (n *memNode) GetAttr(out *fuse.Attr, file nodefs.File, context *fuse.Contex
return
fuse
.
OK
return
fuse
.
OK
}
}
n
.
file
.
Stat
(
out
)
n
.
file
.
Stat
(
out
)
out
.
Blocks
=
(
out
.
Size
+
511
)
/
512
return
fuse
.
OK
return
fuse
.
OK
}
}
...
...
zipfs/zipfs_test.go
View file @
5690be47
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"os"
"os"
"path/filepath"
"path/filepath"
"runtime"
"runtime"
"syscall"
"testing"
"testing"
"time"
"time"
...
@@ -72,6 +73,10 @@ func TestZipFs(t *testing.T) {
...
@@ -72,6 +73,10 @@ func TestZipFs(t *testing.T) {
if
fi
.
Mode
()
!=
0664
{
if
fi
.
Mode
()
!=
0664
{
t
.
Fatalf
(
"File mode 0%o != 0664"
,
fi
.
Mode
())
t
.
Fatalf
(
"File mode 0%o != 0664"
,
fi
.
Mode
())
}
}
if
st
:=
fi
.
Sys
()
.
(
*
syscall
.
Stat_t
);
st
.
Blocks
!=
1
{
t
.
Errorf
(
"got block count %d, want 1"
,
st
.
Blocks
)
}
mtime
,
err
:=
time
.
Parse
(
time
.
RFC3339
,
"2011-02-22T12:56:12Z"
)
mtime
,
err
:=
time
.
Parse
(
time
.
RFC3339
,
"2011-02-22T12:56:12Z"
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment