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
ca1fef9c
Commit
ca1fef9c
authored
Jan 02, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move DirEntryList into its own file.
parent
34c84d1c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
52 deletions
+58
-52
fuse/Makefile
fuse/Makefile
+1
-0
fuse/direntry.go
fuse/direntry.go
+57
-0
fuse/fuse.go
fuse/fuse.go
+0
-44
fuse/types.go
fuse/types.go
+0
-8
No files found.
fuse/Makefile
View file @
ca1fef9c
...
...
@@ -6,6 +6,7 @@ TARG=github.com/hanwen/go-fuse/fuse
GOFILES
=
misc.go
\
fuse.go
\
direntry.go
\
mount.go
\
types.go
\
pathfilesystem.go
\
...
...
fuse/direntry.go
0 → 100644
View file @
ca1fef9c
package
fuse
// all of the code for DirEntryList.
import
(
"encoding/binary"
"bytes"
)
// Should make interface ?
type
DirEntryList
struct
{
buf
bytes
.
Buffer
offset
uint64
maxSize
int
}
func
NewDirEntryList
(
max
int
)
*
DirEntryList
{
return
&
DirEntryList
{
maxSize
:
max
}
}
func
(
de
*
DirEntryList
)
AddString
(
name
string
,
inode
uint64
,
mode
uint32
)
bool
{
return
de
.
Add
([]
byte
(
name
),
inode
,
mode
)
}
func
(
de
*
DirEntryList
)
Add
(
name
[]
byte
,
inode
uint64
,
mode
uint32
)
bool
{
lastLen
:=
de
.
buf
.
Len
()
de
.
offset
++
dirent
:=
new
(
Dirent
)
dirent
.
Off
=
de
.
offset
dirent
.
Ino
=
inode
dirent
.
NameLen
=
uint32
(
len
(
name
))
dirent
.
Typ
=
(
mode
&
0170000
)
>>
12
err
:=
binary
.
Write
(
&
de
.
buf
,
binary
.
LittleEndian
,
dirent
)
if
err
!=
nil
{
panic
(
"Serialization of Dirent failed"
)
}
de
.
buf
.
Write
(
name
)
padding
:=
8
-
len
(
name
)
&
7
if
padding
<
8
{
de
.
buf
.
Write
(
make
([]
byte
,
padding
))
}
if
de
.
buf
.
Len
()
>
de
.
maxSize
{
de
.
buf
.
Truncate
(
lastLen
)
de
.
offset
--
return
false
}
return
true
}
func
(
de
*
DirEntryList
)
Bytes
()
[]
byte
{
return
de
.
buf
.
Bytes
()
}
fuse/fuse.go
View file @
ca1fef9c
...
...
@@ -540,47 +540,3 @@ func doReadDir(state *MountState, header *InHeader, input *ReadIn) (out Empty, c
func
doFsyncDir
(
state
*
MountState
,
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
{
return
state
.
FindDir
(
input
.
Fh
)
.
FsyncDir
(
input
)
}
////////////////////////////////////////////////////////////////
// DentryList.
func
NewDirEntryList
(
max
int
)
*
DirEntryList
{
return
&
DirEntryList
{
maxSize
:
max
}
}
func
(
de
*
DirEntryList
)
AddString
(
name
string
,
inode
uint64
,
mode
uint32
)
bool
{
return
de
.
Add
([]
byte
(
name
),
inode
,
mode
)
}
func
(
de
*
DirEntryList
)
Add
(
name
[]
byte
,
inode
uint64
,
mode
uint32
)
bool
{
lastLen
:=
de
.
buf
.
Len
()
de
.
offset
++
dirent
:=
new
(
Dirent
)
dirent
.
Off
=
de
.
offset
dirent
.
Ino
=
inode
dirent
.
NameLen
=
uint32
(
len
(
name
))
dirent
.
Typ
=
(
mode
&
0170000
)
>>
12
err
:=
binary
.
Write
(
&
de
.
buf
,
binary
.
LittleEndian
,
dirent
)
if
err
!=
nil
{
panic
(
"Serialization of Dirent failed"
)
}
de
.
buf
.
Write
(
name
)
padding
:=
8
-
len
(
name
)
&
7
if
padding
<
8
{
de
.
buf
.
Write
(
make
([]
byte
,
padding
))
}
if
de
.
buf
.
Len
()
>
de
.
maxSize
{
de
.
buf
.
Truncate
(
lastLen
)
de
.
offset
--
return
false
}
return
true
}
func
(
de
*
DirEntryList
)
Bytes
()
[]
byte
{
return
de
.
buf
.
Bytes
()
}
fuse/types.go
View file @
ca1fef9c
...
...
@@ -2,7 +2,6 @@ package fuse
import
(
"syscall"
"bytes"
)
const
(
...
...
@@ -543,13 +542,6 @@ type RawFuseDir interface {
FsyncDir
(
input
*
FsyncIn
)
(
code
Status
)
}
// Should make interface ?
type
DirEntryList
struct
{
buf
bytes
.
Buffer
offset
uint64
maxSize
int
}
type
PathFilesystem
interface
{
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
Readlink
(
name
string
)
(
string
,
Status
)
...
...
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