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
9d6d672c
Commit
9d6d672c
authored
May 22, 2011
by
Han-Wen Nienhuys
Committed by
Han-Wen Nienhuys
Jun 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make file member public in LoopbackFile.
parent
a29304bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
fuse/files.go
fuse/files.go
+10
-10
fuse/loopback.go
fuse/loopback.go
+2
-2
No files found.
fuse/files.go
View file @
9d6d672c
...
...
@@ -62,7 +62,7 @@ func (me *DevNullFile) Fsync(*FsyncIn) (code Status) {
// LoopbackFile delegates all operations back to an underlying os.File.
type
LoopbackFile
struct
{
f
ile
*
os
.
File
F
ile
*
os
.
File
DefaultFile
}
...
...
@@ -70,8 +70,8 @@ type LoopbackFile struct {
func
(
me
*
LoopbackFile
)
Read
(
input
*
ReadIn
,
buffers
BufferPool
)
([]
byte
,
Status
)
{
slice
:=
buffers
.
AllocBuffer
(
input
.
Size
)
n
,
err
:=
me
.
f
ile
.
ReadAt
(
slice
,
int64
(
input
.
Offset
))
// TODO - fix Go documentation.
n
,
err
:=
me
.
F
ile
.
ReadAt
(
slice
,
int64
(
input
.
Offset
))
// TODO - fix Go
n
documentation.
if
err
==
os
.
EOF
{
err
=
nil
}
...
...
@@ -79,35 +79,35 @@ func (me *LoopbackFile) Read(input *ReadIn, buffers BufferPool) ([]byte, Status)
}
func
(
me
*
LoopbackFile
)
Write
(
input
*
WriteIn
,
data
[]
byte
)
(
uint32
,
Status
)
{
n
,
err
:=
me
.
f
ile
.
WriteAt
(
data
,
int64
(
input
.
Offset
))
n
,
err
:=
me
.
F
ile
.
WriteAt
(
data
,
int64
(
input
.
Offset
))
return
uint32
(
n
),
OsErrorToErrno
(
err
)
}
func
(
me
*
LoopbackFile
)
Release
()
{
me
.
f
ile
.
Close
()
me
.
F
ile
.
Close
()
}
func
(
me
*
LoopbackFile
)
Fsync
(
*
FsyncIn
)
(
code
Status
)
{
return
Status
(
syscall
.
Fsync
(
me
.
f
ile
.
Fd
()))
return
Status
(
syscall
.
Fsync
(
me
.
F
ile
.
Fd
()))
}
func
(
me
*
LoopbackFile
)
Truncate
(
size
uint64
)
Status
{
return
Status
(
syscall
.
Ftruncate
(
me
.
f
ile
.
Fd
(),
int64
(
size
)))
return
Status
(
syscall
.
Ftruncate
(
me
.
F
ile
.
Fd
(),
int64
(
size
)))
}
// futimens missing from 6g runtime.
func
(
me
*
LoopbackFile
)
Chmod
(
mode
uint32
)
Status
{
return
OsErrorToErrno
(
me
.
f
ile
.
Chmod
(
mode
))
return
OsErrorToErrno
(
me
.
F
ile
.
Chmod
(
mode
))
}
func
(
me
*
LoopbackFile
)
Chown
(
uid
uint32
,
gid
uint32
)
Status
{
return
OsErrorToErrno
(
me
.
f
ile
.
Chown
(
int
(
uid
),
int
(
gid
)))
return
OsErrorToErrno
(
me
.
F
ile
.
Chown
(
int
(
uid
),
int
(
gid
)))
}
func
(
me
*
LoopbackFile
)
GetAttr
()
(
*
os
.
FileInfo
,
Status
)
{
fi
,
err
:=
me
.
f
ile
.
Stat
()
fi
,
err
:=
me
.
F
ile
.
Stat
()
if
err
!=
nil
{
return
nil
,
OsErrorToErrno
(
err
)
}
...
...
fuse/loopback.go
View file @
9d6d672c
...
...
@@ -79,7 +79,7 @@ func (me *LoopbackFileSystem) Open(name string, flags uint32) (fuseFile File, st
if
err
!=
nil
{
return
nil
,
OsErrorToErrno
(
err
)
}
return
&
LoopbackFile
{
f
ile
:
f
},
OK
return
&
LoopbackFile
{
F
ile
:
f
},
OK
}
func
(
me
*
LoopbackFileSystem
)
Chmod
(
path
string
,
mode
uint32
)
(
code
Status
)
{
...
...
@@ -140,7 +140,7 @@ func (me *LoopbackFileSystem) Access(name string, mode uint32) (code Status) {
func
(
me
*
LoopbackFileSystem
)
Create
(
path
string
,
flags
uint32
,
mode
uint32
)
(
fuseFile
File
,
code
Status
)
{
f
,
err
:=
os
.
OpenFile
(
me
.
GetPath
(
path
),
int
(
flags
)
|
os
.
O_CREATE
,
mode
)
return
&
LoopbackFile
{
f
ile
:
f
},
OsErrorToErrno
(
err
)
return
&
LoopbackFile
{
F
ile
:
f
},
OsErrorToErrno
(
err
)
}
func
(
me
*
LoopbackFileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
...
...
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