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
2c39d5b4
Commit
2c39d5b4
authored
Jun 24, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
391ae350
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
38 deletions
+38
-38
fuse/handle.go
fuse/handle.go
+17
-17
fuse/handle_test.go
fuse/handle_test.go
+6
-6
fuse/owner_test.go
fuse/owner_test.go
+2
-2
fuse/pathdebug.go
fuse/pathdebug.go
+2
-2
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+7
-7
unionfs/autounion.go
unionfs/autounion.go
+1
-1
unionfs/cachingfs.go
unionfs/cachingfs.go
+2
-2
unionfs/unionfs.go
unionfs/unionfs.go
+1
-1
No files found.
fuse/handle.go
View file @
2c39d5b4
package
fuse
import
(
"fmt"
"unsafe"
...
...
@@ -64,9 +65,9 @@ func (me *HandleMap) Register(obj *Handled) (handle uint64) {
check
:=
me
.
nextFree
me
.
nextFree
++
if
unsafe
.
Sizeof
(
obj
)
==
8
{
me
.
nextFree
=
me
.
nextFree
&
(
1
<<
(
64
-
48
+
3
)
-
1
)
me
.
nextFree
=
me
.
nextFree
&
(
1
<<
(
64
-
48
+
3
)
-
1
)
rest
:=
(
handle
&^
(
1
<<
48
-
1
))
|
(
handle
&
(
1
<<
3
-
1
))
rest
:=
(
handle
&^
(
1
<<
48
-
1
))
|
(
handle
&
(
1
<<
3
-
1
))
if
rest
!=
0
{
panic
(
"unaligned ptr or more than 48 bits in address"
)
}
...
...
@@ -100,13 +101,13 @@ func (me *HandleMap) Forget(handle uint64) (val *Handled) {
func
DecodeHandle
(
handle
uint64
)
(
val
*
Handled
)
{
var
check
uint32
if
unsafe
.
Sizeof
(
val
)
==
8
{
ptrBits
:=
uintptr
(
handle
&
(
1
<<
45
-
1
))
ptrBits
:=
uintptr
(
handle
&
(
1
<<
45
-
1
))
check
=
uint32
(
handle
>>
45
)
val
=
(
*
Handled
)(
unsafe
.
Pointer
(
ptrBits
<<
3
))
val
=
(
*
Handled
)(
unsafe
.
Pointer
(
ptrBits
<<
3
))
}
if
unsafe
.
Sizeof
(
val
)
==
4
{
check
=
uint32
(
handle
>>
32
)
val
=
(
*
Handled
)(
unsafe
.
Pointer
(
uintptr
(
handle
&
((
1
<<
32
)
-
1
))))
val
=
(
*
Handled
)(
unsafe
.
Pointer
(
uintptr
(
handle
&
((
1
<<
32
)
-
1
))))
}
if
val
.
check
!=
check
{
msg
:=
fmt
.
Sprintf
(
"handle check mismatch; handle has 0x%x, object has 0x%x"
,
...
...
@@ -115,4 +116,3 @@ func DecodeHandle(handle uint64) (val *Handled) {
}
return
val
}
fuse/handle_test.go
View file @
2c39d5b4
...
...
@@ -46,7 +46,7 @@ func TestHandleMapPointerLayout(t *testing.T) {
}
hm
:=
NewHandleMap
()
bogus
:=
uint64
(
1
)
<<
uint32
((
8
*
(
unsafe
.
Sizeof
(
t
)
-
1
)))
bogus
:=
uint64
(
1
)
<<
uint32
((
8
*
(
unsafe
.
Sizeof
(
t
)
-
1
)))
p
:=
uintptr
(
bogus
)
v
:=
(
*
Handled
)(
unsafe
.
Pointer
(
p
))
defer
markSeen
(
"48"
)
...
...
@@ -79,7 +79,7 @@ func TestHandleMapMultiple(t *testing.T) {
if
DecodeHandle
(
h
)
!=
v
{
t
.
Fatal
(
"address mismatch"
)
}
if
hm
.
Count
()
!=
i
+
1
{
if
hm
.
Count
()
!=
i
+
1
{
t
.
Fatal
(
"count error"
)
}
}
...
...
@@ -91,6 +91,6 @@ func TestHandleMapCheckFail(t *testing.T) {
v
:=
new
(
Handled
)
hm
:=
NewHandleMap
()
h
:=
hm
.
Register
(
v
)
DecodeHandle
(
h
|
(
uint64
(
1
)
<<
63
))
DecodeHandle
(
h
|
(
uint64
(
1
)
<<
63
))
t
.
Error
(
"Borked decode did not panic"
)
}
fuse/owner_test.go
View file @
2c39d5b4
...
...
@@ -16,13 +16,13 @@ func (me *ownerFs) GetAttr(name string) (*os.FileInfo, Status) {
if
name
==
""
{
return
&
os
.
FileInfo
{
Mode
:
S_IFDIR
|
0755
,
},
OK
},
OK
}
return
&
os
.
FileInfo
{
Mode
:
S_IFREG
|
0644
,
Uid
:
_RANDOM_OWNER
,
Gid
:
_RANDOM_OWNER
,
},
OK
},
OK
}
func
setupOwnerTest
(
opts
*
FileSystemOptions
)
(
workdir
string
,
cleanup
func
())
{
...
...
fuse/pathdebug.go
View file @
2c39d5b4
...
...
@@ -80,14 +80,14 @@ func (me *FileSystemDebug) GetAttr(path string) (*os.FileInfo, Status) {
if
path
==
DebugDir
{
return
&
os
.
FileInfo
{
Mode
:
S_IFDIR
|
0755
,
},
OK
},
OK
}
c
:=
me
.
getContent
(
path
)
if
c
!=
nil
{
return
&
os
.
FileInfo
{
Mode
:
S_IFREG
|
0644
,
Size
:
int64
(
len
(
c
)),
},
OK
},
OK
}
return
nil
,
ENOENT
}
...
...
fuse/pathfilesystem.go
View file @
2c39d5b4
...
...
@@ -79,7 +79,7 @@ func (me *mountData) setOwner(attr *Attr) {
}
}
func
(
me
*
mountData
)
unregisterFileHandle
(
node
*
inode
,
handle
uint64
)
(
*
openedFile
)
{
func
(
me
*
mountData
)
unregisterFileHandle
(
node
*
inode
,
handle
uint64
)
*
openedFile
{
obj
:=
me
.
openFiles
.
Forget
(
handle
)
opened
:=
(
*
openedFile
)(
unsafe
.
Pointer
(
obj
))
...
...
unionfs/autounion.go
View file @
2c39d5b4
...
...
@@ -283,7 +283,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
if
me
.
getUnionFs
(
path
)
!=
nil
{
return
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFDIR
|
0755
,
},
fuse
.
OK
},
fuse
.
OK
}
return
nil
,
fuse
.
ENOENT
...
...
unionfs/cachingfs.go
View file @
2c39d5b4
...
...
@@ -136,10 +136,10 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem {
c
.
links
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
readLink
(
fs
,
n
)
},
ttlNs
)
c
.
xattr
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
getXAttr
(
fs
,
n
)
},
ttlNs
)
},
ttlNs
)
c
.
files
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
openFile
(
fs
,
n
)
},
ttlNs
)
},
ttlNs
)
return
c
}
...
...
unionfs/unionfs.go
View file @
2c39d5b4
...
...
@@ -571,7 +571,7 @@ func (me *UnionFs) GetAttr(name string) (a *os.FileInfo, s fuse.Status) {
if
name
==
_DROP_CACHE
{
return
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFREG
|
0777
,
},
fuse
.
OK
},
fuse
.
OK
}
if
name
==
me
.
options
.
DeletionDirName
{
return
nil
,
fuse
.
ENOENT
...
...
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