From 7bd4d900c7fee6d7321ef7fe080375961d120bcc Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sun, 13 May 2012 19:46:25 -0400 Subject: [PATCH] read/write oob. --- driver.c | 4 ++++ marignotti.h | 2 ++ mread.c | 26 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/driver.c b/driver.c index 515eb04..7b55d83 100644 --- a/driver.c +++ b/driver.c @@ -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: diff --git a/marignotti.h b/marignotti.h index 5c3cb0e..c7fae06 100644 --- a/marignotti.h +++ b/marignotti.h @@ -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); diff --git a/mread.c b/mread.c index 4b473f0..d5ebbb4 100644 --- a/mread.c +++ b/mread.c @@ -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) {