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
339bc03e
Commit
339bc03e
authored
Jul 29, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempted to fix memfs.
parent
6d01ffa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
samples/memfs/inode.go
samples/memfs/inode.go
+5
-6
samples/memfs/memfs.go
samples/memfs/memfs.go
+5
-5
No files found.
samples/memfs/inode.go
View file @
339bc03e
...
@@ -278,7 +278,7 @@ func (in *inode) RemoveChild(name string) {
...
@@ -278,7 +278,7 @@ func (in *inode) RemoveChild(name string) {
// Serve a ReadDir request.
// Serve a ReadDir request.
//
//
// REQUIRES: in.isDir()
// REQUIRES: in.isDir()
func
(
in
*
inode
)
ReadDir
(
offset
int
,
size
int
)
(
data
[]
byte
)
{
func
(
in
*
inode
)
ReadDir
(
p
[]
byte
,
offset
int
)
(
n
int
)
{
if
!
in
.
isDir
()
{
if
!
in
.
isDir
()
{
panic
(
"ReadDir called on non-directory."
)
panic
(
"ReadDir called on non-directory."
)
}
}
...
@@ -291,13 +291,12 @@ func (in *inode) ReadDir(offset int, size int) (data []byte) {
...
@@ -291,13 +291,12 @@ func (in *inode) ReadDir(offset int, size int) (data []byte) {
continue
continue
}
}
data
=
fuseutil
.
AppendDirent
(
data
,
in
.
entries
[
i
])
tmp
:=
fuseutil
.
WriteDirent
(
p
[
n
:
],
in
.
entries
[
i
])
if
n
==
0
{
// Trim and stop early if we've exceeded the requested size.
if
len
(
data
)
>
size
{
data
=
data
[
:
size
]
break
break
}
}
n
+=
tmp
}
}
return
return
...
...
samples/memfs/memfs.go
View file @
339bc03e
...
@@ -428,7 +428,9 @@ func (fs *memFS) Rename(
...
@@ -428,7 +428,9 @@ func (fs *memFS) Rename(
existingID
,
_
,
ok
:=
newParent
.
LookUpChild
(
op
.
NewName
)
existingID
,
_
,
ok
:=
newParent
.
LookUpChild
(
op
.
NewName
)
if
ok
{
if
ok
{
existing
:=
fs
.
getInodeOrDie
(
existingID
)
existing
:=
fs
.
getInodeOrDie
(
existingID
)
if
existing
.
isDir
()
&&
len
(
existing
.
ReadDir
(
0
,
1024
))
>
0
{
var
buf
[
4096
]
byte
if
existing
.
isDir
()
&&
existing
.
ReadDir
(
buf
[
:
],
0
)
>
0
{
err
=
fuse
.
ENOTEMPTY
err
=
fuse
.
ENOTEMPTY
return
return
}
}
...
@@ -538,7 +540,7 @@ func (fs *memFS) ReadDir(
...
@@ -538,7 +540,7 @@ func (fs *memFS) ReadDir(
inode
:=
fs
.
getInodeOrDie
(
op
.
Inode
)
inode
:=
fs
.
getInodeOrDie
(
op
.
Inode
)
// Serve the request.
// Serve the request.
op
.
Data
=
inode
.
ReadDir
(
int
(
op
.
Offset
),
op
.
Size
)
op
.
BytesRead
=
inode
.
ReadDir
(
op
.
Dst
,
int
(
op
.
Offset
)
)
return
return
}
}
...
@@ -571,9 +573,7 @@ func (fs *memFS) ReadFile(
...
@@ -571,9 +573,7 @@ func (fs *memFS) ReadFile(
inode
:=
fs
.
getInodeOrDie
(
op
.
Inode
)
inode
:=
fs
.
getInodeOrDie
(
op
.
Inode
)
// Serve the request.
// Serve the request.
op
.
Data
=
make
([]
byte
,
op
.
Size
)
op
.
BytesRead
,
err
=
inode
.
ReadAt
(
op
.
Dst
,
op
.
Offset
)
n
,
err
:=
inode
.
ReadAt
(
op
.
Data
,
op
.
Offset
)
op
.
Data
=
op
.
Data
[
:
n
]
// Don't return EOF errors; we just indicate EOF to fuse using a short read.
// Don't return EOF errors; we just indicate EOF to fuse using a short read.
if
err
==
io
.
EOF
{
if
err
==
io
.
EOF
{
...
...
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