示例#1
0
static void
retrieve_ownership__rx(errval_t status, struct retrieve_rpc_st *st)
{
    caplock_unlock(st->cap);
    st->result_handler(status, st->st);
    free(st);
}
示例#2
0
static void
revoke_result__rx(errval_t result,
                  struct revoke_master_st *st,
                  bool locked)
{
    DEBUG_CAPOPS("%s\n", __FUNCTION__);
    errval_t err;

    if (locked) {
        caplock_unlock(st->cap);
    }

    if (err_is_ok(result)) {
        // clear the remote copies bit
        err = monitor_domcap_remote_relations(st->cap.croot, st->cap.cptr,
                                              st->cap.bits, 0, RRELS_COPY_BIT,
                                              NULL);
        if (err_is_fail(err) && err_no(err) != SYS_ERR_CAP_NOT_FOUND) {
            DEBUG_ERR(err, "resetting remote copies bit after revoke");
        }
    }

    DEBUG_CAPOPS("%s ## revocation completed, calling %p\n", __FUNCTION__,
                 st->result_handler);

    st->result_handler(result, st->st);
    free(st);
}
示例#3
0
void
capops_retrieve(struct domcapref cap,
                move_result_handler_t result_handler,
                void *st)
{
    errval_t err;

    distcap_state_t state;
    err = dom_cnode_get_state(cap, &state);
    GOTO_IF_ERR(err, report_error);
    if (distcap_state_is_busy(state)) {
        err = MON_ERR_REMOTE_CAP_RETRY;
    }
    if (distcap_state_is_foreign(state)) {
        err = MON_ERR_CAP_FOREIGN;
    }
    GOTO_IF_ERR(err, report_error);

    err = monitor_lock_cap(cap.croot, cap.cptr, cap.bits);
    GOTO_IF_ERR(err, report_error);

    struct retrieve_rpc_st *rst = NULL;
    err = calloce(1, sizeof(*rst), &rst);
    GOTO_IF_ERR(err, unlock_cap);

    rst->cap = cap;
    rst->result_handler = result_handler;
    rst->st = st;

    err = monitor_get_domcap_owner(cap, &rst->prev_owner);
    GOTO_IF_ERR(err, free_st);

    if (rst->prev_owner == my_core_id) {
        err = SYS_ERR_OK;
        goto free_st;
    }

    retrieve_owner__enq(rst);

    return;

free_st:
    free(rst);

unlock_cap:
    caplock_unlock(cap);

report_error:
    result_handler(err, st);
}