[PVFS2-CVS] commit by slang in pvfs2/src/io/description: pint-dist-utils.c pint-request.c pint-request.h

CVS commit program cvs at parl.clemson.edu
Fri Nov 4 02:14:19 EST 2005


Update of /projects/cvsroot/pvfs2/src/io/description
In directory parlweb:/tmp/cvs-serv6522/src/io/description

Modified Files:
      Tag: slang-sio-branch
	pint-dist-utils.c pint-request.c pint-request.h 
Log Message:
small I/O changes in sio branch for now


Index: pint-dist-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-dist-utils.c,v
diff -p -u -r1.8 -r1.8.2.1
--- pint-dist-utils.c	25 Oct 2005 18:00:59 -0000	1.8
+++ pint-dist-utils.c	4 Nov 2005 07:14:19 -0000	1.8.2.1
@@ -109,7 +109,8 @@ int PINT_dist_default_set_param(const ch
     offset_data = PINT_get_param_offset(dist_name, param_name);
     if (0 != offset_data)
     {
-        memcpy((char *) params + offset_data->offset, value, offset_data->size);
+        memcpy(((char *)params) + offset_data->offset, 
+               value, offset_data->size);
     }
     else
     {

Index: pint-request.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.c,v
diff -p -u -r1.55 -r1.55.2.1
--- pint-request.c	25 Oct 2005 18:00:59 -0000	1.55
+++ pint-request.c	4 Nov 2005 07:14:19 -0000	1.55.2.1
@@ -9,7 +9,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <gossip.h>
-#include <pvfs2-types.h>
 #include <pvfs2-debug.h>
 #include <pint-request.h>
 #include <pint-distribution.h>
@@ -109,11 +108,17 @@ int PINT_process_request(PINT_Request_st
 				req->cur->rqbase->depth);
 		temp_space = (void *)malloc(sizeof(PINT_Request_state)+
 				(sizeof(PINT_reqstack)*req->cur->rqbase->depth));
+        if(!temp_space)
+        {
+            return -PVFS_ENOMEM;
+        }
+
 		memcpy(temp_space,req,sizeof(PINT_Request_state));
 		req = (PINT_Request_state *)temp_space;
-		memcpy((char *)temp_space + sizeof(PINT_Request_state),
+		memcpy(((char *)temp_space) + sizeof(PINT_Request_state),
 				req->cur,(sizeof(PINT_reqstack)*req->cur->rqbase->depth));
-		req->cur = (PINT_reqstack *)((char *)temp_space + sizeof(PINT_Request_state));
+		req->cur = (PINT_reqstack *)
+            (((char *)temp_space) + sizeof(PINT_Request_state));
 	}
 	/* check to see if we are picking up where we left off */
 	if (req->lvl < 0)

Index: pint-request.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.h,v
diff -p -u -r1.32 -r1.32.2.1
--- pint-request.h	27 Sep 2005 21:04:28 -0000	1.32
+++ pint-request.h	4 Nov 2005 07:14:19 -0000	1.32.2.1
@@ -58,59 +58,10 @@ typedef struct PINT_Request {
 	struct PINT_Request *ereq;  /* element type */
 	struct PINT_Request *sreq;  /* sequence type */
 } PINT_Request;
-#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
-/* encode a linearized array of the above things, assumes space exists */
-#define encode_PVFS_Request(pptr,rp) do { int i; \
-    for (i=0; i<=(rp)->num_nested_req; i++) { \
-	encode_PVFS_offset(pptr, &(rp+i)->offset); \
-	encode_int32_t(pptr, &(rp+i)->num_ereqs); \
-	encode_int32_t(pptr, &(rp+i)->num_blocks); \
-	encode_PVFS_size(pptr, &(rp+i)->stride); \
-	encode_PVFS_offset(pptr, &(rp+i)->ub); \
-	encode_PVFS_offset(pptr, &(rp+i)->lb); \
-	encode_PVFS_size(pptr, &(rp+i)->aggregate_size); \
-	encode_int32_t(pptr, &(rp+i)->num_contig_chunks); \
-	encode_int32_t(pptr, &(rp+i)->depth); \
-	encode_int32_t(pptr, &(rp+i)->num_nested_req); \
-	encode_int32_t(pptr, &(rp+i)->committed); \
-	encode_int32_t(pptr, &(rp+i)->refcount); \
-	encode_skip4(pptr,); \
-	/* These pointers have been encoded already, just write as ints */ \
-	{ u_int32_t encti = (u_int32_t)(uintptr_t) (rp+i)->ereq; \
-		encode_uint32_t(pptr, &encti); \
-	}\
-	{ u_int32_t encti = (u_int32_t)(uintptr_t) (rp+i)->sreq; \
-		encode_uint32_t(pptr, &encti); \
-	}\
-    }\
-} while (0);
-#define decode_PVFS_Request(pptr,rp) do { int i; \
-    for (i=0; i == 0 || i<=(rp)->num_nested_req; i++) { \
-	decode_PVFS_offset(pptr, &(rp+i)->offset); \
-	decode_int32_t(pptr, &(rp+i)->num_ereqs); \
-	decode_int32_t(pptr, &(rp+i)->num_blocks); \
-	decode_PVFS_size(pptr, &(rp+i)->stride); \
-	decode_PVFS_offset(pptr, &(rp+i)->ub); \
-	decode_PVFS_offset(pptr, &(rp+i)->lb); \
-	decode_PVFS_size(pptr, &(rp+i)->aggregate_size); \
-	decode_int32_t(pptr, &(rp+i)->num_contig_chunks); \
-	decode_int32_t(pptr, &(rp+i)->depth); \
-	decode_int32_t(pptr, &(rp+i)->num_nested_req); \
-	decode_int32_t(pptr, &(rp+i)->committed); \
-	decode_int32_t(pptr, &(rp+i)->refcount); \
-	decode_skip4(pptr,); \
-	/* put integer offsets into pointers, let PINT_Request_decode fix */ \
-	{ u_int32_t encti; \
-		decode_uint32_t(pptr, &encti); \
-		(rp+i)->ereq = (PINT_Request *)(uintptr_t) encti; \
-	}\
-	{ u_int32_t encti; \
-		decode_uint32_t(pptr, &encti); \
-		(rp+i)->sreq = (PINT_Request *)(uintptr_t) encti; \
-	}\
-    } \
-} while (0);
-#endif
+
+#define PVFS_REQUEST_ENCODED_SIZE \
+    ((sizeof(PVFS_offset) * 3) + (sizeof(PVFS_size) * 2) + \
+     (sizeof(int32_t) * 7) + (sizeof(uint32_t) * 2) + 4)
 
 typedef struct PINT_reqstack {
 	int64_t      el;           /* number of element being processed */
@@ -187,6 +138,8 @@ int PINT_request_decode(struct PINT_Requ
 
 void PINT_dump_packed_request(struct PINT_Request *req);
 void PINT_dump_request(struct PINT_Request *req);
+
+#include "pint-request-encode.h"
 
 /********* macros for accessing key fields in a request *********/
 



More information about the PVFS2-CVS mailing list