diff options
Diffstat (limited to 'sg_pt_linux.c')
-rw-r--r-- | sg_pt_linux.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/sg_pt_linux.c b/sg_pt_linux.c index 4d51d7dc..ff56879b 100644 --- a/sg_pt_linux.c +++ b/sg_pt_linux.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2006 Douglas Gilbert. + * Copyright (c) 2005-2007 Douglas Gilbert. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ * */ -/* version 1.01 2006/1/9 */ +/* version 1.02 2007/1/21 */ #include <stdio.h> #include <stdlib.h> @@ -90,7 +90,8 @@ void * construct_scsi_pt_obj() { struct sg_pt_linux_scsi * ptp; - ptp = malloc(sizeof(struct sg_pt_linux_scsi)); + ptp = (struct sg_pt_linux_scsi *) + malloc(sizeof(struct sg_pt_linux_scsi)); if (ptp) { memset(ptp, 0, sizeof(struct sg_pt_linux_scsi)); ptp->io_hdr.interface_id = 'S'; @@ -101,7 +102,7 @@ void * construct_scsi_pt_obj() void destruct_scsi_pt_obj(void * vp) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; if (ptp) free(ptp); @@ -109,7 +110,7 @@ void destruct_scsi_pt_obj(void * vp) void set_scsi_pt_cdb(void * vp, const unsigned char * cdb, int cdb_len) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; if (ptp->io_hdr.cmdp) ++ptp->in_err; @@ -120,7 +121,7 @@ void set_scsi_pt_cdb(void * vp, const unsigned char * cdb, int cdb_len) void set_scsi_pt_sense(void * vp, unsigned char * sense, int max_sense_len) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; if (ptp->io_hdr.sbp) ++ptp->in_err; @@ -132,7 +133,7 @@ void set_scsi_pt_sense(void * vp, unsigned char * sense, void set_scsi_pt_data_in(void * vp, /* from device */ unsigned char * dxferp, int dxfer_len) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; if (ptp->io_hdr.dxferp) ++ptp->in_err; @@ -146,7 +147,7 @@ void set_scsi_pt_data_in(void * vp, /* from device */ void set_scsi_pt_data_out(void * vp, /* to device */ const unsigned char * dxferp, int dxfer_len) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; if (ptp->io_hdr.dxferp) ++ptp->in_err; @@ -159,14 +160,14 @@ void set_scsi_pt_data_out(void * vp, /* to device */ void set_scsi_pt_packet_id(void * vp, int pack_id) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; ptp->io_hdr.pack_id = pack_id; } void set_scsi_pt_tag(void * vp, int tag) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; ++ptp->in_err; tag = tag; /* dummy to silence compiler */ @@ -174,7 +175,7 @@ void set_scsi_pt_tag(void * vp, int tag) void set_scsi_pt_task_management(void * vp, int tmf_code) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; ++ptp->in_err; tmf_code = tmf_code; /* dummy to silence compiler */ @@ -182,7 +183,7 @@ void set_scsi_pt_task_management(void * vp, int tmf_code) void set_scsi_pt_task_attr(void * vp, int attribute, int priority) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; ++ptp->in_err; attribute = attribute; /* dummy to silence compiler */ @@ -191,7 +192,7 @@ void set_scsi_pt_task_attr(void * vp, int attribute, int priority) int do_scsi_pt(void * vp, int fd, int time_secs, int verbose) { - struct sg_pt_linux_scsi * ptp = vp; + struct sg_pt_linux_scsi * ptp = (struct sg_pt_linux_scsi *)vp; if (NULL == sg_warnings_strm) sg_warnings_strm = stderr; @@ -242,7 +243,7 @@ int do_scsi_pt(void * vp, int fd, int time_secs, int verbose) int get_scsi_pt_result_category(const void * vp) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; int dr_st = ptp->io_hdr.driver_status & SG_LIB_DRIVER_MASK; int scsi_st = ptp->io_hdr.status & 0x7e; @@ -264,42 +265,42 @@ int get_scsi_pt_result_category(const void * vp) int get_scsi_pt_resid(const void * vp) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; return ptp->io_hdr.resid; } int get_scsi_pt_status_response(const void * vp) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; return ptp->io_hdr.status; } int get_scsi_pt_sense_len(const void * vp) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; return ptp->io_hdr.sb_len_wr; } int get_scsi_pt_duration_ms(const void * vp) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; return ptp->io_hdr.duration; } int get_scsi_pt_transport_err(const void * vp) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; return (ptp->io_hdr.host_status << 8) + ptp->io_hdr.driver_status; } int get_scsi_pt_os_err(const void * vp) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; return ptp->os_err; } @@ -335,7 +336,7 @@ static const char * linux_driver_suggests[] = { char * get_scsi_pt_transport_err_str(const void * vp, int max_b_len, char * b) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; int ds = ptp->io_hdr.driver_status; int hs = ptp->io_hdr.host_status; int n, m; @@ -376,7 +377,7 @@ char * get_scsi_pt_transport_err_str(const void * vp, int max_b_len, char * b) char * get_scsi_pt_os_err_str(const void * vp, int max_b_len, char * b) { - const struct sg_pt_linux_scsi * ptp = vp; + const struct sg_pt_linux_scsi * ptp = (const struct sg_pt_linux_scsi *)vp; const char * cp; cp = safe_strerror(ptp->os_err); |