Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
350b8333
Commit
350b8333
authored
Nov 07, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #277 from jbenet/fuse-fix
Fix buffer size bug in fuse mounts
parents
3155fa2c
387d0a93
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
10 deletions
+22
-10
fuse/ipns/ipns_test.go
fuse/ipns/ipns_test.go
+0
-5
fuse/ipns/ipns_unix.go
fuse/ipns/ipns_unix.go
+3
-0
fuse/readonly/readonly_unix.go
fuse/readonly/readonly_unix.go
+9
-2
test/t0040-add-and-cat.sh
test/t0040-add-and-cat.sh
+3
-3
unixfs/io/dagmodifier.go
unixfs/io/dagmodifier.go
+7
-0
No files found.
fuse/ipns/ipns_test.go
View file @
350b8333
...
...
@@ -5,7 +5,6 @@ import (
"crypto/rand"
"io/ioutil"
"os"
"runtime"
"strings"
"testing"
"time"
...
...
@@ -300,10 +299,6 @@ func TestFastRepublish(t *testing.T) {
// Test writing a medium sized file one byte at a time
func
TestMultiWrite
(
t
*
testing
.
T
)
{
if
runtime
.
GOOS
==
"darwin"
{
link
:=
"https://github.com/jbenet/go-ipfs/issues/147"
t
.
Skipf
(
"Skipping as is broken in OSX. See %s"
,
link
)
}
_
,
mnt
:=
setupIpnsTest
(
t
,
nil
)
defer
mnt
.
Close
()
...
...
fuse/ipns/ipns_unix.go
View file @
350b8333
...
...
@@ -232,6 +232,9 @@ func (s *Node) Attr() fuse.Attr {
log
.
Errorf
(
"Error getting size of file: %s"
,
err
)
size
=
0
}
if
size
==
0
{
size
=
s
.
dagMod
.
Size
()
}
return
fuse
.
Attr
{
Mode
:
0666
,
Size
:
size
,
...
...
fuse/readonly/readonly_unix.go
View file @
350b8333
...
...
@@ -98,13 +98,20 @@ func (s *Node) Attr() fuse.Attr {
switch
s
.
cached
.
GetType
()
{
case
ftpb
.
Data_Directory
:
return
fuse
.
Attr
{
Mode
:
os
.
ModeDir
|
0555
}
case
ftpb
.
Data_File
,
ftpb
.
Data_Raw
:
size
,
_
:=
s
.
Nd
.
S
ize
()
case
ftpb
.
Data_File
:
size
:=
s
.
cached
.
GetFiles
ize
()
return
fuse
.
Attr
{
Mode
:
0444
,
Size
:
uint64
(
size
),
Blocks
:
uint64
(
len
(
s
.
Nd
.
Links
)),
}
case
ftpb
.
Data_Raw
:
return
fuse
.
Attr
{
Mode
:
0444
,
Size
:
uint64
(
len
(
s
.
cached
.
GetData
())),
Blocks
:
uint64
(
len
(
s
.
Nd
.
Links
)),
}
default
:
log
.
Error
(
"Invalid data type."
)
return
fuse
.
Attr
{}
...
...
test/t0040-add-and-cat.sh
View file @
350b8333
...
...
@@ -48,7 +48,7 @@ test_expect_success "generate 100MB file using go-random" '
test_expect_success
"sha1 of the file looks ok"
'
echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 mountdir/bigfile" >sha1_expected &&
sha
1
sum mountdir/bigfile >sha1_actual &&
shasum mountdir/bigfile >sha1_actual &&
test_cmp sha1_expected sha1_actual
'
...
...
@@ -63,7 +63,7 @@ test_expect_success "ipfs add bigfile output looks good" '
'
test_expect_success
"ipfs cat succeeds"
'
ipfs cat $HASH | sha
1
sum >sha1_actual
ipfs cat $HASH | shasum >sha1_actual
'
test_expect_success
"ipfs cat output looks good"
'
...
...
@@ -72,7 +72,7 @@ test_expect_success "ipfs cat output looks good" '
'
test_expect_success
"cat ipfs/bigfile succeeds"
'
cat ipfs/$HASH | sha
1
sum >sha1_actual
cat ipfs/$HASH | shasum >sha1_actual
'
test_expect_success
"cat ipfs/bigfile looks good"
'
...
...
unixfs/io/dagmodifier.go
View file @
350b8333
...
...
@@ -173,6 +173,13 @@ func (dm *DagModifier) WriteAt(b []byte, offset uint64) (int, error) {
return
origlen
,
nil
}
func
(
dm
*
DagModifier
)
Size
()
uint64
{
if
dm
==
nil
{
return
0
}
return
dm
.
pbdata
.
GetFilesize
()
}
// splitBytes uses a splitterFunc to turn a large array of bytes
// into many smaller arrays of bytes
func
splitBytes
(
b
[]
byte
,
spl
chunk
.
BlockSplitter
)
[][]
byte
{
...
...
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