func (r *RH) serve(req fuse.Request) {
	defer func() {
		if r := recover(); r != nil {
			log.Printf("fuse/rh serve panic: %v", r)
			debug.PrintStack()
		}
	}()
	// Debugf("◘ %v", req)
	//defer r.dump()
	//Debugf("<= %#T", req)

	// Create request interrupt object
	q := r.serving.Add(req)

	// Call this before responding.
	// After responding is too late: we might get another request
	// with the same ID and be very confused.
	done := q.Clunk

	// Locate FID object, corresponding to Header.Node
	hdr := req.Hdr()
	var nodeFID rh.FID
	if id := hdr.Node; id != 0 {
		nodeFID = r.node.Lookup(hdr.Node) // Locate node,
		if nodeFID == nil {               // Otherwise,
			//Debugln("missing node", id)
			done(fuse.ESTALE)
			req.RespondError(fuse.ESTALE)
			return
		}
	}

	// if !IsJunkRequest(req) {
	// 	Debugf("◘ %#x %v", hdr.ID, req)
	// }

	var x interface{}
	switch req := req.(type) {
	default:
		// Note: To FUSE, ENOSYS means "this server never implements this request."
		// It would be inappropriate to return ENOSYS for other operations in this
		// switch that might only be unavailable in some contexts, not all.
		x = fuse.ENOSYS

	case *fuse.InterruptRequest:
		//Debugf("◘ %#x %v", hdr.ID, req)
		r.serving.Lookup(req.IntrID).Interrupt()
		x = nil

	// Requests to the file system object

	case *fuse.InitRequest:
		x = r.init()

	case *fuse.StatfsRequest:
		x = r.statfs()

	case *fuse.DestroyRequest:
		x = r.destroy()

	case *fuse.MkdirRequest:
		x = r.mkdir(req, nodeFID)

	case *fuse.SymlinkRequest, *fuse.ReadlinkRequest, *fuse.LinkRequest: // Resource hierarchies do not support linking
		x = fuse.ENOSYS

	// Requests acting on nodes

	case *fuse.RemoveRequest:
		x = r.remove(req, nodeFID)

	case *fuse.GetattrRequest:
		x = r.getattr(nodeFID)

	case *fuse.SetattrRequest:
		x = r.setattr(req, hdr, nodeFID)

	case *fuse.LookupRequest:
		x = r.lookup(req, nodeFID)

	case *fuse.AccessRequest:
		x = r.access(req, nodeFID)

	case *fuse.OpenRequest:
		x = r.open(q, req, nodeFID)

	case *fuse.CreateRequest:
		x = r.create(req, nodeFID)

	case *fuse.MknodRequest: // Not supported
		x = fuse.ENOSYS

	case *fuse.ForgetRequest: // Forget a FUSE node ID, returned to a Lookup, Create or Mkdir request
		x = r.forget(hdr, nodeFID)

	case *fuse.GetxattrRequest, *fuse.SetxattrRequest, *fuse.ListxattrRequest, *fuse.RemovexattrRequest: // Not supported, OSX extended file attributes
		x = fuse.ENOSYS

	// Requests acting on open file handles

	case *fuse.ReadRequest:
		x = r.read(q, req, hdr)

	case *fuse.WriteRequest:
		x = r.write(q, req, hdr)

	case *fuse.FlushRequest:
		// (9fuse) Flush is supposed to flush any buffered writes.  Don't use this.
		//
		// Flush is a total crock.  It gets called on close() of a file descriptor
		// associated with this open file.  Some open files have multiple file
		// descriptors and thus multiple closes of those file descriptors.
		// In those cases, Flush is called multiple times.  Some open files
		// have file descriptors that are closed on process exit instead of
		// closed explicitly.  For those files, Flush is never called.
		// Even more amusing, Flush gets called before close() of read-only
		// file descriptors too!
		//
		// This is just a bad idea.
		x = nil

	case *fuse.FsyncRequest: // Not supported
		// (9fuse) Fsync commits file info to stable storage.
		x = fuse.ENOSYS

	case *fuse.ReleaseRequest:
		x = r.release(req, hdr)

	case *fuse.RenameRequest:
		x = r.rename(req, nodeFID)
	}
	//
	done(x)
	// if !IsJunkRequest(req) {
	// 	Debugf("‣ %#x %v", hdr.ID, x)
	// }
	switch z := x.(type) {
	case nil:
		req.(interface {
			Respond()
		}).Respond()
	case fuse.Error:
		//Debugf("• %#x %v => %v", hdr.ID, req, z)
		req.RespondError(z)
	default:
		reflect.ValueOf(req).MethodByName("Respond").Call([]reflect.Value{reflect.ValueOf(z)})
	}
}
// serve responds to an individual FUSE request.
serve responds to an individual FUSE request.
// serve responds to an individual FUSE request .
func (r *RH) serve(req fuse.Request) {
	defer func() {
		if r := recover(); r != nil {
			log.Printf("fuse/rh serve panic: %v", r)
			debug.PrintStack()
		}
	}()
	q := r.serving.Add(req)
	done := q.Clunk
	hdr := req.Hdr()
	var nodeFID rh.FID
	if id := hdr.Node; id != 0 {
		nodeFID = r.node.Lookup(hdr.Node) 
		if nodeFID == nil {               
			done(fuse.ESTALE)
			req.RespondError(fuse.ESTALE)
			return
		}
	}
	var x interface{}
	switch req := req.(type) {
	default:
		x = fuse.ENOSYS
	case *fuse.InterruptRequest:
		r.serving.Lookup(req.IntrID).Interrupt()
		x = nil
	case *fuse.InitRequest:
		x = r.init()
	case *fuse.StatfsRequest:
		x = r.statfs()
	case *fuse.DestroyRequest:
		x = r.destroy()
	case *fuse.MkdirRequest:
		x = r.mkdir(req, nodeFID)
	case *fuse.SymlinkRequest, *fuse.ReadlinkRequest, *fuse.LinkRequest: 
		x = fuse.ENOSYS
	case *fuse.RemoveRequest:
		x = r.remove(req, nodeFID)
	case *fuse.GetattrRequest:
		x = r.getattr(nodeFID)
	case *fuse.SetattrRequest:
		x = r.setattr(req, hdr, nodeFID)
	case *fuse.LookupRequest:
		x = r.lookup(req, nodeFID)
	case *fuse.AccessRequest:
		x = r.access(req, nodeFID)
	case *fuse.OpenRequest:
		x = r.open(q, req, nodeFID)
	case *fuse.CreateRequest:
		x = r.create(req, nodeFID)
	case *fuse.MknodRequest: 
		x = fuse.ENOSYS
	case *fuse.ForgetRequest: 
		x = r.forget(hdr, nodeFID)
	case *fuse.GetxattrRequest, *fuse.SetxattrRequest, *fuse.ListxattrRequest, *fuse.RemovexattrRequest: , OSX extended file attributes
		x = fuse.ENOSYS
	case *fuse.ReadRequest:
		x = r.read(q, req, hdr)
	case *fuse.WriteRequest:
		x = r.write(q, req, hdr)
	case *fuse.FlushRequest:
		 Flush is a total crock.  It gets called on close() of a file descriptor
		 associated with this open file.  Some open files have multiple file
		 descriptors and thus multiple closes of those file descriptors.
		 In those cases, Flush is called multiple times.  Some open files
		 have file descriptors that are closed on process exit instead of
		 closed explicitly.  For those files, Flush is never called.
		 Even more amusing, Flush gets called before close() of read-only
		 file descriptors too!
		 This is just a bad idea.
		x = nil
	case *fuse.FsyncRequest: 
		 (9fuse) Fsync commits file info to stable storage.
		x = fuse.ENOSYS
	case *fuse.ReleaseRequest:
		x = r.release(req, hdr)
	case *fuse.RenameRequest:
		x = r.rename(req, nodeFID)
	}
	done(x)
	 	Debugf("‣ %#x %v", hdr.ID, x)
	switch z := x.(type) {
	case nil:
		req.(interface {
			Respond()
		}).Respond()
	case fuse.Error:
		Debugf("• %#x %v => %v", hdr.ID, req, z)
		req.RespondError(z)
	default:
		reflect.ValueOf(req).MethodByName("Respond").Call([]reflect.Value{reflect.ValueOf(z)})
	}
}
func ( r * RH ) serve ( req fuse . Request ) { defer func ( ) { if r := recover ( ) ; r != nil { log . Printf ( " " , r ) debug . PrintStack ( ) } } ( ) q := r . serving . Add ( req ) done := q . Clunk hdr := req . Hdr ( ) var nodeFID rh . FID if id := hdr . Node ; id != 0 { nodeFID = r . node . Lookup ( hdr . Node ) if nodeFID == nil { done ( fuse . ESTALE ) req . RespondError ( fuse . ESTALE ) return } } var x interface { } switch req := req . ( type ) { default : x = fuse . ENOSYS case * fuse . InterruptRequest : r . serving . Lookup ( req . IntrID ) . Interrupt ( ) x = nil case * fuse . InitRequest : x = r . init ( ) case * fuse . StatfsRequest : x = r . statfs ( ) case * fuse . DestroyRequest : x = r . destroy ( ) case * fuse . MkdirRequest : x = r . mkdir ( req , nodeFID ) case * fuse . SymlinkRequest , * fuse . ReadlinkRequest , * fuse . LinkRequest : x = fuse . ENOSYS case * fuse . RemoveRequest : x = r . remove ( req , nodeFID ) case * fuse . GetattrRequest : x = r . getattr ( nodeFID ) case * fuse . SetattrRequest : x = r . setattr ( req , hdr , nodeFID ) case * fuse . LookupRequest : x = r . lookup ( req , nodeFID ) case * fuse . AccessRequest : x = r . access ( req , nodeFID ) case * fuse . OpenRequest : x = r . open ( q , req , nodeFID ) case * fuse . CreateRequest : x = r . create ( req , nodeFID ) case * fuse . MknodRequest : x = fuse . ENOSYS case * fuse . ForgetRequest : x = r . forget ( hdr , nodeFID ) case * fuse . GetxattrRequest , * fuse . SetxattrRequest , * fuse . ListxattrRequest , * fuse . RemovexattrRequest : x = fuse . ENOSYS case * fuse . ReadRequest : x = r . read ( q , req , hdr ) case * fuse . WriteRequest : x = r . write ( q , req , hdr ) case * fuse . FlushRequest : x = nil case * fuse . FsyncRequest : x = fuse . ENOSYS case * fuse . ReleaseRequest : x = r . release ( req , hdr ) case * fuse . RenameRequest : x = r . rename ( req , nodeFID ) } done ( x ) switch z := x . ( type ) { case nil : req . ( interface { Respond ( ) } ) . Respond ( ) case fuse . Error : req . RespondError ( z ) default : reflect . ValueOf ( req ) . MethodByName ( " " ) . Call ( [ ] reflect . Value { reflect . ValueOf ( z ) } ) } }
serve responds to an individual FUSE request.
serve responds to an individual FUSE request .
// Debugf("◘ %v", req) //defer r.dump() //Debugf("<= %#T", req) // Create request interrupt object // Call this before responding. // After responding is too late: we might get another request // with the same ID and be very confused. // Locate FID object, corresponding to Header.Node // Locate node, // Otherwise, //Debugln("missing node", id) // if !IsJunkRequest(req) { // 	Debugf("◘ %#x %v", hdr.ID, req) // } // Note: To FUSE, ENOSYS means "this server never implements this request." // It would be inappropriate to return ENOSYS for other operations in this // switch that might only be unavailable in some contexts, not all. //Debugf("◘ %#x %v", hdr.ID, req) // Requests to the file system object // Resource hierarchies do not support linking // Requests acting on nodes // Not supported // Forget a FUSE node ID, returned to a Lookup, Create or Mkdir request // Not supported, OSX extended file attributes // Requests acting on open file handles // (9fuse) Flush is supposed to flush any buffered writes.  Don't use this. // // Flush is a total crock.  It gets called on close() of a file descriptor // associated with this open file.  Some open files have multiple file // descriptors and thus multiple closes of those file descriptors. // In those cases, Flush is called multiple times.  Some open files // have file descriptors that are closed on process exit instead of // closed explicitly.  For those files, Flush is never called. // Even more amusing, Flush gets called before close() of read-only // file descriptors too! // // This is just a bad idea. // Not supported // (9fuse) Fsync commits file info to stable storage. // // if !IsJunkRequest(req) { // 	Debugf("‣ %#x %v", hdr.ID, x) // } //Debugf("• %#x %v => %v", hdr.ID, req, z)