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
Kirill Smelkov
go-fuse
Commits
b189413a
Commit
b189413a
authored
Nov 21, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trim TODOs.
parent
5e0b2dbf
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
24 deletions
+20
-24
fuse/api.go
fuse/api.go
+3
-0
fuse/files.go
fuse/files.go
+0
-1
fuse/fsconnector.go
fuse/fsconnector.go
+0
-9
fuse/fsops.go
fuse/fsops.go
+7
-3
fuse/misc.go
fuse/misc.go
+7
-0
fuse/types.go
fuse/types.go
+2
-3
unionfs/unionfs.go
unionfs/unionfs.go
+0
-4
zipfs/multizip.go
zipfs/multizip.go
+1
-4
No files found.
fuse/api.go
View file @
b189413a
...
@@ -36,6 +36,9 @@ type FsNode interface {
...
@@ -36,6 +36,9 @@ type FsNode interface {
// within the treeLock critical section, so you cannot look at
// within the treeLock critical section, so you cannot look at
// other inodes.
// other inodes.
Deletable
()
bool
Deletable
()
bool
// OnForget is called when the reference to this inode is
// dropped from the tree.
OnForget
()
OnForget
()
// Misc.
// Misc.
...
...
fuse/files.go
View file @
b189413a
...
@@ -97,7 +97,6 @@ func (me *LoopbackFile) Read(input *ReadIn, buffers BufferPool) ([]byte, Status)
...
@@ -97,7 +97,6 @@ func (me *LoopbackFile) Read(input *ReadIn, buffers BufferPool) ([]byte, Status)
slice
:=
buffers
.
AllocBuffer
(
input
.
Size
)
slice
:=
buffers
.
AllocBuffer
(
input
.
Size
)
n
,
err
:=
me
.
File
.
ReadAt
(
slice
,
int64
(
input
.
Offset
))
n
,
err
:=
me
.
File
.
ReadAt
(
slice
,
int64
(
input
.
Offset
))
// TODO - fix Go ndocumentation.
if
err
==
io
.
EOF
{
if
err
==
io
.
EOF
{
err
=
nil
err
=
nil
}
}
...
...
fuse/fsconnector.go
View file @
b189413a
...
@@ -109,8 +109,6 @@ func (me *FileSystemConnector) toInode(nodeid uint64) *Inode {
...
@@ -109,8 +109,6 @@ func (me *FileSystemConnector) toInode(nodeid uint64) *Inode {
}
}
// Must run outside treeLock. Returns the nodeId.
// Must run outside treeLock. Returns the nodeId.
//
// TODO - write a stress test to exercise this.
func
(
me
*
FileSystemConnector
)
lookupUpdate
(
node
*
Inode
)
uint64
{
func
(
me
*
FileSystemConnector
)
lookupUpdate
(
node
*
Inode
)
uint64
{
node
.
treeLock
.
Lock
()
node
.
treeLock
.
Lock
()
defer
node
.
treeLock
.
Unlock
()
defer
node
.
treeLock
.
Unlock
()
...
@@ -160,8 +158,6 @@ func (me *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool)
...
@@ -160,8 +158,6 @@ func (me *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool)
if
ch
==
nil
{
if
ch
==
nil
{
log
.
Panicf
(
"trying to del child %q, but not present"
,
k
)
log
.
Panicf
(
"trying to del child %q, but not present"
,
k
)
}
}
// TODO - change name? This does not really mark the
// fuse Forget operation.
ch
.
fsInode
.
OnForget
()
ch
.
fsInode
.
OnForget
()
}
}
...
@@ -255,11 +251,6 @@ func (me *FileSystemConnector) MountRoot(nodeFs NodeFileSystem, opts *FileSystem
...
@@ -255,11 +251,6 @@ func (me *FileSystemConnector) MountRoot(nodeFs NodeFileSystem, opts *FileSystem
// ENOENT: the directory containing the mount point does not exist.
// ENOENT: the directory containing the mount point does not exist.
//
//
// EBUSY: the intended mount point already exists.
// EBUSY: the intended mount point already exists.
//
// TODO - would be useful to expose an interface to put all of the
// mount management in FileSystemConnector, so AutoUnionFs and
// MultiZipFs don't have to do it separately, with the risk of
// inconsistencies.
func
(
me
*
FileSystemConnector
)
Mount
(
parent
*
Inode
,
name
string
,
nodeFs
NodeFileSystem
,
opts
*
FileSystemOptions
)
Status
{
func
(
me
*
FileSystemConnector
)
Mount
(
parent
*
Inode
,
name
string
,
nodeFs
NodeFileSystem
,
opts
*
FileSystemOptions
)
Status
{
parent
.
treeLock
.
Lock
()
parent
.
treeLock
.
Lock
()
defer
parent
.
treeLock
.
Unlock
()
defer
parent
.
treeLock
.
Unlock
()
...
...
fuse/fsops.go
View file @
b189413a
...
@@ -151,17 +151,21 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
...
@@ -151,17 +151,21 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
code
=
node
.
fsInode
.
Truncate
(
f
,
input
.
Size
,
&
header
.
Context
)
code
=
node
.
fsInode
.
Truncate
(
f
,
input
.
Size
,
&
header
.
Context
)
}
}
if
code
.
Ok
()
&&
(
input
.
Valid
&
(
FATTR_ATIME
|
FATTR_MTIME
|
FATTR_ATIME_NOW
|
FATTR_MTIME_NOW
)
!=
0
)
{
if
code
.
Ok
()
&&
(
input
.
Valid
&
(
FATTR_ATIME
|
FATTR_MTIME
|
FATTR_ATIME_NOW
|
FATTR_MTIME_NOW
)
!=
0
)
{
now
:=
uint64
(
0
)
if
input
.
Valid
&
FATTR_ATIME_NOW
!=
0
||
input
.
Valid
&
FATTR_MTIME_NOW
!=
0
{
now
=
uint64
(
time
.
Nanoseconds
())
}
atime
:=
uint64
(
input
.
Atime
*
1e9
)
+
uint64
(
input
.
Atimensec
)
atime
:=
uint64
(
input
.
Atime
*
1e9
)
+
uint64
(
input
.
Atimensec
)
if
input
.
Valid
&
FATTR_ATIME_NOW
!=
0
{
if
input
.
Valid
&
FATTR_ATIME_NOW
!=
0
{
atime
=
uint64
(
time
.
Nanoseconds
())
atime
=
now
}
}
mtime
:=
uint64
(
input
.
Mtime
*
1e9
)
+
uint64
(
input
.
Mtimensec
)
mtime
:=
uint64
(
input
.
Mtime
*
1e9
)
+
uint64
(
input
.
Mtimensec
)
if
input
.
Valid
&
FATTR_MTIME_NOW
!=
0
{
if
input
.
Valid
&
FATTR_MTIME_NOW
!=
0
{
mtime
=
uint64
(
time
.
Nanoseconds
())
mtime
=
now
}
}
// TODO - if using NOW, mtime and atime may differ.
code
=
node
.
fsInode
.
Utimens
(
f
,
atime
,
mtime
,
&
header
.
Context
)
code
=
node
.
fsInode
.
Utimens
(
f
,
atime
,
mtime
,
&
header
.
Context
)
}
}
...
...
fuse/misc.go
View file @
b189413a
...
@@ -175,3 +175,10 @@ func Linkat(fd1 int, n1 string, fd2 int, n2 string) int {
...
@@ -175,3 +175,10 @@ func Linkat(fd1 int, n1 string, fd2 int, n2 string) int {
0
,
0
)
0
,
0
)
return
int
(
errNo
)
return
int
(
errNo
)
}
}
func
init
()
{
p
:=
syscall
.
Getpagesize
()
if
p
!=
PAGESIZE
{
log
.
Panicf
(
"page size incorrect: %d"
,
p
)
}
}
fuse/types.go
View file @
b189413a
...
@@ -25,14 +25,13 @@ const (
...
@@ -25,14 +25,13 @@ const (
S_IFLNK
=
syscall
.
S_IFLNK
S_IFLNK
=
syscall
.
S_IFLNK
S_IFIFO
=
syscall
.
S_IFIFO
S_IFIFO
=
syscall
.
S_IFIFO
// TODO - get this from a canonical place.
PAGESIZE
=
4096
CUSE_INIT
=
4096
CUSE_INIT
=
4096
O_ANYWRITE
=
uint32
(
os
.
O_WRONLY
|
os
.
O_RDWR
|
os
.
O_APPEND
|
os
.
O_CREATE
|
os
.
O_TRUNC
)
O_ANYWRITE
=
uint32
(
os
.
O_WRONLY
|
os
.
O_RDWR
|
os
.
O_APPEND
|
os
.
O_CREATE
|
os
.
O_TRUNC
)
)
)
const
PAGESIZE
=
4096
const
(
const
(
_DEFAULT_BACKGROUND_TASKS
=
12
_DEFAULT_BACKGROUND_TASKS
=
12
)
)
...
...
unionfs/unionfs.go
View file @
b189413a
...
@@ -14,15 +14,11 @@ import (
...
@@ -14,15 +14,11 @@ import (
"time"
"time"
)
)
// TODO(hanwen): is md5 sufficiently fast?
func
filePathHash
(
path
string
)
string
{
func
filePathHash
(
path
string
)
string
{
dir
,
base
:=
filepath
.
Split
(
path
)
dir
,
base
:=
filepath
.
Split
(
path
)
h
:=
md5
.
New
()
h
:=
md5
.
New
()
h
.
Write
([]
byte
(
dir
))
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-%s"
,
h
.
Sum
()[
:
8
],
base
)
return
fmt
.
Sprintf
(
"%x-%s"
,
h
.
Sum
()[
:
8
],
base
)
}
}
...
...
zipfs/multizip.go
View file @
b189413a
...
@@ -26,9 +26,7 @@ const (
...
@@ -26,9 +26,7 @@ const (
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// MultiZipFs is a path filesystem that mounts zipfiles. It needs a
// MultiZipFs is a path filesystem that mounts zipfiles.
// reference to the FileSystemConnector to be able to execute
// mounts.
type
MultiZipFs
struct
{
type
MultiZipFs
struct
{
lock
sync
.
RWMutex
lock
sync
.
RWMutex
zips
map
[
string
]
*
MemTreeFs
zips
map
[
string
]
*
MemTreeFs
...
@@ -87,7 +85,6 @@ func (me *MultiZipFs) GetAttr(name string, context *fuse.Context) (*os.FileInfo,
...
@@ -87,7 +85,6 @@ func (me *MultiZipFs) GetAttr(name string, context *fuse.Context) (*os.FileInfo,
}
}
if
name
==
"config"
{
if
name
==
"config"
{
// TODO
a
.
Mode
=
fuse
.
S_IFDIR
|
0700
a
.
Mode
=
fuse
.
S_IFDIR
|
0700
return
a
,
fuse
.
OK
return
a
,
fuse
.
OK
}
}
...
...
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