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
93276d3e
Commit
93276d3e
authored
May 17, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AutoUnionFs: allow reads of status/gounionfs_version.
parent
fa9a8c95
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
unionfs/autounion.go
unionfs/autounion.go
+11
-0
unionfs/autounion_test.go
unionfs/autounion_test.go
+12
-0
No files found.
unionfs/autounion.go
View file @
93276d3e
...
@@ -245,6 +245,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
...
@@ -245,6 +245,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
if
path
==
filepath
.
Join
(
_STATUS
,
_VERSION
)
{
if
path
==
filepath
.
Join
(
_STATUS
,
_VERSION
)
{
a
:=
&
os
.
FileInfo
{
a
:=
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFREG
|
0644
,
Mode
:
fuse
.
S_IFREG
|
0644
,
Size
:
int64
(
len
(
fuse
.
Version
())),
}
}
return
a
,
fuse
.
OK
return
a
,
fuse
.
OK
}
}
...
@@ -295,6 +296,16 @@ func (me *AutoUnionFs) StatusDir() (stream chan fuse.DirEntry, status fuse.Statu
...
@@ -295,6 +296,16 @@ func (me *AutoUnionFs) StatusDir() (stream chan fuse.DirEntry, status fuse.Statu
return
stream
,
fuse
.
OK
return
stream
,
fuse
.
OK
}
}
func
(
me
*
AutoUnionFs
)
Open
(
path
string
,
flags
uint32
)
(
fuse
.
File
,
fuse
.
Status
)
{
if
path
==
_STATUS
+
"/"
+
_VERSION
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
return
nil
,
fuse
.
EPERM
}
return
fuse
.
NewReadOnlyFile
([]
byte
(
fuse
.
Version
())),
fuse
.
OK
}
return
nil
,
fuse
.
ENOENT
}
func
(
me
*
AutoUnionFs
)
OpenDir
(
name
string
)
(
stream
chan
fuse
.
DirEntry
,
status
fuse
.
Status
)
{
func
(
me
*
AutoUnionFs
)
OpenDir
(
name
string
)
(
stream
chan
fuse
.
DirEntry
,
status
fuse
.
Status
)
{
switch
name
{
switch
name
{
case
_STATUS
:
case
_STATUS
:
...
...
unionfs/autounion_test.go
View file @
93276d3e
...
@@ -55,6 +55,18 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
...
@@ -55,6 +55,18 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
}
}
}
}
func
TestVersion
(
t
*
testing
.
T
)
{
wd
,
clean
:=
setup
(
t
)
defer
clean
()
c
,
err
:=
ioutil
.
ReadFile
(
wd
+
"/mount/status/gounionfs_version"
)
CheckSuccess
(
err
)
if
len
(
c
)
==
0
{
t
.
Fatal
(
"No version found."
)
}
log
.
Println
(
"Found version:"
,
string
(
c
))
}
func
TestAutoFsSymlink
(
t
*
testing
.
T
)
{
func
TestAutoFsSymlink
(
t
*
testing
.
T
)
{
wd
,
clean
:=
setup
(
t
)
wd
,
clean
:=
setup
(
t
)
defer
clean
()
defer
clean
()
...
...
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