Remove the discard_const() macro
Declare dynamically allocated strings as 'char *' instead of 'const char *'. Remove the discard_const() macro. Do not test whether or not a pointer is NULL before calling free() because it is allowed to pass NULL to free(). Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
@@ -37,10 +37,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int showluns;
|
int showluns;
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-ls";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-ls";
|
||||||
|
|
||||||
@@ -318,7 +314,7 @@ int main(int argc, char *argv[])
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
struct client_state state;
|
struct client_state state;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
int c;
|
int c;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
|
|
||||||
@@ -384,9 +380,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
iscsi_url = iscsi_parse_portal_url(iscsi, url);
|
iscsi_url = iscsi_parse_portal_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -31,10 +31,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MIN
|
#ifndef MIN
|
||||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -549,12 +549,12 @@ EXTERN int iscsi_logout_sync(struct iscsi_context *iscsi);
|
|||||||
|
|
||||||
struct iscsi_target_portal {
|
struct iscsi_target_portal {
|
||||||
struct iscsi_target_portal *next;
|
struct iscsi_target_portal *next;
|
||||||
const char *portal;
|
char *portal;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct iscsi_discovery_address {
|
struct iscsi_discovery_address {
|
||||||
struct iscsi_discovery_address *next;
|
struct iscsi_discovery_address *next;
|
||||||
const char *target_name;
|
char *target_name;
|
||||||
struct iscsi_target_portal *portals;
|
struct iscsi_target_portal *portals;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -89,14 +89,14 @@ iscsi_free_discovery_addresses(struct iscsi_context *iscsi, struct iscsi_discove
|
|||||||
while (addresses != NULL) {
|
while (addresses != NULL) {
|
||||||
struct iscsi_discovery_address *next = addresses->next;
|
struct iscsi_discovery_address *next = addresses->next;
|
||||||
|
|
||||||
iscsi_free(iscsi, discard_const(addresses->target_name));
|
iscsi_free(iscsi, addresses->target_name);
|
||||||
addresses->target_name = NULL;
|
addresses->target_name = NULL;
|
||||||
|
|
||||||
while (addresses->portals != NULL) {
|
while (addresses->portals != NULL) {
|
||||||
struct iscsi_target_portal *next_portal = addresses->portals->next;
|
struct iscsi_target_portal *next_portal = addresses->portals->next;
|
||||||
|
|
||||||
iscsi_free(iscsi, discard_const(addresses->portals->portal));
|
iscsi_free(iscsi, addresses->portals->portal);
|
||||||
iscsi_free(iscsi, discard_const(addresses->portals));
|
iscsi_free(iscsi, addresses->portals);
|
||||||
|
|
||||||
addresses->portals = next_portal;
|
addresses->portals = next_portal;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1828,11 +1828,12 @@ void iscsi_free_discovery_data(struct iscsi_context *iscsi _U_,
|
|||||||
|
|
||||||
while (da->portals) {
|
while (da->portals) {
|
||||||
struct iscsi_target_portal *ponext = da->portals->next;
|
struct iscsi_target_portal *ponext = da->portals->next;
|
||||||
free(discard_const(da->portals->portal));
|
|
||||||
|
free(da->portals->portal);
|
||||||
free(da->portals);
|
free(da->portals);
|
||||||
da->portals = ponext;
|
da->portals = ponext;
|
||||||
}
|
}
|
||||||
free(discard_const(da->target_name));
|
free(da->target_name);
|
||||||
free(da);
|
free(da);
|
||||||
da = danext;
|
da = danext;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,10 +298,8 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
|
|||||||
if (sdev->iscsi_url) {
|
if (sdev->iscsi_url) {
|
||||||
time_t current_time = time(NULL);
|
time_t current_time = time(NULL);
|
||||||
|
|
||||||
if (sdev->error_str != NULL) {
|
free(sdev->error_str);
|
||||||
free(discard_const(sdev->error_str));
|
sdev->error_str = NULL;
|
||||||
sdev->error_str = NULL;
|
|
||||||
}
|
|
||||||
task = iscsi_scsi_command_sync(sdev->iscsi_ctx, sdev->iscsi_lun, task, NULL);
|
task = iscsi_scsi_command_sync(sdev->iscsi_ctx, sdev->iscsi_lun, task, NULL);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
sdev->error_str = strdup(iscsi_get_error(sdev->iscsi_ctx));
|
sdev->error_str = strdup(iscsi_get_error(sdev->iscsi_ctx));
|
||||||
@@ -372,9 +370,7 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
|
|||||||
if(ioctl(sdev->sgio_fd, SG_IO, &io_hdr) < 0){
|
if(ioctl(sdev->sgio_fd, SG_IO, &io_hdr) < 0){
|
||||||
int err = errno;
|
int err = errno;
|
||||||
|
|
||||||
if (sdev->error_str != NULL) {
|
free(sdev->error_str);
|
||||||
free(discard_const(sdev->error_str));
|
|
||||||
}
|
|
||||||
if (asprintf(&sdev->error_str, "SG_IO ioctl failed: %s",
|
if (asprintf(&sdev->error_str, "SG_IO ioctl failed: %s",
|
||||||
strerror(err)) < 0)
|
strerror(err)) < 0)
|
||||||
sdev->error_str = NULL;
|
sdev->error_str = NULL;
|
||||||
@@ -401,18 +397,14 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
|
|||||||
task->sense.key,
|
task->sense.key,
|
||||||
scsi_sense_ascq_str(task->sense.ascq),
|
scsi_sense_ascq_str(task->sense.ascq),
|
||||||
task->sense.ascq);
|
task->sense.ascq);
|
||||||
if (sdev->error_str != NULL) {
|
free(sdev->error_str);
|
||||||
free(discard_const(sdev->error_str));
|
|
||||||
}
|
|
||||||
sdev->error_str = strdup(buf);
|
sdev->error_str = strdup(buf);
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(io_hdr.status == SCSI_STATUS_RESERVATION_CONFLICT){
|
if(io_hdr.status == SCSI_STATUS_RESERVATION_CONFLICT){
|
||||||
task->status = SCSI_STATUS_RESERVATION_CONFLICT;
|
task->status = SCSI_STATUS_RESERVATION_CONFLICT;
|
||||||
if (sdev->error_str != NULL) {
|
free(sdev->error_str);
|
||||||
free(discard_const(sdev->error_str));
|
|
||||||
}
|
|
||||||
sdev->error_str = strdup("Reservation Conflict");
|
sdev->error_str = strdup("Reservation Conflict");
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
@@ -422,9 +414,7 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
|
|||||||
task->sense.key = 0x0f;
|
task->sense.key = 0x0f;
|
||||||
task->sense.ascq = 0xffff;
|
task->sense.ascq = 0xffff;
|
||||||
|
|
||||||
if (sdev->error_str != NULL) {
|
free(sdev->error_str);
|
||||||
free(discard_const(sdev->error_str));
|
|
||||||
}
|
|
||||||
sdev->error_str = strdup("SCSI masked error");
|
sdev->error_str = strdup("SCSI masked error");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -434,9 +424,7 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
|
|||||||
task->sense.ascq = 0xffff;
|
task->sense.ascq = 0xffff;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "SCSI host error. Status=0x%x", io_hdr.host_status);
|
snprintf(buf, sizeof(buf), "SCSI host error. Status=0x%x", io_hdr.host_status);
|
||||||
if (sdev->error_str != NULL) {
|
free(sdev->error_str);
|
||||||
free(discard_const(sdev->error_str));
|
|
||||||
}
|
|
||||||
sdev->error_str = strdup(buf);
|
sdev->error_str = strdup(buf);
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
@@ -445,9 +433,7 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
|
|||||||
task->sense.key = 0x0f;
|
task->sense.key = 0x0f;
|
||||||
task->sense.ascq = 0xffff;
|
task->sense.ascq = 0xffff;
|
||||||
|
|
||||||
if (sdev->error_str != NULL) {
|
free(sdev->error_str);
|
||||||
free(discard_const(sdev->error_str));
|
|
||||||
}
|
|
||||||
sdev->error_str = strdup("SCSI driver error");
|
sdev->error_str = strdup("SCSI driver error");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern const char *initiatorname1;
|
extern const char *initiatorname1;
|
||||||
extern const char *initiatorname2;
|
extern const char *initiatorname2;
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,6 @@
|
|||||||
#include "iscsi-private.h"
|
#include "iscsi-private.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-header-digest";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-header-digest";
|
||||||
|
|
||||||
struct client_state {
|
struct client_state {
|
||||||
@@ -136,7 +132,7 @@ int main(int argc, char *argv[])
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
struct client_state state;
|
struct client_state state;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
int c;
|
int c;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
|
|
||||||
@@ -210,10 +206,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -37,10 +37,6 @@
|
|||||||
#include "iscsi-private.h"
|
#include "iscsi-private.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-noop-reply";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-noop-reply";
|
||||||
|
|
||||||
struct client_state {
|
struct client_state {
|
||||||
@@ -136,7 +132,7 @@ int main(int argc, char *argv[])
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
struct client_state state;
|
struct client_state state;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
int c;
|
int c;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
|
|
||||||
@@ -210,10 +206,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -34,10 +34,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-readwrite-iov";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-readwrite-iov";
|
||||||
|
|
||||||
void print_usage(void)
|
void print_usage(void)
|
||||||
@@ -84,7 +80,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
int c, i, count;
|
int c, i, count;
|
||||||
|
|
||||||
@@ -156,10 +152,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -34,10 +34,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-readwrite-iov";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-readwrite-iov";
|
||||||
|
|
||||||
void print_usage(void)
|
void print_usage(void)
|
||||||
@@ -75,7 +71,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_iovec iov[4];
|
struct scsi_iovec iov[4];
|
||||||
@@ -152,10 +148,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -34,10 +34,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-reconnect";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-reconnect";
|
||||||
|
|
||||||
struct client_state {
|
struct client_state {
|
||||||
@@ -194,7 +190,7 @@ int main(int argc, char *argv[])
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
struct client_state state;
|
struct client_state state;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
int i, c;
|
int i, c;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
struct scsi_readcapacity10 *rc10;
|
struct scsi_readcapacity10 *rc10;
|
||||||
@@ -270,10 +266,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -34,10 +34,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-reconnect-timeout";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-reconnect-timeout";
|
||||||
|
|
||||||
struct client_state {
|
struct client_state {
|
||||||
@@ -217,7 +213,7 @@ int main(int argc, char *argv[])
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
struct client_state state;
|
struct client_state state;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
int i, c;
|
int i, c;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
struct scsi_readcapacity10 *rc10;
|
struct scsi_readcapacity10 *rc10;
|
||||||
@@ -293,10 +289,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -38,10 +38,6 @@
|
|||||||
#include "iscsi-private.h"
|
#include "iscsi-private.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-timeout";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:prog-timeout";
|
||||||
|
|
||||||
void print_usage(void)
|
void print_usage(void)
|
||||||
@@ -108,7 +104,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
int c;
|
int c;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
@@ -182,9 +178,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -31,10 +31,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-inq";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-inq";
|
||||||
|
|
||||||
void inquiry_block_limits(struct scsi_inquiry_block_limits *inq)
|
void inquiry_block_limits(struct scsi_inquiry_block_limits *inq)
|
||||||
@@ -236,7 +232,7 @@ void print_help(void)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
int evpd = 0, pagecode = 0;
|
int evpd = 0, pagecode = 0;
|
||||||
int show_help = 0, show_usage = 0, debug = 0;
|
int show_help = 0, show_usage = 0, debug = 0;
|
||||||
@@ -312,10 +308,8 @@ int main(int argc, char *argv[])
|
|||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ WSADATA wsaData;
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int showluns;
|
int showluns;
|
||||||
int useurls;
|
int useurls;
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-ls";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-ls";
|
||||||
@@ -349,7 +345,7 @@ int main(int argc, char *argv[])
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
struct client_state state;
|
struct client_state state;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
int i;
|
int i;
|
||||||
static int show_help = 0, show_usage = 0, debug = 0;
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
|
|
||||||
@@ -418,10 +414,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
iscsi_url = iscsi_parse_portal_url(iscsi, url);
|
iscsi_url = iscsi_parse_portal_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -26,10 +26,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-readcapacity16";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-readcapacity16";
|
||||||
|
|
||||||
void print_usage(void)
|
void print_usage(void)
|
||||||
@@ -59,7 +55,7 @@ void print_help(void)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
int show_help = 0, show_usage = 0, debug = 0, size_only=0;
|
int show_help = 0, show_usage = 0, debug = 0, size_only=0;
|
||||||
int c;
|
int c;
|
||||||
@@ -134,10 +130,8 @@ int main(int argc, char *argv[])
|
|||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
if (url) {
|
free(url);
|
||||||
free(discard_const(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
@@ -30,10 +30,6 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-swp";
|
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-swp";
|
||||||
|
|
||||||
|
|
||||||
@@ -65,7 +61,7 @@ void print_help(void)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
const char *url = NULL;
|
char *url = NULL;
|
||||||
struct iscsi_url *iscsi_url = NULL;
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
int show_help = 0, show_usage = 0, debug = 0;
|
int show_help = 0, show_usage = 0, debug = 0;
|
||||||
int c;
|
int c;
|
||||||
@@ -148,8 +144,8 @@ int main(int argc, char *argv[])
|
|||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||||
|
|
||||||
free(discard_const(url));
|
free(url);
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user