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
Kirill Smelkov
go-fuse
Commits
1fa5a003
Commit
1fa5a003
authored
Jun 23, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide ReadOnlyFile to reduce API clutter.
parent
eb033a6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
fuse/files.go
fuse/files.go
+15
-11
fuse/pathfs/readonlyfs.go
fuse/pathfs/readonlyfs.go
+1
-1
No files found.
fuse/files.go
View file @
1fa5a003
...
...
@@ -220,37 +220,41 @@ func (f *loopbackFile) Utimens(a *time.Time, m *time.Time) Status {
////////////////////////////////////////////////////////////////
// ReadOnlyFile is a wrapper that denies writable operations
type
ReadOnlyFile
struct
{
func
NewReadOnlyFile
(
f
File
)
File
{
return
&
readOnlyFile
{
File
:
f
}
}
// readOnlyFile is a wrapper that denies writable operations
type
readOnlyFile
struct
{
File
}
var
_
=
(
File
)((
*
R
eadOnlyFile
)(
nil
))
var
_
=
(
File
)((
*
r
eadOnlyFile
)(
nil
))
func
(
f
*
R
eadOnlyFile
)
String
()
string
{
return
fmt
.
Sprintf
(
"
R
eadOnlyFile(%s)"
,
f
.
File
.
String
())
func
(
f
*
r
eadOnlyFile
)
String
()
string
{
return
fmt
.
Sprintf
(
"
r
eadOnlyFile(%s)"
,
f
.
File
.
String
())
}
func
(
f
*
R
eadOnlyFile
)
Write
(
data
[]
byte
,
off
int64
)
(
uint32
,
Status
)
{
func
(
f
*
r
eadOnlyFile
)
Write
(
data
[]
byte
,
off
int64
)
(
uint32
,
Status
)
{
return
0
,
EPERM
}
func
(
f
*
R
eadOnlyFile
)
Fsync
(
flag
int
)
(
code
Status
)
{
func
(
f
*
r
eadOnlyFile
)
Fsync
(
flag
int
)
(
code
Status
)
{
return
OK
}
func
(
f
*
R
eadOnlyFile
)
Truncate
(
size
uint64
)
Status
{
func
(
f
*
r
eadOnlyFile
)
Truncate
(
size
uint64
)
Status
{
return
EPERM
}
func
(
f
*
R
eadOnlyFile
)
Chmod
(
mode
uint32
)
Status
{
func
(
f
*
r
eadOnlyFile
)
Chmod
(
mode
uint32
)
Status
{
return
EPERM
}
func
(
f
*
R
eadOnlyFile
)
Chown
(
uid
uint32
,
gid
uint32
)
Status
{
func
(
f
*
r
eadOnlyFile
)
Chown
(
uid
uint32
,
gid
uint32
)
Status
{
return
EPERM
}
func
(
f
*
R
eadOnlyFile
)
Allocate
(
off
uint64
,
sz
uint64
,
mode
uint32
)
Status
{
func
(
f
*
r
eadOnlyFile
)
Allocate
(
off
uint64
,
sz
uint64
,
mode
uint32
)
Status
{
return
EPERM
}
fuse/pathfs/readonlyfs.go
View file @
1fa5a003
...
...
@@ -73,7 +73,7 @@ func (fs *readonlyFileSystem) Open(name string, flags uint32, context *fuse.Cont
return
nil
,
fuse
.
EPERM
}
file
,
code
=
fs
.
FileSystem
.
Open
(
name
,
flags
,
context
)
return
&
fuse
.
ReadOnlyFile
{
file
}
,
code
return
fuse
.
NewReadOnlyFile
(
file
)
,
code
}
func
(
fs
*
readonlyFileSystem
)
OpenDir
(
name
string
,
context
*
fuse
.
Context
)
(
stream
[]
fuse
.
DirEntry
,
status
fuse
.
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