[PVFS2-CVS]
commit by bradles in pvfs2/src/io/description: dist-basic.c
dist-simple-stripe.c pint-distribution.c pint-distribution.h
pint-request.h pvfs-distribution.c pvfs-distribution.h
CVS commit program
cvs at parl.clemson.edu
Thu May 13 11:46:37 EDT 2004
Update of /projects/cvsroot/pvfs2/src/io/description
In directory styx.parl.clemson.edu:/tmp/cvs-serv6124/description
Modified Files:
dist-basic.c dist-simple-stripe.c pint-distribution.c
pint-distribution.h pint-request.h pvfs-distribution.c
pvfs-distribution.h
Log Message:
Update naming conventions to match current standards.
Rename PVFS_Dist to PINT_dist
PVFS_Dist_create => PVFS_dist_create
PVFS_Dist_free => PVFS_dist_free
Index: dist-basic.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/dist-basic.c,v
diff -p -u -r1.2 -r1.3
--- dist-basic.c 11 May 2004 18:52:27 -0000 1.2
+++ dist-basic.c 13 May 2004 14:46:37 -0000 1.3
@@ -88,7 +88,7 @@ static PVFS_Dist_methods basic_methods =
decode_lebf,
};
-PVFS_Dist basic_dist = {
+PINT_dist basic_dist = {
PVFS_DIST_BASIC_NAME,
roundup8(PVFS_DIST_BASIC_NAME_SIZE), /* name size */
0, /* param size */
Index: dist-simple-stripe.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/dist-simple-stripe.c,v
diff -p -u -r1.2 -r1.3
--- dist-simple-stripe.c 11 May 2004 18:52:27 -0000 1.2
+++ dist-simple-stripe.c 13 May 2004 14:46:37 -0000 1.3
@@ -159,7 +159,7 @@ static PVFS_Dist_methods simple_stripe_m
decode_lebf,
};
-PVFS_Dist simple_stripe_dist = {
+PINT_dist simple_stripe_dist = {
PVFS_DIST_SIMPLE_STRIPE_NAME,
roundup8(PVFS_DIST_SIMPLE_STRIPE_NAME_SIZE), /* name size */
roundup8(sizeof(PVFS_simple_stripe_params)), /* param size */
Index: pint-distribution.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-distribution.c,v
diff -p -u -r1.12 -r1.13
--- pint-distribution.c 11 May 2004 18:52:27 -0000 1.12
+++ pint-distribution.c 13 May 2004 14:46:37 -0000 1.13
@@ -8,17 +8,16 @@
#include <stdio.h>
#include <string.h>
#include "pvfs2-types.h"
-#include "pint-distribution.h"
-#include "pvfs-distribution.h"
#include "pvfs2-debug.h"
#include "gossip.h"
+#include "pint-distribution.h"
/* compiled-in distributions */
-extern struct PVFS_Dist basic_dist;
-extern struct PVFS_Dist simple_stripe_dist;
+extern PINT_dist basic_dist;
+extern PINT_dist simple_stripe_dist;
/* initial dist table - default dists */
-struct PVFS_Dist *PINT_Dist_table[PINT_DIST_TABLE_SZ] = {
+PINT_dist* PINT_Dist_table[PINT_DIST_TABLE_SZ] = {
&basic_dist,
&simple_stripe_dist,
NULL
@@ -29,14 +28,14 @@ int PINT_Dist_count = 2; /* global size
/*
* add a dist to dist table
*/
-int PINT_register_distribution(struct PVFS_Dist *d_p)
+int PINT_register_distribution(PINT_dist *d_p)
{
- if (PINT_Dist_count < PINT_DIST_TABLE_SZ)
- {
- PINT_Dist_table[PINT_Dist_count++] = d_p;
- return (0);
- }
- return (-1);
+ if (PINT_Dist_count < PINT_DIST_TABLE_SZ)
+ {
+ PINT_Dist_table[PINT_Dist_count++] = d_p;
+ return (0);
+ }
+ return (-1);
}
/*
@@ -44,26 +43,26 @@ int PINT_register_distribution(struct PV
*/
int PINT_unregister_distribution(char *dist_name)
{
- int d;
- if (!dist_name)
- return -1;
- for (d = 0; d < PINT_Dist_count && PINT_Dist_table[d]; d++)
- {
- if (!strncmp(dist_name, PINT_Dist_table[d]->dist_name,
- PINT_DIST_NAME_SZ))
- {
- PINT_Dist_table[d]->dist_name[0] = 0; /* bad cheese here-WBL */
- return (0);
- }
- }
- return (-1);
+ int d;
+ if (!dist_name)
+ return -1;
+ for (d = 0; d < PINT_Dist_count && PINT_Dist_table[d]; d++)
+ {
+ if (!strncmp(dist_name, PINT_Dist_table[d]->dist_name,
+ PINT_DIST_NAME_SZ))
+ {
+ PINT_Dist_table[d]->dist_name[0] = 0; /* bad cheese here-WBL */
+ return (0);
+ }
+ }
+ return (-1);
}
/*
* 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(struct PVFS_Dist *dist)
+int PINT_Dist_lookup(PINT_dist *dist)
{
int d;
if (!dist || !dist->dist_name)
@@ -91,26 +90,28 @@ int PINT_Dist_lookup(struct PVFS_Dist *d
* if buffer is null, convert pointers to integers in dist
* with no copy - dist is modified
*/
-void PINT_Dist_encode(void *buffer, struct PVFS_Dist *dist)
+void PINT_Dist_encode(void *buffer, PINT_dist *dist)
{
- PVFS_Dist* old_dist = dist;
+ PINT_dist* old_dist = dist;
- if (!dist)
- return;
- if (buffer)
- {
- memcpy(buffer, dist, PINT_DIST_PACK_SIZE(dist));
- dist = buffer;
- /* adjust pointers in new buffer */
- dist->dist_name = ((char *)dist + ((char *)old_dist->dist_name -
- (char *)old_dist));
- dist->params = (struct PVFS_Dist_params *)
- ((char *)dist + ((char *)old_dist->params - (char *)old_dist));
- }
- /* convert pointers in dist to ints */
- dist->dist_name = (void *) (dist->dist_name - (char *) dist);
- dist->params = (void *) ((char *) dist->params - (char *) dist);
- dist->methods = NULL;
+ if (!dist)
+ return;
+
+ if (buffer)
+ {
+ memcpy(buffer, dist, PINT_DIST_PACK_SIZE(dist));
+ dist = buffer;
+ /* adjust pointers in new buffer */
+ dist->dist_name = ((char *)dist + ((char *)old_dist->dist_name -
+ (char *)old_dist));
+ dist->params = (struct PVFS_Dist_params *)
+ ((char *)dist + ((char *)old_dist->params - (char *)old_dist));
+ }
+
+ /* convert pointers in dist to ints */
+ dist->dist_name = (void *) (dist->dist_name - (char *) dist);
+ dist->params = (void *) ((char *) dist->params - (char *) dist);
+ dist->methods = NULL;
}
/*
@@ -119,13 +120,13 @@ void PINT_Dist_encode(void *buffer, stru
* if buffer is null, convert integers to pointers in dist
* with no copy - dist is modified
*/
-void PINT_Dist_decode(struct PVFS_Dist *dist, void *buffer)
+void PINT_Dist_decode(PINT_dist *dist, void *buffer)
{
if (!dist)
return;
if (buffer)
{
- PVFS_Dist *d2 = (PVFS_Dist *)buffer;
+ PINT_dist *d2 = (PINT_dist *)buffer;
memcpy(dist, buffer, PINT_DIST_PACK_SIZE(d2));
}
/* convert ints in dist to pointers */
@@ -139,7 +140,7 @@ void PINT_Dist_decode(struct PVFS_Dist *
}
}
-void PINT_Dist_dump(PVFS_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);
Index: pint-distribution.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-distribution.h,v
diff -p -u -r1.5 -r1.6
--- pint-distribution.h 4 Oct 2003 15:21:38 -0000 1.5
+++ pint-distribution.h 13 May 2004 14:46:37 -0000 1.6
@@ -24,18 +24,18 @@ void cleanup_module(void);
/* these functions can be called by a distribution module */
-int PVFS_register_distribution(struct PVFS_Dist *d_p);
+int PVFS_register_distribution(PINT_dist *d_p);
int PVFS_unregister_distribution(char *dist_name);
#endif
/* fill in missing items in dist struct */
-int PINT_Dist_lookup(PVFS_Dist *dist);
+int PINT_Dist_lookup(PINT_dist *dist);
/* pack dist struct for sending over wire */
-void PINT_Dist_encode(void *buffer, PVFS_Dist *dist);
+void PINT_Dist_encode(void *buffer, PINT_dist *dist);
/* unpack dist struct after receiving from wire */
-void PINT_Dist_decode(PVFS_Dist *dist, void *buffer);
+void PINT_Dist_decode(PINT_dist *dist, void *buffer);
#endif /* __PINT_DISTRIBUTION_H */
Index: pint-request.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.h,v
diff -p -u -r1.24 -r1.25
--- pint-request.h 17 Mar 2004 20:11:11 -0000 1.24
+++ pint-request.h 13 May 2004 14:46:37 -0000 1.25
@@ -139,7 +139,7 @@ typedef struct PINT_Request_file_data {
PVFS_size fsize; /* actual size of local storage object */
uint32_t server_nr; /* ordinal number of THIS server for this file */
uint32_t server_ct; /* number of servers for this file */
- PVFS_Dist *dist; /* dist struct for the file */
+ PINT_dist *dist; /* dist struct for the file */
PVFS_boolean extend_flag; /* if zero, file will not be extended */
} PINT_Request_file_data;
Index: pvfs-distribution.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pvfs-distribution.c,v
diff -p -u -r1.5 -r1.6
--- pvfs-distribution.c 7 Oct 2003 13:38:17 -0000 1.5
+++ pvfs-distribution.c 13 May 2004 14:46:37 -0000 1.6
@@ -7,22 +7,22 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <pvfs-distribution.h>
-#include <pint-distribution.h>
+#include "pint-distribution.h"
+#include "pvfs-distribution.h"
/*
* 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.
*/
-PVFS_Dist *PVFS_Dist_create(char *name)
+PINT_dist *PVFS_dist_create(const char *name)
{
- PVFS_Dist old_dist;
- PVFS_Dist *new_dist = 0;
+ PINT_dist old_dist;
+ PINT_dist *new_dist = 0;
if (!name)
return 0;
- old_dist.dist_name = name;
+ old_dist.dist_name = (char*)name;
old_dist.params = 0;
old_dist.methods = 0;
if (PINT_Dist_lookup(&old_dist) == 0)
@@ -45,7 +45,7 @@ PVFS_Dist *PVFS_Dist_create(char *name)
return new_dist;
}
-int PVFS_Dist_free(PVFS_Dist *dist)
+int PVFS_dist_free(PINT_dist *dist)
{
if (dist)
{
@@ -56,17 +56,17 @@ int PVFS_Dist_free(PVFS_Dist *dist)
return -1;
}
-PVFS_Dist *PVFS_Dist_copy(const PVFS_Dist *dist)
+PINT_dist *PVFS_Dist_copy(const PINT_dist *dist)
{
int dist_size;
- PVFS_Dist *new_dist;
+ PINT_dist *new_dist;
if (!dist)
{
return NULL;
}
dist_size = PINT_DIST_PACK_SIZE(dist);
- new_dist = (PVFS_Dist *)malloc(dist_size);
+ new_dist = (PINT_dist *)malloc(dist_size);
if (new_dist)
{
memcpy(new_dist, dist, dist_size);
@@ -79,7 +79,7 @@ PVFS_Dist *PVFS_Dist_copy(const PVFS_Dis
return (new_dist);
}
-int PVFS_Dist_getparams(void *buf, const PVFS_Dist *dist)
+int PVFS_Dist_getparams(void *buf, const PINT_dist *dist)
{
if (!dist || !buf)
{
@@ -89,7 +89,7 @@ int PVFS_Dist_getparams(void *buf, const
return 0;
}
-int PVFS_Dist_setparams(PVFS_Dist *dist, const void *buf)
+int PVFS_Dist_setparams(PINT_dist *dist, const void *buf)
{
if (!dist || !buf)
{
Index: pvfs-distribution.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pvfs-distribution.h,v
diff -p -u -r1.9 -r1.10
--- pvfs-distribution.h 11 May 2004 15:33:47 -0000 1.9
+++ pvfs-distribution.h 13 May 2004 14:46:37 -0000 1.10
@@ -10,13 +10,6 @@
#include "pvfs2-types.h"
/* each particular distribution implementation will define this for itself */
-#ifndef DIST_MODULE
-struct PVFS_Dist_params_s {
- /* empty */
-};
-#endif
-typedef struct PVFS_Dist_params PVFS_Dist_params;
-
typedef struct {
PVFS_offset (*logical_to_physical_offset)(void* params,
uint32_t server_nr,
@@ -44,16 +37,16 @@ typedef struct {
} PVFS_Dist_methods;
/* this struct is used to define a distribution to PVFS */
-typedef struct PVFS_Dist {
+typedef struct PINT_dist_s {
char *dist_name;
int32_t name_size;
int32_t param_size;
void *params;
PVFS_Dist_methods *methods;
-} PVFS_Dist;
+} PINT_dist;
#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
-#define encode_PVFS_Dist(pptr,x) do { PVFS_Dist *px = *(x); \
+#define encode_PVFS_Dist(pptr,x) do { PINT_dist *px = *(x); \
encode_string(pptr, &px->dist_name); \
if (!px->methods) { \
gossip_err("%s: encode_PVFS_Dist: methods is null\n", __func__); \
@@ -61,8 +54,8 @@ typedef struct PVFS_Dist {
} \
(px->methods->encode_lebf) (pptr, px->params); \
} while (0)
-#define decode_PVFS_Dist(pptr,x) do { PVFS_Dist tmp_dist; PVFS_Dist *px; \
- extern int PINT_Dist_lookup(PVFS_Dist *dist); \
+#define decode_PVFS_Dist(pptr,x) do { PINT_dist tmp_dist; PINT_dist *px; \
+ extern int PINT_Dist_lookup(PINT_dist *dist); \
decode_string(pptr, &tmp_dist.dist_name); \
tmp_dist.params = 0; \
tmp_dist.methods = 0; \
@@ -82,11 +75,11 @@ typedef struct PVFS_Dist {
} while (0)
#endif
-extern PVFS_Dist *PVFS_Dist_create(char *name);
-extern int PVFS_Dist_free(PVFS_Dist *dist);
-extern PVFS_Dist *PVFS_Dist_copy(const PVFS_Dist *dist);
-extern int PVFS_Dist_getparams(void *buf, const PVFS_Dist *dist);
-extern int PVFS_Dist_setparams(PVFS_Dist *dist, const void *buf);
+extern PINT_dist *PVFS_dist_create(const char *name);
+extern int PVFS_dist_free(PINT_dist *dist);
+extern PINT_dist *PVFS_Dist_copy(const PINT_dist *dist);
+extern int PINT_dist_getparams(void *buf, const PINT_dist *dist);
+extern int PINT_dist_setparams(PINT_dist *dist, const void *buf);
/******** macros for access to dist struct ***********/
More information about the PVFS2-CVS
mailing list