AFS

 view release on metacpan or  search on metacpan

src/AFS.xs  view on Meta::CPAN

    char *name;
{
    int result, len, i;
    char *ptr;

    result = 1;
    ptr = name;
    len = strlen(name);
    for (i = 0; i < len; i++) {
        if (*ptr < '0' || *ptr > '9') {
            result = 0;
            break;
        }
        ptr++;

    }
    return result;

}

int IsPartValid(partId, server, code)
    afs_int32 server, partId, *code;
{
    struct partList dummyPartList;
    int i, success, cnt;


    success = 0;
    *code = 0;

    *code = UV_ListPartitions(server, &dummyPartList, &cnt);
    if (*code)
        return success;
    for (i = 0; i < cnt; i++) {
        if (dummyPartList.partFlags[i] & PARTVALID)
            if (dummyPartList.partId[i] == partId)
                success = 1;
    }
    return success;
}

afs_int32 GetServer(aname)
    char *aname;
{
    register struct hostent *th;
    afs_int32 addr;
    int b1, b2, b3, b4;
    register afs_int32 code;
    char hostname[MAXHOSTCHARS];

    code = sscanf(aname, "%d.%d.%d.%d", &b1, &b2, &b3, &b4);
    if (code == 4) {
        addr = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
        addr = ntohl(addr);     /* convert to host order */
    }
    else {
        th = gethostbyname(aname);
        if (!th)
            return 0;
        /* memcpy(&addr, th->h_addr, sizeof(addr)); */
        Copy(th->h_addr, &addr, th->h_length, char);
    }

    if (addr == htonl(0x7f000001)) {    /* local host */
        code = gethostname(hostname, MAXHOSTCHARS);
        if (code)
            return 0;
        th = gethostbyname(hostname);   /* returns host byte order */
        if (!th)
            return 0;
        /* memcpy(&addr, th->h_addr, sizeof(addr)); */
        Copy(th->h_addr, &addr, th->h_length, char);
    }

    return (addr);
}

 /*sends the contents of file associated with <fd> and <blksize>  to Rx Stream 
    * associated  with <call> */
int SendFile(ufd, call, blksize)
    usd_handle_t ufd;
    register struct rx_call *call;
    long blksize;
{
    char *buffer = (char *) 0;
    afs_int32 error = 0;
    int done = 0;
    afs_uint32 nbytes;

    buffer = (char *) safemalloc(blksize);
    if (!buffer) {
        char buf[256];
        sprintf(buf, "malloc failed\n");
        VSETCODE(-1, buf);
        return -1;
    }

    while (!error && !done) {
#ifndef AFS_NT40_ENV            /* NT csn't select on non-socket fd's */
        fd_set in;
        FD_ZERO(&in);
        FD_SET((long) (ufd->handle), &in);
        /* don't timeout if read blocks */
#ifdef AFS_PTHREAD_ENV
        select(((long) (ufd->handle)) + 1, &in, 0, 0, 0);
#else
        IOMGR_Select(((long) (ufd->handle)) + 1, &in, 0, 0, 0); 
#endif /* AFS_PTHREAD_ENV*/
#endif
        error = USD_READ(ufd, buffer, blksize, &nbytes);
        if (error) {
            char buf[256];
            sprintf(buf, "File system read failed\n");
            VSETCODE(error, buf);
            break;
        }
        if (nbytes == 0) {
            done = 1;
            break;
        }
        if (rx_Write(call, buffer, nbytes) != nbytes) {
            error = -1;
            break;
        }
    }
    if (buffer)
        free(buffer);
    return error;
}

/* function invoked by UV_RestoreVolume, reads the data from rx_trx_stream and
 * writes it out to the volume. */

src/AFS.xs  view on Meta::CPAN

            base = 8;
    }
    else
        base = 10;

    /* compute the # itself */
    while ((tc = *as)) {
        if (!ismeta(tc, base))
            return -1;
        total *= base;
        total += getmeta(tc);
        as++;
    }

    *aval = total;
    return 0;
}
#endif

/* keep those lines small */
static char *em(acode)
    afs_int32 acode;
{
    if (acode == -1)
        return "communications failure (-1)";
    else if (acode == -3)
        return "communications timeout (-3)";
    else
        return (char *) error_message(acode);
}

static struct rx_connection *internal_bos_new(code, hostname, localauth, noauth, aencrypt,
                                              tname)
    int32 *code;
    char *hostname;
    int localauth;
    int noauth;
    int aencrypt;
    char *tname;
{
    struct hostent *th;
    register struct rx_connection *tconn;
    struct rx_securityClass *sc[3];
    int scIndex;
    afs_int32 addr;
    int encryptLevel;
    struct ktc_principal sname;
    struct ktc_token ttoken;

    /* printf("bos DEBUG-1: %s \n", cdir); */
    th = (struct hostent *) hostutil_GetHostByName(hostname);
    if (!th) {
        char buffer[256];
        sprintf(buffer, "AFS::BOS: can't find address for host '%s'\n", hostname);
        *code = -1;
        BSETCODE(code, buffer);
/*         printf("bos DEBUG-1: %s\n", buffer); */
        return NULL;
    }
    /* Copy(th->h_addr, &addr, sizeof(afs_int32), afs_int32); */
    Copy(th->h_addr, &addr, th->h_length, char);

    /* get tokens for making authenticated connections */
    if (!rx_initialized) {
        /* printf("bos DEBUG rx_Init\n"); */
        *code = rx_Init(0);
        if (*code) {
            char buffer[256];
            sprintf(buffer, "AFS::BOS: could not initialize rx (%d)\n", *code);
            BSETCODE(code, buffer);
/*          printf("bos DEBUG-2\n"); */
            return NULL;
        }
    }
    rx_initialized = 1;

    *code = ka_Init(0);
    if (*code) {
        char buffer[256];
        sprintf(buffer, "AFS::BOS: could not initialize ka (%d)\n", *code);
        BSETCODE(code, buffer);
/*          printf("bos DEBUG-3\n"); */
        return NULL;
    }

    if (localauth)
        internal_GetServerConfigDir();
    else
        internal_GetConfigDir();
    /* printf("bos DEBUG-2: %s\n", cdir->name); */

    if (!cdir) {
        *code = errno;
        SETCODE(code);
/*         printf("bos DEBUG-4\n"); */
        return NULL;
    }

    struct afsconf_cell info;

    /* next call expands cell name abbrevs for us and handles looking up
     * local cell */
    *code = internal_GetCellInfo(tname, (char *) 0, &info);
    if (*code) {
        char buffer[256];
        sprintf(buffer, "AFS::BOS %d (can't find cell '%s' in cell database)",
                *code, (tname ? tname : "<default>"));
        BSETCODE(code, buffer);
        /*             printf("bos DEBUG-5\n"); */
        return NULL;
    }

    strcpy(sname.cell, info.name);
    sname.instance[0] = 0;
    strcpy(sname.name, "afs");
    sc[0] = (struct rx_securityClass *) rxnull_NewClientSecurityObject();
    sc[1] = 0;
    sc[2] = (struct rx_securityClass *) NULL;
    scIndex = 0;

    if (!noauth) {              /* not -noauth */

src/AFS.xs  view on Meta::CPAN

        struct ViceIoctl vi;
        int32 code, max = OMAXHOSTS;
        int32 *lp;
        char space[MAXSIZE];

        lp = (int32 *) space;
        *lp++ = in_index;
        *lp = 0x12345678;
        vi.in_size = sizeof(int32) * 2;
        vi.in = (char *) space;
        vi.out_size = MAXSIZE;
        vi.out = space;
        code = pioctl(NULL, VIOCGETCELL, &vi, 1);
        SETCODE(code);
        if (code == 0) {
            struct in_addr *hosts = (struct in_addr *) space;
            /* int32 *magic = (int32 *) space; */
            struct hostent *ht;
            int i;
            char *h;
            /*if (*magic == 0x12345678) { */
            max = MAXHOSTS;
            /*            hosts++; */
            /*    } */
            h = (char *) hosts + max * sizeof(int32);
            XPUSHs(sv_2mortal(newSVpv(h, strlen(h))));
            for (i = 0; i < max; i++) {
                if (hosts[i].s_addr == 0)
                    break;
                if (ip == 0) {
                    ht = gethostbyaddr((const char *) &hosts[i], sizeof(struct in_addr), AF_INET);
                    if (ht == NULL)
                        h = (char *) inet_ntoa(hosts[i]);
                    else
                        h = ht->h_name;
                }
                else {
                    h = (char *) inet_ntoa(hosts[i]);
                }
                XPUSHs(sv_2mortal(newSVpv(h, strlen(h))));
            }

        }
    }

void
fs__get_server_version(port,hostName="localhost",verbose=0)
        short port
        char *hostName
        int32 verbose
    CODE:
    {
#if defined(AFS_3_4)
        not_here("AFS::Utils::get_server_version");
#else
        struct sockaddr_in taddr;
        struct in_addr hostAddr;
        struct hostent *th;
        int32 host;
        short port_num = htons(port);
        int32 length = 64;
        int32 code;
        char version[64];
        int s;

          /* lookup host */
        if (hostName) {
            th = (struct hostent *) hostutil_GetHostByName(hostName);
            if (!th) {
                warn("rxdebug: host %s not found in host table\n", hostName);
                SETCODE(EFAULT);
                XSRETURN_UNDEF;
            }
            /* bcopy(th->h_addr, &host, sizeof(int32)); */
            Copy(th->h_addr, &host, th->h_length, char);
        }
        else
            host = htonl(0x7f000001);   /* IP localhost */

        hostAddr.s_addr = host;
        if (verbose)
            printf("Trying %s (port %d):\n", inet_ntoa(hostAddr), ntohs(port_num));

        s = socket(AF_INET, SOCK_DGRAM, 0);
        taddr.sin_family = AF_INET;
        taddr.sin_port = 0;
        taddr.sin_addr.s_addr = 0;

        code = bind(s, (struct sockaddr *) &taddr, sizeof(struct sockaddr_in));
        SETCODE(code);
        if (code) {
            perror("bind");
            XSRETURN_UNDEF;
        }

        code = rx_GetServerVersion(s, host, port_num, length, version);
        ST(0) = sv_newmortal();
        if (code < 0) {
            SETCODE(code);
        }
        else {
            sv_setpv(ST(0), version);
        }
#endif
    }

void
fs_get_syslib_version()
    CODE:
    {
        extern char *AFSVersion;

        ST(0) = sv_newmortal();
        sv_setpv(ST(0), AFSVersion);
    }

void
fs_XSVERSION()
    CODE:
    {
        ST(0) = sv_newmortal();
        sv_setpv(ST(0), xs_version);
    }

void
fs_sysname(newname=0)
        char *  newname
    CODE:
    {
        struct ViceIoctl vi;
        int32 code, set;
        char space[MAXSIZE];

        set = (newname && *newname);

        vi.in = space;
        bcopy(&set, space, sizeof(set));
        vi.in_size = sizeof(set);
        if (set) {
            strcpy(space + sizeof(set), newname);
            vi.in_size += strlen(newname) + 1;
        }
        vi.out_size = MAXSIZE;
        vi.out = (caddr_t) space;
        code = pioctl(NULL, VIOC_AFS_SYSNAME, &vi, 0);
        SETCODE(code);
        ST(0) = sv_newmortal();
        if (code == 0) {
            sv_setpv(ST(0), space + sizeof(set));
        }
    }

void
fs_getcrypt()
    CODE:
    {

src/AFS.xs  view on Meta::CPAN

        }

        partition = volutil_GetPartitionID(parti);
        if (partition < 0) {
            char buffer[256];
            sprintf(buffer, "AFS::VOS: could not interpret partition name '%s'\n", parti);
            VSETCODE(ENOENT, buffer);
            goto done;
        }

        volid = vsu_GetVolumeID(id, cstruct, &err);     /* -id */
        if (!volid) {
            char buffer[256];
            if (err)
                set_errbuff(buffer, err);
            else
                sprintf(buffer, "Unknown volume ID or name '%s'\n", servername);
            VSETCODE(err ? err : -1, buffer);
            goto done;
        }

        code = UV_SetVolume(server, partition, volid, ITOffline, 0 /*online */ , 0 /*sleep */ );
        if (code) {
            char buffer[256];
            sprintf(buffer, "Failed to set volume. Code = %d\n", code);
            VSETCODE(code, buffer);
            goto done;
        }
        SETCODE(0);
        RETVAL = 1;

        done:
        ;
    }
    OUTPUT:
        RETVAL

void
vos__backupsys(cstruct, seenprefix=Nullsv, servername=NULL, partition=NULL, exclude=Nullsv, seenxprefix=Nullsv, noaction=Nullsv)
        AFS::VOS cstruct
        SV *  seenprefix
        char *servername
        char *partition
        SV *  exclude
        SV *  seenxprefix
        SV *  noaction
    PREINIT:
        int32 apart=0, avolid;
        int32 aserver=0, code, aserver1, apart1;
        int32 vcode, iexclude=0, inoaction=0;
        struct VldbListByAttributes attributes;
        nbulkentries arrayEntries;
        register struct nvldbentry *vllist;
        int32 nentries;
        int j, i, len, verbose = 1;
        afs_int32 totalBack=0;
        afs_int32 totalFail=0;
        int previdx=-1, error, same;
        char *ccode, *itp;
        int match = 0;
        STRLEN prfxlength=0;
        SV *regex;
        AV *av;
        AV *av1 = (AV*)sv_2mortal((SV*)newAV());
        AV *av2 = (AV*)sv_2mortal((SV*)newAV());
    PPCODE:
    {
        /* printf("vos-backupsys DEBUG-1 server %s part %s exclude %d noaction %d \n", servername, partition, (int)SvIV(exclude), (int)SvIV(noaction)); */
        if (!exclude)
            exclude = newSViv(0);
        if (!noaction)
            noaction = newSViv(0);
        if ((!SvIOKp(exclude))) {
            char buffer[256];
            sprintf(buffer, "Flag \"exclude\" should be numeric.\n");
            VSETCODE(EINVAL, buffer);
            XSRETURN_UNDEF;
        }
        else
            iexclude = SvIV(exclude);         /* -exclude */
        /* printf("vos-backupsys DEBUG-2: iexclude = %d \n", iexclude); */
        if ((!SvIOKp(noaction))) {
            char buffer[256];
            sprintf(buffer, "Flag \"noaction\" should be numeric.\n");
            VSETCODE(EINVAL, buffer);
            XSRETURN_UNDEF;
        }
        else
            inoaction = SvIV(noaction);       /* -noaction */

        Zero(&attributes, 1, VldbListByAttributes);
        attributes.Mask = 0;
        /* printf("vos-backupsys DEBUG-3\n"); */

        if (servername && (strlen(servername) != 0)) {  /* -server */
            /* printf("vos-backupsys DEBUG-4\n"); */
            aserver = GetServer(servername);
            if (aserver == 0) {
                char buffer[256];
                sprintf(buffer, "AFS::VOS: server '%s' not found in host table\n", servername);
                VSETCODE(-1, buffer);
                XSRETURN_UNDEF;
            }
            attributes.server = ntohl(aserver);
            attributes.Mask |= VLLIST_SERVER;
        }
        else {
            servername = NULL;
        }

        /* printf("vos-backupsys DEBUG-5\n"); */
        if (partition && (strlen(partition) != 0)) {    /* -partition */
            /* printf("vos-backupsys DEBUG-6\n"); */
            apart = volutil_GetPartitionID(partition);
            if (apart < 0) {
                char buffer[256];
                sprintf(buffer, "AFS::VOS: could not interpret partition name '%s'\n", partition);
                VSETCODE(-1, buffer);
                XSRETURN_UNDEF;
            }
            attributes.partition = apart;
            attributes.Mask |= VLLIST_PARTITION;
        }
        else {
            partition = NULL;
        }

        /* printf("vos-backupsys DEBUG-7\n"); */
            /* Check to make sure the prefix and xprefix expressions compile ok */
        if (seenprefix && (prfxlength = sv_len(seenprefix)) == 0)
            seenprefix = NULL;
        /* printf("vos-backupsys DEBUG-7-1 PrfxLen %d\n", prfxlength); */

        if (seenprefix && (! (SvTYPE(SvRV(seenprefix)) == SVt_PVAV))) {
            VSETCODE(-1, "AFS::VOS: PREFIX not an array reference");
            XSRETURN_UNDEF;
        }

        if (seenprefix) {
            av = (AV *) SvRV(seenprefix);
            len = av_len(av);
            /* printf("vos-backupsys DEBUG-7-2 Len %d\n", len); */
            if (len != -1) {
                for (j = 0; j <= len; j++) {
                    regex = *av_fetch(av, j, 0);
                    itp = SvPV_nolen(regex);
                    if (strncmp(itp, "^", 1) == 0) {
                        ccode = (char *) re_comp(itp);
                        if (ccode) {
                            char buffer[256];
                            sprintf(buffer,
                                    "Unrecognizable PREFIX regular expression: '%s': %s\n", itp,
                                    ccode);
                            VSETCODE(ccode, buffer);
                            XSRETURN_UNDEF;
                        }
                    }
                }                       /*for loop */
            /* printf("vos-backupsys DEBUG-8 RE %s \n", itp); */
            }
        }

        /* printf("vos-backupsys DEBUG-9\n"); */
        if (seenxprefix && (prfxlength = sv_len(seenxprefix)) == 0)
            seenxprefix = NULL;
        /* printf("vos-backupsys DEBUG-10\n"); */

        if (seenxprefix && (! (SvTYPE(SvRV(seenxprefix)) == SVt_PVAV))) {
            VSETCODE(-1, "AFS::VOS: XPREFIX not an array reference");
            XSRETURN_UNDEF;
        }
        if (seenxprefix) {
            /* printf("vos-backupsys DEBUG-11\n"); */
            av = (AV *) SvRV(seenxprefix);
            len = av_len(av);
            if (len != -1) {
                for (j = 0; j <= len; j++) {
                    regex = *av_fetch(av, j, 0);
                    itp = SvPV_nolen(regex);
                    if (strncmp(itp, "^", 1) == 0) {
                        ccode = (char *) re_comp(itp);
                        if (ccode) {
                            char buffer[256];
                            sprintf(buffer,
                                    "Unrecognizable XPREFIX regular expression: '%s': %s\n", itp,
                                    ccode);
                            VSETCODE(ccode, buffer);
                            XSRETURN_UNDEF;
                        }
                    }
                }                       /*for */
            }
        }

        /* printf("vos-backupsys DEBUG-12\n"); */
        Zero(&arrayEntries, 1, nbulkentries);   /* initialize to hint the stub to alloc space */
        vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
        if (vcode) {
            VSETCODE(vcode, "Could not access the VLDB for attributes");
            XSRETURN_UNDEF;
        }

            /* a bunch of output generation code deleted. A.W. */

        /* printf("vos-backupsys DEBUG-13\n"); */
        for (j = 0; j < nentries; j++) {        /* process each vldb entry */
            vllist = &arrayEntries.nbulkentries_val[j];
            /* printf("vos-backupsys DEBUG-13-1 Name %s\n", vllist->name); */

            if (seenprefix) {
                av = (AV *) SvRV(seenprefix);
                len = av_len(av);
                /* printf("vos-backupsys DEBUG-14 Len %d\n", len); */
                for (i = 0; i <= len; i++) {
                    regex = *av_fetch(av, i, 0);
                    itp = SvPV_nolen(regex);
                    /* printf("vos-backupsys DEBUG-14-1 RE %s \n", itp); */
                    if (strncmp(itp, "^", 1) == 0) {
                        ccode = (char *) re_comp(itp);
                        if (ccode) {
                            char buffer[256];
                            sprintf(buffer, "Error in PREFIX regular expression: '%s': %s\n",
                                    itp, ccode);
                            VSETCODE(ccode, buffer);

src/AFS.xs  view on Meta::CPAN

                safe_hv_store(status, vllist->name, strlen(vllist->name), newRV_inc((SV *) (stats)),
                         0);
            }
            if (arrayEntries.nbulkentries_val)
                free(arrayEntries.nbulkentries_val);
        }

        finish:
        /* printf("DEBUG-19 \n"); */
        SETCODE(0);
        ST(0) = sv_2mortal(newRV_inc((SV *) status));
        XSRETURN(1);
    }

void
vldb_listaddrs(cstruct, host=NULL, uuid=NULL, noresolve=0, printuuid=0)
        AFS::VLDB cstruct
        char *host
        char *uuid
        int noresolve
        int printuuid
    PREINIT:
        afs_int32 vcode;
        afs_int32 i, j;
        afs_int32            nentries;
        bulkaddrs            m_addrs;
        ListAddrByAttributes m_attrs;
        afsUUID              m_uuid, askuuid;
        afs_int32            m_unique, m_nentries;
    PPCODE:
    {
        Zero(&m_attrs, 1, ListAddrByAttributes);
        m_attrs.Mask = VLADDR_INDEX;

        Zero(&m_addrs, 1, bulkaddrs);
        Zero(&askuuid, 1, afsUUID);
#ifdef OpenAFS
        if (uuid && strlen(uuid) != 0) {
            /* -uuid */
            afsUUID_from_string(uuid, &askuuid);
            m_attrs.Mask = VLADDR_UUID;
            m_attrs.uuid = askuuid;
        }
        else
#endif
            uuid = NULL;

        if (host && strlen(host) != 0) {
            /* -host */
            struct hostent *he;
            afs_int32 saddr;
            he = (struct hostent *) hostutil_GetHostByName(host);
            if (he == (struct hostent *) 0) {
                char buffer[256];
                sprintf(buffer, "Can't get host info for '%s'\n", host);
                VSETCODE(-1, buffer);
                XSRETURN_UNDEF;
            }
            /*memcpy(&saddr, he->h_addr, 4); */
            /* Copy(he->h_addr, &saddr, sizeof(afs_int32), afs_int32); */
            Copy(he->h_addr, &saddr, he->h_length, char);
            m_attrs.Mask = VLADDR_IPADDR;
            m_attrs.ipaddr = ntohl(saddr);
        }
        else
            host = NULL;

        m_addrs.bulkaddrs_val = 0;
        m_addrs.bulkaddrs_len = 0;

        vcode = ubik_Call_New(VL_GetAddrs, cstruct, 0, 0, 0, &m_unique, &nentries, &m_addrs);
        if (vcode) {
            char buffer[256];
            sprintf(buffer, "AFS::VLDB: could not list the server addresses\n");
            VSETCODE(vcode, buffer);
            XSRETURN_UNDEF;
        }

        m_nentries = 0;
        m_addrs.bulkaddrs_val = 0;
        m_addrs.bulkaddrs_len = 0;
        i = 1;
        j = 0;
        while (1) {
            HV *addr = (HV *) sv_2mortal((SV *) newHV());
            m_attrs.index = i;

            vcode = ubik_Call_New(VL_GetAddrsU, cstruct, 0, &m_attrs, &m_uuid,
                                  &m_unique, &m_nentries, &m_addrs);
            if (vcode == VL_NOENT) {
                i++;
                nentries++;
                continue;
            }

            if (vcode == VL_INDEXERANGE) {
                vcode = 0;
                break;
            }

            if (vcode) {
                char buffer[256];
                sprintf(buffer, "AFS::VLDB: could not list the server addresses\n");
                VSETCODE(vcode, buffer);
                XSRETURN_UNDEF;
            }

            myprint_addrs(addr, &m_addrs, &m_uuid, m_nentries, printuuid, noresolve);
            XPUSHs(sv_2mortal(newRV_inc((SV *) (addr))));
            i++;
            j++;

            if (host || uuid || (i > nentries))
                break;
        }

        SETCODE(vcode);
        XSRETURN(j);
    }

void
vldb__delentry(cstruct, volume=NULL, prfx=NULL, server=NULL, partition=NULL, noexecute=0)
        AFS::VLDB cstruct
        SV* volume
        char *prfx
        char *server
        char *partition
        int noexecute
    PREINIT:
        afs_int32 apart;
        afs_int32 avolid;
        afs_int32 vcode = 0;
        struct VldbListByAttributes attributes;
        nbulkentries arrayEntries;
        register struct nvldbentry *vllist;
        SV *vol;
        char *itp;
        afs_int32 nentries;
        int j;
        char prefix[VOLSER_MAXVOLNAME+1];
        int seenprefix=0;
        STRLEN volumelength=0;
        afs_int32 totalBack=0, totalFail=0, err;
        AV *av;
    PPCODE:
    {
        if (prfx && strlen(prfx) == 0)
            prfx = NULL;
        if (partition && strlen(partition) == 0)
            partition = NULL;
        if (server && strlen(server) == 0)
            server = NULL;

        if (volume && (volumelength = sv_len(volume)) == 0)
            volume = NULL;

        if (volume && (! (SvTYPE(SvRV(volume)) == SVt_PVAV))) {
            VSETCODE(-1, "AFS::VLDB: VOLUME not array reference");
            XSRETURN_UNDEF;
        }

        if (volume) {                       /* -id */
            int len;
            if (prfx || server || partition) {
                VSETCODE(-1, "You cannot use SERVER, PARTITION, or PREFIX with the VOLUME argument");
                XSRETURN_UNDEF;
            }
            av = (AV *) SvRV(volume);
            len = av_len(av);
            if (len != -1) {
                for (j = 0; j <= len; j++) {
                    vol = *av_fetch(av, j, 0);
                    itp = SvPV_nolen(vol);
                    if (itp) {
                        avolid = vsu_GetVolumeID(itp, cstruct, &err);
                        if (avolid == 0) {
                            char buffer[256];
                            if (err)
                                set_errbuff(buffer, err);
                            else
                                sprintf(buffer, "AFS::VLDB: can't find volume '%s'\n", itp);
                            VSETCODE(err ? err : -1, buffer);
                            continue;
                        }
                        if (noexecute) {        /* -noexecute */
                            fprintf(STDOUT, "Would have deleted VLDB entry for %s \n", itp);
                            fflush(STDOUT);
                            continue;
                        }
                        vcode = ubik_Call(VL_DeleteEntry, cstruct, 0, avolid, RWVOL);
                        if (vcode) {
                            char buffer[256];
                            sprintf(buffer, "Could not delete entry for volume %s\n"
                                    "You must specify a RW volume name or ID "
                                    "(the entire VLDB entry will be deleted)\n", itp);
                            VSETCODE(vcode, buffer);
                            totalFail++;
                            continue;
                        }
                        totalBack++;
                    }
                }                       /* for */
            }                           /* len */
            EXTEND(sp, 2);
            PUSHs(sv_2mortal(newSViv(totalBack)));
            PUSHs(sv_2mortal(newSViv(totalFail)));
            goto done;
        }                               /* id */

        if (!prfx && !server && !partition) {
            VSETCODE(-1, "You must specify an argument");
            XSRETURN_UNDEF;
        }



( run in 1.277 second using v1.01-cache-2.11-cpan-437f7b0c052 )