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
1abfc5d4
Commit
1abfc5d4
authored
Apr 22, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop Type field from inode.
parent
1ff48a1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+13
-12
No files found.
fuse/pathfilesystem.go
View file @
1abfc5d4
...
@@ -22,7 +22,7 @@ type mountData struct {
...
@@ -22,7 +22,7 @@ type mountData struct {
// * eventual consistency is OK here
// * eventual consistency is OK here
//
//
// * the kernel controls when to ask for updates,
// * the kernel controls when to ask for updates,
// so we can't make entries directly anyway.
// so we can't make entries di
sappear di
rectly anyway.
unmountPending
bool
unmountPending
bool
}
}
...
@@ -41,7 +41,6 @@ type inode struct {
...
@@ -41,7 +41,6 @@ type inode struct {
Name
string
Name
string
LookupCount
int
LookupCount
int
OpenCount
int
OpenCount
int
Type
uint32
// dirent type, used to check if mounts are valid.
mount
*
mountData
mount
*
mountData
}
}
...
@@ -66,6 +65,10 @@ func (me *inode) totalMountCount() int {
...
@@ -66,6 +65,10 @@ func (me *inode) totalMountCount() int {
return
o
return
o
}
}
func
(
me
*
inode
)
IsDir
()
bool
{
return
me
.
Children
!=
nil
}
const
initDirSize
=
20
const
initDirSize
=
20
func
(
me
*
inode
)
verify
()
{
func
(
me
*
inode
)
verify
()
{
...
@@ -256,7 +259,7 @@ func (me *FileSystemConnector) verify() {
...
@@ -256,7 +259,7 @@ func (me *FileSystemConnector) verify() {
}
}
}
}
func
(
me
*
FileSystemConnector
)
newInode
(
root
bool
)
*
inode
{
func
(
me
*
FileSystemConnector
)
newInode
(
root
bool
,
isDir
bool
)
*
inode
{
data
:=
new
(
inode
)
data
:=
new
(
inode
)
if
root
{
if
root
{
data
.
NodeId
=
FUSE_ROOT_ID
data
.
NodeId
=
FUSE_ROOT_ID
...
@@ -265,7 +268,10 @@ func (me *FileSystemConnector) newInode(root bool) *inode {
...
@@ -265,7 +268,10 @@ func (me *FileSystemConnector) newInode(root bool) *inode {
data
.
NodeId
=
uint64
(
uintptr
(
unsafe
.
Pointer
(
data
)))
data
.
NodeId
=
uint64
(
uintptr
(
unsafe
.
Pointer
(
data
)))
}
}
me
.
inodeMap
[
data
.
NodeId
]
=
data
me
.
inodeMap
[
data
.
NodeId
]
=
data
if
isDir
{
data
.
Children
=
make
(
map
[
string
]
*
inode
,
initDirSize
)
}
return
data
return
data
}
}
...
@@ -277,12 +283,9 @@ func (me *FileSystemConnector) lookupUpdate(parent *inode, name string, isDir bo
...
@@ -277,12 +283,9 @@ func (me *FileSystemConnector) lookupUpdate(parent *inode, name string, isDir bo
data
,
ok
:=
parent
.
Children
[
name
]
data
,
ok
:=
parent
.
Children
[
name
]
if
!
ok
{
if
!
ok
{
data
=
me
.
newInode
(
false
)
data
=
me
.
newInode
(
false
,
isDir
)
data
.
Name
=
name
data
.
Name
=
name
data
.
setParent
(
parent
)
data
.
setParent
(
parent
)
if
isDir
{
data
.
Children
=
make
(
map
[
string
]
*
inode
,
initDirSize
)
}
}
}
return
data
return
data
...
@@ -376,8 +379,7 @@ func EmptyFileSystemConnector() (out *FileSystemConnector) {
...
@@ -376,8 +379,7 @@ func EmptyFileSystemConnector() (out *FileSystemConnector) {
out
.
inodeMap
=
make
(
map
[
uint64
]
*
inode
)
out
.
inodeMap
=
make
(
map
[
uint64
]
*
inode
)
out
.
openFiles
=
make
(
map
[
uint64
]
*
interfaceBridge
)
out
.
openFiles
=
make
(
map
[
uint64
]
*
interfaceBridge
)
rootData
:=
out
.
newInode
(
true
)
rootData
:=
out
.
newInode
(
true
,
true
)
rootData
.
Type
=
ModeToType
(
S_IFDIR
)
rootData
.
Children
=
make
(
map
[
string
]
*
inode
,
initDirSize
)
rootData
.
Children
=
make
(
map
[
string
]
*
inode
,
initDirSize
)
out
.
options
.
NegativeTimeout
=
0.0
out
.
options
.
NegativeTimeout
=
0.0
...
@@ -413,7 +415,7 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem) Status {
...
@@ -413,7 +415,7 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem) Status {
}
}
node
=
me
.
findInode
(
mountPoint
)
node
=
me
.
findInode
(
mountPoint
)
if
node
.
Type
&
ModeToType
(
S_IFDIR
)
==
0
{
if
!
node
.
IsDir
()
{
return
EINVAL
return
EINVAL
}
}
...
@@ -534,7 +536,6 @@ func (me *FileSystemConnector) internalLookupWithNode(parent *inode, name string
...
@@ -534,7 +536,6 @@ func (me *FileSystemConnector) internalLookupWithNode(parent *inode, name string
data
:=
me
.
lookupUpdate
(
parent
,
name
,
attr
.
Mode
&
S_IFDIR
!=
0
)
data
:=
me
.
lookupUpdate
(
parent
,
name
,
attr
.
Mode
&
S_IFDIR
!=
0
)
data
.
LookupCount
+=
lookupCount
data
.
LookupCount
+=
lookupCount
data
.
Type
=
ModeToType
(
attr
.
Mode
)
out
=
&
EntryOut
{
out
=
&
EntryOut
{
NodeId
:
data
.
NodeId
,
NodeId
:
data
.
NodeId
,
...
...
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