From: Hiroshi Ito <ito@mlb.co.jp>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [Patch] bugfix:return value of NFS command
Date: Sat, 11 Dec 2004 04:03:16 +0900 [thread overview]
Message-ID: <20041211040316M.ito@mlb.co.jp> (raw)
Hello,
1.nfs command return code is depend on umount-all, but not state of
downloading.
2.When fail to write flash, it doesn't change state to umount
example1:
---nfs server---
[mldbox]# ls -l u-boot.bin
---------- 1 root root 204048 Dec 11 02:06 u-boot.bin
--- u-boot ---
# if nfs 80400000 192.168.3.98:/usr/src/mldbox/u-boot.bin; then echo ok; else echo error; fi
Trying i82559#0
Using i82559#0 device
File transfer via NFS from server 192.168.3.98; our IP address is 192.168.3.200
Filename '/usr/src/mldbox/u-boot.bin'.
Load address: 0x80400000
Loading: *
done
ok <= Wrong!!
example2:
[root at tv mldbox]# rm u-boot.bin
rm: remove regular file `u-boot.bin'? y
[root@tv mldbox]#
# if nfs 80400000 192.168.3.98:/usr/src/mldbox/u-boot.bin; then echo ok; else echo error; fi
Trying i82559#0
Using i82559#0 device
File transfer via NFS from server 192.168.3.98; our IP address is 192.168.3.200
Filename '/usr/src/mldbox/u-boot.bin'.
Load address: 0x80400000
Loading: *** ERROR: File lookup fail
done
ok <= Wrong!!
#
attached patch fixes these problems.
patch is for current CVS.
--------
Hiroshi Ito
Media Lab. Inc.,
URL http://www.mlb.co.jp ( Sorry, Japanese only. )
TEL +81-3-5294-7255 FAX +81-3-5294-7256
-------------- next part --------------
Index: net/nfs.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/net/nfs.c,v
retrieving revision 1.8
diff -u -b -B -w -p -r1.8 nfs.c
--- net/nfs.c 28 Sep 2004 21:51:43 -0000 1.8
+++ net/nfs.c 10 Dec 2004 17:36:09 -0000
@@ -44,6 +44,7 @@ static int nfs_len;
static char dirfh[NFS_FHSIZE]; /* file handle of directory */
static char filefh[NFS_FHSIZE]; /* file handle of kernel image */
+static int NfsDownloadState;
static IPaddr_t NfsServerIP;
static int NfsSrvMountPort;
static int NfsSrvNfsPort;
@@ -63,7 +64,7 @@ static char *nfs_filename;
static char *nfs_path;
static char nfs_path_buff[2048];
-static __inline__ void
+static __inline__ int
store_block (uchar * src, unsigned offset, unsigned len)
{
ulong newsize = offset + len;
@@ -82,8 +83,7 @@ store_block (uchar * src, unsigned offse
rc = flash_write ((uchar *)src, (ulong)(load_addr+offset), len);
if (rc) {
flash_perror (rc);
- NetState = NETLOOP_FAIL;
- return;
+ return -1;
}
} else
#endif /* CFG_DIRECT_FLASH_NFS */
@@ -93,6 +93,7 @@ store_block (uchar * src, unsigned offse
if (NetBootFileXferSize < (offset+len))
NetBootFileXferSize = newsize;
+ return 0;
}
static char*
@@ -573,7 +574,8 @@ nfs_read_reply (uchar *pkt, unsigned len
}
rlen = ntohl(rpc_pkt.u.reply.data[18]);
- store_block ((uchar *)pkt+sizeof(rpc_pkt.u.reply), nfs_offset, rlen);
+ if ( store_block ((uchar *)pkt+sizeof(rpc_pkt.u.reply), nfs_offset, rlen) )
+ return -9999;
return rlen;
}
@@ -632,7 +634,7 @@ NfsHandler (uchar *pkt, unsigned dest, u
NetState = NETLOOP_FAIL;
} else {
puts ("\ndone\n");
- NetState = NETLOOP_SUCCESS;
+ NetState = NfsDownloadState;
}
break;
@@ -678,6 +680,7 @@ NfsHandler (uchar *pkt, unsigned dest, u
NfsState = STATE_READLINK_REQ;
NfsSend ();
} else {
+ if ( ! rlen ) NfsDownloadState = NETLOOP_SUCCESS;
NfsState = STATE_UMOUNT_REQ;
NfsSend ();
}
@@ -692,6 +695,7 @@ NfsStart (void)
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
+ NfsDownloadState = NETLOOP_FAIL;
NfsServerIP = NetServerIP;
nfs_path = (char *)nfs_path_buff;
next reply other threads:[~2004-12-10 19:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-10 19:03 Hiroshi Ito [this message]
2004-12-14 17:19 ` [U-Boot-Users] Porting U-Boot - SDRAM mode register set command - question Peter Asemann
2005-08-05 23:10 ` [U-Boot-Users] [Patch] bugfix:return value of NFS command Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041211040316M.ito@mlb.co.jp \
--to=ito@mlb.co.jp \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.