Beispiel #1
0
int main(int argc, char **argv)
{
    nzb_file *file = malloc(sizeof(nzb_file));
    FILE *fp;
    int ret, bytes;
    segment_t *segment;
    
    char *data;

   
    data = malloc(2048576);
    fp = fopen(argv[1], "r");
    if (fp == NULL)
        return -1;
    
    bytes = fread(data, sizeof(char), 2048576, fp);
    fclose(fp);

    segment = segment_create();
    segment->data = data;
    segment->bytes = bytes;
    segment->number = 1;
    
    file->storage_path = strdup("tmp/complete/");
    file->temporary_path = strdup("tmp/chunks/");
    
    yenc_decode(segment);
    file_write_chunk(segment, file);
    
    return 0;
}
/*-----------------------------------------------------------*/
int allocateHaloexchangeData(int sizeofBuffer){

    GASPI(segment_create(0, sizeofBuffer*sizeof(int)*6, GASPI_GROUP_ALL, GASPI_BLOCK, GASPI_ALLOC_DEFAULT));
    char* ptr;
    GASPI(segment_ptr(0, (gaspi_pointer_t*)&ptr));

    leftSendBuf = (int *)ptr;
    ptr += sizeofBuffer * sizeof(int);
    leftRecvBuf = (int *)ptr;
    ptr += sizeofBuffer * sizeof(int);
    rightSendBuf = (int *)ptr;
    ptr += sizeofBuffer * sizeof(int);
    rightRecvBuf = (int *)ptr;
    ptr += sizeofBuffer * sizeof(int);
    finalLeftBuf = (int *)ptr;
    ptr += sizeofBuffer * sizeof(int);
    finalRightBuf = (int *)ptr;

	return 0;
}