[PVFS2-CVS] commit by bradles in pvfs2/src/io/description: pint-dist-utils.c pint-dist-utils.h dist-basic.c dist-simple-stripe.c module.mk.in pint-distribution.c pint-distribution.h pint-request.c pint-request.h

CVS commit program cvs at parl.clemson.edu
Mon May 17 12:57:03 EDT 2004


Update of /projects/cvsroot/pvfs2/src/io/description
In directory styx.parl.clemson.edu:/tmp/cvs-serv15238

Modified Files:
	dist-basic.c dist-simple-stripe.c module.mk.in 
	pint-distribution.c pint-distribution.h pint-request.c 
	pint-request.h 
Added Files:
	pint-dist-utils.c pint-dist-utils.h 
Log Message:
Distribution cleanup and refactoring.  All naming is consistent with PVFS2
naming schemes.  Added new methods PINT_dist_methods to enable distribution
to determine the number of datafiles to use.  Removed unused methods (encode
and decode) from distributions (encode_lebf and decode_lebf are the preferred
mechanism).


--- /dev/null	2003-01-30 05:24:37.000000000 -0500
+++ pint-dist-utils.c	2004-05-17 11:57:03.000000000 -0400
@@ -0,0 +1,107 @@
+/*
+ * (C) 2002 Clemson University and The University of Chicago.
+ *
+ * See COPYING in top-level directory.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "pint-dist-utils.h"
+
+/* Default distributions */
+extern PINT_dist basic_dist;
+extern PINT_dist simple_stripe_dist;
+
+/* Struct for determining how to set a distribution parameter by name */
+typedef struct PINT_dist_param_offset_s
+{
+    char* dist_name;
+    char* param_name;
+    size_t offset;
+    size_t size;
+} PINT_dist_param_offset;
+
+/* Dist param table */
+static PINT_dist_param_offset* PINT_dist_param_table = 0;
+static size_t PINT_dist_param_table_size = 0;
+
+/* Return a pointer to the dist param offset for this parameter, or null
+ *  if none exists
+ */
+static PINT_dist_param_offset* PINT_get_param_offset(const char* dist_name,
+                                                     const char* param_name)
+{
+    PINT_dist_param_offset* dpo = 0;
+    if (0 != PINT_dist_param_table)
+    {
+        int i;
+        for (i = 0; i < PINT_dist_param_table_size; i++)
+        {
+            dpo = PINT_dist_param_table + i;
+            if (0 == strcmp(dpo->dist_name, dist_name) &&
+                0 == strcmp(dpo->param_name, param_name))
+            {
+                return dpo;
+            }
+        }
+    }
+    return NULL;
+}
+
+/* PINT_dist_initialize implementation */
+int PINT_dist_initialize(void)
+{
+    /* Register the basic distribution 
+    PINT_register_distribution(&basic_dist);    
+    */
+    /* Register the simple stripe distribution
+    PINT_register_distribution(&simple_stripe_dist);    
+    */
+    return 0;
+}
+
+/*  PINT_dist_default_get_num_dfiles implementation */
+int PINT_dist_default_get_num_dfiles(void* params,
+                                     uint32_t num_servers_requested,
+                                     uint32_t num_dfiles_requested)
+{
+    int dfiles;
+    if (0 < num_dfiles_requested)
+    {
+        dfiles = num_dfiles_requested;
+    }
+    else
+    {
+        dfiles = num_servers_requested;
+    }
+    return dfiles;
+}
+
+/*  PINT_dist_default_set_param implementation */
+int PINT_dist_default_set_param(const char* dist_name, void* params,
+                                const char* param_name, void* value)
+{
+    int rc = 0;
+    PINT_dist_param_offset* offset_data;
+    offset_data = PINT_get_param_offset(dist_name, param_name);
+    if (0 != offset_data)
+    {
+        memcpy(params + offset_data->offset, value, offset_data->size);
+    }
+    else
+    {
+        rc = -1;
+    }
+    return rc;
+}
+
+/*
+ * Local variables:
+ *  mode: c
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 noexpandtab
+ */

--- /dev/null	2003-01-30 05:24:37.000000000 -0500
+++ pint-dist-utils.h	2004-05-17 11:57:03.000000000 -0400
@@ -0,0 +1,51 @@
+/*
+ * (C) 2002 Clemson University and The University of Chicago.
+ *
+ * See COPYING in top-level directory.
+ */
+
+#ifndef __PINT_DIST_UTILS_H
+#define __PINT_DIST_UTILS_H
+
+#include "pint-distribution.h"
+
+/**
+ * Perform initialization tasks for distributions
+ *   register the default distributions
+ */
+int PINT_dist_intialize(void);
+
+/**
+ * Utility default implmentation for PINT_dist_methods get_num_dfiles
+ *
+ * Returns the number of dfiles suggested by hint parameter if non-zero
+ * else returns the number of servers requested
+ */
+int PINT_dist_default_get_num_dfiles(void* params,
+                                     uint32_t num_servers_requested,
+                                     uint32_t num_dfiles_requested);
+
+/**
+ * Utility default implmentation for PINT_dist_methods set_param
+ *
+ * Returns the number of dfiles suggested by hint parameter
+ */
+int PINT_dist_default_set_param(const char* dist_name, void* params,
+                                const char* param_name, void* value);
+
+/**
+ *
+ */
+#define PINT_dist_register_parameter(dname, pname, params, field) NULL
+
+#endif
+
+/*
+ * Local variables:
+ *  mode: c
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 noexpandtab
+ */

Index: dist-basic.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/dist-basic.c,v
diff -p -u -r1.3 -r1.4
--- dist-basic.c	13 May 2004 14:46:37 -0000	1.3
+++ dist-basic.c	17 May 2004 15:57:02 -0000	1.4
@@ -7,7 +7,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "pvfs-distribution.h"
+#include "pint-distribution.h"
+#include "pint-dist-utils.h"
 #include "pvfs2-types.h"
 #include "pvfs2-dist-basic.h"
 
@@ -56,16 +57,6 @@ static PVFS_size logical_file_size(void*
     return psizes[0];
 }
 
-static void encode(void* params, void *buffer)
-{
-    memcpy(buffer, params, sizeof(PVFS_basic_params));
-}
-
-static void decode(void* params, void *buffer)
-{
-	memcpy(params, buffer, sizeof(PVFS_basic_params));
-}
-
 static void encode_lebf(char **pptr, void* params)
 {
 }
@@ -76,14 +67,14 @@ static void decode_lebf(char **pptr, voi
 
 static PVFS_basic_params basic_params;
 
-static PVFS_Dist_methods basic_methods = {
+static PINT_dist_methods basic_methods = {
     logical_to_physical_offset,
     physical_to_logical_offset,
     next_mapped_offset,
     contiguous_length,
     logical_file_size,
-    encode,
-    decode,
+    PINT_dist_default_get_num_dfiles,
+    PINT_dist_default_set_param,
     encode_lebf,
     decode_lebf,
 };
@@ -96,16 +87,12 @@ PINT_dist basic_dist = {
     &basic_methods
 };
 
-#ifdef MODULE
-
-void init_module()
-{
-    PVFS_register_distribution(&basic_dist);
-}
-
-void cleanup_module()
-{
-    PVFS_unregister_distribution(PVFS_DIST_BASIC_NAME);
-}
-
-#endif
+/*
+ * Local variables:
+ *  mode: c
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 noexpandtab
+ */

Index: dist-simple-stripe.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/dist-simple-stripe.c,v
diff -p -u -r1.3 -r1.4
--- dist-simple-stripe.c	13 May 2004 14:46:37 -0000	1.3
+++ dist-simple-stripe.c	17 May 2004 15:57:03 -0000	1.4
@@ -8,7 +8,8 @@
 #include <stdio.h>
 #include <string.h>
 #define __PINT_REQPROTO_ENCODE_FUNCS_C
-#include "pvfs-distribution.h"
+#include "pint-distribution.h"
+#include "pint-dist-utils.h"
 #include "pvfs2-types.h"
 #include "pvfs2-dist-simple-stripe.h"
 
@@ -30,11 +31,11 @@ static PVFS_offset logical_to_physical_o
     leftover = logical_offset - full_stripes * dparam->strip_size * server_ct;
     if(leftover >= server_nr*dparam->strip_size)
     {
-	     /* if so, tack that on to the physical offset as well */
-	     if(leftover < (server_nr + 1) * dparam->strip_size)
-	         ret_offset += leftover - (server_nr * dparam->strip_size);
-	     else
-	         ret_offset += dparam->strip_size;
+        /* if so, tack that on to the physical offset as well */
+        if(leftover < (server_nr + 1) * dparam->strip_size)
+            ret_offset += leftover - (server_nr * dparam->strip_size);
+        else
+            ret_offset += dparam->strip_size;
     }
     return(ret_offset);
 }
@@ -119,18 +120,6 @@ static PVFS_size logical_file_size(void*
     return max;
 }  
 
-static void encode(void* params, void *buffer)
-{
-    PVFS_simple_stripe_params* dparam = (PVFS_simple_stripe_params*)params;
-    memcpy(buffer, dparam, sizeof(PVFS_simple_stripe_params));
-}
-
-static void decode (void* params, void *buffer)
-{
-    PVFS_simple_stripe_params* dparam = (PVFS_simple_stripe_params*)params;
-    memcpy(dparam, buffer, sizeof(PVFS_simple_stripe_params));
-}
-
 static void encode_lebf(char **pptr, void* params)
 {
     PVFS_simple_stripe_params* dparam = (PVFS_simple_stripe_params*)params;
@@ -147,14 +136,14 @@ static PVFS_simple_stripe_params simple_
 	65536 /* stripe size */
 };
 
-static PVFS_Dist_methods simple_stripe_methods = {
+static PINT_dist_methods simple_stripe_methods = {
     logical_to_physical_offset,
     physical_to_logical_offset,
     next_mapped_offset,
     contiguous_length,
     logical_file_size,
-    encode,
-    decode,
+    PINT_dist_default_get_num_dfiles,
+    PINT_dist_default_set_param,
     encode_lebf,
     decode_lebf,
 };
@@ -167,16 +156,13 @@ PINT_dist simple_stripe_dist = {
     &simple_stripe_methods
 };
 
-#ifdef MODULE
-
-void init_module()
-{
-	 PVFS_register_distribution(&simple_stripe_dist);
-}
-
-void cleanup_module()
-{
-	 PVFS_unregister_distribution(PVFS_DIST_SIMPLE_STRIPE_NAME);
-}
 
-#endif
+/*
+ * Local variables:
+ *  mode: c
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 noexpandtab
+ */

Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/module.mk.in,v
diff -p -u -r1.3 -r1.4
--- module.mk.in	11 May 2004 16:12:27 -0000	1.3
+++ module.mk.in	17 May 2004 15:57:03 -0000	1.4
@@ -2,16 +2,16 @@ DIR := src/io/description
 LIBSRC += \
 	$(DIR)/pvfs-request.c \
 	$(DIR)/pint-request.c \
-	$(DIR)/pvfs-distribution.c \
 	$(DIR)/pint-distribution.c \
+	$(DIR)/pint-dist-utils.c \
 	$(DIR)/dist-basic.c \
 	$(DIR)/dist-simple-stripe.c
 
 SERVERSRC += \
 	$(DIR)/pvfs-request.c \
 	$(DIR)/pint-request.c \
-	$(DIR)/pvfs-distribution.c \
 	$(DIR)/pint-distribution.c \
+	$(DIR)/pint-dist-utils.c \
 	$(DIR)/dist-basic.c \
 	$(DIR)/dist-simple-stripe.c
 

Index: pint-distribution.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-distribution.c,v
diff -p -u -r1.13 -r1.14
--- pint-distribution.c	13 May 2004 14:46:37 -0000	1.13
+++ pint-distribution.c	17 May 2004 15:57:03 -0000	1.14
@@ -12,6 +12,11 @@
 #include "gossip.h"
 #include "pint-distribution.h"
 
+
+/* global size of dist table */
+#define PINT_DIST_TABLE_SZ 8
+static int PINT_Dist_count = 2; 
+
 /* compiled-in distributions */
 extern PINT_dist basic_dist;
 extern PINT_dist simple_stripe_dist;
@@ -23,8 +28,6 @@ PINT_dist* PINT_Dist_table[PINT_DIST_TAB
     NULL
 };
 
-int PINT_Dist_count = 2; /* global size of dist table */
-
 /*
  * add a dist to dist table
  */
@@ -59,10 +62,99 @@ int PINT_unregister_distribution(char *d
 }
 
 /*
+ * Looks up a distribution and copies it into a contiguous memory region.
+ * This is similar to PVFS_Dist_copy, but it copies from the static table,
+ * not from another contiguous region.
+ */
+PINT_dist *PINT_dist_create(const char *name)
+{
+    PINT_dist old_dist;
+    PINT_dist *new_dist = 0;
+
+    if (!name)
+	return 0;
+    old_dist.dist_name = (char*)name;
+    old_dist.params = 0;
+    old_dist.methods = 0;
+    if (PINT_dist_lookup(&old_dist) == 0)
+    {
+	/* distribution was found */
+	new_dist = malloc(PINT_DIST_PACK_SIZE(&old_dist));
+	if (new_dist)
+	{
+	    *new_dist = old_dist;
+	    new_dist->dist_name
+	      = (char *) new_dist + roundup8(sizeof(*new_dist));
+	    new_dist->params
+	      = (void *)(new_dist->dist_name + roundup8(new_dist->name_size));
+	    memcpy(new_dist->dist_name, old_dist.dist_name,
+	      old_dist.name_size);
+	    memcpy(new_dist->params, old_dist.params, old_dist.param_size);
+	    /* leave methods pointing to same static functions */
+	}
+    }
+    return new_dist;
+}
+
+int PINT_dist_free(PINT_dist *dist)
+{
+	if (dist)
+	{
+		/* assumes this is a dist created from above */
+		free(dist);
+		return 0;
+	}
+	return -1;
+}
+
+PINT_dist* PINT_dist_copy(const PINT_dist *dist)
+{
+	int dist_size;
+	PINT_dist *new_dist;
+
+	if (!dist)
+	{
+		return NULL;
+	}
+	dist_size = PINT_DIST_PACK_SIZE(dist);
+	new_dist = (PINT_dist *)malloc(dist_size);
+	if (new_dist)
+	{
+		memcpy(new_dist, dist, dist_size);
+		/* fixup pointers to new space */
+		new_dist->dist_name
+		  = (char *) new_dist + roundup8(sizeof(*new_dist));
+		new_dist->params
+		  = (void *)(new_dist->dist_name + roundup8(new_dist->name_size));
+	}
+	return (new_dist);
+}
+
+int PINT_dist_getparams(void *buf, const PINT_dist *dist)
+{
+	if (!dist || !buf)
+	{
+		return -1;
+	}
+	memcpy (buf, dist->params, dist->param_size);
+	return 0;
+}
+
+int PINT_dist_setparams(PINT_dist *dist, const void *buf)
+{
+	if (!dist || !buf)
+	{
+		return -1;
+	}
+	memcpy (dist->params, buf, dist->param_size);
+	return 0;
+}
+
+/*
  * pass in a dist with a valid name, looks up in dist table
  * if found, fills in the missing parts of the structure
  */
-int PINT_Dist_lookup(PINT_dist *dist)
+int PINT_dist_lookup(PINT_dist *dist)
 {
 	int d;
 	if (!dist || !dist->dist_name)
@@ -90,7 +182,7 @@ int PINT_Dist_lookup(PINT_dist *dist)
  * if buffer is null, convert pointers to integers in dist
  * with no copy - dist is modified
  */
-void PINT_Dist_encode(void *buffer, PINT_dist *dist)
+void PINT_dist_encode(void *buffer, PINT_dist *dist)
 {
     PINT_dist* old_dist = dist;
 	
@@ -104,7 +196,7 @@ void PINT_Dist_encode(void *buffer, PINT
         /* adjust pointers in new buffer */
         dist->dist_name = ((char *)dist + ((char *)old_dist->dist_name -
                                            (char *)old_dist));
-        dist->params = (struct PVFS_Dist_params *)
+        dist->params =
             ((char *)dist + ((char *)old_dist->params - (char *)old_dist));
     }
     
@@ -120,7 +212,7 @@ void PINT_Dist_encode(void *buffer, PINT
  * if buffer is null, convert integers to pointers in dist
  * with no copy - dist is modified
  */
-void PINT_Dist_decode(PINT_dist *dist, void *buffer)
+void PINT_dist_decode(PINT_dist *dist, void *buffer)
 {
 	if (!dist)
 		return;
@@ -134,20 +226,30 @@ void PINT_Dist_decode(PINT_dist *dist, v
 	dist->params = (void *) ((char *) dist + (unsigned long) dist->params);
 	/* set methods */
 	dist->methods = NULL;
-	if (PINT_Dist_lookup(dist)) {
+	if (PINT_dist_lookup(dist)) {
 	    gossip_err("%s: lookup dist failed\n", __func__);
 	    exit(1);
 	}
 }
 
-void PINT_Dist_dump(PINT_dist *dist)
+void PINT_dist_dump(PINT_dist *dist)
 {
-	gossip_debug(GOSSIP_DIST_DEBUG,"******************************\n");
-	gossip_debug(GOSSIP_DIST_DEBUG,"address\t\t%p\n", dist);
-	gossip_debug(GOSSIP_DIST_DEBUG,"dist_name\t%s\n", dist->dist_name);
-	gossip_debug(GOSSIP_DIST_DEBUG,"name_size\t%d\n", dist->name_size);
-	gossip_debug(GOSSIP_DIST_DEBUG,"param_size\t%d\n", dist->param_size);
-	gossip_debug(GOSSIP_DIST_DEBUG,"params\t\t%p\n", dist->params);
-	gossip_debug(GOSSIP_DIST_DEBUG,"methods\t\t%p\n", dist->methods);
-	gossip_debug(GOSSIP_DIST_DEBUG,"******************************\n");
+    gossip_debug(GOSSIP_DIST_DEBUG,"******************************\n");
+    gossip_debug(GOSSIP_DIST_DEBUG,"address\t\t%p\n", dist);
+    gossip_debug(GOSSIP_DIST_DEBUG,"dist_name\t%s\n", dist->dist_name);
+    gossip_debug(GOSSIP_DIST_DEBUG,"name_size\t%d\n", dist->name_size);
+    gossip_debug(GOSSIP_DIST_DEBUG,"param_size\t%d\n", dist->param_size);
+    gossip_debug(GOSSIP_DIST_DEBUG,"params\t\t%p\n", dist->params);
+    gossip_debug(GOSSIP_DIST_DEBUG,"methods\t\t%p\n", dist->methods);
+    gossip_debug(GOSSIP_DIST_DEBUG,"******************************\n");
 }
+
+/*
+ * Local variables:
+ *  mode: c
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 noexpandtab
+ */

Index: pint-distribution.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-distribution.h,v
diff -p -u -r1.6 -r1.7
--- pint-distribution.h	13 May 2004 14:46:37 -0000	1.6
+++ pint-distribution.h	17 May 2004 15:57:03 -0000	1.7
@@ -8,34 +8,150 @@
 #define __PINT_DISTRIBUTION_H
 
 #include "pvfs2-types.h"
-#include "pvfs-distribution.h"
 
-/* PVFS Distribution Processing Stuff */
+/* Distribution table size limits */
+#define PINT_DIST_NAME_SZ 32
 
-#define PINT_DIST_TABLE_SZ 8
-#define PINT_DIST_NAME_SZ 15
+/* Distribution functions that must be supplied by each dist implmentation */
+typedef struct PINT_dist_methods_s {
 
-#ifdef DIST_MODULE
-
-/* these functions must be defined by a distribution module */
-
-void init_module(void);
-void cleanup_module(void);
+    /* Returns the physical storage offset for a logical file offset */
+    PVFS_offset (*logical_to_physical_offset)(void* params,
+                                              uint32_t server_nr,
+                                              uint32_t server_ct,
+                                              PVFS_offset logical_offset);
+    
+    /* Returns the logical file offset for a given physical storage offset */
+    PVFS_offset (*physical_to_logical_offset)(void* params,
+                                              uint32_t server_nr,
+                                              uint32_t server_ct,
+                                              PVFS_offset physical_offset);
+
+    /* Returns the next physical offset for the file on server_nr given an
+     * arbitraty logical offset (i.e. an offset anywhere in the file) */
+    PVFS_offset (*next_mapped_offset)(void* params,
+                                      uint32_t server_nr,
+                                      uint32_t server_ct,
+                                      PVFS_offset logical_offset);
+
+    /* Returns the contiguous length of file data starting at physical_offset*/
+    PVFS_size (*contiguous_length)(void* params,
+                                   uint32_t server_nr,
+                                   uint32_t server_ct,
+                                   PVFS_offset physical_offset);
+
+    /* Returns the logical file size */
+    PVFS_size (*logical_file_size)(void* params,
+                                   uint32_t server_ct,
+                                   PVFS_size *psizes);
+
+    /* Returns the number of data file objects to use for a file */
+    int (*get_num_dfiles)(void* params,
+                          uint32_t num_servers_requested,
+                          uint32_t num_dfiles_requested);
+
+    /* Sets the parameter designated by name to the given value */
+    int (*set_param)(const char* dist_name, void* params,
+                     const char* param_name, void* value);
+
+    /* Stores parameters in lebf memory at pptr */
+    void (*encode_lebf)(char **pptr, void* params);
+    
+    /* Restores parameters in lebf memory at pptr */
+    void (*decode_lebf)(char **pptr, void* params);
+
+} PINT_dist_methods;
+
+/* Internal representation of a PVFS2 Distribution */
+typedef struct PINT_dist_s {
+	char *dist_name;
+	int32_t name_size;
+	int32_t param_size; 
+	void *params;
+	PINT_dist_methods *methods;
+} PINT_dist;
+
+
+/* Macros to encode/decode distributions for sending requests */
+#define PINT_DIST_PACK_SIZE(d) \
+ (roundup8(sizeof(*(d))) + roundup8((d)->name_size) + roundup8((d)->param_size))
+
+#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
+#define encode_PINT_dist(pptr,x) do { PINT_dist *px = *(x); \
+    encode_string(pptr, &px->dist_name); \
+    if (!px->methods) { \
+	gossip_err("%s: encode_PINT_dist: methods is null\n", __func__); \
+	exit(1); \
+    } \
+    (px->methods->encode_lebf) (pptr, px->params); \
+} while (0)
+#define decode_PINT_dist(pptr,x) do { PINT_dist tmp_dist; PINT_dist *px; \
+    decode_string(pptr, &tmp_dist.dist_name); \
+    tmp_dist.params = 0; \
+    tmp_dist.methods = 0; \
+    /* bizzare lookup function fills in most fields */ \
+    PINT_dist_lookup(&tmp_dist); \
+    if (!tmp_dist.methods) { \
+	gossip_err("%s: decode_PINT_dist: methods is null\n", __func__); \
+	exit(1); \
+    } \
+    /* later routines assume dist is a big contiguous thing, do so */ \
+    *(x) = px = decode_malloc(PINT_DIST_PACK_SIZE(&tmp_dist)); \
+    memcpy(px, &tmp_dist, sizeof(*px)); \
+    px->dist_name = (char *) px + roundup8(sizeof(*px)); \
+    memcpy(px->dist_name, tmp_dist.dist_name, tmp_dist.name_size); \
+    px->params = (void *)(px->dist_name + roundup8(px->name_size)); \
+    (px->methods->decode_lebf) (pptr, px->params); \
+} while (0)
+#endif
 
-/* these functions can be called by a distribution module */
+/* Return a cloned copy of the distribution registered for name*/
+PINT_dist* PINT_dist_create(const char *name);
 
-int PVFS_register_distribution(PINT_dist *d_p);
-int PVFS_unregister_distribution(char *dist_name);
+/* Deallocate resources in a PINT_dist */
+int PINT_dist_free(PINT_dist *dist);
 
-#endif
+/* Return a cloned copy of dist */
+PINT_dist* PINT_dist_copy(const PINT_dist *dist);
 
-/* fill in missing items in dist struct */
-int PINT_Dist_lookup(PINT_dist *dist);
+/* Makes a memcpy of the distribution parameters in buf.
+ * buf must be allocated to the correct size */
+int PINT_dist_getparams(void *buf, const PINT_dist *dist);
+
+/* Memcpys the the distribution params from buf into dist */
+int PINT_dist_setparams(PINT_dist *dist, const void *buf);
+
+/* Given a distribution with only the dist_name filled in, the remaining
+ * distribution parameters are copied from the registered distribution for
+ * that name */
+int PINT_dist_lookup(PINT_dist *dist);
 
 /* pack dist struct for sending over wire */
-void PINT_Dist_encode(void *buffer, PINT_dist *dist);
+void PINT_dist_encode(void *buffer, PINT_dist *dist);
 
 /* unpack dist struct after receiving from wire */
-void PINT_Dist_decode(PINT_dist *dist, void *buffer);
+void PINT_dist_decode(PINT_dist *dist, void *buffer);
+
+/* Print dist state to debug system */
+void PINT_dist_dump(PINT_dist *dist);
+
+/* Registers the distribution d_p
+ *
+ * the registration key d_p->dist_name
+ */
+int PINT_register_distribution(PINT_dist *d_p);
+
+/* Removes the distribution registered for the name dist_name */
+int PINT_unregister_distribution(char *dist_name);
 
 #endif /* __PINT_DISTRIBUTION_H */
+
+/*
+ * Local variables:
+ *  mode: c
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 noexpandtab
+ */

Index: pint-request.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.c,v
diff -p -u -r1.43 -r1.44
--- pint-request.c	30 Jan 2004 20:12:12 -0000	1.43
+++ pint-request.c	17 May 2004 15:57:03 -0000	1.44
@@ -11,7 +11,6 @@
 #include <pvfs2-types.h>
 #include <pvfs2-debug.h>
 #include <pint-request.h>
-#include <pvfs-distribution.h>
 #include <pint-distribution.h>
 
 /* this macro is only used in this file to add a segment to the

Index: pint-request.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.h,v
diff -p -u -r1.25 -r1.26
--- pint-request.h	13 May 2004 14:46:37 -0000	1.25
+++ pint-request.h	17 May 2004 15:57:03 -0000	1.26
@@ -7,8 +7,8 @@
 #ifndef __PINT_REQUEST_H
 #define __PINT_REQUEST_H
 
+#include "pint-distribution.h"
 #include <pvfs2-types.h>
-#include <pvfs-distribution.h>
 
 /* modes for PINT_Process_request  and PINT_Distribute */
 #define PINT_SERVER                000001



More information about the PVFS2-CVS mailing list