From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 6/8] nfs: Use generic progression bar
Date: Thu, 24 Jun 2010 11:35:06 +0200 [thread overview]
Message-ID: <1277372108-30332-7-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1277372108-30332-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
net/nfs.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/nfs.c b/net/nfs.c
index 51df7a3..bdf05bd 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -32,6 +32,7 @@
#include <libgen.h>
#include <fcntl.h>
#include <errno.h>
+#include <progress.h>
#include <linux/err.h>
#define SUNRPC_PORT 111
@@ -123,7 +124,6 @@ struct rpc_t {
} u;
};
-#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */
#define NFS_TIMEOUT 60
static unsigned long rpc_id = 0;
@@ -540,10 +540,10 @@ static int nfs_read_reply(unsigned char *pkt, unsigned len)
data = (uint32_t *)(pkt + sizeof(struct rpc_reply));
- if (nfs_offset && !((nfs_offset) % (NFS_READ_SIZE / 2 * 10 * HASHES_PER_LINE)))
- puts ("\n\t ");
- if (!(nfs_offset % ((NFS_READ_SIZE / 2) * 10)))
- putchar ('#');
+ if (!nfs_offset) {
+ uint32_t filesize = ntohl(net_read_uint32(data + 6));
+ init_progression_bar(filesize);
+ }
rlen = ntohl(net_read_uint32(data + 18));
@@ -629,7 +629,7 @@ static void nfs_handler(char *packet, unsigned len)
nfs_state = STATE_READLINK_REQ;
else
goto err_umount;
-
+ show_progress(nfs_offset);
break;
}
@@ -659,7 +659,7 @@ static void nfs_start(char *p)
nfs_filename = basename (nfs_path);
nfs_path = dirname (nfs_path);
- printf("\nFilename '%s/%s'.\nLoading: ", nfs_path, nfs_filename);
+ printf("\nFilename '%s/%s'.\n", nfs_path, nfs_filename);
nfs_timer_start = get_time_ns();
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2010-06-24 9:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-24 9:35 more network patches Sascha Hauer
2010-06-24 9:35 ` [PATCH 1/8] tftp: remove unused variables Sascha Hauer
2010-06-24 9:35 ` [PATCH 2/8] add progression bar function Sascha Hauer
2010-06-24 9:35 ` [PATCH 3/8] cfi flash driver: Use generic " Sascha Hauer
2010-06-24 9:35 ` [PATCH 4/8] tftp: use generic progression bar Sascha Hauer
2010-06-24 9:35 ` [PATCH 5/8] tftp: Add push support Sascha Hauer
2010-06-24 9:35 ` Sascha Hauer [this message]
2010-06-24 9:35 ` [PATCH 7/8] nfs: resend requests after timeout Sascha Hauer
2010-06-24 9:35 ` [PATCH 8/8] tftp: update doxygen information Sascha Hauer
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=1277372108-30332-7-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox