FreeBSD Bugzilla – Attachment 190740 Details for
Bug 225993
[PATCH] mfiutil: show progress command could be more user-friendly/consistent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Improved "show progress" patch
mfiutil-show-progress-improved-output.patch (text/plain), 1.68 KB, created by
Enji Cooper
on 2018-02-17 21:18:43 UTC
(
hide
)
Description:
Improved "show progress" patch
Filename:
MIME Type:
Creator:
Enji Cooper
Created:
2018-02-17 21:18:43 UTC
Size:
1.68 KB
patch
obsolete
>Index: /usr/src/usr.sbin/mfiutil/mfi_cmd.c >=================================================================== >--- /usr/src/usr.sbin/mfiutil/mfi_cmd.c (revision 325464) >+++ /usr/src/usr.sbin/mfiutil/mfi_cmd.c (working copy) >@@ -29,17 +29,18 @@ > * $FreeBSD$ > */ > >-#include <sys/errno.h> >+#include <sys/param.h> > #include <sys/ioctl.h> >-#include <sys/param.h> > #include <sys/sysctl.h> > #include <sys/uio.h> > > #include <err.h> >+#include <errno.h> > #include <fcntl.h> > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >+#include <time.h> > #include <unistd.h> > > #include "mfiutil.h" >@@ -309,24 +310,32 @@ > return (open(path, acs)); > } > >+static void >+print_time_humanized(uint seconds) >+{ >+ >+ if (seconds > 3600) >+ printf("%u:", seconds / 3600); >+ if (seconds > 60) { >+ seconds %= 3600; >+ printf("%02u:%02u", seconds / 60, seconds % 60); >+ } else >+ printf("%us", seconds); >+} >+ > void > mfi_display_progress(const char *label, struct mfi_progress *prog) > { > uint seconds; > >- printf("%s: %.2f%% complete, after %ds", label, >- (float)prog->progress * 100 / 0xffff, prog->elapsed_seconds); >+ printf("%s: %.2f%% complete after ", label, >+ (float)prog->progress * 100 / 0xffff); >+ print_time_humanized(prog->elapsed_seconds); > if (prog->progress != 0 && prog->elapsed_seconds > 10) { >- printf(" finished in "); >+ printf(". Completion ETA: "); > seconds = (0x10000 * (uint32_t)prog->elapsed_seconds) / > prog->progress - prog->elapsed_seconds; >- if (seconds > 3600) >- printf("%u:", seconds / 3600); >- if (seconds > 60) { >- seconds %= 3600; >- printf("%02u:%02u", seconds / 60, seconds % 60); >- } else >- printf("%us", seconds); >+ print_time_humanized(seconds); > } > printf("\n"); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 225993
:
190740
|
192091