9fans archive / 1997 / 10 / 67 / prev next
From: beto@ncu... beto@ncu...
Subject: [9fans] convS2M improvement
Date: Fri, 24 Oct 97 11:02:52 PDT
Hi,
I've modified convS2M to avoid having to copy the
data during a read reply. The idea is to set the Fcall data
pointer to point to the right place within the
reply message.
ConvS2M starts doing it's data conversion and if the data
pointer is already pointing to the right place it bypasses
the copy.
case Rread:
SHORT(fid);
SHORT(count);
p++; /* pad(1) */
if (p != (uchar*)f->data) {
STRING(data, f->count);
} else
p+=f->count;
break;
The server needs to know the data offset for a read reply,
but some macro definitions will solve the problem.
p->reply.data = (char *) p->rbp->wptr+8;
With this enhancement a 9P server does not have to copy
data for reads.
Has something like this been done to brazil/plan9?
P.S.
This is not scatter/gatther but it's so simple :-)