Use the name bazilfuse.
parent
2903084abb
commit
139cb4e968
|
@ -3,10 +3,10 @@
|
|||
|
||||
package fuse
|
||||
|
||||
import "bazil.org/fuse"
|
||||
import bazilfuse "bazil.org/fuse"
|
||||
|
||||
const (
|
||||
// Errors corresponding to kernel error numbers. These may be treated
|
||||
// specially when returned by a FileSystem method.
|
||||
ENOSYS = fuse.ENOSYS
|
||||
ENOSYS = bazilfuse.ENOSYS
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ package fuse
|
|||
import (
|
||||
"time"
|
||||
|
||||
"bazil.org/fuse"
|
||||
bazilfuse "bazil.org/fuse"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
@ -60,7 +60,7 @@ type InodeID uint64
|
|||
// in a request to Open or Lookup. Unlike all other inode IDs, which are minted
|
||||
// by the file system, the FUSE VFS layer may send a request for this ID
|
||||
// without the file system ever having referenced it in a previous response.
|
||||
const RootInodeID InodeID = InodeID(fuse.RootID)
|
||||
const RootInodeID InodeID = InodeID(bazilfuse.RootID)
|
||||
|
||||
// A generation number for an inode. Irrelevant for file systems that won't be
|
||||
// exported over NFS. For those that will and that reuse inode IDs when they
|
||||
|
@ -95,7 +95,7 @@ type OpenRequest struct {
|
|||
Inode InodeID
|
||||
|
||||
// Mode and options flags.
|
||||
Flags fuse.OpenFlags
|
||||
Flags bazilfuse.OpenFlags
|
||||
}
|
||||
|
||||
// Currently nothing interesting here. The file system should perform any
|
||||
|
|
|
@ -6,7 +6,7 @@ package fuse
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"bazil.org/fuse"
|
||||
bazilfuse "bazil.org/fuse"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
@ -61,20 +61,20 @@ func (mfs *MountedFileSystem) Join(ctx context.Context) error {
|
|||
// unmounted. You must first call WaitForReady to ensure there is no race with
|
||||
// mounting.
|
||||
func (mfs *MountedFileSystem) Unmount() error {
|
||||
return fuse.Unmount(mfs.dir)
|
||||
return bazilfuse.Unmount(mfs.dir)
|
||||
}
|
||||
|
||||
// Runs in the background.
|
||||
func (mfs *MountedFileSystem) mountAndServe(
|
||||
server *server,
|
||||
options []fuse.MountOption) {
|
||||
options []bazilfuse.MountOption) {
|
||||
logger := getLogger()
|
||||
|
||||
// Open a FUSE connection.
|
||||
logger.Println("Opening a FUSE connection.")
|
||||
c, err := fuse.Mount(mfs.dir, options...)
|
||||
c, err := bazilfuse.Mount(mfs.dir, options...)
|
||||
if err != nil {
|
||||
mfs.readyStatus = errors.New("fuse.Mount: " + err.Error())
|
||||
mfs.readyStatus = errors.New("bazilfuse.Mount: " + err.Error())
|
||||
close(mfs.readyStatusAvailable)
|
||||
return
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func (mfs *MountedFileSystem) mountAndServe(
|
|||
func Mount(
|
||||
dir string,
|
||||
fs FileSystem,
|
||||
options ...fuse.MountOption) (mfs *MountedFileSystem, err error) {
|
||||
options ...bazilfuse.MountOption) (mfs *MountedFileSystem, err error) {
|
||||
// Create a server object.
|
||||
server, err := newServer(fs)
|
||||
if err != nil {
|
||||
|
|
20
server.go
20
server.go
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"bazil.org/fuse"
|
||||
bazilfuse "bazil.org/fuse"
|
||||
)
|
||||
|
||||
// An object that terminates one end of the userspace <-> FUSE VFS connection.
|
||||
|
@ -32,11 +32,11 @@ func newServer(fs FileSystem) (s *server, err error) {
|
|||
// Serve the fuse connection by repeatedly reading requests from the supplied
|
||||
// FUSE connection, responding as dictated by the file system. Return when the
|
||||
// connection is closed or an unexpected error occurs.
|
||||
func (s *server) Serve(c *fuse.Conn) (err error) {
|
||||
func (s *server) Serve(c *bazilfuse.Conn) (err error) {
|
||||
// Read a message at a time, dispatching to goroutines doing the actual
|
||||
// processing.
|
||||
for {
|
||||
var fuseReq fuse.Request
|
||||
var fuseReq bazilfuse.Request
|
||||
fuseReq, err = c.ReadRequest()
|
||||
|
||||
// ReadRequest returns EOF when the connection has been closed.
|
||||
|
@ -57,7 +57,7 @@ func (s *server) Serve(c *fuse.Conn) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *server) handleFuseRequest(fuseReq fuse.Request) {
|
||||
func (s *server) handleFuseRequest(fuseReq bazilfuse.Request) {
|
||||
// Log the request.
|
||||
s.logger.Println("Received:", fuseReq)
|
||||
|
||||
|
@ -67,23 +67,23 @@ func (s *server) handleFuseRequest(fuseReq fuse.Request) {
|
|||
|
||||
// Attempt to handle it.
|
||||
switch typed := fuseReq.(type) {
|
||||
case *fuse.InitRequest:
|
||||
case *bazilfuse.InitRequest:
|
||||
// Responding to this is required to make mounting work, at least on OS X.
|
||||
// We don't currently expose the capability for the file system to
|
||||
// intercept this.
|
||||
fuseResp := &fuse.InitResponse{}
|
||||
fuseResp := &bazilfuse.InitResponse{}
|
||||
s.logger.Println("Responding:", fuseResp)
|
||||
typed.Respond(fuseResp)
|
||||
|
||||
case *fuse.StatfsRequest:
|
||||
case *bazilfuse.StatfsRequest:
|
||||
// Responding to this is required to make mounting work, at least on OS X.
|
||||
// We don't currently expose the capability for the file system to
|
||||
// intercept this.
|
||||
fuseResp := &fuse.StatfsResponse{}
|
||||
fuseResp := &bazilfuse.StatfsResponse{}
|
||||
s.logger.Println("Responding:", fuseResp)
|
||||
typed.Respond(fuseResp)
|
||||
|
||||
case *fuse.OpenRequest:
|
||||
case *bazilfuse.OpenRequest:
|
||||
// Convert the request.
|
||||
req := &OpenRequest{
|
||||
Inode: InodeID(typed.Header.Node),
|
||||
|
@ -98,7 +98,7 @@ func (s *server) handleFuseRequest(fuseReq fuse.Request) {
|
|||
}
|
||||
|
||||
// There is nothing interesting to convert in the response.
|
||||
fuseResp := &fuse.OpenResponse{}
|
||||
fuseResp := &bazilfuse.OpenResponse{}
|
||||
s.logger.Print("Responding:", fuseResp)
|
||||
typed.Respond(fuseResp)
|
||||
|
||||
|
|
Loading…
Reference in New Issue