Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/sbin/raidctl Pull up revision 1.37 (requested by oster in...



details:   https://anonhg.NetBSD.org/src/rev/85968963f44f
branches:  netbsd-3
changeset: 575929:85968963f44f
user:      tron <tron%NetBSD.org@localhost>
date:      Sat May 28 13:50:16 2005 +0000

description:
Pull up revision 1.37 (requested by oster in ticket #347):
Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues.  (Thanks to beefy and pooka, among others)

diffstat:

 sbin/raidctl/raidctl.c |  27 +++++----------------------
 1 files changed, 5 insertions(+), 22 deletions(-)

diffs (81 lines):

diff -r 836e7b841792 -r 85968963f44f sbin/raidctl/raidctl.c
--- a/sbin/raidctl/raidctl.c    Sat May 28 13:48:25 2005 +0000
+++ b/sbin/raidctl/raidctl.c    Sat May 28 13:50:16 2005 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: raidctl.c,v 1.36 2005/02/09 14:21:37 xtraeme Exp $   */
+/*      $NetBSD: raidctl.c,v 1.36.2.1 2005/05/28 13:50:16 tron Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: raidctl.c,v 1.36 2005/02/09 14:21:37 xtraeme Exp $");
+__RCSID("$NetBSD: raidctl.c,v 1.36.2.1 2005/05/28 13:50:16 tron Exp $");
 #endif
 
 
@@ -864,21 +864,18 @@
 do_meter(int fd, u_long option)
 {
        int percent_done;
-       int last_value;
-       int start_value;
+       RF_uint64 start_value;
        RF_ProgressInfo_t progressInfo;
        void *pInfoPtr;
        struct timeval start_time;
-       struct timeval last_time;
        struct timeval current_time;
        double elapsed;
        int elapsed_sec;
        int elapsed_usec;
        int simple_eta,last_eta;
        double rate;
-       int amount;
+       RF_uint64 amount;
        int tbit_value;
-       int wait_for_more_data;
        char buffer[1024];
        char bar_buffer[1024];
        char eta_buffer[1024];
@@ -892,12 +889,9 @@
 
        percent_done = 0;
        do_ioctl(fd, option, &pInfoPtr, "");
-       last_value = progressInfo.completed;
-       start_value = last_value;
-       last_time = start_time;
+       start_value = progressInfo.completed;
        current_time = start_time;
        
-       wait_for_more_data = 0;
        tbit_value = 0;
        while(progressInfo.completed < progressInfo.total) {
 
@@ -920,9 +914,6 @@
 
                if (amount <= 0) { /* we don't do negatives (yet?) */
                        amount = 0;
-                       wait_for_more_data = 1;
-               } else {
-                       wait_for_more_data = 0;
                }
 
                if (elapsed == 0)
@@ -952,14 +943,6 @@
                write(fileno(stdout),buffer,strlen(buffer));
                fflush(stdout);
 
-               /* resolution wasn't high enough... wait until we get another
-                  timestamp and perhaps more "work" done. */
-
-               if (!wait_for_more_data) {
-                       last_time = current_time;
-                       last_value = progressInfo.completed;
-               }
-
                if (++tbit_value>3) 
                        tbit_value = 0;
 



Home | Main Index | Thread Index | Old Index