static int nbd_handle_list(NBDClient *client, uint32_t length)

{

    int csock;

    NBDExport *exp;



    csock = client->sock;

    if (length) {

        if (drop_sync(csock, length) != length) {

            return -EIO;

        }

        return nbd_send_rep(csock, NBD_REP_ERR_INVALID, NBD_OPT_LIST);

    }



    /* For each export, send a NBD_REP_SERVER reply. */

    QTAILQ_FOREACH(exp, &exports, next) {

        if (nbd_send_rep_list(csock, exp)) {

            return -EINVAL;

        }

    }

    /* Finish with a NBD_REP_ACK. */

    return nbd_send_rep(csock, NBD_REP_ACK, NBD_OPT_LIST);

}

static int nbd_handle_list(NBDClient *client, uint32_t length)

{

    int csock;

    NBDExport *exp;



    csock = client->sock;

    if (length) {

        if (drop_sync(csock, length) != length) {

            return -EIO;

        }

        return nbd_send_rep(csock, NBD_REP_ERR_INVALID, NBD_OPT_LIST);

    }



    

    QTAILQ_FOREACH(exp, &exports, next) {

        if (nbd_send_rep_list(csock, exp)) {

            return -EINVAL;

        }

    }

    

    return nbd_send_rep(csock, NBD_REP_ACK, NBD_OPT_LIST);

}

static int FUNC_0(NBDClient *VAR_0, uint32_t VAR_1)

{

    int VAR_2;

    NBDExport *exp;



    VAR_2 = VAR_0->sock;

    if (VAR_1) {

        if (drop_sync(VAR_2, VAR_1) != VAR_1) {

            return -EIO;

        }

        return nbd_send_rep(VAR_2, NBD_REP_ERR_INVALID, NBD_OPT_LIST);

    }



    

    QTAILQ_FOREACH(exp, &exports, next) {

        if (nbd_send_rep_list(VAR_2, exp)) {

            return -EINVAL;

        }

    }

    

    return nbd_send_rep(VAR_2, NBD_REP_ACK, NBD_OPT_LIST);

}

static int FUNC_0(NBDClient *VAR_0, uint32_t VAR_1)
{ int VAR_2; NBDExport *exp; VAR_2 = VAR_0->sock; if (VAR_1) { if (drop_sync(VAR_2, VAR_1) != VAR_1) { return -EIO; } return nbd_send_rep(VAR_2, NBD_REP_ERR_INVALID, NBD_OPT_LIST); } QTAILQ_FOREACH(exp, &exports, next) { if (nbd_send_rep_list(VAR_2, exp)) { return -EINVAL; } } return nbd_send_rep(VAR_2, NBD_REP_ACK, NBD_OPT_LIST); }