Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-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
Kirill Smelkov
jacobsa-fuse
Commits
aebfed4d
Commit
aebfed4d
authored
Mar 02, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug in newInode.
parent
26ac0296
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
samples/memfs/fs.go
samples/memfs/fs.go
+2
-1
samples/memfs/inode.go
samples/memfs/inode.go
+10
-3
No files found.
samples/memfs/fs.go
View file @
aebfed4d
...
...
@@ -5,6 +5,7 @@ package memfs
import
(
"fmt"
"os"
"time"
"github.com/jacobsa/fuse"
...
...
@@ -57,7 +58,7 @@ func NewMemFS(
}
// Set up the root inode.
fs
.
inodes
[
fuse
.
RootInodeID
]
=
newInode
(
true
)
// dir
fs
.
inodes
[
fuse
.
RootInodeID
]
=
newInode
(
os
.
ModeDir
)
// Set up invariant checking.
fs
.
mu
=
syncutil
.
NewInvariantMutex
(
fs
.
checkInvariants
)
...
...
samples/memfs/inode.go
View file @
aebfed4d
...
...
@@ -58,9 +58,12 @@ type inode struct {
contents
[]
byte
// GUARDED_BY(mu)
}
func
newInode
(
dir
bool
)
(
in
*
inode
)
{
func
newInode
(
mode
os
.
FileMode
)
(
in
*
inode
)
{
in
=
&
inode
{
dir
:
dir
,
dir
:
(
mode
&
os
.
ModeDir
!=
0
),
attributes
:
fuse
.
InodeAttributes
{
Mode
:
mode
,
},
}
in
.
mu
=
syncutil
.
NewInvariantMutex
(
in
.
checkInvariants
)
...
...
@@ -75,7 +78,11 @@ func (inode *inode) checkInvariants() {
// Check os.ModeDir.
if
inode
.
dir
!=
(
inode
.
attributes
.
Mode
&
os
.
ModeDir
==
os
.
ModeDir
)
{
panic
(
fmt
.
Sprintf
(
"Unexpected mode: %v"
,
inode
.
attributes
.
Mode
))
panic
(
fmt
.
Sprintf
(
"Unexpected mode: %v, dir: %v"
,
inode
.
attributes
.
Mode
,
inode
.
dir
))
}
// Check directory-specific stuff.
...
...
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