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
04a0abbf
Commit
04a0abbf
authored
Sep 26, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use String() throughout for debug prints.
parent
1229efb2
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
59 additions
and
20 deletions
+59
-20
fuse/api.go
fuse/api.go
+4
-1
fuse/default.go
fuse/default.go
+1
-1
fuse/defaultnode.go
fuse/defaultnode.go
+4
-0
fuse/handle.go
fuse/handle.go
+3
-1
fuse/loopback.go
fuse/loopback.go
+1
-1
fuse/memnode.go
fuse/memnode.go
+13
-4
fuse/pathfs.go
fuse/pathfs.go
+11
-1
fuse/readonlyfs.go
fuse/readonlyfs.go
+5
-0
fuse/typeprint.go
fuse/typeprint.go
+7
-1
unionfs/autounion.go
unionfs/autounion.go
+2
-2
unionfs/cachingfs.go
unionfs/cachingfs.go
+3
-3
unionfs/dircache.go
unionfs/dircache.go
+1
-1
unionfs/unionfs.go
unionfs/unionfs.go
+3
-3
zipfs/multizip.go
zipfs/multizip.go
+1
-1
No files found.
fuse/api.go
View file @
04a0abbf
...
...
@@ -21,6 +21,9 @@ type NodeFileSystem interface {
OnMount
(
conn
*
FileSystemConnector
)
StatFs
()
*
StatfsOut
Root
()
FsNode
// Used for debug outputs
String
()
string
}
type
FsNode
interface
{
...
...
@@ -78,7 +81,7 @@ type FsNode interface {
// required methods.
type
FileSystem
interface
{
// Used for pretty printing.
Name
()
string
String
()
string
// Attributes. This function is the main entry point, through
// which FUSE discovers which files and directories exist.
...
...
fuse/default.go
View file @
04a0abbf
...
...
@@ -95,7 +95,7 @@ func (me *DefaultFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64
return
ENOSYS
}
func
(
me
*
DefaultFileSystem
)
Name
()
string
{
func
(
me
*
DefaultFileSystem
)
String
()
string
{
return
"DefaultFileSystem"
}
...
...
fuse/defaultnode.go
View file @
04a0abbf
...
...
@@ -26,6 +26,10 @@ func (me *DefaultNodeFileSystem) Root() FsNode {
return
new
(
DefaultFsNode
)
}
func
(
me
*
DefaultNodeFileSystem
)
String
()
string
{
return
"DefaultNodeFileSystem"
}
////////////////////////////////////////////////////////////////
// FsNode default
...
...
fuse/handle.go
View file @
04a0abbf
...
...
@@ -51,7 +51,9 @@ func (me *portableHandleMap) Register(obj *Handled, asInt interface{}) uint64 {
for
{
h
:=
uint64
(
me
.
nextFree
)
me
.
nextFree
++
if
h
<
2
{
// HACK - we make sure we start with 1, so we always
// assign root to 1.
if
h
<
1
{
continue
}
old
:=
me
.
handles
[
h
]
...
...
fuse/loopback.go
View file @
04a0abbf
...
...
@@ -166,7 +166,7 @@ func (me *LoopbackFileSystem) RemoveXAttr(name string, attr string, context *Con
return
Status
(
Removexattr
(
me
.
GetPath
(
name
),
attr
))
}
func
(
me
*
LoopbackFileSystem
)
Name
()
string
{
func
(
me
*
LoopbackFileSystem
)
String
()
string
{
return
fmt
.
Sprintf
(
"LoopbackFileSystem(%s)"
,
me
.
Root
)
}
...
...
fuse/memnode.go
View file @
04a0abbf
...
...
@@ -12,13 +12,17 @@ var _ = log.Println
type
MemNodeFs
struct
{
DefaultNodeFileSystem
backingStore
string
backingStore
Prefix
string
root
*
memNode
mutex
sync
.
Mutex
nextFree
int
}
func
(
me
*
MemNodeFs
)
String
()
string
{
return
fmt
.
Sprintf
(
"MemNodeFs(%s)"
,
me
.
backingStorePrefix
)
}
func
(
me
*
MemNodeFs
)
Root
()
FsNode
{
return
me
.
root
}
...
...
@@ -34,13 +38,14 @@ func (me *MemNodeFs) newNode() *memNode {
n
.
info
.
Mtime_ns
=
now
n
.
info
.
Atime_ns
=
now
n
.
info
.
Ctime_ns
=
now
n
.
info
.
Mode
=
S_IFDIR
|
0777
me
.
nextFree
++
return
n
}
func
NewMemNodeFs
(
backingStore
string
)
*
MemNodeFs
{
func
NewMemNodeFs
(
prefix
string
)
*
MemNodeFs
{
me
:=
&
MemNodeFs
{}
me
.
backingStore
=
backingStore
me
.
backingStore
Prefix
=
prefix
me
.
root
=
me
.
newNode
()
return
me
}
...
...
@@ -66,7 +71,11 @@ func (me *memNode) newNode(isdir bool) *memNode {
}
func
(
me
*
memNode
)
filename
()
string
{
return
fmt
.
Sprintf
(
"%s/%d"
,
me
.
fs
.
backingStore
,
me
.
id
)
return
fmt
.
Sprintf
(
"%s%d"
,
me
.
fs
.
backingStorePrefix
,
me
.
id
)
}
func
(
me
*
memNode
)
Deletable
()
bool
{
return
false
}
func
(
me
*
memNode
)
Readlink
(
c
*
Context
)
([]
byte
,
Status
)
{
...
...
fuse/pathfs.go
View file @
04a0abbf
package
fuse
import
(
"fmt"
"log"
"os"
"path/filepath"
...
...
@@ -52,7 +53,7 @@ func (me *PathNodeFs) Mount(path string, nodeFs NodeFileSystem, opts *FileSystem
if
dir
!=
""
{
dir
=
filepath
.
Clean
(
dir
)
}
parent
:=
me
.
Node
(
dir
)
parent
:=
me
.
Lookup
Node
(
dir
)
if
parent
==
nil
{
return
ENOENT
}
...
...
@@ -94,6 +95,10 @@ func (me *PathNodeFs) Unmount(path string) Status {
func
(
me
*
PathNodeFs
)
OnUnmount
()
{
}
func
(
me
*
PathNodeFs
)
String
()
string
{
return
fmt
.
Sprintf
(
"PathNodeFs(%v)"
,
me
.
fs
)
}
func
(
me
*
PathNodeFs
)
OnMount
(
conn
*
FileSystemConnector
)
{
me
.
connector
=
conn
me
.
fs
.
OnMount
(
me
)
...
...
@@ -111,6 +116,11 @@ func (me *PathNodeFs) Node(name string) *Inode {
return
n
}
// Like node, but use Lookup to discover inodes we may not have yet.
func
(
me
*
PathNodeFs
)
LookupNode
(
name
string
)
*
Inode
{
return
me
.
connector
.
LookupNode
(
me
.
Root
()
.
Inode
(),
name
)
}
func
(
me
*
PathNodeFs
)
Path
(
node
*
Inode
)
string
{
pNode
:=
node
.
FsNode
()
.
(
*
pathInode
)
return
pNode
.
GetPath
()
...
...
fuse/readonlyfs.go
View file @
04a0abbf
package
fuse
import
(
"fmt"
"os"
)
...
...
@@ -77,6 +78,10 @@ func (me *ReadonlyFileSystem) OnUnmount() {
me
.
FileSystem
.
OnUnmount
()
}
func
(
me
*
ReadonlyFileSystem
)
String
()
string
{
return
fmt
.
Sprintf
(
"ReadonlyFileSystem(%v)"
,
me
.
FileSystem
)
}
func
(
me
*
ReadonlyFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
return
me
.
FileSystem
.
Access
(
name
,
mode
,
context
)
}
...
...
fuse/typeprint.go
View file @
04a0abbf
...
...
@@ -113,7 +113,7 @@ func (me *SetAttrIn) String() string {
func
(
me
*
Attr
)
String
()
string
{
return
fmt
.
Sprintf
(
"{0%o S=%d L=%d "
+
"{
M
0%o S=%d L=%d "
+
"%d:%d "
+
"%d*%d %d:%d "
+
"A %d.%09d "
+
...
...
@@ -132,6 +132,12 @@ func (me *CreateIn) String() string {
flagString
(
openFlagNames
,
int
(
me
.
Flags
),
"O_RDONLY"
),
me
.
Umask
)
}
func
(
me
*
EntryOut
)
String
()
string
{
return
fmt
.
Sprintf
(
"{%d E%d.%09d A%d.%09d %v}"
,
me
.
NodeId
,
me
.
EntryValid
,
me
.
EntryValidNsec
,
me
.
AttrValid
,
me
.
AttrValidNsec
,
&
me
.
Attr
)
}
func
(
me
*
CreateOut
)
String
()
string
{
return
fmt
.
Sprintf
(
"{%v %v}"
,
&
me
.
EntryOut
,
&
me
.
OpenOut
)
}
...
...
unionfs/autounion.go
View file @
04a0abbf
...
...
@@ -66,7 +66,7 @@ func NewAutoUnionFs(directory string, options AutoUnionFsOptions) *AutoUnionFs {
return
a
}
func
(
me
*
AutoUnionFs
)
Name
()
string
{
func
(
me
*
AutoUnionFs
)
String
()
string
{
return
fmt
.
Sprintf
(
"AutoUnionFs(%s)"
,
me
.
root
)
}
...
...
@@ -110,7 +110,7 @@ func (me *AutoUnionFs) createFs(name string, roots []string) fuse.Status {
return
fuse
.
EPERM
}
log
.
Printf
(
"Adding workspace %v for roots %v"
,
name
,
ufs
.
Name
())
log
.
Printf
(
"Adding workspace %v for roots %v"
,
name
,
ufs
.
String
())
nfs
:=
fuse
.
NewPathNodeFs
(
ufs
,
&
me
.
options
.
PathNodeFsOptions
)
code
:=
me
.
nodeFs
.
Mount
(
name
,
nfs
,
&
me
.
options
.
FileSystemOptions
)
if
code
.
Ok
()
{
...
...
unionfs/cachingfs.go
View file @
04a0abbf
...
...
@@ -140,13 +140,13 @@ func (me *CachingFileSystem) OpenDir(name string, context *fuse.Context) (stream
return
nil
,
r
.
Status
}
func
(
me
*
CachingFileSystem
)
Name
()
string
{
return
fmt
.
Sprintf
(
"CachingFileSystem(%
s)"
,
me
.
FileSystem
.
Name
()
)
func
(
me
*
CachingFileSystem
)
String
()
string
{
return
fmt
.
Sprintf
(
"CachingFileSystem(%
v)"
,
me
.
FileSystem
)
}
func
(
me
*
CachingFileSystem
)
Open
(
name
string
,
flags
uint32
,
context
*
fuse
.
Context
)
(
f
fuse
.
File
,
status
fuse
.
Status
)
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
&&
name
==
_DROP_CACHE
{
log
.
Println
(
"Dropping cache for"
,
me
.
Name
()
)
log
.
Println
(
"Dropping cache for"
,
me
)
me
.
DropCache
()
}
return
me
.
FileSystem
.
Open
(
name
,
flags
,
context
)
...
...
unionfs/dircache.go
View file @
04a0abbf
...
...
@@ -13,7 +13,7 @@ import (
func
newDirnameMap
(
fs
fuse
.
FileSystem
,
dir
string
)
map
[
string
]
bool
{
stream
,
code
:=
fs
.
OpenDir
(
dir
,
nil
)
if
!
code
.
Ok
()
{
log
.
Printf
(
"newDirnameMap(%
s): %v %v"
,
fs
.
Name
()
,
dir
,
code
)
log
.
Printf
(
"newDirnameMap(%
v): %v %v"
,
fs
,
dir
,
code
)
return
nil
}
...
...
unionfs/unionfs.go
View file @
04a0abbf
...
...
@@ -918,7 +918,7 @@ func (me *UnionFs) DropSubFsCaches() {
func
(
me
*
UnionFs
)
Open
(
name
string
,
flags
uint32
,
context
*
fuse
.
Context
)
(
fuseFile
fuse
.
File
,
status
fuse
.
Status
)
{
if
name
==
_DROP_CACHE
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
log
.
Println
(
"Forced cache drop on"
,
me
.
Name
()
)
log
.
Println
(
"Forced cache drop on"
,
me
)
me
.
DropBranchCache
(
nil
)
me
.
DropDeletionCache
()
me
.
DropSubFsCaches
()
...
...
@@ -949,10 +949,10 @@ func (me *UnionFs) Open(name string, flags uint32, context *fuse.Context) (fuseF
return
fuseFile
,
status
}
func
(
me
*
UnionFs
)
Name
()
string
{
func
(
me
*
UnionFs
)
String
()
string
{
names
:=
[]
string
{}
for
_
,
fs
:=
range
me
.
fileSystems
{
names
=
append
(
names
,
fs
.
Name
())
names
=
append
(
names
,
fs
.
String
())
}
return
fmt
.
Sprintf
(
"%v"
,
names
)
}
...
...
zipfs/multizip.go
View file @
04a0abbf
...
...
@@ -45,7 +45,7 @@ func NewMultiZipFs() *MultiZipFs {
return
m
}
func
(
me
*
MultiZipFs
)
Name
()
string
{
func
(
me
*
MultiZipFs
)
String
()
string
{
return
"MultiZipFs"
}
...
...
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