apps/vm/components/helloworld/src/hello.c
/*
    vchantests_vm_burst:
        Send big chunks of data to vm, tests blocking and data sizes larger than the buffer
*/
Send big chunks of data to vm, tests blocking and data sizes larger than the buffer
Send big chunks of data to vm tests blocking and data sizes larger than the buffer
int vchantests_vm_burst(libvchan_t *ctrl) {
    int x, res, ack = 0;
    int *buffer = (int *) malloc(VM_BURST_CHUNK_INTS * sizeof(int));
    assert(buffer != NULL);
    DHELL("vm_burst: planning to write %d bytes to vm client\n", VM_BURST_CHUNK_INTS * sizeof(int));
    for(x = 0; x < VM_BURST_NUM_SENDS; x++) {
        int key = vm_burst_base_nums[x % 4];
        vchantests_vm_burst_init_buf(x, buffer, VM_BURST_CHUNK_INTS);
        DHELL("vm_burst: sending key %x\n", key);
        res = libvchan_send(ctrl, &key, sizeof(int));
        assert(res == sizeof(int));
        DHELL("vm_burst: sending data\n");
        res = libvchan_send(ctrl, buffer, VM_BURST_CHUNK_INTS * sizeof(int));
        assert(res == VM_BURST_CHUNK_INTS * sizeof(int));
        DHELL("vm_burst: waiting for ack\n");
        res = libvchan_recv(ctrl, &ack, sizeof(int));
        assert(res == sizeof(int));
        assert(ack == VM_BURST_CHECKSUM);
        DHELL("vm_burst: done\n");
    }
    return 0;
}
int vchantests_vm_burst ( libvchan_t * ctrl ) { int x , res , ack = 0 ; int * buffer = ( int * ) malloc ( VM_BURST_CHUNK_INTS * sizeof ( int ) ) ; assert ( buffer != NULL ) ; DHELL ( " \n " , VM_BURST_CHUNK_INTS * sizeof ( int ) ) ; for ( x = 0 ; x < VM_BURST_NUM_SENDS ; x ++ ) { int key = vm_burst_base_nums [ x % 4 ] ; vchantests_vm_burst_init_buf ( x , buffer , VM_BURST_CHUNK_INTS ) ; DHELL ( " \n " , key ) ; res = libvchan_send ( ctrl , & key , sizeof ( int ) ) ; assert ( res == sizeof ( int ) ) ; DHELL ( " \n " ) ; res = libvchan_send ( ctrl , buffer , VM_BURST_CHUNK_INTS * sizeof ( int ) ) ; assert ( res == VM_BURST_CHUNK_INTS * sizeof ( int ) ) ; DHELL ( " \n " ) ; res = libvchan_recv ( ctrl , & ack , sizeof ( int ) ) ; assert ( res == sizeof ( int ) ) ; assert ( ack == VM_BURST_CHECKSUM ) ; DHELL ( " \n " ) ; } return 0 ; }
vchantests_vm_burst:
Send big chunks of data to vm, tests blocking and data sizes larger than the buffer
vchantests_vm_burst : Send big chunks of data to vm tests blocking and data sizes larger than the buffer