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
ca8d62a1
Commit
ca8d62a1
authored
May 26, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move WriteIn/ReadIn to raw/
parent
aa91e8c0
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
78 additions
and
75 deletions
+78
-75
fuse/api.go
fuse/api.go
+3
-3
fuse/copy.go
fuse/copy.go
+1
-4
fuse/defaultraw.go
fuse/defaultraw.go
+3
-3
fuse/direntry.go
fuse/direntry.go
+2
-2
fuse/fsops.go
fuse/fsops.go
+3
-3
fuse/lockingfs.go
fuse/lockingfs.go
+3
-3
fuse/opcode.go
fuse/opcode.go
+8
-8
fuse/typeprint.go
fuse/typeprint.go
+0
-21
fuse/types.go
fuse/types.go
+0
-28
raw/print.go
raw/print.go
+26
-0
raw/types.go
raw/types.go
+29
-0
No files found.
fuse/api.go
View file @
ca8d62a1
...
...
@@ -278,16 +278,16 @@ type RawFileSystem interface {
// File handling.
Create
(
out
*
raw
.
CreateOut
,
header
*
raw
.
InHeader
,
input
*
raw
.
CreateIn
,
name
string
)
(
code
Status
)
Open
(
out
*
raw
.
OpenOut
,
header
*
raw
.
InHeader
,
input
*
raw
.
OpenIn
)
(
status
Status
)
Read
(
*
raw
.
InHeader
,
*
ReadIn
,
[]
byte
)
ReadResult
Read
(
*
raw
.
InHeader
,
*
raw
.
ReadIn
,
[]
byte
)
ReadResult
Release
(
header
*
raw
.
InHeader
,
input
*
raw
.
ReleaseIn
)
Write
(
*
raw
.
InHeader
,
*
WriteIn
,
[]
byte
)
(
written
uint32
,
code
Status
)
Write
(
*
raw
.
InHeader
,
*
raw
.
WriteIn
,
[]
byte
)
(
written
uint32
,
code
Status
)
Flush
(
header
*
raw
.
InHeader
,
input
*
raw
.
FlushIn
)
Status
Fsync
(
*
raw
.
InHeader
,
*
raw
.
FsyncIn
)
(
code
Status
)
// Directory handling
OpenDir
(
out
*
raw
.
OpenOut
,
header
*
raw
.
InHeader
,
input
*
raw
.
OpenIn
)
(
status
Status
)
ReadDir
(
out
*
DirEntryList
,
header
*
raw
.
InHeader
,
input
*
ReadIn
)
Status
ReadDir
(
out
*
DirEntryList
,
header
*
raw
.
InHeader
,
input
*
raw
.
ReadIn
)
Status
ReleaseDir
(
header
*
raw
.
InHeader
,
input
*
raw
.
ReleaseIn
)
FsyncDir
(
header
*
raw
.
InHeader
,
input
*
raw
.
FsyncIn
)
(
code
Status
)
...
...
fuse/copy.go
View file @
ca8d62a1
...
...
@@ -17,10 +17,7 @@ func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *Conte
return
code
}
w
:=
WriteIn
{
Flags
:
uint32
(
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
),
}
dst
,
code
:=
destFs
.
Create
(
destFile
,
w
.
Flags
,
attr
.
Mode
,
context
)
dst
,
code
:=
destFs
.
Create
(
destFile
,
uint32
(
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
),
attr
.
Mode
,
context
)
if
!
code
.
Ok
()
{
return
code
}
...
...
fuse/defaultraw.go
View file @
ca8d62a1
...
...
@@ -96,14 +96,14 @@ func (fs *DefaultRawFileSystem) OpenDir(out *raw.OpenOut, header *raw.InHeader,
return
ENOSYS
}
func
(
fs
*
DefaultRawFileSystem
)
Read
(
header
*
raw
.
InHeader
,
input
*
ReadIn
,
buf
[]
byte
)
ReadResult
{
func
(
fs
*
DefaultRawFileSystem
)
Read
(
header
*
raw
.
InHeader
,
input
*
raw
.
ReadIn
,
buf
[]
byte
)
ReadResult
{
return
ReadResult
{}
}
func
(
fs
*
DefaultRawFileSystem
)
Release
(
header
*
raw
.
InHeader
,
input
*
raw
.
ReleaseIn
)
{
}
func
(
fs
*
DefaultRawFileSystem
)
Write
(
header
*
raw
.
InHeader
,
input
*
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
func
(
fs
*
DefaultRawFileSystem
)
Write
(
header
*
raw
.
InHeader
,
input
*
raw
.
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
return
0
,
ENOSYS
}
...
...
@@ -115,7 +115,7 @@ func (fs *DefaultRawFileSystem) Fsync(header *raw.InHeader, input *raw.FsyncIn)
return
ENOSYS
}
func
(
fs
*
DefaultRawFileSystem
)
ReadDir
(
l
*
DirEntryList
,
header
*
raw
.
InHeader
,
input
*
ReadIn
)
Status
{
func
(
fs
*
DefaultRawFileSystem
)
ReadDir
(
l
*
DirEntryList
,
header
*
raw
.
InHeader
,
input
*
raw
.
ReadIn
)
Status
{
return
ENOSYS
}
...
...
fuse/direntry.go
View file @
ca8d62a1
...
...
@@ -73,7 +73,7 @@ func (l *DirEntryList) Bytes() []byte {
////////////////////////////////////////////////////////////////
type
rawDir
interface
{
ReadDir
(
out
*
DirEntryList
,
input
*
ReadIn
)
Status
ReadDir
(
out
*
DirEntryList
,
input
*
raw
.
ReadIn
)
Status
Release
()
}
...
...
@@ -83,7 +83,7 @@ type connectorDir struct {
lastOffset
uint64
}
func
(
d
*
connectorDir
)
ReadDir
(
list
*
DirEntryList
,
input
*
ReadIn
)
(
code
Status
)
{
func
(
d
*
connectorDir
)
ReadDir
(
list
*
DirEntryList
,
input
*
raw
.
ReadIn
)
(
code
Status
)
{
if
d
.
stream
==
nil
{
return
OK
}
...
...
fuse/fsops.go
View file @
ca8d62a1
...
...
@@ -123,7 +123,7 @@ func (c *FileSystemConnector) OpenDir(out *raw.OpenOut, header *raw.InHeader, in
return
OK
}
func
(
c
*
FileSystemConnector
)
ReadDir
(
l
*
DirEntryList
,
header
*
raw
.
InHeader
,
input
*
ReadIn
)
Status
{
func
(
c
*
FileSystemConnector
)
ReadDir
(
l
*
DirEntryList
,
header
*
raw
.
InHeader
,
input
*
raw
.
ReadIn
)
Status
{
node
:=
c
.
toInode
(
header
.
NodeId
)
opened
:=
node
.
mount
.
getOpenedFile
(
input
.
Fh
)
return
opened
.
dir
.
ReadDir
(
l
,
input
)
...
...
@@ -344,13 +344,13 @@ func (c *FileSystemConnector) ListXAttr(header *raw.InHeader) (data []byte, code
////////////////
// files.
func
(
c
*
FileSystemConnector
)
Write
(
header
*
raw
.
InHeader
,
input
*
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
func
(
c
*
FileSystemConnector
)
Write
(
header
*
raw
.
InHeader
,
input
*
raw
.
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
node
:=
c
.
toInode
(
header
.
NodeId
)
opened
:=
node
.
mount
.
getOpenedFile
(
input
.
Fh
)
return
opened
.
WithFlags
.
File
.
Write
(
data
,
int64
(
input
.
Offset
))
}
func
(
c
*
FileSystemConnector
)
Read
(
header
*
raw
.
InHeader
,
input
*
ReadIn
,
buf
[]
byte
)
ReadResult
{
func
(
c
*
FileSystemConnector
)
Read
(
header
*
raw
.
InHeader
,
input
*
raw
.
ReadIn
,
buf
[]
byte
)
ReadResult
{
node
:=
c
.
toInode
(
header
.
NodeId
)
opened
:=
node
.
mount
.
getOpenedFile
(
input
.
Fh
)
...
...
fuse/lockingfs.go
View file @
ca8d62a1
...
...
@@ -276,12 +276,12 @@ func (fs *LockingRawFileSystem) ReleaseDir(header *raw.InHeader, h *raw.ReleaseI
fs
.
RawFileSystem
.
ReleaseDir
(
header
,
h
)
}
func
(
fs
*
LockingRawFileSystem
)
Read
(
header
*
raw
.
InHeader
,
input
*
ReadIn
,
buf
[]
byte
)
ReadResult
{
func
(
fs
*
LockingRawFileSystem
)
Read
(
header
*
raw
.
InHeader
,
input
*
raw
.
ReadIn
,
buf
[]
byte
)
ReadResult
{
defer
fs
.
locked
()()
return
fs
.
RawFileSystem
.
Read
(
header
,
input
,
buf
)
}
func
(
fs
*
LockingRawFileSystem
)
Write
(
header
*
raw
.
InHeader
,
input
*
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
func
(
fs
*
LockingRawFileSystem
)
Write
(
header
*
raw
.
InHeader
,
input
*
raw
.
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
defer
fs
.
locked
()()
return
fs
.
RawFileSystem
.
Write
(
header
,
input
,
data
)
}
...
...
@@ -296,7 +296,7 @@ func (fs *LockingRawFileSystem) Fsync(header *raw.InHeader, input *raw.FsyncIn)
return
fs
.
RawFileSystem
.
Fsync
(
header
,
input
)
}
func
(
fs
*
LockingRawFileSystem
)
ReadDir
(
out
*
DirEntryList
,
header
*
raw
.
InHeader
,
input
*
ReadIn
)
Status
{
func
(
fs
*
LockingRawFileSystem
)
ReadDir
(
out
*
DirEntryList
,
header
*
raw
.
InHeader
,
input
*
raw
.
ReadIn
)
Status
{
defer
fs
.
locked
()()
return
fs
.
RawFileSystem
.
ReadDir
(
out
,
header
,
input
)
}
...
...
fuse/opcode.go
View file @
ca8d62a1
...
...
@@ -127,7 +127,7 @@ func doCreate(state *MountState, req *request) {
}
func
doReadDir
(
state
*
MountState
,
req
*
request
)
{
in
:=
(
*
ReadIn
)(
req
.
inData
)
in
:=
(
*
raw
.
ReadIn
)(
req
.
inData
)
buf
:=
state
.
AllocOut
(
req
,
in
.
Size
)
entries
:=
NewDirEntryList
(
buf
,
uint64
(
in
.
Offset
))
...
...
@@ -148,7 +148,7 @@ func doSetattr(state *MountState, req *request) {
}
func
doWrite
(
state
*
MountState
,
req
*
request
)
{
n
,
status
:=
state
.
fileSystem
.
Write
(
req
.
inHeader
,
(
*
WriteIn
)(
req
.
inData
),
req
.
arg
)
n
,
status
:=
state
.
fileSystem
.
Write
(
req
.
inHeader
,
(
*
raw
.
WriteIn
)(
req
.
inData
),
req
.
arg
)
o
:=
(
*
raw
.
WriteOut
)(
req
.
outData
)
o
.
Size
=
n
req
.
status
=
status
...
...
@@ -267,7 +267,7 @@ func doLink(state *MountState, req *request) {
}
func
doRead
(
state
*
MountState
,
req
*
request
)
{
in
:=
(
*
ReadIn
)(
req
.
inData
)
in
:=
(
*
raw
.
ReadIn
)(
req
.
inData
)
buf
:=
state
.
AllocOut
(
req
,
in
.
Size
)
res
:=
state
.
fileSystem
.
Read
(
req
.
inHeader
,
in
,
buf
)
req
.
flatData
=
res
...
...
@@ -379,8 +379,8 @@ func init() {
_OP_RENAME
:
unsafe
.
Sizeof
(
raw
.
RenameIn
{}),
_OP_LINK
:
unsafe
.
Sizeof
(
raw
.
LinkIn
{}),
_OP_OPEN
:
unsafe
.
Sizeof
(
raw
.
OpenIn
{}),
_OP_READ
:
unsafe
.
Sizeof
(
ReadIn
{}),
_OP_WRITE
:
unsafe
.
Sizeof
(
WriteIn
{}),
_OP_READ
:
unsafe
.
Sizeof
(
raw
.
ReadIn
{}),
_OP_WRITE
:
unsafe
.
Sizeof
(
raw
.
WriteIn
{}),
_OP_RELEASE
:
unsafe
.
Sizeof
(
raw
.
ReleaseIn
{}),
_OP_FSYNC
:
unsafe
.
Sizeof
(
raw
.
FsyncIn
{}),
_OP_SETXATTR
:
unsafe
.
Sizeof
(
raw
.
SetXAttrIn
{}),
...
...
@@ -389,7 +389,7 @@ func init() {
_OP_FLUSH
:
unsafe
.
Sizeof
(
raw
.
FlushIn
{}),
_OP_INIT
:
unsafe
.
Sizeof
(
raw
.
InitIn
{}),
_OP_OPENDIR
:
unsafe
.
Sizeof
(
raw
.
OpenIn
{}),
_OP_READDIR
:
unsafe
.
Sizeof
(
ReadIn
{}),
_OP_READDIR
:
unsafe
.
Sizeof
(
raw
.
ReadIn
{}),
_OP_RELEASEDIR
:
unsafe
.
Sizeof
(
raw
.
ReleaseIn
{}),
_OP_FSYNCDIR
:
unsafe
.
Sizeof
(
raw
.
FsyncIn
{}),
_OP_ACCESS
:
unsafe
.
Sizeof
(
raw
.
AccessIn
{}),
...
...
@@ -540,8 +540,8 @@ func init() {
_OP_OPEN
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
OpenIn
)(
ptr
)
},
_OP_MKNOD
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
MknodIn
)(
ptr
)
},
_OP_CREATE
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
CreateIn
)(
ptr
)
},
_OP_READ
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
ReadIn
)(
ptr
)
},
_OP_READDIR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
ReadIn
)(
ptr
)
},
_OP_READ
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
ReadIn
)(
ptr
)
},
_OP_READDIR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
ReadIn
)(
ptr
)
},
_OP_ACCESS
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
AccessIn
)(
ptr
)
},
_OP_FORGET
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
ForgetIn
)(
ptr
)
},
_OP_BATCH_FORGET
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
BatchForgetIn
)(
ptr
)
},
...
...
fuse/typeprint.go
View file @
ca8d62a1
...
...
@@ -5,27 +5,6 @@ import (
"github.com/hanwen/go-fuse/raw"
)
var
writeFlagNames
map
[
int
]
string
var
readFlagNames
map
[
int
]
string
func
init
()
{
writeFlagNames
=
map
[
int
]
string
{
WRITE_CACHE
:
"CACHE"
,
WRITE_LOCKOWNER
:
"LOCKOWNER"
,
}
readFlagNames
=
map
[
int
]
string
{
READ_LOCKOWNER
:
"LOCKOWNER"
,
}
}
func
(
me
*
ReadIn
)
String
()
string
{
return
fmt
.
Sprintf
(
"{Fh %d off %d sz %d %s L %d %s}"
,
me
.
Fh
,
me
.
Offset
,
me
.
Size
,
raw
.
FlagString
(
readFlagNames
,
int
(
me
.
ReadFlags
),
""
),
me
.
LockOwner
,
raw
.
FlagString
(
raw
.
OpenFlagNames
,
int
(
me
.
Flags
),
"RDONLY"
))
}
func
(
me
*
WithFlags
)
String
()
string
{
return
fmt
.
Sprintf
(
"File %s (%s) %s %s"
,
me
.
File
,
me
.
Description
,
raw
.
FlagString
(
raw
.
OpenFlagNames
,
int
(
me
.
OpenFlags
),
"O_RDONLY"
),
...
...
fuse/types.go
View file @
ca8d62a1
...
...
@@ -49,31 +49,3 @@ type Context raw.Context
type
StatfsOut
raw
.
StatfsOut
const
(
READ_LOCKOWNER
=
(
1
<<
1
)
)
type
ReadIn
struct
{
Fh
uint64
Offset
uint64
Size
uint32
ReadFlags
uint32
LockOwner
uint64
Flags
uint32
Padding
uint32
}
const
(
WRITE_CACHE
=
(
1
<<
0
)
WRITE_LOCKOWNER
=
(
1
<<
1
)
)
type
WriteIn
struct
{
Fh
uint64
Offset
uint64
Size
uint32
WriteFlags
uint32
LockOwner
uint64
Flags
uint32
Padding
uint32
}
raw/print.go
View file @
ca8d62a1
...
...
@@ -12,8 +12,18 @@ var releaseFlagNames map[int]string
var
OpenFlagNames
map
[
int
]
string
var
FuseOpenFlagNames
map
[
int
]
string
var
accessFlagName
map
[
int
]
string
var
writeFlagNames
map
[
int
]
string
var
readFlagNames
map
[
int
]
string
func
init
()
{
writeFlagNames
=
map
[
int
]
string
{
WRITE_CACHE
:
"CACHE"
,
WRITE_LOCKOWNER
:
"LOCKOWNER"
,
}
readFlagNames
=
map
[
int
]
string
{
READ_LOCKOWNER
:
"LOCKOWNER"
,
}
initFlagNames
=
map
[
int
]
string
{
CAP_ASYNC_READ
:
"ASYNC_READ"
,
CAP_POSIX_LOCKS
:
"POSIX_LOCKS"
,
...
...
@@ -218,3 +228,19 @@ func (a *Attr) String() string {
a
.
Rdev
,
a
.
Ino
,
a
.
Atime
,
a
.
Atimensec
,
a
.
Mtime
,
a
.
Mtimensec
,
a
.
Ctime
,
a
.
Ctimensec
)
}
func
(
me
*
ReadIn
)
String
()
string
{
return
fmt
.
Sprintf
(
"{Fh %d off %d sz %d %s L %d %s}"
,
me
.
Fh
,
me
.
Offset
,
me
.
Size
,
FlagString
(
readFlagNames
,
int
(
me
.
ReadFlags
),
""
),
me
.
LockOwner
,
FlagString
(
OpenFlagNames
,
int
(
me
.
Flags
),
"RDONLY"
))
}
func
(
me
*
WriteIn
)
String
()
string
{
return
fmt
.
Sprintf
(
"{Fh %d off %d sz %d %s L %d %s}"
,
me
.
Fh
,
me
.
Offset
,
me
.
Size
,
FlagString
(
writeFlagNames
,
int
(
me
.
WriteFlags
),
""
),
me
.
LockOwner
,
FlagString
(
OpenFlagNames
,
int
(
me
.
Flags
),
"RDONLY"
))
}
raw/types.go
View file @
ca8d62a1
...
...
@@ -389,3 +389,32 @@ type Dirent struct {
NameLen
uint32
Typ
uint32
}
const
(
READ_LOCKOWNER
=
(
1
<<
1
)
)
type
ReadIn
struct
{
Fh
uint64
Offset
uint64
Size
uint32
ReadFlags
uint32
LockOwner
uint64
Flags
uint32
Padding
uint32
}
const
(
WRITE_CACHE
=
(
1
<<
0
)
WRITE_LOCKOWNER
=
(
1
<<
1
)
)
type
WriteIn
struct
{
Fh
uint64
Offset
uint64
Size
uint32
WriteFlags
uint32
LockOwner
uint64
Flags
uint32
Padding
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