read/write oob.

This commit is contained in:
Kelvin Sherlock 2012-05-13 19:46:25 -04:00
parent 6ab3356fc2
commit 7bd4d900c7
3 changed files with 32 additions and 0 deletions

View File

@ -131,6 +131,7 @@ int driver(
break;
case PRU_RCVOOB:
return mreadoob(e, p1, p2, p3, p4, p5);
break;
case PRU_SEND:
@ -143,6 +144,9 @@ int driver(
break;
case PRU_SENDOOB:
// OOB is always inline. so there.
// this is never called via ReadGS.
return mwrite(e, p1, p2, p3, p4, p5);
break;
case PRU_SENSE:

View File

@ -106,6 +106,8 @@ int driver(int, int, void *, void *, void *, void *, void *);
int mattach(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5);
int mread(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mreadoob(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5);
int mwrite(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mconnect(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mbind(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);

26
mread.c
View File

@ -158,6 +158,32 @@ static int sock_read(
}
int mreadoob(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5)
{
// called via recv, recvfrom.
// OOB is always inline, therefore an OOB read will
// just return 0.
// todo -- just treat as regular read?
char *buffer = (char *)p1;
LongWord nbytes = *(LongWord *)p2;
xsockaddr *addr = (xsockaddr *)p3;
int addrlen = p4 ? *(int *)p4 : 0;
LongWord *outbytes = (LongWord *)p2;
*outbytes = 0;
if (Debug > 0)
{
s16_debug_printf("oob read nbytes = %ld", nbytes);
}
return 0;
}
// called through ReadGS, recv, recvfrom
int mread(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5)
{