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
Levin Zimmermann
go-fuse
Commits
042b95af
Commit
042b95af
authored
Aug 13, 2010
by
Ivan Krasin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminated Init func from FileSystem interface
parent
a4692c96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
27 deletions
+13
-27
fuse/fuse.go
fuse/fuse.go
+13
-7
fuse/fuse_test.go
fuse/fuse_test.go
+0
-20
No files found.
fuse/fuse.go
View file @
042b95af
...
@@ -13,7 +13,6 @@ const (
...
@@ -13,7 +13,6 @@ const (
)
)
type
FileSystem
interface
{
type
FileSystem
interface
{
Init
(
in
*
InitIn
)
(
out
*
InitOut
,
code
Error
,
err
os
.
Error
)
GetAttr
(
h
*
InHeader
,
in
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Error
,
err
os
.
Error
)
GetAttr
(
h
*
InHeader
,
in
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Error
,
err
os
.
Error
)
}
}
...
@@ -138,13 +137,20 @@ func initFuse(fs FileSystem, h *InHeader, r io.Reader, mr chan *managerRequest)
...
@@ -138,13 +137,20 @@ func initFuse(fs FileSystem, h *InHeader, r io.Reader, mr chan *managerRequest)
return
return
}
}
fmt
.
Printf
(
"in: %v
\n
"
,
in
)
fmt
.
Printf
(
"in: %v
\n
"
,
in
)
var
out
*
InitOut
if
in
.
Major
!=
FUSE_KERNEL_VERSION
{
out
,
res
,
err
:=
fs
.
Init
(
in
)
fmt
.
Printf
(
"Major versions does not match. Given %d, want %d
\n
"
,
in
.
Major
,
FUSE_KERNEL_VERSION
)
if
err
!=
nil
{
return
serialize
(
h
,
EIO
,
nil
)
return
}
}
data
,
err
=
serialize
(
h
,
res
,
out
)
if
in
.
Minor
<
FUSE_KERNEL_MINOR_VERSION
{
return
fmt
.
Printf
(
"Minor version is less than we support. Given %d, want at least %d
\n
"
,
in
.
Minor
,
FUSE_KERNEL_MINOR_VERSION
)
return
serialize
(
h
,
EIO
,
nil
)
}
out
:=
new
(
InitOut
)
out
.
Major
=
FUSE_KERNEL_VERSION
out
.
Minor
=
FUSE_KERNEL_MINOR_VERSION
out
.
MaxReadAhead
=
in
.
MaxReadAhead
out
.
MaxWrite
=
65536
return
serialize
(
h
,
OK
,
out
)
}
}
func
getAttr
(
fs
FileSystem
,
h
*
InHeader
,
r
io
.
Reader
,
mr
chan
*
managerRequest
)
(
data
[][]
byte
,
err
os
.
Error
)
{
func
getAttr
(
fs
FileSystem
,
h
*
InHeader
,
r
io
.
Reader
,
mr
chan
*
managerRequest
)
(
data
[][]
byte
,
err
os
.
Error
)
{
...
...
fuse/fuse_test.go
View file @
042b95af
package
fuse
package
fuse
import
(
import
(
"fmt"
"log"
"log"
"os"
"os"
"testing"
"testing"
...
@@ -13,25 +12,6 @@ const (
...
@@ -13,25 +12,6 @@ const (
type
testFuse
struct
{}
type
testFuse
struct
{}
func
(
fs
*
testFuse
)
Init
(
in
*
InitIn
)
(
out
*
InitOut
,
code
Error
,
err
os
.
Error
)
{
if
in
.
Major
!=
FUSE_KERNEL_VERSION
{
fmt
.
Printf
(
"Major versions does not match. Given %d, want %d
\n
"
,
in
.
Major
,
FUSE_KERNEL_VERSION
)
code
=
EIO
return
}
if
in
.
Minor
<
FUSE_KERNEL_MINOR_VERSION
{
fmt
.
Printf
(
"Minor version is less than we support. Given %d, want at least %d
\n
"
,
in
.
Minor
,
FUSE_KERNEL_MINOR_VERSION
)
code
=
EIO
return
}
out
=
new
(
InitOut
)
out
.
Major
=
FUSE_KERNEL_VERSION
out
.
Minor
=
FUSE_KERNEL_MINOR_VERSION
out
.
MaxReadAhead
=
in
.
MaxReadAhead
out
.
MaxWrite
=
65536
return
}
func
(
fs
*
testFuse
)
GetAttr
(
h
*
InHeader
,
in
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Error
,
err
os
.
Error
)
{
func
(
fs
*
testFuse
)
GetAttr
(
h
*
InHeader
,
in
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Error
,
err
os
.
Error
)
{
out
=
new
(
AttrOut
)
out
=
new
(
AttrOut
)
out
.
Ino
=
h
.
NodeId
out
.
Ino
=
h
.
NodeId
...
...
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