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
c0387f23
Commit
c0387f23
authored
Jun 22, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide ReadOnlyFileSystem type to reduce API clutter.
parent
8c5c22a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
28 deletions
+34
-28
fuse/pathfs/readonlyfs.go
fuse/pathfs/readonlyfs.go
+34
-28
No files found.
fuse/pathfs/readonlyfs.go
View file @
c0387f23
...
...
@@ -7,62 +7,68 @@ import (
"github.com/hanwen/go-fuse/fuse"
)
// This is a wrapper that only exposes read-only operations.
type
ReadonlyFileSystem
struct
{
// NewReadonlyFileSystem returns a wrapper that only exposes read-only
// operations.
func
NewReadonlyFileSystem
(
fs
FileSystem
)
FileSystem
{
return
&
readonlyFileSystem
{
fs
}
}
type
readonlyFileSystem
struct
{
FileSystem
}
var
_
=
(
FileSystem
)((
*
R
eadonlyFileSystem
)(
nil
))
var
_
=
(
FileSystem
)((
*
r
eadonlyFileSystem
)(
nil
))
func
(
fs
*
R
eadonlyFileSystem
)
GetAttr
(
name
string
,
context
*
fuse
.
Context
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
GetAttr
(
name
string
,
context
*
fuse
.
Context
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
return
fs
.
FileSystem
.
GetAttr
(
name
,
context
)
}
func
(
fs
*
R
eadonlyFileSystem
)
Readlink
(
name
string
,
context
*
fuse
.
Context
)
(
string
,
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Readlink
(
name
string
,
context
*
fuse
.
Context
)
(
string
,
fuse
.
Status
)
{
return
fs
.
FileSystem
.
Readlink
(
name
,
context
)
}
func
(
fs
*
R
eadonlyFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
,
context
*
fuse
.
Context
)
fuse
.
Status
{
func
(
fs
*
r
eadonlyFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
,
context
*
fuse
.
Context
)
fuse
.
Status
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Mkdir
(
name
string
,
mode
uint32
,
context
*
fuse
.
Context
)
fuse
.
Status
{
func
(
fs
*
r
eadonlyFileSystem
)
Mkdir
(
name
string
,
mode
uint32
,
context
*
fuse
.
Context
)
fuse
.
Status
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Unlink
(
name
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Unlink
(
name
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Rmdir
(
name
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Rmdir
(
name
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Symlink
(
value
string
,
linkName
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Symlink
(
value
string
,
linkName
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Rename
(
oldName
string
,
newName
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Rename
(
oldName
string
,
newName
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Link
(
oldName
string
,
newName
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Link
(
oldName
string
,
newName
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Chmod
(
name
string
,
mode
uint32
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Chmod
(
name
string
,
mode
uint32
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Truncate
(
name
string
,
offset
uint64
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Truncate
(
name
string
,
offset
uint64
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Open
(
name
string
,
flags
uint32
,
context
*
fuse
.
Context
)
(
file
fuse
.
File
,
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Open
(
name
string
,
flags
uint32
,
context
*
fuse
.
Context
)
(
file
fuse
.
File
,
code
fuse
.
Status
)
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
return
nil
,
fuse
.
EPERM
}
...
...
@@ -70,46 +76,46 @@ func (fs *ReadonlyFileSystem) Open(name string, flags uint32, context *fuse.Cont
return
&
fuse
.
ReadOnlyFile
{
file
},
code
}
func
(
fs
*
R
eadonlyFileSystem
)
OpenDir
(
name
string
,
context
*
fuse
.
Context
)
(
stream
[]
fuse
.
DirEntry
,
status
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
OpenDir
(
name
string
,
context
*
fuse
.
Context
)
(
stream
[]
fuse
.
DirEntry
,
status
fuse
.
Status
)
{
return
fs
.
FileSystem
.
OpenDir
(
name
,
context
)
}
func
(
fs
*
R
eadonlyFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
func
(
fs
*
r
eadonlyFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
fs
.
FileSystem
.
OnMount
(
nodeFs
)
}
func
(
fs
*
R
eadonlyFileSystem
)
OnUnmount
()
{
func
(
fs
*
r
eadonlyFileSystem
)
OnUnmount
()
{
fs
.
FileSystem
.
OnUnmount
()
}
func
(
fs
*
R
eadonlyFileSystem
)
String
()
string
{
return
fmt
.
Sprintf
(
"
R
eadonlyFileSystem(%v)"
,
fs
.
FileSystem
)
func
(
fs
*
r
eadonlyFileSystem
)
String
()
string
{
return
fmt
.
Sprintf
(
"
r
eadonlyFileSystem(%v)"
,
fs
.
FileSystem
)
}
func
(
fs
*
R
eadonlyFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fs
.
FileSystem
.
Access
(
name
,
mode
,
context
)
}
func
(
fs
*
R
eadonlyFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
,
context
*
fuse
.
Context
)
(
file
fuse
.
File
,
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
,
context
*
fuse
.
Context
)
(
file
fuse
.
File
,
code
fuse
.
Status
)
{
return
nil
,
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
Utimens
(
name
string
,
atime
*
time
.
Time
,
ctime
*
time
.
Time
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
Utimens
(
name
string
,
atime
*
time
.
Time
,
ctime
*
time
.
Time
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
GetXAttr
(
name
string
,
attr
string
,
context
*
fuse
.
Context
)
([]
byte
,
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
GetXAttr
(
name
string
,
attr
string
,
context
*
fuse
.
Context
)
([]
byte
,
fuse
.
Status
)
{
return
fs
.
FileSystem
.
GetXAttr
(
name
,
attr
,
context
)
}
func
(
fs
*
R
eadonlyFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
,
context
*
fuse
.
Context
)
fuse
.
Status
{
func
(
fs
*
r
eadonlyFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
,
context
*
fuse
.
Context
)
fuse
.
Status
{
return
fuse
.
EPERM
}
func
(
fs
*
R
eadonlyFileSystem
)
ListXAttr
(
name
string
,
context
*
fuse
.
Context
)
([]
string
,
fuse
.
Status
)
{
func
(
fs
*
r
eadonlyFileSystem
)
ListXAttr
(
name
string
,
context
*
fuse
.
Context
)
([]
string
,
fuse
.
Status
)
{
return
fs
.
FileSystem
.
ListXAttr
(
name
,
context
)
}
func
(
fs
*
R
eadonlyFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
,
context
*
fuse
.
Context
)
fuse
.
Status
{
func
(
fs
*
r
eadonlyFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
,
context
*
fuse
.
Context
)
fuse
.
Status
{
return
fuse
.
EPERM
}
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