Skip to contentSkip to conversation

NFS: Add error message when U-Boot NFS version (V2) is not supported by NFS server

PATCH In review Guillaume GARDET 3 participants 6 messages Jun 6, 2016 – Jun 21, 2016 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: Add error message when U-Boot NFS version (V2) is not supported by NFS server

Cc joe.hershberger at ni.com
---
 net/nfs.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
net/nfs.c +15 -1
index 78968d8..0ed47c9 100644
@@ -481,8 +481,22 @@ static int nfs_lookup_reply(uchar *pkt, unsigned len)
 	if (rpc_pkt.u.reply.rstatus  ||
 	    rpc_pkt.u.reply.verifier ||
 	    rpc_pkt.u.reply.astatus  ||
-	    rpc_pkt.u.reply.data[0])
+	    rpc_pkt.u.reply.data[0]){
+		switch(ntohl(rpc_pkt.u.reply.astatus)){
+		case 0: /* Not an error */
+			break;
+		case 2: /* Remote can't support NFS version */
+			printf("*** ERROR: NFS version not supported: Requested: V%d, accepted: min V%d - max V%d\n", 
+				2, 
+				ntohl(rpc_pkt.u.reply.data[0]), 
+				ntohl(rpc_pkt.u.reply.data[1]));
+			break;
+		default: /* Unknown error on 'accept state' flag */
+			printf("*** ERROR: accept state error (%d)\n", ntohl(rpc_pkt.u.reply.astatus));
+			break;
+		}
 		return -1;
+	}
 
 	memcpy(filefh, rpc_pkt.u.reply.data + 1, NFS_FHSIZE);
 
Signature · 1 line
1.8.4.5
#3 lore raw

PATCH 1/1 NFS: Add error message when U-Boot NFS version (V2) is not supported by NFS server

Quoted 7 lines · Guillaume Gardet

Le 07/06/2016 17:56, Joe Hershberger a ?crit :

Quoted 4 lines
Quoted 1 line · Guillaume GARDET
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Cc joe.hershberger at ni.com

Joe, you will add it to u-boot-net repo and then send a pull request to Tom or Tom will directly pick it up?

I'll take tare of it.

-Joe

#4 lore raw

PATCH 1/1 NFS: Add error message when U-Boot NFS version (V2) is not supported by NFS server

In reply to Guillaume GARDET

Hi Guillaume,

Quoted 12 lines · Guillaume GARDET
Cc joe.hershberger at ni.com
---
 net/nfs.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
net/nfs.c +0 -0
index 78968d8..0ed47c9 100644

net/nfs.c static int nfs_lookup_reply(uchar *pkt, unsigned len) · line 485

Quoted 6 lines
net/nfs.c +2 -1
@@ -481,8 +481,22 @@ static int nfs_lookup_reply(uchar *pkt, unsigned len)
        if (rpc_pkt.u.reply.rstatus  ||
            rpc_pkt.u.reply.verifier ||
            rpc_pkt.u.reply.astatus  ||
-           rpc_pkt.u.reply.data[0])
+           rpc_pkt.u.reply.data[0]){
+               switch(ntohl(rpc_pkt.u.reply.astatus)){

There are 7 checkpatch.pl issues with this patch. I'll fix them when I apply it, but in the future, please at least run checkpatch and follow the coding conventions. Even better would be to use tools/patman.

...

-Joe