// Pass sequential writes on to the correct handle for uploading func (sc *serveConn) write(req *fuse.WriteRequest) { if *readOnly { req.RespondError(fuse.EPERM) return } // TODO: if allow_other, require uid == invoking uid to allow writes h, err := sc.handleById(req.Handle) if err != nil { fuse.Debug(fmt.Sprintf("inodeByNodeID(%v): %v", req.Handle, err)) req.RespondError(fuse.ESTALE) return } if h.lastByte != req.Offset { fuse.Debug(fmt.Sprintf("non-sequential write: got %v, expected %v", req.Offset, h.lastByte)) req.RespondError(fuse.EIO) return } n, err := h.writer.Write(req.Data) if err != nil { req.RespondError(fuse.EIO) return } sc.Lock() h.lastByte += int64(n) sc.handles[req.Handle] = h sc.Unlock() req.Respond(&fuse.WriteResponse{n}) }