9
0
Fork 0

nfs: Use generic progression bar

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2010-06-15 10:41:47 +02:00
parent d0548ba506
commit 80c071dd56
1 changed files with 7 additions and 7 deletions

View File

@ -32,6 +32,7 @@
#include <libgen.h> #include <libgen.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <progress.h>
#include <linux/err.h> #include <linux/err.h>
#define SUNRPC_PORT 111 #define SUNRPC_PORT 111
@ -123,7 +124,6 @@ struct rpc_t {
} u; } u;
}; };
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */
#define NFS_TIMEOUT 60 #define NFS_TIMEOUT 60
static unsigned long rpc_id = 0; 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)); data = (uint32_t *)(pkt + sizeof(struct rpc_reply));
if (nfs_offset && !((nfs_offset) % (NFS_READ_SIZE / 2 * 10 * HASHES_PER_LINE))) if (!nfs_offset) {
puts ("\n\t "); uint32_t filesize = ntohl(net_read_uint32(data + 6));
if (!(nfs_offset % ((NFS_READ_SIZE / 2) * 10))) init_progression_bar(filesize);
putchar ('#'); }
rlen = ntohl(net_read_uint32(data + 18)); rlen = ntohl(net_read_uint32(data + 18));
@ -629,7 +629,7 @@ static void nfs_handler(char *packet, unsigned len)
nfs_state = STATE_READLINK_REQ; nfs_state = STATE_READLINK_REQ;
else else
goto err_umount; goto err_umount;
show_progress(nfs_offset);
break; break;
} }
@ -659,7 +659,7 @@ static void nfs_start(char *p)
nfs_filename = basename (nfs_path); nfs_filename = basename (nfs_path);
nfs_path = dirname (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(); nfs_timer_start = get_time_ns();