[Ocfs2-tools-devel] [PATCH 03/18] libtools-internal: Create an API for displaying a progress bar.
Joel Becker
Joel.Becker at oracle.com
Fri Jan 9 16:12:55 PST 2009
On Mon, Jan 05, 2009 at 06:33:39PM -0800, Joel Becker wrote:
> libtools-internal gets an API for displaying progress in a progress bar.
> The progress bar has some nice features:
>
> - It checks the terminal size and adjusts the output accordingly
> - It updates only when something has changed, and only every 1/8s.
> - It is integrated with verbosef() and tools_interact(), such that it
> is cleared before they write something, and redisplayed when they are
> done.
>
> See include/tools-internal/progress.h for information on using the API.
This is the patch to fix the spinner so it goes at the right
speed.
>From 7395744eab0b2ec5b8195828b6231c9b6c44e56f Mon Sep 17 00:00:00 2001
From: Joel Becker <joel.becker at oracle.com>
Date: Thu, 8 Jan 2009 18:12:27 -0800
Subject: [PATCH 2/6] libtools-internal: Ratelimit the spinner.
The code to ratelimit our progress bar was broken for the spinner.
Fix it.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
libtools-internal/progress.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libtools-internal/progress.c b/libtools-internal/progress.c
index d294117..b712af0 100644
--- a/libtools-internal/progress.c
+++ b/libtools-internal/progress.c
@@ -558,8 +558,8 @@ void tools_progress_step(struct tools_progress *prog, unsigned int step)
if (!check_percent(prog))
return;
- if (!check_tick() &&
- (prog->p_percent != 0) && (prog->p_percent != 100))
+ if (!check_tick() && (prog->p_percent != 100) &&
+ (!prog->p_count || (prog->p_percent != 0)))
return;
if (!prog->p_count)
--
1.5.6.5
--
"Where are my angels?
Where's my golden one?
And where is my hope
Now that my heroes are gone?"
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-tools-devel
mailing list