aboutsummaryrefslogtreecommitdiff
path: root/src/sg_sanitize.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2022-06-25 04:05:14 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2022-06-25 04:05:14 +0000
commit2e225c87784735360e9619766efe06782179a86a (patch)
tree1df2832c733c55207261b829ec7f0146287afe82 /src/sg_sanitize.c
parenta3eb530bb4b93949287f19a2b6fb418901f1f699 (diff)
downloadsg3_utils-2e225c87784735360e9619766efe06782179a86a.tar.gz
sg_rem_rest_elem: new utility for removing or restoring elements; bug fixes
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@955 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_sanitize.c')
-rw-r--r--src/sg_sanitize.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/sg_sanitize.c b/src/sg_sanitize.c
index 41db4bba..74c33f2f 100644
--- a/src/sg_sanitize.c
+++ b/src/sg_sanitize.c
@@ -33,19 +33,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.18 20220127";
-
-/* Not all environments support the Unix sleep() */
-#if defined(MSC_VER) || defined(__MINGW32__)
-#define HAVE_MS_SLEEP
-#endif
-#ifdef HAVE_MS_SLEEP
-#include <windows.h>
-#define sleep_for(seconds) Sleep( (seconds) * 1000)
-#else
-#define sleep_for(seconds) sleep(seconds)
-#endif
-
+static const char * version_str = "1.19 20220608";
#define ME "sg_sanitize: "
@@ -720,20 +708,8 @@ main(int argc, char * argv[])
sg_put_unaligned_be16((uint16_t)op->ipl, wBuff + 2);
}
- if ((! op->quick) && (! op->fail)) {
- printf("\nA SANITIZE will commence in 15 seconds\n");
- printf(" ALL data on %s will be DESTROYED\n", device_name);
- printf(" Press control-C to abort\n");
- sleep_for(5);
- printf("\nA SANITIZE will commence in 10 seconds\n");
- printf(" ALL data on %s will be DESTROYED\n", device_name);
- printf(" Press control-C to abort\n");
- sleep_for(5);
- printf("\nA SANITIZE will commence in 5 seconds\n");
- printf(" ALL data on %s will be DESTROYED\n", device_name);
- printf(" Press control-C to abort\n");
- sleep_for(5);
- }
+ if ((! op->quick) && (! op->fail))
+ sg_warn_and_wait("SANITIZE", device_name, true);
ret = do_sanitize(sg_fd, op, wBuff, param_lst_len);
if (ret) {
@@ -747,7 +723,7 @@ main(int argc, char * argv[])
pr2serr("Due to --dry-run option, leave poll loop\n");
break;
}
- sleep_for(POLL_DURATION_SECS);
+ sg_sleep_secs(POLL_DURATION_SECS);
memset(rsBuff, 0x0, sizeof(rsBuff));
res = sg_ll_request_sense(sg_fd, op->desc, rsBuff, sizeof(rsBuff),
1, vb);