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
Kirill Smelkov
go-fuse
Commits
20b92a9a
Commit
20b92a9a
authored
May 26, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bpb around end-of-file.
parent
ce101c4f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
11 deletions
+29
-11
fuse/loopback_test.go
fuse/loopback_test.go
+26
-7
fuse/mountstate.go
fuse/mountstate.go
+3
-4
No files found.
fuse/loopback_test.go
View file @
20b92a9a
package
fuse
import
(
"bytes"
"fmt"
"io"
"io/ioutil"
...
...
@@ -530,18 +529,38 @@ func TestReadLarge(t *testing.T) {
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
// Add a bit more to test the splicing at the end.
content
:=
make
([]
byte
,
1024
*
1024
+
43
)
for
i
:=
range
content
{
content
[
i
]
=
byte
(
i
)
// Make blocks that are not period on 1024 bytes, so we can
// catch errors due to misalignments.
block
:=
make
([]
byte
,
1023
)
content
:=
make
([]
byte
,
385
*
1023
)
for
i
:=
range
block
{
block
[
i
]
=
byte
(
i
)
}
start
:=
0
for
start
<
len
(
content
)
{
left
:=
len
(
content
)
-
start
if
left
<
len
(
block
)
{
block
=
block
[
:
left
]
}
copy
(
content
[
start
:
],
block
)
start
+=
len
(
block
)
}
err
:=
ioutil
.
WriteFile
(
ts
.
origFile
,
[]
byte
(
content
),
0644
)
CheckSuccess
(
err
)
back
,
err
:=
ioutil
.
ReadFile
(
ts
.
mountFile
)
CheckSuccess
(
err
)
if
bytes
.
Compare
(
content
,
back
)
!=
0
{
t
.
Errorf
(
"content comparison failed"
)
if
len
(
back
)
!=
len
(
content
)
{
t
.
Errorf
(
"content length: got %d want %d"
,
len
(
back
),
len
(
content
))
}
for
i
:=
range
content
{
if
content
[
i
]
!=
back
[
i
]
{
t
.
Errorf
(
"content mismatch byte %d, got %d want %d."
,
i
,
back
[
i
],
content
[
i
])
break
}
}
}
...
...
fuse/mountstate.go
View file @
20b92a9a
...
...
@@ -364,7 +364,7 @@ func (ms *MountState) write(req *request) Status {
if
err
:=
ms
.
TrySplice
(
header
,
req
,
req
.
flatData
.
Fd
,
req
.
flatData
.
FdSize
,
req
.
flatData
.
FdOff
);
err
==
nil
{
return
OK
}
else
{
log
.
Println
(
"
Splice error
"
,
err
)
log
.
Println
(
"
TrySplice:
"
,
err
)
buf
:=
ms
.
AllocOut
(
req
,
uint32
(
req
.
flatData
.
FdSize
))
req
.
flatData
.
Read
(
buf
)
header
=
req
.
serializeHeader
(
req
.
flatData
.
Size
())
...
...
@@ -406,9 +406,8 @@ func (ms *MountState) TrySplice(header []byte, req *request,
return
err
}
// TODO - fix debug output.
header
=
req
.
serializeHeader
(
n
)
return
ms
.
TrySplice
(
header
,
req
,
f
d
,
n
,
-
1
)
return
ms
.
TrySplice
(
header
,
req
,
f
inalSplice
.
ReadFd
()
,
n
,
-
1
)
}
if
err
!=
nil
{
...
...
@@ -417,7 +416,7 @@ func (ms *MountState) TrySplice(header []byte, req *request,
}
if
n
!=
size
{
return
fmt
.
Errorf
(
"
splice:
wrote %d, want %d"
,
n
,
req
.
flatData
.
FdSize
)
return
fmt
.
Errorf
(
"wrote %d, want %d"
,
n
,
req
.
flatData
.
FdSize
)
}
_
,
err
=
finalSplice
.
WriteTo
(
ms
.
mountFile
.
Fd
(),
total
)
...
...
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