aboutsummaryrefslogtreecommitdiff
path: root/src/sgp_dd.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-01-04 06:17:04 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-01-04 06:17:04 +0000
commit6a2fe0f14972e955e466a0d36f3a8b1d15dc3fcc (patch)
tree11f749ae8399d179dda5d6c84a7f842957c45ad3 /src/sgp_dd.c
parent2f7e361640305f7bfa1addb5c8419562a45676a7 (diff)
downloadsg3_utils-6a2fe0f14972e955e466a0d36f3a8b1d15dc3fcc.tar.gz
sg_raw: add --cmdset option to bypass cdb heuristic, add --scan= first_opcode,last_opcode; bug fixes
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@872 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sgp_dd.c')
-rw-r--r--src/sgp_dd.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/sgp_dd.c b/src/sgp_dd.c
index 3975f038..cda52d3b 100644
--- a/src/sgp_dd.c
+++ b/src/sgp_dd.c
@@ -1,7 +1,7 @@
/* A utility program for copying files. Specialised for "files" that
* represent devices that understand the SCSI command set.
*
- * Copyright (C) 1999 - 2020 D. Gilbert and P. Allworth
+ * Copyright (C) 1999 - 2021 D. Gilbert and P. Allworth
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
@@ -84,7 +84,7 @@
#include "sg_pr2serr.h"
-static const char * version_str = "5.76 20200510";
+static const char * version_str = "5.77 20210103";
#define DEF_BLOCK_SIZE 512
#define DEF_BLOCKS_PER_TRANSFER 128
@@ -229,14 +229,17 @@ static atomic_uint ascending_val;
static pthread_mutex_t av_mut = PTHREAD_MUTEX_INITIALIZER;
static int ascending_val = 1;
-#define GET_NEXT_PACK_ID(_v) \
- ( { int _r; \
- do { \
- pthread_mutex_lock(&av_mut); \
- _r = ascending_val; \
- ascending_val += _v; \
- pthread_mutex_lock(&av_mut); \
- } while (0) ; _r; } )
+static unsigned int
+GET_NEXT_PACK_ID(unsigned int val)
+{
+ int res;
+
+ pthread_mutex_lock(&av_mut);
+ res = ascending_val;
+ ascending_val += val;
+ pthread_mutex_unlock(&av_mut);
+ return res;
+}
#endif