/* write to a file */ static NTSTATUS svfs_write(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_write *wr) { struct svfs_private *p = ntvfs->private_data; struct svfs_file *f; ssize_t ret; if (wr->generic.level != RAW_WRITE_WRITEX) { return ntvfs_map_write(ntvfs, req, wr); } CHECK_READ_ONLY(req); f = find_fd(p, wr->writex.in.file.ntvfs); if (!f) { return NT_STATUS_INVALID_HANDLE; } ret = pwrite(f->fd, wr->writex.in.data, wr->writex.in.count, wr->writex.in.offset); if (ret == -1) { return map_nt_error_from_unix(errno); } wr->writex.out.nwritten = ret; wr->writex.out.remaining = 0; /* should fill this in? */ return NT_STATUS_OK; }
/* write to a file */ static NTSTATUS cvfs_write(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_write *io) { struct cvfs_private *p = ntvfs->private_data; struct smbcli_request *c_req; SETUP_PID; if (io->generic.level != RAW_WRITE_GENERIC && p->map_generic) { return ntvfs_map_write(ntvfs, req, io); } SETUP_FILE; if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) { return smb_raw_write(p->tree, io); } c_req = smb_raw_write_send(p->tree, io); ASYNC_RECV_TAIL(io, async_write); }