<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Eric Van Hensbergen &lt;ericvh@gmail.com&gt;

This part of the patch contains the 9P protocol function changes related to
hch's comments.

Signed-off-by: Eric Van Hensbergen &lt;ericvh@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 fs/9p/9p.c   |    2 +-
 fs/9p/conv.c |   54 ++++++++++++++++++------------------------------------
 2 files changed, 19 insertions(+), 37 deletions(-)

diff -puN fs/9p/9p.c~v9fs-9p-protocol-implementation-resend-take-2 fs/9p/9p.c
--- devel/fs/9p/9p.c~v9fs-9p-protocol-implementation-resend-take-2	2005-07-14 16:23:35.000000000 -0700
+++ devel-akpm/fs/9p/9p.c	2005-07-14 16:23:35.000000000 -0700
@@ -28,9 +28,9 @@
 #include &lt;linux/module.h&gt;
 #include &lt;linux/errno.h&gt;
 #include &lt;linux/fs.h&gt;
+#include &lt;linux/idr.h&gt;
 
 #include "debug.h"
-#include "idpool.h"
 #include "v9fs.h"
 #include "9p.h"
 #include "mux.h"
diff -puN fs/9p/conv.c~v9fs-9p-protocol-implementation-resend-take-2 fs/9p/conv.c
--- devel/fs/9p/conv.c~v9fs-9p-protocol-implementation-resend-take-2	2005-07-14 16:23:35.000000000 -0700
+++ devel-akpm/fs/9p/conv.c	2005-07-14 16:23:35.000000000 -0700
@@ -28,9 +28,9 @@
 #include &lt;linux/module.h&gt;
 #include &lt;linux/errno.h&gt;
 #include &lt;linux/fs.h&gt;
+#include &lt;linux/idr.h&gt;
 
 #include "debug.h"
-#include "idpool.h"
 #include "v9fs.h"
 #include "9p.h"
 #include "conv.h"
@@ -55,39 +55,21 @@ static inline int buf_check_overflow(str
 	return buf-&gt;p &gt; buf-&gt;ep;
 }
 
-#define buf_check_sizep(buf, len) \
-	if (buf-&gt;p+len &gt; buf-&gt;ep) { \
-		if (buf-&gt;p &lt; buf-&gt;ep) { \
-			eprintk(KERN_ERR, "buffer overflow\n"); \
-			buf-&gt;p = buf-&gt;ep + 1; \
-		} \
-		return NULL; \
-	} \
-
-
-#define buf_check_size(buf, len) \
-	if (buf-&gt;p+len &gt; buf-&gt;ep) { \
-		if (buf-&gt;p &lt; buf-&gt;ep) { \
-			eprintk(KERN_ERR, "buffer overflow\n"); \
-			buf-&gt;p = buf-&gt;ep + 1; \
-		} \
-		return 0; \
-	} \
-
-#define buf_check_sizev(buf, len) \
-	if (buf-&gt;p+len &gt; buf-&gt;ep) { \
-		if (buf-&gt;p &lt; buf-&gt;ep) { \
-			eprintk(KERN_ERR, "buffer overflow\n"); \
-			buf-&gt;p = buf-&gt;ep + 1; \
-		} \
-		return; \
-	} \
+static inline void buf_check_size(struct cbuf *buf, int len)
+{
+	if (buf-&gt;p+len &gt; buf-&gt;ep) {
+		if (buf-&gt;p &lt; buf-&gt;ep) {
+			eprintk(KERN_ERR, "buffer overflow\n");
+			buf-&gt;p = buf-&gt;ep + 1;
+		}
+	}
+}
 
 static inline void *buf_alloc(struct cbuf *buf, int len)
 {
 	void *ret = NULL;
 
-	buf_check_sizep(buf, len);
+	buf_check_size(buf, len);
 	ret = buf-&gt;p;
 	buf-&gt;p += len;
 
@@ -96,7 +78,7 @@ static inline void *buf_alloc(struct cbu
 
 static inline void buf_put_int8(struct cbuf *buf, u8 val)
 {
-	buf_check_sizev(buf, 1);
+	buf_check_size(buf, 1);
 
 	buf-&gt;p[0] = val;
 	buf-&gt;p++;
@@ -104,7 +86,7 @@ static inline void buf_put_int8(struct c
 
 static inline void buf_put_int16(struct cbuf *buf, u16 val)
 {
-	buf_check_sizev(buf, 2);
+	buf_check_size(buf, 2);
 
 	buf-&gt;p[0] = val;
 	buf-&gt;p[1] = val &gt;&gt; 8;
@@ -113,7 +95,7 @@ static inline void buf_put_int16(struct 
 
 static inline void buf_put_int32(struct cbuf *buf, u32 val)
 {
-	buf_check_sizev(buf, 4);
+	buf_check_size(buf, 4);
 
 	buf-&gt;p[0] = val;
 	buf-&gt;p[1] = val &gt;&gt; 8;
@@ -124,7 +106,7 @@ static inline void buf_put_int32(struct 
 
 static inline void buf_put_int64(struct cbuf *buf, u64 val)
 {
-	buf_check_sizev(buf, 8);
+	buf_check_size(buf, 8);
 
 	buf-&gt;p[0] = val;
 	buf-&gt;p[1] = val &gt;&gt; 8;
@@ -139,7 +121,7 @@ static inline void buf_put_int64(struct 
 
 static inline void buf_put_stringn(struct cbuf *buf, const char *s, u16 slen)
 {
-	buf_check_sizev(buf, slen + 2);
+	buf_check_size(buf, slen + 2);
 
 	buf_put_int16(buf, slen);
 	memcpy(buf-&gt;p, s, slen);
@@ -153,7 +135,7 @@ static inline void buf_put_string(struct
 
 static inline void buf_put_data(struct cbuf *buf, void *data, u32 datalen)
 {
-	buf_check_sizev(buf, datalen);
+	buf_check_size(buf, datalen);
 
 	memcpy(buf-&gt;p, data, datalen);
 	buf-&gt;p += datalen;
@@ -257,7 +239,7 @@ static inline void *buf_get_datab(struct
 	char *ret = NULL;
 	int n = 0;
 
-	buf_check_sizep(dbuf, datalen);
+	buf_check_size(dbuf, datalen);
 
 	n = buf_get_data(buf, dbuf-&gt;p, datalen);
 
_
</pre></body></html>