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
3cd80699
Commit
3cd80699
authored
Apr 20, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only hash directory part of filename.
parent
b216a171
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
unionfs/autounion.go
unionfs/autounion.go
+17
-1
unionfs/unionfs.go
unionfs/unionfs.go
+4
-2
No files found.
unionfs/autounion.go
View file @
3cd80699
...
...
@@ -93,6 +93,10 @@ func (me *AutoUnionFs) updateKnownFses() {
func
(
me
*
AutoUnionFs
)
Readlink
(
path
string
)
(
out
string
,
code
fuse
.
Status
)
{
comps
:=
strings
.
Split
(
path
,
filepath
.
SeparatorString
,
-
1
)
if
comps
[
0
]
==
"status"
&&
comps
[
1
]
==
"autobase"
{
return
me
.
root
,
fuse
.
OK
}
if
comps
[
0
]
!=
"config"
{
return
""
,
fuse
.
ENOENT
}
...
...
@@ -121,6 +125,13 @@ func (me *AutoUnionFs) GetAttr(path string) (*fuse.Attr, fuse.Status) {
return
a
,
fuse
.
OK
}
if
path
==
"status/autobase"
{
a
:=
&
fuse
.
Attr
{
Mode
:
syscall
.
S_IFLNK
|
0644
,
}
return
a
,
fuse
.
OK
}
comps
:=
strings
.
Split
(
path
,
filepath
.
SeparatorString
,
-
1
)
me
.
lock
.
RLock
()
...
...
@@ -148,11 +159,16 @@ func (me *AutoUnionFs) GetAttr(path string) (*fuse.Attr, fuse.Status) {
}
func
(
me
*
AutoUnionFs
)
StatusDir
()
(
stream
chan
fuse
.
DirEntry
,
status
fuse
.
Status
)
{
stream
=
make
(
chan
fuse
.
DirEntry
,
1
)
stream
=
make
(
chan
fuse
.
DirEntry
,
1
0
)
stream
<-
fuse
.
DirEntry
{
Name
:
"gounionfs_version"
,
Mode
:
fuse
.
S_IFREG
|
0644
,
}
stream
<-
fuse
.
DirEntry
{
Name
:
"autobase"
,
Mode
:
syscall
.
S_IFLNK
|
0644
,
}
close
(
stream
)
return
stream
,
fuse
.
OK
}
...
...
unionfs/unionfs.go
View file @
3cd80699
...
...
@@ -16,12 +16,14 @@ import (
// TODO(hanwen): is md5 sufficiently fast?
func
filePathHash
(
path
string
)
string
{
dir
,
base
:=
filepath
.
Split
(
path
)
h
:=
md5
.
New
()
h
.
Write
([]
byte
(
path
))
h
.
Write
([]
byte
(
dir
))
// TODO(hanwen): should use a tighter format, so we can pack
// more results in a readdir() roundtrip.
return
fmt
.
Sprintf
(
"%x
"
,
h
.
Sum
()
)
return
fmt
.
Sprintf
(
"%x
-%s"
,
h
.
Sum
()[
:
8
],
base
)
}
/*
...
...
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