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
5b5bf08b
Commit
5b5bf08b
authored
Sep 26, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PrefixFileSystem.
parent
1d2327a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
0 deletions
+114
-0
fuse/Makefile
fuse/Makefile
+1
-0
fuse/prefixfs.go
fuse/prefixfs.go
+113
-0
No files found.
fuse/Makefile
View file @
5b5bf08b
...
@@ -25,6 +25,7 @@ MANUAL_GOFILES=api.go \
...
@@ -25,6 +25,7 @@ MANUAL_GOFILES=api.go \
mount.go
\
mount.go
\
mountstate.go
\
mountstate.go
\
opcode.go
\
opcode.go
\
prefixfs.go
\
pathfs.go
\
pathfs.go
\
fsops.go
\
fsops.go
\
readonlyfs.go
\
readonlyfs.go
\
...
...
fuse/prefixfs.go
0 → 100644
View file @
5b5bf08b
package
fuse
import
(
"fmt"
"os"
"path/filepath"
)
// PrefixFileSystem adds a path prefix to incoming calls.
type
PrefixFileSystem
struct
{
FileSystem
Prefix
string
}
func
(
me
*
PrefixFileSystem
)
prefixed
(
n
string
)
string
{
return
filepath
.
Join
(
me
.
Prefix
,
n
)
}
func
(
me
*
PrefixFileSystem
)
GetAttr
(
name
string
,
context
*
Context
)
(
*
os
.
FileInfo
,
Status
)
{
return
me
.
FileSystem
.
GetAttr
(
me
.
prefixed
(
name
),
context
)
}
func
(
me
*
PrefixFileSystem
)
Readlink
(
name
string
,
context
*
Context
)
(
string
,
Status
)
{
return
me
.
FileSystem
.
Readlink
(
me
.
prefixed
(
name
),
context
)
}
func
(
me
*
PrefixFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
,
context
*
Context
)
Status
{
return
me
.
FileSystem
.
Mknod
(
me
.
prefixed
(
name
),
mode
,
dev
,
context
)
}
func
(
me
*
PrefixFileSystem
)
Mkdir
(
name
string
,
mode
uint32
,
context
*
Context
)
Status
{
return
me
.
FileSystem
.
Mkdir
(
me
.
prefixed
(
name
),
mode
,
context
)
}
func
(
me
*
PrefixFileSystem
)
Unlink
(
name
string
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Unlink
(
me
.
prefixed
(
name
),
context
)
}
func
(
me
*
PrefixFileSystem
)
Rmdir
(
name
string
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Rmdir
(
me
.
prefixed
(
name
),
context
)
}
func
(
me
*
PrefixFileSystem
)
Symlink
(
value
string
,
linkName
string
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Symlink
(
value
,
me
.
prefixed
(
linkName
),
context
)
}
func
(
me
*
PrefixFileSystem
)
Rename
(
oldName
string
,
newName
string
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Rename
(
me
.
prefixed
(
oldName
),
me
.
prefixed
(
newName
),
context
)
}
func
(
me
*
PrefixFileSystem
)
Link
(
oldName
string
,
newName
string
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Link
(
me
.
prefixed
(
oldName
),
me
.
prefixed
(
newName
),
context
)
}
func
(
me
*
PrefixFileSystem
)
Chmod
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Chmod
(
me
.
prefixed
(
name
),
mode
,
context
)
}
func
(
me
*
PrefixFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Chown
(
me
.
prefixed
(
name
),
uid
,
gid
,
context
)
}
func
(
me
*
PrefixFileSystem
)
Truncate
(
name
string
,
offset
uint64
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Truncate
(
me
.
prefixed
(
name
),
offset
,
context
)
}
func
(
me
*
PrefixFileSystem
)
Open
(
name
string
,
flags
uint32
,
context
*
Context
)
(
file
File
,
code
Status
)
{
return
me
.
FileSystem
.
Open
(
me
.
prefixed
(
name
),
flags
,
context
)
}
func
(
me
*
PrefixFileSystem
)
OpenDir
(
name
string
,
context
*
Context
)
(
stream
chan
DirEntry
,
status
Status
)
{
return
me
.
FileSystem
.
OpenDir
(
me
.
prefixed
(
name
),
context
)
}
func
(
me
*
PrefixFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
me
.
FileSystem
.
OnMount
(
nodeFs
)
}
func
(
me
*
PrefixFileSystem
)
OnUnmount
()
{
me
.
FileSystem
.
OnUnmount
()
}
func
(
me
*
PrefixFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Access
(
me
.
prefixed
(
name
),
mode
,
context
)
}
func
(
me
*
PrefixFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
,
context
*
Context
)
(
file
File
,
code
Status
)
{
return
me
.
FileSystem
.
Create
(
me
.
prefixed
(
name
),
flags
,
mode
,
context
)
}
func
(
me
*
PrefixFileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Utimens
(
me
.
prefixed
(
name
),
AtimeNs
,
CtimeNs
,
context
)
}
func
(
me
*
PrefixFileSystem
)
GetXAttr
(
name
string
,
attr
string
,
context
*
Context
)
([]
byte
,
Status
)
{
return
me
.
FileSystem
.
GetXAttr
(
me
.
prefixed
(
name
),
attr
,
context
)
}
func
(
me
*
PrefixFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
,
context
*
Context
)
Status
{
return
me
.
FileSystem
.
SetXAttr
(
me
.
prefixed
(
name
),
attr
,
data
,
flags
,
context
)
}
func
(
me
*
PrefixFileSystem
)
ListXAttr
(
name
string
,
context
*
Context
)
([]
string
,
Status
)
{
return
me
.
FileSystem
.
ListXAttr
(
me
.
prefixed
(
name
),
context
)
}
func
(
me
*
PrefixFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
,
context
*
Context
)
Status
{
return
me
.
FileSystem
.
RemoveXAttr
(
me
.
prefixed
(
name
),
attr
,
context
)
}
func
(
me
*
PrefixFileSystem
)
String
()
string
{
return
fmt
.
Sprintf
(
"PrefixFileSystem(%s,%s)"
,
me
.
FileSystem
.
String
(),
me
.
Prefix
)
}
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