static int nbd_send_option_request(QIOChannel *ioc, uint32_t opt,

                                   uint32_t len, const char *data,

                                   Error **errp)

{

    nbd_option req;

    QEMU_BUILD_BUG_ON(sizeof(req) != 16);



    if (len == -1) {

        req.length = len = strlen(data);

    }

    TRACE("Sending option request %" PRIu32", len %" PRIu32, opt, len);



    stq_be_p(&req.magic, NBD_OPTS_MAGIC);

    stl_be_p(&req.option, opt);

    stl_be_p(&req.length, len);



    if (write_sync(ioc, &req, sizeof(req), errp) < 0) {

        error_prepend(errp, "Failed to send option request header");

        return -1;

    }



    if (len && write_sync(ioc, (char *) data, len, errp) < 0) {

        error_prepend(errp, "Failed to send option request data");

        return -1;

    }



    return 0;

}

static int nbd_send_option_request(QIOChannel *ioc, uint32_t opt,

                                   uint32_t len, const char *data,

                                   Error **errp)

{

    nbd_option req;

    QEMU_BUILD_BUG_ON(sizeof(req) != 16);



    if (len == -1) {

        req.length = len = strlen(data);

    }

    TRACE("Sending option request %" PRIu32", len %" PRIu32, opt, len);



    stq_be_p(&req.magic, NBD_OPTS_MAGIC);

    stl_be_p(&req.option, opt);

    stl_be_p(&req.length, len);



    if (write_sync(ioc, &req, sizeof(req), errp) < 0) {

        error_prepend(errp, "Failed to send option request header");

        return -1;

    }



    if (len && write_sync(ioc, (char *) data, len, errp) < 0) {

        error_prepend(errp, "Failed to send option request data");

        return -1;

    }



    return 0;

}

static int FUNC_0(QIOChannel *VAR_0, uint32_t VAR_1,

                                   uint32_t VAR_2, const char *VAR_3,

                                   Error **VAR_4)

{

    nbd_option req;

    QEMU_BUILD_BUG_ON(sizeof(req) != 16);



    if (VAR_2 == -1) {

        req.length = VAR_2 = strlen(VAR_3);

    }

    TRACE("Sending option request %" PRIu32", VAR_2 %" PRIu32, VAR_1, VAR_2);



    stq_be_p(&req.magic, NBD_OPTS_MAGIC);

    stl_be_p(&req.option, VAR_1);

    stl_be_p(&req.length, VAR_2);



    if (write_sync(VAR_0, &req, sizeof(req), VAR_4) < 0) {

        error_prepend(VAR_4, "Failed to send option request header");

        return -1;

    }



    if (VAR_2 && write_sync(VAR_0, (char *) VAR_3, VAR_2, VAR_4) < 0) {

        error_prepend(VAR_4, "Failed to send option request VAR_3");

        return -1;

    }



    return 0;

}

static int FUNC_0(QIOChannel *VAR_0, uint32_t VAR_1,
uint32_t VAR_2, const char *VAR_3,
Error **VAR_4)
{ nbd_option req; QEMU_BUILD_BUG_ON(sizeof(req) != 16); if (VAR_2 == -1) { req.length = VAR_2 = strlen(VAR_3); } TRACE("Sending option request %" PRIu32", VAR_2 %" PRIu32, VAR_1, VAR_2); stq_be_p(&req.magic, NBD_OPTS_MAGIC); stl_be_p(&req.option, VAR_1); stl_be_p(&req.length, VAR_2); if (write_sync(VAR_0, &req, sizeof(req), VAR_4) < 0) { error_prepend(VAR_4, "Failed to send option request header"); return -1; } if (VAR_2 && write_sync(VAR_0, (char *) VAR_3, VAR_2, VAR_4) < 0) { error_prepend(VAR_4, "Failed to send option request VAR_3"); return -1; } return 0; }