AFS

 view release on metacpan or  search on metacpan

src/AFS.xs  view on Meta::CPAN

    int totalOK, totalNotOK, totalBusy;

    myDisplayFormat(volinfo, pntr, server, part, &totalOK, &totalNotOK, &totalBusy, 0);
    return;
}

static void DisplayVolumes(partition, server, part, pntr, count, fast)
    HV *partition;
    afs_int32 server, part;
    volintInfo *pntr;
    afs_int32 count, fast;
{
    int totalOK, totalNotOK, totalBusy, i;
    char buff[32];

    totalOK = 0;
    totalNotOK = 0;
    totalBusy = 0;
    qInit(&busyHead);
    qInit(&notokHead);
    for (i = 0; i < count; i++) {
        HV *vol = (HV *) sv_2mortal((SV *) newHV());
        myDisplayFormat(vol, pntr, server, part, &totalOK, &totalNotOK, &totalBusy, fast);
        if (pntr->status == VOK) {
            safe_hv_store(partition, pntr->name, strlen(pntr->name), newRV_inc((SV *) (vol)), 0);
        }
        else if (pntr->status == VBUSY) {
            sprintf(buff, "volume_busy_%d", i);
            safe_hv_store(partition, buff, strlen(buff), newRV_inc((SV *) (vol)), 0);
            /* fprintf(STDERR, "DEBUG-1: %s %d\n", buff, strlen(buff)); */
        }
        else {
            sprintf(buff, "volume_notok_%d", i);
            safe_hv_store(partition, buff, strlen(buff), newRV_inc((SV *) (vol)), 0);
            /* fprintf(STDERR, "DEBUG-2: %s %d\n", buff, strlen(buff)); */
        }
        pntr++;
    }
    if (!fast) {
        safe_hv_store(partition, " totalOK", 8, newSViv(totalOK), 0);
        safe_hv_store(partition, " totalBusy", 10, newSViv(totalBusy), 0);
        safe_hv_store(partition, " totalNotOK", 11, newSViv(totalNotOK), 0);
    }
}

static void XDisplayVolumes(part, a_servID, a_partID, a_xInfoP, a_count)
    HV *part;
    afs_int32 a_servID;
    afs_int32 a_partID;
    volintXInfo *a_xInfoP;
    afs_int32 a_count;

{                               /*XDisplayVolumes */

    int totalOK;                /*Total OK volumes */
    int totalNotOK;             /*Total screwed volumes */
    int totalBusy;              /*Total busy volumes */
    int i;                      /*Loop variable */
    char buff[32];

    /* Initialize counters and (global!!) queues.*/
    totalOK = 0;
    totalNotOK = 0;
    totalBusy = 0;
    qInit(&busyHead);
    qInit(&notokHead);

    /* Display each volume in the list.*/
    for (i = 0; i < a_count; i++) {
        HV *vol = (HV *) sv_2mortal((SV *) newHV());
        myXDisplayFormat(vol,
                         a_xInfoP,
                         a_servID,
                         a_partID, &totalOK, &totalNotOK, &totalBusy);
        if (a_xInfoP->status == VOK) {
            safe_hv_store(part, a_xInfoP->name, strlen(a_xInfoP->name), newRV_inc((SV *) (vol)), 0);
        }
        else if (a_xInfoP->status == VBUSY) {
            sprintf(buff, "volume_busy_%d", i);
            safe_hv_store(part, buff, strlen(buff), newRV_inc((SV *) (vol)), 0);
            /* fprintf(STDERR, "DEBUG-1: %s %d\n", buff, strlen(buff)); */
        }
        else {
            sprintf(buff, "volume_notok_%d", i);
            safe_hv_store(part, buff, strlen(buff), newRV_inc((SV *) (vol)), 0);
            /* fprintf(STDERR, "DEBUG-2: %s %d\n", buff, strlen(buff)); */
        }
        a_xInfoP++;
    }

    /* If any volumes were found to be busy or screwed, display them.*/
    safe_hv_store(part, " totalOK", 8, newSViv(totalOK), 0);
    safe_hv_store(part, " totalBusy", 10, newSViv(totalBusy), 0);
    safe_hv_store(part, " totalNotOK", 11, newSViv(totalNotOK), 0);
}                               /*XDisplayVolumes */
/* end of helper functions for VOS class */


/* helper functions for VLDB class: */

void myEnumerateEntry(stats, entry)
    HV *stats;
    struct nvldbentry *entry;
{
    int i;
    char pname[10];
    char hostname[256];
    int isMixed = 0;
    AV *av = (AV *) sv_2mortal((SV *) newAV());

    if (entry->flags & RW_EXISTS)
        safe_hv_store(stats, "RWrite", 6, newSViv(entry->volumeId[RWVOL]), 0);
    if (entry->flags & RO_EXISTS)
        safe_hv_store(stats, "ROnly", 5, newSViv(entry->volumeId[ROVOL]), 0);
    if (entry->flags & BACK_EXISTS)
        safe_hv_store(stats, "Backup", 6, newSViv(entry->volumeId[BACKVOL]), 0);
    if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS))
        safe_hv_store(stats, "cloneId", 7, newSViv(entry->cloneId), 0);

    safe_hv_store(stats, "nServers", 8, newSViv(entry->nServers), 0);



( run in 3.553 seconds using v1.01-cache-2.11-cpan-437f7b0c052 )