1 #include <u.h> 2 #include <libc.h> 3 #include <auth.h> 4 #include <fcall.h> 5 #include <thread.h> 6 #include "9p.h" 7 8 void 9 readbuf(Req *r, void *s, long n) 10 { 11 r->ofcall.count = r->ifcall.count; 12 if(r->ifcall.offset >= n){ 13 r->ofcall.count = 0; 14 return; 15 } 16 if(r->ifcall.offset+r->ofcall.count > n) 17 r->ofcall.count = n - r->ifcall.offset; 18 memmove(r->ofcall.data, (char*)s+r->ifcall.offset, r->ofcall.count); 19 } 20 21 void 22 readstr(Req *r, char *s) 23 { 24 readbuf(r, s, strlen(s)); 25 } 26