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
7b502e0b
Commit
7b502e0b
authored
Aug 11, 2010
by
Ivan Krasin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made fields public. Reformatted with gofmt. binary.Read now works.
parent
0c5b36c5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
202 additions
and
205 deletions
+202
-205
fuse/fuse.go
fuse/fuse.go
+14
-17
fuse/types.go
fuse/types.go
+188
-188
No files found.
fuse/fuse.go
View file @
7b502e0b
...
...
@@ -17,8 +17,7 @@ const (
bufSize
=
65536
+
100
// See the link above for the details
)
type
FileSystem
interface
{
}
type
FileSystem
interface
{}
type
MountPoint
struct
{
mountPoint
string
...
...
@@ -44,10 +43,10 @@ func Mount(mountPoint string, fs FileSystem) (m *MountPoint, err os.Error) {
mountPoint
=
path
.
Clean
(
path
.
Join
(
cwd
,
mountPoint
))
}
pid
,
err
:=
os
.
ForkExec
(
"/bin/fusermount"
,
[]
string
{
"/bin/fusermount"
,
mountPoint
},
[]
string
{
"_FUSE_COMMFD=3"
},
[]
string
{
"/bin/fusermount"
,
mountPoint
},
[]
string
{
"_FUSE_COMMFD=3"
},
""
,
[]
*
os
.
File
{
nil
,
nil
,
nil
,
remote
.
File
()
})
[]
*
os
.
File
{
nil
,
nil
,
nil
,
remote
.
File
()
})
if
err
!=
nil
{
return
}
...
...
@@ -63,7 +62,7 @@ func Mount(mountPoint string, fs FileSystem) (m *MountPoint, err os.Error) {
if
err
!=
nil
{
return
}
m
=
&
MountPoint
{
mountPoint
,
f
}
m
=
&
MountPoint
{
mountPoint
,
f
}
go
m
.
loop
()
return
}
...
...
@@ -78,7 +77,7 @@ func (m *MountPoint) loop() {
fmt
.
Printf
(
"MountPoint.loop: Read failed, err: %v
\n
"
,
err
)
os
.
Exit
(
1
)
}
var
h
fuse_i
n_header
var
h
I
n_header
err
=
binary
.
Read
(
r
,
binary
.
LittleEndian
,
&
h
)
if
err
!=
nil
{
fmt
.
Printf
(
"MountPoint.loop: binary.Read of fuse_in_header failed with err: %v
\n
"
,
err
)
...
...
@@ -94,10 +93,10 @@ func (m *MountPoint) Unmount() (err os.Error) {
return
nil
}
pid
,
err
:=
os
.
ForkExec
(
"/bin/fusermount"
,
[]
string
{
"/bin/fusermount"
,
"-u"
,
m
.
mountPoint
},
[]
string
{
"/bin/fusermount"
,
"-u"
,
m
.
mountPoint
},
nil
,
""
,
[]
*
os
.
File
{
nil
,
nil
,
os
.
Stderr
})
[]
*
os
.
File
{
nil
,
nil
,
os
.
Stderr
})
if
err
!=
nil
{
return
}
...
...
@@ -127,7 +126,7 @@ func Recvmsg(fd int, msg *syscall.Msghdr, flags int) (n int, err os.Error) {
return
}
func
getFuseConn
(
local
net
.
Conn
)
(
f
*
os
.
File
,
err
os
.
Error
)
{
func
getFuseConn
(
local
net
.
Conn
)
(
f
*
os
.
File
,
err
os
.
Error
)
{
var
msg
syscall
.
Msghdr
var
iov
syscall
.
Iovec
base
:=
make
([]
int32
,
256
)
...
...
@@ -157,12 +156,10 @@ func getFuseConn(local net.Conn) (f * os.File, err os.Error) {
return
}
if
(
fd
<
0
)
{
if
fd
<
0
{
err
=
os
.
NewError
(
fmt
.
Sprintf
(
"getFuseConn: fd < 0: %d"
,
fd
))
return
}
f
=
os
.
NewFile
(
int
(
fd
),
"fuse-conn"
)
return
}
fuse/types.go
View file @
7b502e0b
...
...
@@ -12,7 +12,7 @@ const (
FUSE_ROOT_ID
=
1
/**
* Bitmasks for
fuse_s
etattr_in.valid
* Bitmasks for
S
etattr_in.valid
*/
FATTR_MODE
=
(
1
<<
0
)
FATTR_UID
=
(
1
<<
1
)
...
...
@@ -183,330 +183,330 @@ const (
userspace works under 64bit kernels */
type
Attr
struct
{
i
no
uint64
s
ize
uint64
b
locks
uint64
a
time
uint64
m
time
uint64
c
time
uint64
a
timensec
uint32
m
timensec
uint32
c
timensec
uint32
m
ode
uint32
n
link
uint32
u
id
uint32
g
id
uint32
r
dev
uint32
b
lksize
uint32
p
adding
uint32
I
no
uint64
S
ize
uint64
B
locks
uint64
A
time
uint64
M
time
uint64
C
time
uint64
A
timensec
uint32
M
timensec
uint32
C
timensec
uint32
M
ode
uint32
N
link
uint32
U
id
uint32
G
id
uint32
R
dev
uint32
B
lksize
uint32
P
adding
uint32
}
type
Kstatfs
struct
{
b
locks
uint64
b
free
uint64
b
avail
uint64
f
iles
uint64
f
free
uint64
b
size
uint32
n
amelen
uint32
f
rsize
uint32
p
adding
uint32
s
pare
[
6
]
uint32
B
locks
uint64
B
free
uint64
B
avail
uint64
F
iles
uint64
F
free
uint64
B
size
uint32
N
amelen
uint32
F
rsize
uint32
P
adding
uint32
S
pare
[
6
]
uint32
}
type
File_lock
struct
{
s
tart
uint64
e
nd
uint64
t
yp
uint32
p
id
uint32
/* tgid */
S
tart
uint64
E
nd
uint64
T
yp
uint32
P
id
uint32
/* tgid */
}
type
Entry_out
struct
{
n
odeid
uint64
/* Inode ID */
g
eneration
uint64
/* Inode generation: nodeid:gen must
N
odeid
uint64
/* Inode ID */
G
eneration
uint64
/* Inode generation: nodeid:gen must
be unique for the fs's lifetime */
e
ntry_valid
uint64
/* Cache timeout for the name */
a
ttr_valid
uint64
/* Cache timeout for the attributes */
e
ntry_valid_nsec
uint32
a
ttr_valid_nsec
uint32
attr
fuse_a
ttr
E
ntry_valid
uint64
/* Cache timeout for the name */
A
ttr_valid
uint64
/* Cache timeout for the attributes */
E
ntry_valid_nsec
uint32
A
ttr_valid_nsec
uint32
Attr
A
ttr
}
type
Forget_in
struct
{
n
lookup
uint64
N
lookup
uint64
}
type
Getattr_in
struct
{
g
etattr_flags
uint32
d
ummy
uint32
f
h
uint64
G
etattr_flags
uint32
D
ummy
uint32
F
h
uint64
}
type
Attr_out
struct
{
a
ttr_valid
uint64
/* Cache timeout for the attributes */
a
ttr_valid_nsec
uint32
d
ummy
uint32
attr
fuse_a
ttr
A
ttr_valid
uint64
/* Cache timeout for the attributes */
A
ttr_valid_nsec
uint32
D
ummy
uint32
Attr
A
ttr
}
type
Mknod_in
struct
{
m
ode
uint32
r
dev
uint32
u
mask
uint32
p
adding
uint32
M
ode
uint32
R
dev
uint32
U
mask
uint32
P
adding
uint32
}
type
Mkdir_in
struct
{
m
ode
uint32
u
mask
uint32
M
ode
uint32
U
mask
uint32
}
type
Rename_in
struct
{
n
ewdir
uint64
N
ewdir
uint64
}
type
Link_in
struct
{
o
ldnodeid
uint64
O
ldnodeid
uint64
}
type
Setattr_in
struct
{
v
alid
uint32
p
adding
uint32
f
h
uint64
s
ize
uint64
l
ock_owner
uint64
a
time
uint64
m
time
uint64
u
nused2
uint64
a
timensec
uint32
m
timensec
uint32
u
nused3
uint32
m
ode
uint32
u
nused4
uint32
u
id
uint32
g
id
uint32
u
nused5
uint32
V
alid
uint32
P
adding
uint32
F
h
uint64
S
ize
uint64
L
ock_owner
uint64
A
time
uint64
M
time
uint64
U
nused2
uint64
A
timensec
uint32
M
timensec
uint32
U
nused3
uint32
M
ode
uint32
U
nused4
uint32
U
id
uint32
G
id
uint32
U
nused5
uint32
}
type
Open_in
struct
{
f
lags
uint32
u
nused
uint32
F
lags
uint32
U
nused
uint32
}
type
Create_in
struct
{
f
lags
uint32
m
ode
uint32
u
mask
uint32
p
adding
uint32
F
lags
uint32
M
ode
uint32
U
mask
uint32
P
adding
uint32
}
type
Open_out
struct
{
f
h
uint64
o
pen_flags
uint32
p
adding
uint32
F
h
uint64
O
pen_flags
uint32
P
adding
uint32
}
type
Release_in
struct
{
f
h
uint64
f
lags
uint32
r
elease_flags
uint32
l
ock_owner
uint64
F
h
uint64
F
lags
uint32
R
elease_flags
uint32
L
ock_owner
uint64
}
type
Flush_in
struct
{
f
h
uint64
u
nused
uint32
p
adding
uint32
l
ock_owner
uint64
F
h
uint64
U
nused
uint32
P
adding
uint32
L
ock_owner
uint64
}
type
Read_in
struct
{
f
h
uint64
o
ffset
uint64
s
ize
uint32
r
ead_flags
uint32
l
ock_owner
uint64
f
lags
uint32
p
adding
uint32
F
h
uint64
O
ffset
uint64
S
ize
uint32
R
ead_flags
uint32
L
ock_owner
uint64
F
lags
uint32
P
adding
uint32
}
type
Write_in
struct
{
f
h
uint64
o
ffset
uint64
s
ize
uint32
w
rite_flags
uint32
l
ock_owner
uint64
f
lags
uint32
p
adding
uint32
F
h
uint64
O
ffset
uint64
S
ize
uint32
W
rite_flags
uint32
L
ock_owner
uint64
F
lags
uint32
P
adding
uint32
}
type
Write_out
struct
{
s
ize
uint32
p
adding
uint32
S
ize
uint32
P
adding
uint32
}
type
Statfs_out
struct
{
st
fuse_k
statfs
St
K
statfs
}
type
Fsync_in
struct
{
f
h
uint64
f
sync_flags
uint32
p
adding
uint32
F
h
uint64
F
sync_flags
uint32
P
adding
uint32
}
type
Setxattr_in
struct
{
s
ize
uint32
f
lags
uint32
S
ize
uint32
F
lags
uint32
}
type
Getxattr_in
struct
{
s
ize
uint32
p
adding
uint32
S
ize
uint32
P
adding
uint32
}
type
Getxattr_out
struct
{
s
ize
uint32
p
adding
uint32
S
ize
uint32
P
adding
uint32
}
type
Lk_in
struct
{
f
h
uint64
o
wner
uint64
lk
fuse_f
ile_lock
l
k_flags
uint32
p
adding
uint32
F
h
uint64
O
wner
uint64
Lk
F
ile_lock
L
k_flags
uint32
P
adding
uint32
}
type
Lk_out
struct
{
lk
fuse_f
ile_lock
Lk
F
ile_lock
}
type
Access_in
struct
{
m
ask
uint32
p
adding
uint32
M
ask
uint32
P
adding
uint32
}
type
Init_in
struct
{
m
ajor
uint32
m
inor
uint32
m
ax_readahead
uint32
f
lags
uint32
M
ajor
uint32
M
inor
uint32
M
ax_readahead
uint32
F
lags
uint32
}
type
Init_out
struct
{
m
ajor
uint32
m
inor
uint32
m
ax_readahead
uint32
f
lags
uint32
m
ax_background
uint16
c
ongestion_threshold
uint16
m
ax_write
uint32
M
ajor
uint32
M
inor
uint32
M
ax_readahead
uint32
F
lags
uint32
M
ax_background
uint16
C
ongestion_threshold
uint16
M
ax_write
uint32
}
type
Cuse_init_in
struct
{
m
ajor
uint32
m
inor
uint32
u
nused
uint32
f
lags
uint32
M
ajor
uint32
M
inor
uint32
U
nused
uint32
F
lags
uint32
}
type
Cuse_init_out
struct
{
m
ajor
uint32
m
inor
uint32
u
nused
uint32
f
lags
uint32
m
ax_read
uint32
m
ax_write
uint32
d
ev_major
uint32
/* chardev major */
d
ev_minor
uint32
/* chardev minor */
s
pare
[
10
]
uint32
M
ajor
uint32
M
inor
uint32
U
nused
uint32
F
lags
uint32
M
ax_read
uint32
M
ax_write
uint32
D
ev_major
uint32
/* chardev major */
D
ev_minor
uint32
/* chardev minor */
S
pare
[
10
]
uint32
}
type
Interrupt_in
struct
{
u
nique
uint64
U
nique
uint64
}
type
Bmap_in
struct
{
b
lock
uint64
b
locksize
uint32
p
adding
uint32
B
lock
uint64
B
locksize
uint32
P
adding
uint32
}
type
Bmap_out
struct
{
b
lock
uint64
B
lock
uint64
}
type
Ioctl_in
struct
{
f
h
uint64
f
lags
uint32
c
md
uint32
a
rg
uint64
i
n_size
uint32
o
ut_size
uint32
F
h
uint64
F
lags
uint32
C
md
uint32
A
rg
uint64
I
n_size
uint32
O
ut_size
uint32
}
type
Ioctl_out
struct
{
r
esult
int32
f
lags
uint32
i
n_iovs
uint32
o
ut_iovs
uint32
R
esult
int32
F
lags
uint32
I
n_iovs
uint32
O
ut_iovs
uint32
}
type
Poll_in
struct
{
f
h
uint64
k
h
uint64
f
lags
uint32
p
adding
uint32
F
h
uint64
K
h
uint64
F
lags
uint32
P
adding
uint32
}
type
Poll_out
struct
{
r
events
uint32
p
adding
uint32
R
events
uint32
P
adding
uint32
}
type
Notify_poll_wakeup_out
struct
{
k
h
uint64
K
h
uint64
}
type
In_header
struct
{
l
ength
uint32
o
pcode
uint32
u
nique
uint64
n
odeid
uint64
u
id
uint32
g
id
uint32
p
id
uint32
p
adding
uint32
L
ength
uint32
O
pcode
uint32
U
nique
uint64
N
odeid
uint64
U
id
uint32
G
id
uint32
P
id
uint32
P
adding
uint32
}
type
Out_header
struct
{
l
ength
uint32
e
rror
int32
u
nique
uint64
L
ength
uint32
E
rror
int32
U
nique
uint64
}
type
Dirent
struct
{
i
no
uint64
o
ff
uint64
n
amelen
uint32
t
yp
uint32
I
no
uint64
O
ff
uint64
N
amelen
uint32
T
yp
uint32
// name []byte // char name[0] -- looks like the name is right after this struct.
}
type
Notify_inval_inode_out
struct
{
i
no
uint64
o
ff
int64
l
ength
int64
I
no
uint64
O
ff
int64
L
ength
int64
}
type
Notify_inval_entry_out
struct
{
p
arent
uint64
n
amelen
uint32
p
adding
uint32
P
arent
uint64
N
amelen
uint32
P
adding
uint32
}
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