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
b6e50a19
Commit
b6e50a19
authored
Mar 03, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented fs.allocateInode.
parent
d81d961c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
samples/memfs/fs.go
samples/memfs/fs.go
+18
-1
No files found.
samples/memfs/fs.go
View file @
b6e50a19
...
...
@@ -147,7 +147,24 @@ func (fs *memFS) getInodeForReadingOrDie(id fuse.InodeID) (inode *inode) {
//
// EXCLUSIVE_LOCKS_REQUIRED(fs.mu)
// EXCLUSIVE_LOCK_FUNCTION(inode.mu)
func
(
fs
*
memFS
)
allocateInode
(
mode
os
.
FileMode
)
(
id
fuse
.
InodeID
,
inode
*
inode
)
func
(
fs
*
memFS
)
allocateInode
(
mode
os
.
FileMode
)
(
id
fuse
.
InodeID
,
inode
*
inode
)
{
// Create the inode.
inode
=
newInode
(
mode
)
// Re-use a free ID if possible. Otherwise mint a new one.
numFree
:=
len
(
fs
.
freeInodes
)
if
numFree
!=
0
{
id
=
fs
.
freeInodes
[
numFree
-
1
]
fs
.
freeInodes
=
fs
.
freeInodes
[
:
numFree
-
1
]
fs
.
inodes
[
id
]
=
inode
}
else
{
id
=
fuse
.
InodeID
(
len
(
fs
.
inodes
))
fs
.
inodes
=
append
(
fs
.
inodes
,
inode
)
}
return
}
func
(
fs
*
memFS
)
LookUpInode
(
ctx
context
.
Context
,
...
...
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