Exemplo n.º 1
0
static void
break_callback (struct ropa_cb *cb, struct ropa_client *caller, Bool break_own)
{
    struct ropa_ccpair *cc;
    struct ropa_ccpair *own_cc = NULL;

    assert (cb);
    assert (cb->ccpairs);

    mlog_log (MDEBROPA, "break_callback: breaking callback %x.%x.%x (%d)",
	    cb->fid.Volume, cb->fid.Vnode, cb->fid.Unique, break_own);

    callback_ref (cb);
    if (caller)
	client_ref (caller);

    while ((cc = listdelhead (cb->ccpairs)) != 0) {
	assert (cc->cb == cb);
	cc->cb_li = NULL;
	if (break_own)
	    break_ccpair (cc, cc->client != caller);
	else
	    if (cc->client == caller)
		own_cc = cc;
	    else
		break_ccpair (cc, TRUE);
    }

    if (own_cc)
	own_cc->cb_li = listaddhead (cb->ccpairs, own_cc);

    callback_deref (cb);
    if (caller)
	client_deref (caller);
}
Exemplo n.º 2
0
int
VOLSER_AFSVolListVolumes(struct rx_call *call,
			 const int32_t partID,
			 const int32_t flags,
			 volEntries *resultEntries)
{
    int ret = 0;
    List *vollist;
    Listitem *item;
    volume_handle *vh;
    struct dp_part *dp;
    int numvol;
    int i;

    mlog_log(MDEBVOLDB, "VOLSER_AFSVolListVolumes");

    ret = dp_create (partID, &dp);
    if (ret)
	goto out;

    ret = vld_list_volumes(dp, &vollist);
    if (ret)
	goto free_part;

    numvol = 0;

    item = listhead(vollist);
    while (item) {
	numvol++;
	item = listnext(vollist, item);
    }

    resultEntries->len = numvol;
    
    resultEntries->val = calloc(sizeof(struct volintInfo) * resultEntries->len, 1);

    i = 0;
    while (!listemptyp(vollist)) {
	vh = (volume_handle *) listdelhead(vollist);
	assert(vh);
	ret = vld_info_uptodatep (vh);
	assert(ret == 0);
	copy_volumeinfo(&resultEntries->val[i], vh, partID);
	vld_free (vh);
	i++;
    }

    free(vollist);

 free_part:
    dp_free (dp);

 out:
    VOLSER_EXIT;
    
    return ret;
}
Exemplo n.º 3
0
static ConnCacheEntry *
get_free_connection (void)
{
    ConnCacheEntry *e;

    e = (ConnCacheEntry *)listdelhead (connfreelist);
    if (e != NULL)
	return e;

    hashtabforeach (connhtab, clear_conn, NULL);

    e = (ConnCacheEntry *)listdelhead (connfreelist);
    if (e != NULL)
	return e;

    create_new_connections (CONNFREELISTINC);

    e = (ConnCacheEntry *)listdelhead (connfreelist);
    if (e != NULL)
	return e;

    arla_errx (1, ADEBERROR,
	       "conncache: there was no way of getting a connection");
}