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
dd442b25
Commit
dd442b25
authored
Apr 26, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement Chmod in UnionFs.
parent
92c27574
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
unionfs/unionfs.go
unionfs/unionfs.go
+25
-0
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+21
-0
No files found.
unionfs/unionfs.go
View file @
dd442b25
...
@@ -254,6 +254,31 @@ func (me *UnionFs) Symlink(pointedTo string, linkName string) (code fuse.Status)
...
@@ -254,6 +254,31 @@ func (me *UnionFs) Symlink(pointedTo string, linkName string) (code fuse.Status)
return
code
return
code
}
}
func
(
me
*
UnionFs
)
Chmod
(
name
string
,
mode
uint32
)
(
code
fuse
.
Status
)
{
r
:=
me
.
branchCache
.
Get
(
name
)
.
(
getBranchResult
)
if
r
.
attr
==
nil
||
r
.
code
!=
fuse
.
OK
{
return
r
.
code
}
if
r
.
attr
.
Mode
&
fuse
.
S_IFREG
==
0
{
return
fuse
.
EPERM
}
permMask
:=
uint32
(
07777
)
oldMode
:=
r
.
attr
.
Mode
&
permMask
if
oldMode
!=
mode
{
if
r
.
branch
>
0
{
err
:=
me
.
Promote
(
name
,
me
.
branches
[
r
.
branch
])
if
err
!=
nil
{
panic
(
"copy: "
+
err
.
String
())
}
}
me
.
fileSystems
[
0
]
.
Chmod
(
name
,
mode
)
}
return
fuse
.
OK
}
func
(
me
*
UnionFs
)
Access
(
name
string
,
mode
uint32
)
(
code
fuse
.
Status
)
{
func
(
me
*
UnionFs
)
Access
(
name
string
,
mode
uint32
)
(
code
fuse
.
Status
)
{
i
:=
me
.
getBranch
(
name
)
i
:=
me
.
getBranch
(
name
)
if
i
>=
0
{
if
i
>=
0
{
...
...
unionfs/unionfs_test.go
View file @
dd442b25
...
@@ -145,6 +145,27 @@ func TestSymlink(t *testing.T) {
...
@@ -145,6 +145,27 @@ func TestSymlink(t *testing.T) {
}
}
}
}
func
TestChmod
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
ro_fn
:=
wd
+
"/ro/file"
m_fn
:=
wd
+
"/mount/file"
writeToFile
(
ro_fn
,
"a"
,
true
)
err
:=
os
.
Chmod
(
m_fn
,
07070
)
CheckSuccess
(
err
)
fi
,
err
:=
os
.
Lstat
(
m_fn
)
CheckSuccess
(
err
)
if
fi
.
Mode
&
07777
!=
07070
{
t
.
Errorf
(
"Unexpected mode found: %v"
,
fi
.
Mode
)
}
_
,
err
=
os
.
Lstat
(
wd
+
"/rw/file"
)
if
err
!=
nil
{
t
.
Errorf
(
"File not promoted"
)
}
}
func
TestBasic
(
t
*
testing
.
T
)
{
func
TestBasic
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
defer
state
.
Unmount
()
...
...
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