[PVFS2-CVS] commit by pcarns in pvfs2/test/proto: module.mk.in bmi-send-recv.c bmi-send-recv.h test-bmi-server.c test-bmi.h test-harness.c test-request.c

CVS commit program cvs at parl.clemson.edu
Tue Jul 20 13:33:21 EDT 2004


Update of /projects/cvsroot/pvfs2/test/proto
In directory parlweb:/tmp/cvs-serv26022/test/proto

Modified Files:
	module.mk.in 
Removed Files:
	bmi-send-recv.c bmi-send-recv.h test-bmi-server.c test-bmi.h 
	test-harness.c test-request.c 
Log Message:
removed some depricated test programs


Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/proto/module.mk.in,v
diff -p -u -r1.3 -r1.4
--- module.mk.in	15 Apr 2004 00:20:06 -0000	1.3
+++ module.mk.in	20 Jul 2004 16:33:21 -0000	1.4
@@ -1,21 +1,2 @@
 DIR := proto
-TEST_PROTO_DIR := proto
-
-TEST_PROTO_DIR_SRC := \
-	$(DIR)/test-bmi-server.c \
-	$(DIR)/test-harness.c \
-	$(DIR)/test-request.c
-
-MISCSRC += $(DIR)/bmi-send-recv.c
-
-TESTSRC += $(TEST_PROTO_DIR_SRC)
-
-LOCALTESTS := $(patsubst %.c,%, $(TEST_PROTO_DIR_SRC))
-$(LOCALTESTS): %: %.o $(TEST_PROTO_DIR)/bmi-send-recv.o
-ifdef QUIET_COMPILE
-	@echo "  LD		$@"
-	@$(LD) $< $(TEST_PROTO_DIR)/bmi-send-recv.o $(LDFLAGS) $(LIBS) -o $@
-else
-	$(LD) $< $(TEST_PROTO_DIR)/bmi-send-recv.o $(LDFLAGS) $(LIBS) -o $@
-endif
 

--- bmi-send-recv.c	2004-07-20 12:33:21.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,138 +0,0 @@
-/*
- * (C) 2001 Clemson University and The University of Chicago
- *
- * See COPYING in top-level directory.
- */
-
-#include <bmi.h>
-#include <pvfs2-req-proto.h>
-#include <gossip.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <PINT-reqproto-encode.h>
-#include <bmi-send-recv.h>
-
-#define RET_CHECK(__name) if(ret != 0) {printf(__name);exit(-1);}
-
-int send_msg(bmi_op_id_t i, 
-		PVFS_BMI_addr_t s, 
-		void *msg, 
-		int size, 
-		int f, 
-		bmi_msg_tag_t t, 
-		void *in_test_user_ptr,
-		bmi_context_id context)
-{
-	int ret;
-	int outcount;
-	bmi_error_code_t error_code;
-	bmi_size_t actual_size;
-	void *u2 = NULL;
-
-	ret = BMI_post_sendunexpected(&(i), 
-			s, 
-			msg,
-			size,
-			f,
-			t,
-			in_test_user_ptr,
-			context);
-
-	if(ret == 0)
-	{
-		/* turning this into a blocking call for testing :) */
-		/* check for completion of request */
-		do
-		{
-			ret = BMI_test(i, &outcount, &error_code, &actual_size,
-					&u2, 10, context);
-		} while(ret == 0 && outcount == 0);
-
-		if(ret < 0 || error_code != 0)
-		{
-			fprintf(stderr, "Request send failed.\n");
-			if(ret<0)
-			{
-				errno = -ret;
-				perror("BMI_test");
-			}
-			return(-1);
-		}
-
-		if(in_test_user_ptr != u2)
-		{
-			fprintf(stderr, "1st ptr failure.\n");
-			return(-1);
-		}
-		u2 = NULL;
-	}
-	return(0);
-}
-
-int recv_msg(bmi_op_id_t i,
-				PVFS_BMI_addr_t a,
-				void *buffer,
-				bmi_size_t s,
-				bmi_size_t *as,
-				int f,
-				bmi_msg_tag_t m,
-				void *in_test_user_ptr,
-				bmi_context_id context)
-{
-	int ret;
-	int outcount;
-	bmi_error_code_t error_code;
-	bmi_size_t actual_size;
-	void *out_test_user_ptr = NULL;
-
-	ret = BMI_post_recv(&(i), 
-								a,
-								buffer, 
-								s, 
-								as, 
-								f, 
-								m, 
-								in_test_user_ptr,
-								context);
-	if(ret < 0)
-	{
-		errno = -ret;
-		perror("BMI_post_recv");
-		return(-1);
-	}
-
-	if(ret == 0)
-	{
-		/* turning this into a blocking call for testing :) */
-		/* check for completion of ack recv */
-		do
-		{
-			ret = BMI_test(i, &outcount, &error_code,
-				&actual_size, &out_test_user_ptr, 10, context);
-		} while(ret == 0 && outcount == 0);
-
-		if(ret < 0 || error_code != 0)
-		{
-			fprintf(stderr, "Ack recv failed.\n");
-			return(-1);
-		}
-		if(in_test_user_ptr != out_test_user_ptr)
-		{
-			fprintf(stderr, "2nd ptr failure.\n");
-		}
-		out_test_user_ptr = NULL;
-	}
-	else
-	{
-		if(actual_size != s)
-		{
-			printf("Short recv.\n");
-			return(-1);
-		}
-	}
-	*as = actual_size;
-	return(0);
-}
-
-

--- bmi-send-recv.h	2004-07-20 12:33:21.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,19 +0,0 @@
-
-int send_msg(bmi_op_id_t i, 
-		PVFS_BMI_addr_t s, 
-		void *msg, 
-		int size, 
-		int f, 
-		bmi_msg_tag_t t, 
-		void *in_test_user_ptr,
-		bmi_context_id context);
-
-int recv_msg(bmi_op_id_t i,
-				PVFS_BMI_addr_t a,
-				void *buffer,
-				bmi_size_t s,
-				bmi_size_t *as,
-				int f,
-				bmi_msg_tag_t m,
-				void *in_test_user_ptr,
-				bmi_context_id context);

--- test-bmi-server.c	2004-07-20 12:33:21.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,261 +0,0 @@
-/*
- * This is an example of a server program that uses the BMI 
- * library for communications
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <bmi.h>
-#include <gossip.h>
-#include <test-bmi.h>
-
-/**************************************************************
- * Data structures 
- */
-
-/* A little structure to hold program options, either defaults or
- * specified on the command line 
- */
-struct options{
-	char* hostid;       /* host identifier */
-};
-
-
-/**************************************************************
- * Internal utility functions
- */
-
-static struct options* parse_args(int argc, char* argv[]);
-
-
-/**************************************************************/
-
-int main(int argc, char **argv)	{
-
-	struct options* user_opts = NULL;
-	struct server_request* my_req = NULL;
-	struct server_ack* my_ack = NULL;
-	int ret = -1;
-	PVFS_BMI_addr_t client_addr;
-	void* recv_buffer = NULL;
-	bmi_op_id_t server_ops[2];
-	bmi_error_code_t error_code;
-	int outcount = 0;
-	struct BMI_unexpected_info request_info;
-	bmi_size_t actual_size;
-	bmi_context_id context;
-
-	/* grab any command line options */
-	user_opts = parse_args(argc, argv);
-	if(!user_opts){
-		return(-1);
-	}
-
-	/* set debugging stuff */
-	gossip_enable_stderr();
-	gossip_set_debug_mask(1, GOSSIP_BMI_DEBUG_ALL);
-
-
-	/* initialize local interface (default options) */
-	ret = BMI_initialize("bmi_tcp", user_opts->hostid, BMI_INIT_SERVER);
-	if(ret < 0){
-		errno = -ret;
-		perror("BMI_initialize");
-		return(-1);
-	}
-
-	ret = BMI_open_context(&context);
-	if(ret < 0)
-	{
-		errno = -ret;
-		perror("BMI_open_context");
-		return(-1);
-	}
-
-	while(1){
-	/* wait for an initial request  */
-	do
-	{
-		ret = BMI_testunexpected(1, &outcount, &request_info, 10);
-	}while(ret == 0 && outcount == 0);
-	if(ret < 0)
-	{
-		fprintf(stderr, "Request recv failure (bad state).\n");
-		errno = -ret;
-		perror("BMI_testunexpected");
-		return(-1);
-	}
-	if(request_info.error_code != 0)
-	{
-		fprintf(stderr, "Request recv failure (bad state).\n");
-		return(-1);
-	}
-
-	printf("Received a request.\n");
-		
-#if 0
-	if(request_info.size != sizeof(struct
-		server_request)){
-		fprintf(stderr, "Bad Request!\n");
-		exit(-1);
-	}
-#endif
-
-	my_req = (struct server_request*)request_info.buffer;
-	client_addr = request_info.addr;
-
-	/* create an ack */
-	my_ack = (struct server_ack*)BMI_memalloc(client_addr,
-		sizeof(struct server_ack), BMI_SEND);
-	if(!my_ack){
-		fprintf(stderr, "BMI_memalloc failed.\n");
-		return(-1);
-	}
-	memset(my_ack, 0, sizeof(struct server_ack));
-
-	/* create a buffer to recv into */
-	recv_buffer = BMI_memalloc(client_addr, my_req->size, BMI_RECV);
-	if(!recv_buffer){
-		fprintf(stderr, "BMI_memalloc failed.\n");
-		return(-1);
-	}
-	
-	/* post the ack */
-	ret = BMI_post_send(&(server_ops[1]), client_addr, request_info.buffer, 
-		request_info.size, BMI_PRE_ALLOC, 0, NULL, context);
-	if(ret < 0)
-	{
-		fprintf(stderr, "BMI_post_send_failure.\n");
-		return(-1);
-	}
-	if(ret == 0)
-	{
-		/* turning this into a blocking call for testing :) */
-		/* check for completion of ack send */
-		do
-		{
-			ret = BMI_test(server_ops[1], &outcount, &error_code,
-			&actual_size, NULL, 10, context);
-		} while(ret == 0 && outcount == 0);
-
-		if(ret < 0 || error_code != 0)
-		{
-			fprintf(stderr, "ack send failed.\n");
-			return(-1);
-		}
-	}
-	}
-
-#if 0
-	/* post the recv */
-	ret = BMI_post_recv(&(server_ops[0]), client_addr, recv_buffer,
-		my_req->size, &actual_size, BMI_PRE_ALLOC, 0, NULL);
-	if(ret < 0)
-	{
-		fprintf(stderr, "BMI_post_recv_failure.\n");
-		return(-1);
-	}
-	if(ret == 0)
-	{
-		/* turning this into a blocking call for testing :) */
-		/* check for completion of data payload recv */
-		do
-		{
-			ret = BMI_test(server_ops[0], &outcount, &error_code,
-			&actual_size, NULL, 10);
-		} while(ret == 0 && outcount == 0);
-
-		if(ret < 0 || error_code != 0)
-		{
-			fprintf(stderr, "data recv failed.\n");
-			return(-1);
-		}
-	}
-	
-	if(actual_size != 15000)
-	{
-		printf("Didn't get short recv when expected.\n");
-		printf("actual_size: %d\n", (int)actual_size);
-		return(0);
-	}
-#endif
-
-	/* free up the message buffers */
-	BMI_memfree(client_addr, recv_buffer, my_req->size, BMI_RECV);
-	BMI_memfree(client_addr, my_ack, sizeof(struct server_ack), 
-		BMI_SEND);
-
-	/* shutdown the local interface */
-	BMI_close_context(context);
-	ret = BMI_finalize();
-	if(ret < 0){
-		errno = -ret;
-		perror("BMI_finalize");
-		return(-1);
-	}
-
-	/* turn off debugging stuff */
-	gossip_disable();
-
-
-	return(0);
-}
-
-
-static struct options* parse_args(int argc, char* argv[]){
-
-	/* getopt stuff */
-	extern char* optarg;
-	extern int optind, opterr, optopt;
-	char flags[] = "h:r:s:c:";
-	int one_opt = 0;
-
-	struct options* tmp_opts = NULL;
-	int len = -1;
-
-	/* create storage for the command line options */
-	tmp_opts = (struct options*)malloc(sizeof(struct options));
-	if(!tmp_opts){
-		goto parse_args_error;
-	}
-
-	/* look at command line arguments */
-	while((one_opt = getopt(argc, argv, flags)) != EOF){
-		switch(one_opt){
-			case('h'):
-				len = (strlen(optarg)) + 1;
-				if((tmp_opts->hostid = (char*)malloc(len))==NULL){
-					goto parse_args_error;
-				}
-				memcpy(tmp_opts->hostid, optarg, len);
-				break;
-			default:
-				break;
-		}
-	}
-	
-	/* if we didn't get a host argument, fill in a default: */
-	len = (strlen(DEFAULT_SERVERID)) + 1;
-	if((tmp_opts->hostid = (char*)malloc(len))==NULL){
-		goto parse_args_error;
-	}
-	memcpy(tmp_opts->hostid, DEFAULT_SERVERID, len);
-
-	return(tmp_opts);
-
-parse_args_error:
-
-	/* if an error occurs, just free everything and return NULL */
-	if(tmp_opts){
-		if(tmp_opts->hostid){
-			free(tmp_opts->hostid);
-		}
-		free(tmp_opts);
-	}
-	return(NULL);
-}
-

--- test-bmi.h	2004-07-20 12:33:22.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,28 +0,0 @@
-
-/*
- * This is a common header file for both a client and server that use
- * the BMI library 
- */
-
-#ifndef __TEST_BMI_H
-#define __TEST_BMI_H
-
-#include <bmi.h>
-
-/* default hostid of server when none is given */
-#define DEFAULT_HOSTID  "tcp://localhost:3334"
-#define DEFAULT_HOSTID_GM  "gm://webwulf:5"
-#define DEFAULT_SERVERID  "tcp://NULL:3334"
-#define DEFAULT_SERVERID_GM  "gm://NULL:5"
-
-/* test server request format */
-struct server_request{
-	bmi_size_t size;
-};
-
-/* test server acknowledgement format */
-struct server_ack{
-	int status;
-};
-
-#endif /* __TEST_BMI_H */

--- test-harness.c	2004-07-20 12:33:22.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,361 +0,0 @@
-/*
- * (C) 2001 Clemson University and The University of Chicago
- *
- * See COPYING in top-level directory.
- */
-
-#include <bmi.h>
-#include <pvfs2-req-proto.h>
-#include <gossip.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <PINT-reqproto-encode.h>
-#ifdef USE_BMI_MSGS
-#include <bmi-send-recv.h>
-#endif
-
-#define RET_CHECK(__name) if(ret != 0) {printf(__name);exit(-1);}
-
-
-int main(int argc, char **argv)
-{
-	struct PVFS_server_req *request;
-	struct PVFS_server_resp *response;
-	struct PINT_encoded_msg encoded;
-	struct PINT_decoded_msg decoded;
-	int ret;
-	PVFS_BMI_addr_t me;
-	PVFS_object_attr *obj_attr;
-#ifdef USE_BMI_MSGS
-	bmi_op_id_t client_ops[2];
-	bmi_size_t actual_size;
-	void* bmi_resp;
-	void* in_test_user_ptr = &me;
-	bmi_context_id context;
-#endif
-
-	request = (struct PVFS_server_req *) malloc(sizeof(struct PVFS_server_req));
-	response = (struct PVFS_server_resp *) malloc(sizeof(struct PVFS_server_resp));
-
-	ret = PINT_encode_initialize();
-	RET_CHECK("PINT_encode_initialize() failure")
-
-	ret = BMI_initialize("bmi_tcp", NULL, 0);
-
-	RET_CHECK("BMI init Error")
-
-	ret = BMI_open_context(&context);
-
-	RET_CHECK("BMI_open_context Error")
-
-	ret = BMI_addr_lookup(&me,"tcp://localhost:3334");
-
-	RET_CHECK("BMI addr Error")
-	// Create
-
-	response->op = PVFS_SERV_CREATE;
-	response->u.create.handle = 7;
-	ret = PINT_encode(response,
-							PINT_ENCODE_RESP,
-							&encoded,
-							me,
-							0);
-	RET_CHECK("Error in Encoding Create Resp\n")
-#ifdef USE_BMI_MSGS
-	bmi_resp = BMI_memalloc(me,encoded.size_list[0],BMI_RECV);
-	ret = send_msg(client_ops[1],
-						me,
-						encoded.buffer_list[0],
-						encoded.size_list[0],
-						BMI_PRE_ALLOC,
-						0,
-						in_test_user_ptr,
-						context);
-
-	/* post a recv for the server acknowledgement */
-
-	ret = recv_msg(client_ops[0],
-						me,
-						bmi_resp,
-						encoded.size_list[0],
-						&actual_size,
-						BMI_PRE_ALLOC,
-						0,
-						in_test_user_ptr,
-						context);
-
-	free(encoded.buffer_list[0]);
-   encoded.buffer_list[0] = bmi_resp;	
-	encoded.total_size = actual_size;
-#endif
-
-	ret = PINT_decode(encoded.buffer_list[0],
-							PINT_ENCODE_RESP,
-							&decoded,
-							me,
-							encoded.total_size);
-
-#ifndef USE_BMI_MSGS
-	PINT_encode_release(&encoded,
-								PINT_ENCODE_RESP,
-								0);
-#endif
-
-	//PINT_decode_release(&decoded,
-								//PINT_ENCODE_RESP,
-								//0);
-
-	RET_CHECK("Error in Decoding Create Resp\n")
-
-	if(((struct PVFS_server_resp *)decoded.buffer)->op != PVFS_SERV_CREATE)
-		if(0)
-		{
-		printf("Op not correct after decoding Create Resp... Got %d\n",
-					//((struct PVFS_serv_req_s *)decoded.buffer)­>op);
-					((struct PVFS_server_resp *)decoded.buffer)->op);
-		ret = -1;
-		}
-	if(((struct PVFS_server_resp *)decoded.buffer)->u.create.handle !=7)
-	{
-		printf("Handle not correct after decoding Create Resp... Got %llu\n",
-					Lu(((struct PVFS_server_resp *)decoded.buffer)->u.create.handle));
-		ret =-1;
-	}
-
-#ifdef VERBOSE_DEBUG
-	if (ret != 0)
-	{
-		printf("Error! \n");
-		display_pvfs_structure(decoded.buffer,2);
-		display_pvfs_structure(response,2);
-	}
-	printf("\n\n-------=============Test 1 Completed============-----------\n\n\n");
-#else
-	if (ret != 0)
-		printf("Create: %d\n",ret);
-#endif
-
-	//Get Config
-
-	response->op = PVFS_SERV_GETCONFIG;
-/* 	response->u.getconfig.fs_id = 7; */
-/* 	response->u.getconfig.root_handle=9; */
-/* 	response->u.getconfig.maskbits = 0; */
-/* 	response->u.getconfig.meta_server_count=3; */
-/* 	response->u.getconfig.meta_server_mapping="tcp://foo1:3334,tcp://foo2:3334"; */
-/* 	response->u.getconfig.io_server_count=3; */
-/* 	response->u.getconfig.io_server_mapping="tcp://bar1:3334,tcp://bar2:3334"; */
-
-#ifdef USE_BMI_MSGS
-	BMI_memfree(me,
-					bmi_resp,
-					encoded.size_list[0],
-					BMI_RECV
-					);
-#endif
-	ret = PINT_encode(response,
-							PINT_ENCODE_RESP,
-							&encoded,
-							me,
-							0);
-	RET_CHECK("Error in Encoding GetConfig Resp\n")
-
-#ifdef USE_BMI_MSGS
-	bmi_resp = BMI_memalloc(me,encoded.size_list[0],BMI_RECV);
-	ret = send_msg(client_ops[1],
-						me,
-						encoded.buffer_list[0],
-						encoded.size_list[0],
-						BMI_PRE_ALLOC,
-						0,
-						in_test_user_ptr,
-						context);
-
-	/* post a recv for the server acknowledgement */
-
-	ret = recv_msg(client_ops[0],
-						me,
-						bmi_resp,
-						encoded.size_list[0],
-						&actual_size,
-						BMI_PRE_ALLOC,
-						0,
-						in_test_user_ptr,
-						context);
-
-	//free(encoded.buffer_list[0]);
-   encoded.buffer_list[0] = bmi_resp;	
-	encoded.total_size = actual_size;
-#endif
-
-
-	ret = PINT_decode(encoded.buffer_list[0],
-							PINT_ENCODE_RESP,
-							&decoded,
-							me,
-							encoded.total_size);
-	RET_CHECK("Error in Decoding GetConfig Resp\n")
-	
-	if(((struct PVFS_server_resp *)decoded.buffer)->op != PVFS_SERV_GETCONFIG)
-	{
-		printf("Op not correct after decoding Getconfig... Got %d\n",
-					((struct PVFS_server_resp *)decoded.buffer)->op);
-		ret = -1;
-	}
-#ifdef VERBOSE_DEBUG
-	if (ret != 0)
-	{
-		printf("Error! \n");
-		printf("\n\n-------=============Sent============-----------\n\n\n");
-		display_pvfs_structure(response,2);
-		printf("\n\n-------=============Recv'd============-----------\n\n\n");
-		display_pvfs_structure(decoded.buffer,2);
-	}
-	printf("\n\n-------=============Test 2 Completed============-----------\n\n\n");
-#else
-	if (ret != 0)
-		printf("GetConfig: %d\n",ret);
-#endif
-
-
-#ifndef USE_BMI_MSGS
-	PINT_encode_release(&encoded,
-								PINT_ENCODE_RESP,
-								0);
-#endif
-
-	//PINT_decode_release(&decoded,
-								//PINT_ENCODE_RESP,
-								//0);
-
-	// Lookup Path
-
-	response->op = PVFS_SERV_LOOKUP_PATH;
-
-	response->u.lookup_path.attr_array = malloc(sizeof(PVFS_object_attr)*3);
-	obj_attr = response->u.lookup_path.attr_array;
-	obj_attr[0].owner = 100;
-	obj_attr[1].owner = 101;
-	obj_attr[2].owner = 102;
-	obj_attr[0].group = 101;
-	obj_attr[1].group = 102;
-	obj_attr[2].group = 103;
-	obj_attr[0].perms = 
-		obj_attr[1].perms = 
-			obj_attr[2].perms = PVFS_O_READ | PVFS_O_WRITE;
-				
-
-	//memcpy(response->u.lookup_path.attr_array,&obj_attr,sizeof(PVFS_object_attr)*3);
-
-	response->u.lookup_path.handle_array = malloc( sizeof(PVFS_handle)*3);
-	response->u.lookup_path.handle_array[0] = 5;
-	response->u.lookup_path.handle_array[1] = 6;
-	response->u.lookup_path.handle_array[2] = 7;
-	response->u.lookup_path.handle_count = 3;
-	response->u.lookup_path.attr_count = 3;
-
-
-#ifdef USE_BMI_MSGS
-	BMI_memfree(me,
-					bmi_resp,
-					encoded.size_list[0],
-					BMI_RECV
-					);
-#endif
-	ret = PINT_encode(response,
-							PINT_ENCODE_RESP,
-							&encoded,
-							me,
-							0);
-	RET_CHECK("Error in Encoding Lookup_path Resp\n")
-
-#ifdef USE_BMI_MSGS
-	bmi_resp = BMI_memalloc(me,encoded.size_list[0],BMI_RECV);
-	ret = send_msg(client_ops[1],
-						me,
-						encoded.buffer_list[0],
-						encoded.size_list[0],
-						BMI_PRE_ALLOC,
-						0,
-						in_test_user_ptr,
-						context);
-
-	/* post a recv for the server acknowledgement */
-
-	ret = recv_msg(client_ops[0],
-						me,
-						bmi_resp,
-						encoded.size_list[0],
-						&actual_size,
-						BMI_PRE_ALLOC,
-						0,
-						in_test_user_ptr,
-						context);
-
-	free(encoded.buffer_list[0]);
-   encoded.buffer_list[0] = bmi_resp;	
-	encoded.total_size = actual_size;
-#endif
-
-
-	ret = PINT_decode(encoded.buffer_list[0],
-							PINT_ENCODE_RESP,
-							&decoded,
-							me,
-							encoded.total_size);
-	RET_CHECK("Error in Decoding Lookup Resp\n")
-	
-	if(((struct PVFS_server_resp *)decoded.buffer)->op != PVFS_SERV_LOOKUP_PATH)
-	{
-		printf("Op not correct after decoding Getconfig... Got %d\n",
-					((struct PVFS_server_resp *)decoded.buffer)->op);
-		ret = -1;
-	}
-#ifdef VERBOSE_DEBUG
-		printf("\n\n-------=============Sent============-----------\n\n\n");
-		display_pvfs_structure(response,2);
-		printf("\n\n-------=============Recv'd============-----------\n\n\n");
-		display_pvfs_structure(decoded.buffer,2);
-	if (ret != 0)
-	{
-		printf("Error! \n");
-		printf("\n\n-------=============Sent============-----------\n\n\n");
-		display_pvfs_structure(response,2);
-		printf("\n\n-------=============Recv'd============-----------\n\n\n");
-		display_pvfs_structure(decoded.buffer,2);
-	}
-	printf("\n\n-------=============Test 3 Completed============-----------\n\n\n");
-#else
-	if (ret != 0)
-		printf("Lookup_path: %d\n",ret);
-#endif
-
-#ifndef USE_BMI_MSGS
-	PINT_encode_release(&encoded,
-								PINT_ENCODE_RESP,
-								0);
-#endif
-
-	//PINT_decode_release(&decoded,
-								//PINT_ENCODE_RESP,
-								//0);
-
-
-#ifdef USE_BMI_MSGS
-	BMI_memfree(me,
-					bmi_resp,
-					encoded.size_list[0],
-					BMI_RECV
-					);
-	BMI_close_context(context);
-	BMI_finalize();
-#endif
-	PINT_encode_finalize();
-
-	free(request);
-	free(response);
-
-	return(0);
-}

--- test-request.c	2004-07-20 12:33:22.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,551 +0,0 @@
-/*
- * (C) 2001 Clemson University and The University of Chicago
- *
- * See COPYING in top-level directory.
- */
-
-#define USE_BMI_MSGS 1
-#include "bmi.h"
-#include "pvfs2-req-proto.h"
-#include "gossip.h"
-#include "stdlib.h"
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "trove.h"
-#include "PINT-reqproto-encode.h"
-#ifdef USE_BMI_MSGS
-#include "bmi-send-recv.h"
-#endif
-
-
-#define MAX_MSGS 10
-
-#define RET_CHECK(__name) if(ret != 0) {printf(__name);printf("ret=%d\n",ret);exit(-1);}
-
-#define DEFAULT_ADDRESS "tcp://speed.parl.clemson.edu:3334"
-#define TEST_STR "`1234567890-=qwertyuiop[]asdfghjkl;'zxcvbnm,./"
-#define NUM_DATAFILES 10
-
-void arrow(int direction)
-{
-	if (!direction)
-	{
-		printf("=<=");
-	}
-	else
-	{
-		printf("=>=");
-	}
-}
-
-void print_request(struct PVFS_server_req *my_req, int direction)
-{
-	int i;
-
-	arrow(direction);
-        printf("======================================\n");
-	arrow(direction);
-        printf("struct address = %p\n", my_req);
-        switch(my_req->op)
-        {
-                case PVFS_SERV_READDIR:
-			arrow(direction);
-                        printf("PVFS_SERV_READDIR structure:\n");
-			arrow(direction);
-                        printf("op = %d \n",(int) my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n",(int) my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_readdir->handle = %d\n",(int) my_req->u.readdir.handle );
-			arrow(direction);
-                        printf("PVFS_servreq_readdir->fs_id = %d\n",(int) my_req->u.readdir.fs_id );
-			arrow(direction);
-                        printf("PVFS_servreq_readdir->token = %d\n",(int) my_req->u.readdir.token );
-			arrow(direction);
-                        printf("PVFS_servreq_readdir->dirent_count = %d\n",(int) my_req->u.readdir.dirent_count );
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-
-                case PVFS_SERV_GETATTR:
-			arrow(direction);
-                        printf("PVFS_SERV_GETATTR structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n",(int) my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_getattr->handle = %d\n", (int)my_req->u.getattr.handle );
-			arrow(direction);
-                        printf("PVFS_servreq_getattr->fs_id = %d\n",(int) my_req->u.getattr.fs_id );
-			arrow(direction);
-                        printf("PVFS_servreq_getattr->attrmask = %d\n", (int)my_req->u.getattr.attrmask );
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-                case PVFS_SERV_REMOVE:
-			arrow(direction);
-                        printf("PVFS_SERV_REMOVE structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n", (int)my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_remove->handle = %d\n", (int)my_req->u.remove.handle );
-			arrow(direction);
-                        printf("PVFS_servreq_remove->fs_id  = %d\n", (int)my_req->u.remove.fs_id );
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-
-                case PVFS_SERV_TRUNCATE:
-			arrow(direction);
-                        printf("PVFS_SERV_TRUNCATE structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n",(int) my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n", (int)my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_truncate->handle = %d\n", (int)my_req->u.truncate.handle );
-			arrow(direction);
-                        printf("PVFS_servreq_truncate->fs_id = %d\n",(int) my_req->u.truncate.fs_id );
-			arrow(direction);
-                        printf("PVFS_servreq_truncate->size = %d\n", (int)my_req->u.truncate.size );
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-
-                case PVFS_SERV_CREATE:
-			arrow(direction);
-                        printf("PVFS_SERV_CREATE structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n",(int) my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_create->handle_extent_array.extent_count = %d\n", (int)my_req->u.create.handle_extent_array.extent_count );
-			arrow(direction);
-                        printf("PVFS_servreq_create->fs_id = %d\n",(int) my_req->u.create.fs_id );
-			arrow(direction);
-                        printf("PVFS_servreq_create->object_type = %d\n", (int)my_req->u.create.object_type );
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-
-                case PVFS_SERV_GETCONFIG:
-			arrow(direction);
-                        printf("PVFS_SERV_GETCONFIG structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n", (int)my_req->credentials.gid);
-			arrow(direction);
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-
-		case PVFS_SERV_LOOKUP_PATH:
-			arrow(direction);
-                        printf("PVFS_SERV_LOOKUP_PATH structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n", (int)my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_lookup_path.path = %s\n", my_req->u.lookup_path.path );
-			arrow(direction);
-                        printf("PVFS_servreq_lookup_path.fs_id = %d\n",(int) my_req->u.lookup_path.fs_id );
-			arrow(direction);
-                        printf("PVFS_servreq_lookup_path.starting_handle = %d\n", (int)my_req->u.lookup_path.starting_handle );
-			arrow(direction);
-                        printf("PVFS_servreq_lookup_path.attrmask = %d\n", (int)my_req->u.lookup_path.attrmask );
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-
-		case PVFS_SERV_CRDIRENT:
-			arrow(direction);
-                        printf("PVFS_SERV_CRDIRENT structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n", (int)my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_crdirent.name = %s\n", my_req->u.crdirent.name );
-			arrow(direction);
-                        printf("PVFS_servreq_crdirent.new_handle = %d\n", (int)my_req->u.crdirent.new_handle );
-			arrow(direction);
-                        printf("PVFS_servreq_crdirent.parent_handle = %d\n", (int)my_req->u.crdirent.parent_handle );
-			arrow(direction);
-                        printf("PVFS_servreq_crdirent.fs_id = %d\n", (int)my_req->u.crdirent.fs_id );
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-
-		case PVFS_SERV_RMDIRENT:
-			arrow(direction);
-                        printf("PVFS_SERV_RMDIRENT structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n", (int)my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_rmdirent.entry = %s\n", my_req->u.rmdirent.entry );
-			arrow(direction);
-                        printf("PVFS_servreq_rmdirent.parent_handle = %d\n", (int)my_req->u.rmdirent.parent_handle );
-			arrow(direction);
-                        printf("PVFS_servreq_rmdirent.fs_id = %d\n", (int)my_req->u.rmdirent.fs_id );
-			arrow(direction);
-                        printf("======================================\n");
-                        break;
-
-		case PVFS_SERV_SETATTR:
-			arrow(direction);
-                        printf("PVFS_SERV_SETATTR structure:\n");
-			arrow(direction);
-                        printf("op = %d \n", (int)my_req->op);
-			arrow(direction);
-                        printf("credentials.uid = %d\n", (int)my_req->credentials.uid);
-			arrow(direction);
-                        printf("credentials.gid = %d\n", (int)my_req->credentials.gid);
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.handle = %d\n", (int)my_req->u.setattr.handle );
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.fs_id = %d\n", (int)my_req->u.setattr.fs_id );
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.attr.mask = %d\n",(int) my_req->u.setattr.attr.mask );
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.attr.owner = %d\n", (int)my_req->u.setattr.attr.owner );
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.attr.group = %d\n", (int)my_req->u.setattr.attr.group );
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.attr.atime = %d\n", (int)my_req->u.setattr.attr.atime );
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.attr.mtime = %d\n", (int)my_req->u.setattr.attr.mtime );
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.attr.ctime = %d\n", (int)my_req->u.setattr.attr.ctime );
-			arrow(direction);
-                        printf("PVFS_servreq_setattr.attr.objtype = %d\n", (int)my_req->u.setattr.attr.objtype );
-			arrow(direction);
-			switch (my_req->u.setattr.attr.objtype)
-			{
-				case PVFS_TYPE_METAFILE:
-                        		printf("PVFS_servreq_setattr.attr.objtype = PVFS_TYPE_METAFILE\n" );
-			arrow(direction);
-                        		printf("PVFS_servreq_setattr.attr.u.meta.dfile_count = %d\n", (int)my_req->u.setattr.attr.u.meta.dfile_count );
-					for( i=0; i<my_req->u.setattr.attr.u.meta.dfile_count; i++ )
-					{
-						arrow(direction);
-                        			printf("PVFS_servreq_setattr.attr.u.meta.dfile_array[%d] = %d\n",(int)i, (int)my_req->u.setattr.attr.u.meta.dfile_array[i] );
-					}
-					break;
-				case PVFS_TYPE_DATAFILE:
-                        		printf("PVFS_servreq_setattr.attr.objtype = PVFS_TYPE_DATAFILE\n" );
-					arrow(direction);
-                        		printf("PVFS_servreq_setattr.attr.u.data.size = %d\n", (int)my_req->u.setattr.attr.u.data.size );
-					arrow(direction);
-					break;
-				case PVFS_TYPE_DIRECTORY:
-                        		printf("PVFS_servreq_setattr.attr.objtype = PVFS_TYPE_DIRECTORY\n" );
-					arrow(direction);
-					printf("PVFS_directory_attr_s is undefined\n");
-        				//request->u.setattr.attr.u.dir = ;
-					break;
-				case PVFS_TYPE_SYMLINK:
-                        		printf("PVFS_servreq_setattr.attr.objtype = PVFS_TYPE_SYMLINK\n" );
-					arrow(direction);
-					printf("PVFS_symlink_attr_s is undefined\n");
-        				//request->u.setattr.attr.u.sym = ;
-					break;
-				default:
-					printf("attribute object type %d undefined\n", my_req->u.setattr.attr.objtype);
-					break;
-			}
-        		//request->u.setattr.extended = ;
-                        printf("======================================\n");
-                        break;
-
-
-                default:
-                        printf("op def not included for op: %d\n",my_req->op);
-                        break;
-        }
-}
-
-
-int main(int argc, char **argv)
-{
-	struct PVFS_server_req *request;
-	struct PVFS_server_resp *response;
-	struct PINT_encoded_msg encoded;
-	struct PINT_decoded_msg decoded;
-	PVFS_BMI_addr_t me;
-	int ret = 0;
-	char* somechars = NULL;
-	int mylen = 0;
-	int i = 0;
-	PVFS_handle* datafiles;
-#ifdef USE_BMI_MSGS
-        bmi_op_id_t client_ops[2];
-        bmi_size_t actual_size;
-        void* bmi_resp;
-        void* in_test_user_ptr = &me;
-		  bmi_context_id context;
-#endif
-
-	request = (struct PVFS_server_req *) malloc(sizeof(struct PVFS_server_req));
-	datafiles = (PVFS_handle*) malloc( NUM_DATAFILES * sizeof( PVFS_handle ) );
-	response = (struct PVFS_server_resp *) malloc( sizeof(struct PVFS_server_resp) );
-
-	ret = PINT_encode_initialize();
-	RET_CHECK("PINT_encode_initialize failure\n")
-
-	ret = BMI_initialize("bmi_tcp", NULL, 0);
-
-	RET_CHECK("BMI init Error\n")
-
-	ret = BMI_open_context(&context);
-	
-	RET_CHECK("BMI_open_context\n")
-
-	//mylen = strlen(DEFAULT_ADDRESS);
-	//server = (char*) malloc(mylen);
-	//strncpy(server, DEFAULT_ADDRESS, mylen);
-
-	mylen = 25;//strlen(TEST_STR);
-	somechars = (char*) malloc(mylen + 1);
-	//strncpy( somechars, TEST_STR, mylen );
-	//strncpy( ((char*)somechars + mylen), "\0", 1 );
-
-	//printf("before BMI_lookup\n");
-	ret = BMI_addr_lookup(&(encoded.dest), DEFAULT_ADDRESS);
-	ret = BMI_addr_lookup(&me, DEFAULT_ADDRESS);
-
-	RET_CHECK("BMI lookup Error\n")
-
-	// Create
-
-	for(i = 0; i < MAX_MSGS; i++)
-	{
-	sprintf(somechars, "this is iteration %d\n", i);
-
-	printf("before PINT_encode\n");
-
-	switch( i )
-	{
-	case 0:
-	request->op = PVFS_SERV_GETCONFIG;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-	break;
-
-	// simple ops
-
-	case 1:
-	request->op = PVFS_SERV_CREATE;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-            {
-                TROVE_extent cur_extent;
-
-                cur_extent.first = cur_extent.last = 69;
-                request->u.create.handle_extent_array.extent_count = 1;
-                request->u.create.handle_extent_array.extent_array = &cur_extent;
-            }
-	request->u.create.fs_id = 11111;
-	request->u.create.object_type = 11111;
-	break;
-
-	case 3:
-        request->op = PVFS_SERV_READDIR;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-        request->u.readdir.handle = 11111;
-        request->u.readdir.fs_id = 22222;
-        request->u.readdir.token = 33333;
-        request->u.readdir.dirent_count = 44444 ;
-	break;
-
-	case 4:
-        request->op =  PVFS_SERV_GETATTR;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-        request->u.getattr.handle = 11111;
-        request->u.getattr.fs_id  = 22222;
-        request->u.getattr.attrmask  = 33333;
-	break;
-
-	case 5:
-        request->op = PVFS_SERV_REMOVE;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-        request->u.remove.handle = 11111;
-        request->u.remove.fs_id  = 22222;
-	break;
-
-	case 6:
-        request->op = PVFS_SERV_TRUNCATE;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-        request->u.truncate.handle = 11111;
-        request->u.truncate.fs_id = 22222;
-        request->u.truncate.size = 33333;
-	break;
-
-	case 7:
-	request->op = PVFS_SERV_LOOKUP_PATH;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-        request->u.lookup_path.path = somechars;
-        request->u.lookup_path.fs_id = 11111;
-        request->u.lookup_path.starting_handle = 22222;
-        request->u.lookup_path.attrmask = 33333;
-	break;
-
-	case 8:
-        request->op = PVFS_SERV_CRDIRENT;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-        request->u.crdirent.name = somechars;
-        request->u.crdirent.new_handle = 111111;
-        request->u.crdirent.parent_handle = 222222;
-        request->u.crdirent.fs_id = 333333;
-	break;
-
-	case 9:
-        request->op = PVFS_SERV_RMDIRENT;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-        request->u.rmdirent.entry = somechars;
-        request->u.rmdirent.parent_handle = 111111;
-        request->u.rmdirent.fs_id  = 2222222;
-	break;
-
-	default:
-		printf("subscript out of range jackass\n");
-		break;
-	
-/*
-        request->op = PVFS_SERV_SETATTR;
-	request->credentials.uid = 420;
-	request->credentials.gid = 420;
-        request->u.setattr.handle = 111111;
-        request->u.setattr.fs_id  = 2222222;
-        request->u.setattr.attrmask  = 333333;
-        request->u.setattr.attr.owner = 14201;
-        request->u.setattr.attr.group = 14201;
-        request->u.setattr.attr.perms = 14201;
-        request->u.setattr.attr.atime = 16661;
-        request->u.setattr.attr.mtime = 16661;
-        request->u.setattr.attr.ctime = 16661;
-        request->u.setattr.attr.objtype = PVFS_TYPE_METAFILE;
-       		request->u.setattr.attr.u.meta.nr_datafiles = NUM_DATAFILES;
-		for( i=0; i<request->u.setattr.attr.u.meta.nr_datafiles; i++ )
-			datafiles[i] = i;
-		request->u.setattr.attr.u.meta.dfh = datafiles;
-        //request->u.setattr.attr.objtype = PVFS_TYPE_DATAFILE;
-	//	request->u.setattr.attr.u.data.size = 100;
-
-        // -
-	// - should test these structs, but they're undefined at present
-	// -
-	//request->u.setattr.attr.u.dir = ;
-        //request->u.setattr.attr.u.sym = ;
-        //request->u.setattr.extended = ;
-*/
-
-	} // end of switch statement
-
-
-	printf("struct before enc:\n");
-	print_request( request, 0 );
-	ret = PINT_encode(request,
-							PINT_ENCODE_REQ,
-							&encoded,
-							me,
-							0);
-	RET_CHECK("Error in Encoding Create Req\n")
-
-#ifdef USE_BMI_MSGS
-        bmi_resp = BMI_memalloc(me,encoded.size_list[0],BMI_RECV);
-        ret = send_msg(client_ops[1],
-                                                me,
-                                                encoded.buffer_list[0],
-                                                encoded.size_list[0],
-                                                BMI_PRE_ALLOC,
-                                                0,
-                                                in_test_user_ptr,
-																context);
-
-        /* post a recv for the server acknowledgement */
-
-        ret = recv_msg(client_ops[0],
-                                                me,
-                                                bmi_resp,
-                                                encoded.size_list[0],
-                                                &actual_size,
-                                                BMI_PRE_ALLOC,
-                                                0,
-                                                in_test_user_ptr,
-																context);
-
-        //free(encoded.buffer_list[0]);
-   //encoded.buffer_list[0] = bmi_resp;
-#endif
-	//printf("before decode:\n");
-
-	//ret = PINT_decode(encoded.buffer_list[0],
-	ret = PINT_decode(bmi_resp,
-							PINT_ENCODE_REQ,
-							&decoded,
-							me,
-							actual_size);
-	RET_CHECK("Error in Decoding Create Resp\n")
-
-	print_request( (struct PVFS_server_req *)decoded.buffer , 1 );
-
-	PINT_encode_release(	&encoded,
-				PINT_ENCODE_REQ);
-
-	PINT_decode_release(	&decoded,
-				PINT_ENCODE_REQ);
-#ifdef USE_BMI_MSGS
-        BMI_memfree(me,
-                                        bmi_resp,
-                                        encoded.size_list[0],
-                                        BMI_RECV
-                                        );
-	BMI_close_context(context);
-	BMI_finalize();
-#endif
-
-	}// end of for loop
-
-	PINT_encode_finalize();
-
-	free(request);
-	free(response);
-	free(somechars);
-	free(datafiles);
-
-	return(0);
-}



More information about the PVFS2-CVS mailing list