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 / test-pack2.c < prev    next >
C/C++ Source or Header  |  2003-01-15  |  788b  |  42 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 <pvfs-distribution.h>
  14. #include <simple-stripe.h>
  15.  
  16. #define SEGMAX 32
  17. #define BYTEMAX 250
  18.  
  19. main(int argc, char **argv)
  20. {
  21.     struct PVFS_Dist *d;
  22.     struct PVFS_Dist *d2;
  23.     int d_size;
  24.     void *buffer;
  25.     void *buffer2;
  26.  
  27.     /* grab a distribution */
  28.     d = PVFS_Dist_create("simple_stripe");
  29.     PINT_Dist_dump(d);
  30.  
  31.     /* encode the distribution */
  32.     d_size = PINT_DIST_PACK_SIZE(d);
  33.     buffer = malloc(d_size);
  34.     PINT_Dist_encode(buffer, d);
  35.  
  36.     /* decode the distribution */
  37.     d2 = (struct PVFS_Dist *)malloc(d_size);
  38.     memcpy(buffer2, buffer, d_size);
  39.     PINT_Dist_decode(d2, buffer);
  40.     PINT_Dist_dump(d2);
  41. }
  42.