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 / debug6.c < prev    next >
C/C++ Source or Header  |  2005-07-07  |  2KB  |  116 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 <pvfs2-types.h>
  10. #include <gossip.h>
  11. #include <pvfs2-debug.h>
  12.  
  13. #include <pint-distribution.h>
  14. #include <pint-dist-utils.h>
  15. #include <pvfs2-request.h>
  16. #include <pint-request.h>
  17.  
  18. #include <debug.h>
  19.  
  20. #define SEGMAX 16
  21. #define BYTEMAX (4*1024*1024)
  22.  
  23. PVFS_offset exp1_offset [] = {
  24.     0
  25. };
  26.  
  27. PVFS_size exp1_size [] = {
  28.     4194304
  29. };
  30.  
  31. PINT_Request_result expected[] =
  32. {{
  33.    offset_array : &exp1_offset[0],
  34.    size_array : &exp1_size[0],
  35.    segmax : SEGMAX,
  36.    segs : 1,
  37.    bytes : 4194304
  38. }};
  39.  
  40. int request_debug(void)
  41. {
  42.     int i;
  43.     PINT_Request *r1;
  44.     PINT_Request_state *rs1;
  45.     PINT_request_file_data rf1;
  46.     PINT_Request_result seg1;
  47.  
  48.     int retval;
  49.  
  50.     int32_t blocklength = 10*1024*1024;
  51.     PVFS_size displacement = 0;  
  52.  
  53.     PVFS_Request_indexed(1, &blocklength, &displacement, PVFS_BYTE, &r1);
  54.  
  55.     rs1 = PINT_new_request_state(r1);
  56.  
  57.     PINT_dist_initialize(NULL);
  58.     rf1.server_nr = 0;
  59.     rf1.server_ct = 1;
  60.     rf1.fsize = 0;
  61.     rf1.dist = PINT_dist_create("simple_stripe");
  62.     rf1.extend_flag = 1;
  63.     PINT_dist_lookup(rf1.dist);
  64.  
  65.     /* set up result struct */
  66.     seg1.offset_array = (int64_t *)malloc(SEGMAX * sizeof(int64_t));
  67.     seg1.size_array = (int64_t *)malloc(SEGMAX * sizeof(int64_t));
  68.     seg1.bytemax = BYTEMAX;
  69.     seg1.segmax = SEGMAX;
  70.     seg1.bytes = 0;
  71.     seg1.segs = 0;
  72.  
  73.    /* Turn on debugging */
  74.     if (gossipflag)
  75.     {
  76.         gossip_enable_stderr(); 
  77.         gossip_set_debug_mask(1,GOSSIP_REQUEST_DEBUG);
  78.     }
  79.  
  80.     i = 0;
  81.  
  82. // client stuff below this line
  83. /*******************************************************************/
  84.  
  85.     fprintf(stderr, "\n************************************\n");
  86.     printf("One request in CLIENT mode size 10M contiguous server 0 of 1\n");
  87.     printf("Simple stripe, default stripe size (64K)\n");
  88.     printf("Offset 0, file size 0, extend flag\n");
  89.     printf("testing process limits 4M and return code\n");
  90.     printf("\n************************************\n");
  91.  
  92.     /* process request */
  93.     retval = PINT_process_request(rs1, NULL, &rf1, &seg1, PINT_CLIENT);
  94.  
  95.     if(retval >= 0)
  96.     {
  97.         prtseg(&seg1,"Results obtained");
  98.         prtseg(&expected[i],"Results expected");
  99.         cmpseg(&seg1,&expected[i]);
  100.     }
  101.  
  102.     i++;
  103.  
  104.     if(retval < 0)
  105.     {
  106.         fprintf(stderr, "Error: PINT_process_request() failure.\n");
  107.         return(-1);
  108.     }
  109.     if(PINT_REQUEST_DONE(rs1))
  110.     {
  111.         fprintf(stderr, "AAAIIIEEEEE!  Why am I done?\n");
  112.     }
  113.  
  114.     return 0;
  115. }
  116.