Use the name bazilfuse.

geesefs-0-30-9
Aaron Jacobs 2015-02-27 09:32:18 +11:00
parent 2903084abb
commit 139cb4e968
4 changed files with 21 additions and 21 deletions

View File

@ -3,10 +3,10 @@
package fuse package fuse
import "bazil.org/fuse" import bazilfuse "bazil.org/fuse"
const ( const (
// Errors corresponding to kernel error numbers. These may be treated // Errors corresponding to kernel error numbers. These may be treated
// specially when returned by a FileSystem method. // specially when returned by a FileSystem method.
ENOSYS = fuse.ENOSYS ENOSYS = bazilfuse.ENOSYS
) )

View File

@ -6,7 +6,7 @@ package fuse
import ( import (
"time" "time"
"bazil.org/fuse" bazilfuse "bazil.org/fuse"
"golang.org/x/net/context" "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 // 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 // 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. // 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 // 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 // exported over NFS. For those that will and that reuse inode IDs when they
@ -95,7 +95,7 @@ type OpenRequest struct {
Inode InodeID Inode InodeID
// Mode and options flags. // Mode and options flags.
Flags fuse.OpenFlags Flags bazilfuse.OpenFlags
} }
// Currently nothing interesting here. The file system should perform any // Currently nothing interesting here. The file system should perform any

View File

@ -6,7 +6,7 @@ package fuse
import ( import (
"errors" "errors"
"bazil.org/fuse" bazilfuse "bazil.org/fuse"
"golang.org/x/net/context" "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 // unmounted. You must first call WaitForReady to ensure there is no race with
// mounting. // mounting.
func (mfs *MountedFileSystem) Unmount() error { func (mfs *MountedFileSystem) Unmount() error {
return fuse.Unmount(mfs.dir) return bazilfuse.Unmount(mfs.dir)
} }
// Runs in the background. // Runs in the background.
func (mfs *MountedFileSystem) mountAndServe( func (mfs *MountedFileSystem) mountAndServe(
server *server, server *server,
options []fuse.MountOption) { options []bazilfuse.MountOption) {
logger := getLogger() logger := getLogger()
// Open a FUSE connection. // Open a FUSE connection.
logger.Println("Opening 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 { if err != nil {
mfs.readyStatus = errors.New("fuse.Mount: " + err.Error()) mfs.readyStatus = errors.New("bazilfuse.Mount: " + err.Error())
close(mfs.readyStatusAvailable) close(mfs.readyStatusAvailable)
return return
} }
@ -110,7 +110,7 @@ func (mfs *MountedFileSystem) mountAndServe(
func Mount( func Mount(
dir string, dir string,
fs FileSystem, fs FileSystem,
options ...fuse.MountOption) (mfs *MountedFileSystem, err error) { options ...bazilfuse.MountOption) (mfs *MountedFileSystem, err error) {
// Create a server object. // Create a server object.
server, err := newServer(fs) server, err := newServer(fs)
if err != nil { if err != nil {

View File

@ -10,7 +10,7 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
"bazil.org/fuse" bazilfuse "bazil.org/fuse"
) )
// An object that terminates one end of the userspace <-> FUSE VFS connection. // 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 // Serve the fuse connection by repeatedly reading requests from the supplied
// FUSE connection, responding as dictated by the file system. Return when the // FUSE connection, responding as dictated by the file system. Return when the
// connection is closed or an unexpected error occurs. // 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 // Read a message at a time, dispatching to goroutines doing the actual
// processing. // processing.
for { for {
var fuseReq fuse.Request var fuseReq bazilfuse.Request
fuseReq, err = c.ReadRequest() fuseReq, err = c.ReadRequest()
// ReadRequest returns EOF when the connection has been closed. // 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. // Log the request.
s.logger.Println("Received:", fuseReq) s.logger.Println("Received:", fuseReq)
@ -67,23 +67,23 @@ func (s *server) handleFuseRequest(fuseReq fuse.Request) {
// Attempt to handle it. // Attempt to handle it.
switch typed := fuseReq.(type) { switch typed := fuseReq.(type) {
case *fuse.InitRequest: case *bazilfuse.InitRequest:
// Responding to this is required to make mounting work, at least on OS X. // 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 // We don't currently expose the capability for the file system to
// intercept this. // intercept this.
fuseResp := &fuse.InitResponse{} fuseResp := &bazilfuse.InitResponse{}
s.logger.Println("Responding:", fuseResp) s.logger.Println("Responding:", fuseResp)
typed.Respond(fuseResp) typed.Respond(fuseResp)
case *fuse.StatfsRequest: case *bazilfuse.StatfsRequest:
// Responding to this is required to make mounting work, at least on OS X. // 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 // We don't currently expose the capability for the file system to
// intercept this. // intercept this.
fuseResp := &fuse.StatfsResponse{} fuseResp := &bazilfuse.StatfsResponse{}
s.logger.Println("Responding:", fuseResp) s.logger.Println("Responding:", fuseResp)
typed.Respond(fuseResp) typed.Respond(fuseResp)
case *fuse.OpenRequest: case *bazilfuse.OpenRequest:
// Convert the request. // Convert the request.
req := &OpenRequest{ req := &OpenRequest{
Inode: InodeID(typed.Header.Node), 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. // There is nothing interesting to convert in the response.
fuseResp := &fuse.OpenResponse{} fuseResp := &bazilfuse.OpenResponse{}
s.logger.Print("Responding:", fuseResp) s.logger.Print("Responding:", fuseResp)
typed.Respond(fuseResp) typed.Respond(fuseResp)