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
ca66423a
Commit
ca66423a
authored
Aug 24, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ReadonlyFileSystem.
parent
5cd3775f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
0 deletions
+107
-0
fuse/Makefile
fuse/Makefile
+1
-0
fuse/readonlyfs.go
fuse/readonlyfs.go
+106
-0
No files found.
fuse/Makefile
View file @
ca66423a
...
...
@@ -22,6 +22,7 @@ MANUAL_GOFILES=api.go \
pathdebug.go
\
pathfilesystem.go
\
pathops.go
\
readonlyfs.go
\
request.go
\
switchfs.go
\
timingfs.go
\
...
...
fuse/readonlyfs.go
0 → 100644
View file @
ca66423a
package
fuse
import
(
"os"
)
// This is a wrapper that only exposes read-only operations.
type
ReadonlyFileSystem
struct
{
FileSystem
}
func
(
me
*
ReadonlyFileSystem
)
GetAttr
(
name
string
,
context
*
Context
)
(
*
os
.
FileInfo
,
Status
)
{
return
me
.
FileSystem
.
GetAttr
(
name
,
context
)
}
func
(
me
*
ReadonlyFileSystem
)
Readlink
(
name
string
,
context
*
Context
)
(
string
,
Status
)
{
return
me
.
FileSystem
.
Readlink
(
name
,
context
)
}
func
(
me
*
ReadonlyFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
,
context
*
Context
)
Status
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Mkdir
(
name
string
,
mode
uint32
,
context
*
Context
)
Status
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Unlink
(
name
string
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Rmdir
(
name
string
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Symlink
(
value
string
,
linkName
string
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Rename
(
oldName
string
,
newName
string
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Link
(
oldName
string
,
newName
string
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Chmod
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Truncate
(
name
string
,
offset
uint64
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Open
(
name
string
,
flags
uint32
,
context
*
Context
)
(
file
File
,
code
Status
)
{
if
flags
&
O_ANYWRITE
!=
0
{
return
nil
,
EPERM
}
// TODO - wrap the File object inside a R/O wrapper too?
return
me
.
FileSystem
.
Open
(
name
,
flags
,
context
)
}
func
(
me
*
ReadonlyFileSystem
)
OpenDir
(
name
string
,
context
*
Context
)
(
stream
chan
DirEntry
,
status
Status
)
{
return
me
.
FileSystem
.
OpenDir
(
name
,
context
)
}
func
(
me
*
ReadonlyFileSystem
)
Mount
(
conn
*
FileSystemConnector
)
{
me
.
FileSystem
.
Mount
(
conn
)
}
func
(
me
*
ReadonlyFileSystem
)
Unmount
()
{
me
.
FileSystem
.
Unmount
()
}
func
(
me
*
ReadonlyFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Access
(
name
,
mode
,
context
)
}
func
(
me
*
ReadonlyFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
,
context
*
Context
)
(
file
File
,
code
Status
)
{
return
nil
,
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
,
context
*
Context
)
(
code
Status
)
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
GetXAttr
(
name
string
,
attr
string
,
context
*
Context
)
([]
byte
,
Status
)
{
return
me
.
FileSystem
.
GetXAttr
(
name
,
attr
,
context
)
}
func
(
me
*
ReadonlyFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
,
context
*
Context
)
Status
{
return
EPERM
}
func
(
me
*
ReadonlyFileSystem
)
ListXAttr
(
name
string
,
context
*
Context
)
([]
string
,
Status
)
{
return
me
.
FileSystem
.
ListXAttr
(
name
,
context
)
}
func
(
me
*
ReadonlyFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
,
context
*
Context
)
Status
{
return
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