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
bde72938
Commit
bde72938
authored
Dec 05, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gofmt.
parent
77177c5d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
39 additions
and
44 deletions
+39
-44
fuse/api.go
fuse/api.go
+2
-3
fuse/attr.go
fuse/attr.go
+19
-23
fuse/bufferpool.go
fuse/bufferpool.go
+4
-4
fuse/cache_test.go
fuse/cache_test.go
+1
-1
fuse/default.go
fuse/default.go
+1
-2
fuse/fsmount.go
fuse/fsmount.go
+2
-2
fuse/fsops.go
fuse/fsops.go
+1
-1
fuse/misc.go
fuse/misc.go
+1
-1
fuse/pathfs.go
fuse/pathfs.go
+0
-1
unionfs/autounion_test.go
unionfs/autounion_test.go
+2
-0
unionfs/cachingfs.go
unionfs/cachingfs.go
+2
-2
unionfs/unionfs.go
unionfs/unionfs.go
+1
-1
zipfs/tarfs.go
zipfs/tarfs.go
+3
-3
No files found.
fuse/api.go
View file @
bde72938
...
...
@@ -4,8 +4,7 @@
package
fuse
import
(
)
import
()
// Types for users to implement.
...
...
@@ -221,7 +220,7 @@ type MountOptions struct {
// Write size to use. If 0, use default. This number is
// capped at the kernel maximum.
MaxWrite
int
MaxWrite
int
}
// DefaultFileSystem implements a FileSystem that returns ENOSYS for every operation.
...
...
fuse/attr.go
View file @
bde72938
...
...
@@ -50,9 +50,6 @@ func (me FileMode) IsSymlink() bool { return (uint32(me) & syscall.S_IFMT) == sy
// IsSocket reports whether the FileInfo describes a socket.
func
(
me
FileMode
)
IsSocket
()
bool
{
return
(
uint32
(
me
)
&
syscall
.
S_IFMT
)
==
syscall
.
S_IFSOCK
}
func
(
me
*
Attr
)
IsFifo
()
bool
{
return
(
uint32
(
me
.
Mode
)
&
syscall
.
S_IFMT
)
==
syscall
.
S_IFIFO
}
// IsChar reports whether the FileInfo describes a character special file.
...
...
@@ -73,33 +70,32 @@ func (me *Attr) IsSymlink() bool { return (uint32(me.Mode) & syscall.S_IFMT) ==
// IsSocket reports whether the FileInfo describes a socket.
func
(
me
*
Attr
)
IsSocket
()
bool
{
return
(
uint32
(
me
.
Mode
)
&
syscall
.
S_IFMT
)
==
syscall
.
S_IFSOCK
}
func
(
a
*
Attr
)
Atimens
()
int64
{
return
int64
(
1e9
*
a
.
Atime
)
+
int64
(
a
.
Atimensec
)
return
int64
(
1e9
*
a
.
Atime
)
+
int64
(
a
.
Atimensec
)
}
func
(
a
*
Attr
)
Mtimens
()
int64
{
return
int64
(
1e9
*
a
.
Mtime
)
+
int64
(
a
.
Mtimensec
)
return
int64
(
1e9
*
a
.
Mtime
)
+
int64
(
a
.
Mtimensec
)
}
func
(
a
*
Attr
)
Ctimens
()
int64
{
return
int64
(
1e9
*
a
.
Ctime
)
+
int64
(
a
.
Ctimensec
)
return
int64
(
1e9
*
a
.
Ctime
)
+
int64
(
a
.
Ctimensec
)
}
func
(
a
*
Attr
)
SetTimes
(
atimens
int64
,
mtimens
int64
,
ctimens
int64
)
{
if
atimens
>=
0
{
a
.
Atime
=
uint64
(
atimens
/
1e9
)
a
.
Atimensec
=
uint32
(
atimens
%
1e9
)
a
.
Atime
=
uint64
(
atimens
/
1e9
)
a
.
Atimensec
=
uint32
(
atimens
%
1e9
)
}
if
mtimens
>=
0
{
a
.
Mtime
=
uint64
(
mtimens
/
1e9
)
a
.
Mtimensec
=
uint32
(
mtimens
%
1e9
)
a
.
Mtime
=
uint64
(
mtimens
/
1e9
)
a
.
Mtimensec
=
uint32
(
mtimens
%
1e9
)
}
if
atimens
>=
0
{
a
.
Ctime
=
uint64
(
ctimens
/
1e9
)
a
.
Ctimensec
=
uint32
(
ctimens
%
1e9
)
a
.
Ctime
=
uint64
(
ctimens
/
1e9
)
a
.
Ctimensec
=
uint32
(
ctimens
%
1e9
)
}
}
}
func
(
attr
*
Attr
)
FromFileInfo
(
fi
*
os
.
FileInfo
)
{
attr
.
Ino
=
uint64
(
fi
.
Ino
)
...
...
@@ -115,17 +111,17 @@ func (attr *Attr) FromFileInfo(fi *os.FileInfo) {
}
func
(
a
*
Attr
)
ToFileInfo
()
(
fi
*
os
.
FileInfo
)
{
return
&
os
.
FileInfo
{
Ino
:
a
.
Ino
,
Size
:
int64
(
a
.
Size
),
Ino
:
a
.
Ino
,
Size
:
int64
(
a
.
Size
),
Atime_ns
:
a
.
Atimens
(),
Mtime_ns
:
a
.
Mtimens
(),
Ctime_ns
:
a
.
Ctimens
(),
Blocks
:
int64
(
a
.
Blocks
),
Mode
:
a
.
Mode
,
Nlink
:
uint64
(
a
.
Nlink
),
Uid
:
int
(
a
.
Uid
),
Gid
:
int
(
a
.
Gid
),
Rdev
:
uint64
(
a
.
Rdev
),
Blksize
:
int64
(
a
.
Blksize
),
Blocks
:
int64
(
a
.
Blocks
),
Mode
:
a
.
Mode
,
Nlink
:
uint64
(
a
.
Nlink
),
Uid
:
int
(
a
.
Uid
),
Gid
:
int
(
a
.
Gid
),
Rdev
:
uint64
(
a
.
Rdev
),
Blksize
:
int64
(
a
.
Blksize
),
}
}
fuse/bufferpool.go
View file @
bde72938
...
...
@@ -3,8 +3,8 @@ package fuse
import
(
"fmt"
"log"
"sync"
"strings"
"sync"
"unsafe"
)
...
...
@@ -99,7 +99,7 @@ func (me *BufferPoolImpl) AllocBuffer(size uint32) []byte {
sz
=
PAGESIZE
}
if
sz
%
PAGESIZE
!=
0
{
if
sz
%
PAGESIZE
!=
0
{
sz
+=
PAGESIZE
}
psz
:=
sz
/
PAGESIZE
...
...
@@ -112,7 +112,7 @@ func (me *BufferPoolImpl) AllocBuffer(size uint32) []byte {
b
=
me
.
getBuffer
(
psz
)
if
b
==
nil
{
me
.
createdBuffers
++
b
=
make
([]
byte
,
size
,
psz
*
PAGESIZE
)
b
=
make
([]
byte
,
size
,
psz
*
PAGESIZE
)
}
else
{
b
=
b
[
:
size
]
}
...
...
@@ -134,7 +134,7 @@ func (me *BufferPoolImpl) FreeBuffer(slice []byte) {
if
slice
==
nil
{
return
}
if
cap
(
slice
)
%
PAGESIZE
!=
0
||
cap
(
slice
)
==
0
{
if
cap
(
slice
)
%
PAGESIZE
!=
0
||
cap
(
slice
)
==
0
{
return
}
psz
:=
cap
(
slice
)
/
PAGESIZE
...
...
fuse/cache_test.go
View file @
bde72938
...
...
@@ -74,7 +74,7 @@ func TestCacheFs(t *testing.T) {
c
,
err
=
ioutil
.
ReadFile
(
wd
+
"/mnt/file.txt"
)
CheckSuccess
(
err
)
// x
// x
if
string
(
c
)
!=
"hello"
{
t
.
Fatalf
(
"Page cache skipped: expect 'hello' %q"
,
string
(
c
))
}
...
...
fuse/default.go
View file @
bde72938
package
fuse
import
(
)
import
()
// DefaultFileSystem
func
(
me
*
DefaultFileSystem
)
GetAttr
(
name
string
,
context
*
Context
)
(
*
Attr
,
Status
)
{
...
...
fuse/fsmount.go
View file @
bde72938
...
...
@@ -62,7 +62,7 @@ func (me *fileSystemMount) setOwner(attr *Attr) {
func
(
me
*
fileSystemMount
)
fileInfoToEntry
(
attr
*
Attr
)
(
out
*
EntryOut
)
{
out
=
&
EntryOut
{}
out
.
Attr
=
*
attr
splitNs
(
me
.
options
.
EntryTimeout
,
&
out
.
EntryValid
,
&
out
.
EntryValidNsec
)
splitNs
(
me
.
options
.
AttrTimeout
,
&
out
.
AttrValid
,
&
out
.
AttrValidNsec
)
me
.
setOwner
(
&
out
.
Attr
)
...
...
@@ -71,7 +71,7 @@ func (me *fileSystemMount) fileInfoToEntry(attr *Attr) (out *EntryOut) {
}
return
out
}
func
(
me
*
fileSystemMount
)
fillAttr
(
a
*
Attr
,
nodeId
uint64
)
(
out
*
AttrOut
)
{
out
=
&
AttrOut
{}
out
.
Attr
=
*
a
...
...
fuse/fsops.go
View file @
bde72938
...
...
@@ -154,7 +154,7 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
if
input
.
Valid
&
FATTR_ATIME_NOW
!=
0
||
input
.
Valid
&
FATTR_MTIME_NOW
!=
0
{
now
=
time
.
Nanoseconds
()
}
atime
:=
int64
(
input
.
Atime
*
1e9
)
+
int64
(
input
.
Atimensec
)
if
input
.
Valid
&
FATTR_ATIME_NOW
!=
0
{
atime
=
now
...
...
fuse/misc.go
View file @
bde72938
...
...
@@ -158,6 +158,6 @@ func Linkat(fd1 int, n1 string, fd2 int, n2 string) int {
func
init
()
{
p
:=
syscall
.
Getpagesize
()
if
p
!=
PAGESIZE
{
log
.
Panicf
(
"page size incorrect: %d"
,
p
)
log
.
Panicf
(
"page size incorrect: %d"
,
p
)
}
}
fuse/pathfs.go
View file @
bde72938
...
...
@@ -40,7 +40,6 @@ type PathNodeFs struct {
options
*
PathNodeFsOptions
}
func
(
me
*
PathNodeFs
)
Mount
(
path
string
,
nodeFs
NodeFileSystem
,
opts
*
FileSystemOptions
)
Status
{
dir
,
name
:=
filepath
.
Split
(
path
)
if
dir
!=
""
{
...
...
unionfs/autounion_test.go
View file @
bde72938
...
...
@@ -13,7 +13,9 @@ var _ = fmt.Print
var
_
=
log
.
Print
var
CheckSuccess
=
fuse
.
CheckSuccess
const
entryTtl
=
0.1
var
testAOpts
=
AutoUnionFsOptions
{
UnionFsOptions
:
testOpts
,
FileSystemOptions
:
fuse
.
FileSystemOptions
{
...
...
unionfs/cachingfs.go
View file @
bde72938
...
...
@@ -62,8 +62,8 @@ func readDir(fs fuse.FileSystem, name string) *dirResponse {
func
getAttr
(
fs
fuse
.
FileSystem
,
name
string
)
*
attrResponse
{
a
,
code
:=
fs
.
GetAttr
(
name
,
nil
)
return
&
attrResponse
{
Attr
:
a
,
Status
:
code
,
Attr
:
a
,
Status
:
code
,
}
}
...
...
unionfs/unionfs.go
View file @
bde72938
...
...
@@ -648,7 +648,7 @@ func (me *UnionFs) Create(name string, flags uint32, mode uint32, context *fuse.
now
:=
time
.
Nanoseconds
()
a
:=
fuse
.
Attr
{
Mode
:
fuse
.
S_IFREG
|
mode
,
Mode
:
fuse
.
S_IFREG
|
mode
,
}
a
.
SetTimes
(
-
1
,
now
,
now
)
me
.
branchCache
.
Set
(
name
,
branchResult
{
&
a
,
fuse
.
OK
,
0
})
...
...
zipfs/tarfs.go
View file @
bde72938
...
...
@@ -19,12 +19,12 @@ var _ = fmt.Println
func
HeaderToFileInfo
(
h
*
tar
.
Header
)
(
*
fuse
.
Attr
,
string
)
{
a
:=
&
fuse
.
Attr
{
Mode
:
uint32
(
h
.
Mode
),
Size
:
uint64
(
h
.
Size
),
Mode
:
uint32
(
h
.
Mode
),
Size
:
uint64
(
h
.
Size
),
}
a
.
Uid
=
uint32
(
h
.
Uid
)
a
.
Gid
=
uint32
(
h
.
Gid
)
a
.
SetTimes
(
h
.
Atime
,
h
.
Mtime
,
h
.
Ctime
)
a
.
SetTimes
(
h
.
Atime
,
h
.
Mtime
,
h
.
Ctime
)
return
a
,
h
.
Name
}
...
...
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