static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun,

                                          int evpd, int pc, Error **errp)

{

    int full_size;

    struct scsi_task *task = NULL;

    task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, 64);

    if (task == NULL || task->status != SCSI_STATUS_GOOD) {

        goto fail;

    }

    full_size = scsi_datain_getfullsize(task);

    if (full_size > task->datain.size) {

        scsi_free_scsi_task(task);



        /* we need more data for the full list */

        task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, full_size);

        if (task == NULL || task->status != SCSI_STATUS_GOOD) {

            goto fail;

        }

    }



    return task;



fail:

    error_setg(errp, "iSCSI: Inquiry command failed : %s",

               iscsi_get_error(iscsi));

    if (task) {

        scsi_free_scsi_task(task);

        return NULL;

    }

    return NULL;

}

static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun,

                                          int evpd, int pc, Error **errp)

{

    int full_size;

    struct scsi_task *task = NULL;

    task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, 64);

    if (task == NULL || task->status != SCSI_STATUS_GOOD) {

        goto fail;

    }

    full_size = scsi_datain_getfullsize(task);

    if (full_size > task->datain.size) {

        scsi_free_scsi_task(task);



        

        task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, full_size);

        if (task == NULL || task->status != SCSI_STATUS_GOOD) {

            goto fail;

        }

    }



    return task;



fail:

    error_setg(errp, "iSCSI: Inquiry command failed : %s",

               iscsi_get_error(iscsi));

    if (task) {

        scsi_free_scsi_task(task);

        return NULL;

    }

    return NULL;

}

static struct scsi_task *FUNC_0(struct iscsi_context *VAR_0, int VAR_1,

                                          int VAR_2, int VAR_3, Error **VAR_4)

{

    int VAR_5;

    struct scsi_task *VAR_6 = NULL;

    VAR_6 = iscsi_inquiry_sync(VAR_0, VAR_1, VAR_2, VAR_3, 64);

    if (VAR_6 == NULL || VAR_6->status != SCSI_STATUS_GOOD) {

        goto fail;

    }

    VAR_5 = scsi_datain_getfullsize(VAR_6);

    if (VAR_5 > VAR_6->datain.size) {

        scsi_free_scsi_task(VAR_6);



        

        VAR_6 = iscsi_inquiry_sync(VAR_0, VAR_1, VAR_2, VAR_3, VAR_5);

        if (VAR_6 == NULL || VAR_6->status != SCSI_STATUS_GOOD) {

            goto fail;

        }

    }



    return VAR_6;



fail:

    error_setg(VAR_4, "iSCSI: Inquiry command failed : %s",

               iscsi_get_error(VAR_0));

    if (VAR_6) {

        scsi_free_scsi_task(VAR_6);

        return NULL;

    }

    return NULL;

}

static struct scsi_task *FUNC_0(struct iscsi_context *VAR_0, int VAR_1,
int VAR_2, int VAR_3, Error **VAR_4)
{ int VAR_5; struct scsi_task *VAR_6 = NULL; VAR_6 = iscsi_inquiry_sync(VAR_0, VAR_1, VAR_2, VAR_3, 64); if (VAR_6 == NULL || VAR_6->status != SCSI_STATUS_GOOD) { goto fail; } VAR_5 = scsi_datain_getfullsize(VAR_6); if (VAR_5 > VAR_6->datain.size) { scsi_free_scsi_task(VAR_6); VAR_6 = iscsi_inquiry_sync(VAR_0, VAR_1, VAR_2, VAR_3, VAR_5); if (VAR_6 == NULL || VAR_6->status != SCSI_STATUS_GOOD) { goto fail; } } return VAR_6; fail:
error_setg(VAR_4, "iSCSI: Inquiry command failed : %s",
iscsi_get_error(VAR_0)); if (VAR_6) { scsi_free_scsi_task(VAR_6); return NULL; } return NULL; }