Fixed some brokenness.
parent
4bf575151c
commit
70479d63bd
12
server.go
12
server.go
|
@ -8,6 +8,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"github.com/jacobsa/gcsfuse/timeutil"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
bazilfuse "bazil.org/fuse"
|
bazilfuse "bazil.org/fuse"
|
||||||
|
@ -16,6 +17,7 @@ import (
|
||||||
// An object that terminates one end of the userspace <-> FUSE VFS connection.
|
// An object that terminates one end of the userspace <-> FUSE VFS connection.
|
||||||
type server struct {
|
type server struct {
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
|
clock timeutil.Clock
|
||||||
fs FileSystem
|
fs FileSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +25,7 @@ type server struct {
|
||||||
func newServer(fs FileSystem) (s *server, err error) {
|
func newServer(fs FileSystem) (s *server, err error) {
|
||||||
s = &server{
|
s = &server{
|
||||||
logger: getLogger(),
|
logger: getLogger(),
|
||||||
|
clock: timeutil.RealClock(),
|
||||||
fs: fs,
|
fs: fs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +102,7 @@ func (s *server) handleFuseRequest(fuseReq bazilfuse.Request) {
|
||||||
|
|
||||||
// Convert the response.
|
// Convert the response.
|
||||||
fuseResp := &bazilfuse.GetattrResponse{
|
fuseResp := &bazilfuse.GetattrResponse{
|
||||||
Attr: resp.Attributes,
|
Attr: convertAttributes(req.Inode, resp.Attributes),
|
||||||
AttrValid: resp.AttributesExpiration.Sub(s.clock.Now()),
|
AttrValid: resp.AttributesExpiration.Sub(s.clock.Now()),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,3 +176,10 @@ func (s *server) handleFuseRequest(fuseReq bazilfuse.Request) {
|
||||||
typed.RespondError(ENOSYS)
|
typed.RespondError(ENOSYS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func convertAttributes(inode InodeID, attr InodeAttributes) bazilfuse.Attr {
|
||||||
|
return bazilfuse.Attr{
|
||||||
|
Inode: uint64(inode),
|
||||||
|
Size: attr.Size,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue