home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / test / io / description / debug27.c < prev    next >
C/C++ Source or Header  |  2005-09-27  |  3KB  |  143 lines

  1. /*
  2.  * (C) 2002 Clemson University.
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */       
  6.  
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <pvfs2-types.h>
  11. #include <gossip.h>
  12. #include <pvfs2-debug.h>
  13.  
  14. #include <pint-distribution.h>
  15. #include <pint-dist-utils.h>
  16. #include <pvfs2-request.h>
  17. #include <pint-request.h>
  18.  
  19. #include <debug.h>
  20.  
  21. #define SEGMAX 16
  22. #define BYTEMAX (1024*1024)
  23.  
  24. PVFS_offset exp1_offset[] =
  25. {
  26.         0, 133120, 266240, 399360,
  27.         532480, 665600, 798720, 931840,
  28.         1082368, 1215488, 1348608, 1481728,
  29.         1614848, 1747968, 1881088, 2014208
  30. };
  31. PVFS_offset exp1_size[] =
  32. {
  33.         33792, 33792, 33792, 33792,
  34.         33792, 33792, 33792, 33792,
  35.         32768, 32768, 32768, 32768,
  36.         32768, 32768, 32768, 1024
  37. };
  38. PINT_Request_result expected[] =
  39. {{
  40.        offset_array : &exp1_offset[0],
  41.        size_array : &exp1_size[0],
  42.        segmax : SEGMAX,
  43.        segs : 16,
  44.        bytes : 500736
  45. }};
  46.  
  47.  
  48. int request_debug(void)
  49. {
  50.     int i;
  51.     PINT_Request *r, *r2, *r3;
  52.     PINT_Request *r_enc;
  53.     PINT_Request_state *rs1;
  54.     PINT_request_file_data rf1;
  55.     PINT_Request_result seg1;
  56.     int ret = -1;
  57.     int pack_size = 0;
  58.  
  59.     /* PVFS_Process_request arguments */
  60.     int retval;
  61.  
  62.    /* Turn on debugging */
  63.     if (gossipflag)
  64.     {
  65.         gossip_enable_stderr();
  66.         gossip_set_debug_mask(1,GOSSIP_REQUEST_DEBUG);
  67.     }
  68.  
  69.     PVFS_Request_contiguous(32, PVFS_BYTE, &r);
  70.     PVFS_Request_vector(32, 32, 64, r, &r2);
  71.     PVFS_Request_free(&r);
  72.     PVFS_Request_vector(32, 32, 64, r2, &r3);
  73.     PVFS_Request_free(&r2);
  74.     pack_size = PINT_REQUEST_PACK_SIZE(r3);
  75.     r_enc = (PINT_Request*)malloc(pack_size);
  76.     ret = PINT_request_commit(r_enc, r3);
  77.     PVFS_Request_free(&r3);
  78.  
  79.     /* set up request states */
  80.     rs1 = PINT_new_request_state(r_enc);
  81.  
  82.     /* set up file data for each server */
  83.     PINT_dist_initialize(NULL);
  84.     rf1.server_nr = 0;
  85.     rf1.server_ct = 4;
  86.     rf1.fsize = 0;
  87.     rf1.dist = PINT_dist_create("simple_stripe");
  88.     rf1.extend_flag = 1;
  89.     PINT_dist_lookup(rf1.dist);
  90.  
  91.     /* set up response for each server */
  92.     seg1.offset_array = (int64_t *)malloc(SEGMAX * sizeof(int64_t));
  93.     seg1.size_array = (int64_t *)malloc(SEGMAX * sizeof(int64_t));
  94.     seg1.segmax = SEGMAX;
  95.     seg1.bytemax = BYTEMAX;
  96.     seg1.segs = 0;
  97.     seg1.bytes = 0;
  98.  
  99.     i = 0;
  100.  
  101.     printf("\n************************************\n");
  102.     printf("one request in CLIENT mode\n");
  103.     printf("Simple stripe, default stripe size (64K)\n");
  104.     printf("Vector of vectors request, 32 blocks of 32x32blocks of 32 bytes\n");
  105.     printf("NULL Memtype\n");
  106.     printf("Each from offset 0, file size 0, extend flag\n");
  107.     printf("Server 0\n");
  108.     printf("\n************************************\n");
  109.     do
  110.     {
  111.         seg1.bytes = 0;
  112.         seg1.segs = 0;
  113.  
  114.         /* process request */
  115.         /* note that bytemax is exactly large enough to hold all of the
  116.          * data that I should find here
  117.          */
  118.         retval = PINT_process_request(rs1, NULL, &rf1, &seg1, PINT_CLIENT);
  119.  
  120.         if(retval >= 0)
  121.         {
  122.             prtseg(&seg1,"Results obtained");
  123.             prtseg(&expected[i],"Results expected");
  124.             cmpseg(&seg1,&expected[i]);
  125.         }
  126.  
  127.         i++;
  128.  
  129.     } while(0); 
  130.     
  131.     if(retval < 0)
  132.     {
  133.         fprintf(stderr, "Error: PINT_process_request() failure.\n");
  134.         return(-1);
  135.     }
  136.     if(PINT_REQUEST_DONE(rs1))
  137.     {
  138.         printf("**** first request done.\n");
  139.     }
  140.  
  141.     return 0;
  142. }
  143.