コード例 #1
0
static void
re_probe (ConnCacheEntry *e)
{
    Listitem *item;
    struct timeval tv;

    assert (e->probe != NULL);

    gettimeofday (&tv, NULL);
    if (e->probe_le) {
	listdel (connprobelist, e->probe_le);
	e->probe_next = min(tv.tv_sec + (1 << e->ntries), e->probe_next);
    } else
	e->probe_next = tv.tv_sec + (1 << e->ntries);

    if (e->ntries <= MAX_RETRIES)
	++e->ntries;

    for (item = listhead (connprobelist);
	 item;
	 item = listnext (connprobelist, item)) {
	ConnCacheEntry *this = (ConnCacheEntry *)listdata (item);

	if (e->probe_next < this->probe_next) {
	    e->probe_le = listaddbefore (connprobelist, item, e);
	    LWP_NoYieldSignal (connprobelist);
	    return;
	}
    }
    e->probe_le = listaddtail (connprobelist, e);
    LWP_NoYieldSignal (connprobelist);
}
コード例 #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;
}