[PVFS2-CVS] commit by pcarns in pvfs2/test/server: module.mk.in getconfig.c print-struct.h

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


Update of /projects/cvsroot/pvfs2/test/server
In directory parlweb:/tmp/cvs-serv26198/test/server

Modified Files:
	module.mk.in 
Removed Files:
	getconfig.c print-struct.h 
Log Message:
removed some depricated test programs


Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/server/module.mk.in,v
diff -p -u -r1.12 -r1.13
--- module.mk.in	15 Apr 2004 00:20:08 -0000	1.12
+++ module.mk.in	20 Jul 2004 16:47:02 -0000	1.13
@@ -1,7 +1,6 @@
 DIR := server
 
 TESTSRC += \
-	$(DIR)/getconfig.c \
 	$(DIR)/showconfig.c
 
 test/server/showconfig: test/server/showconfig.o lib/libpvfs2-server.a

--- getconfig.c	2004-07-20 12:47:02.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,281 +0,0 @@
-/*
- * This is an example of a client 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 <pvfs2-req-proto.h>
-#include <print-struct.h>
-#include <PINT-reqproto-encode.h>
-
-#define DEFAULT_FILESYSTEM_NAME               "fs-foo"
-#define DEFAULT_HOSTID          "tcp://localhost:3334"
-#define DEFAULT_METHOD                       "bmi_tcp"
-
-/**************************************************************
- * Data structures 
- */
-
-/* A little structure to hold program options, either defaults or
- * specified on the command line 
- */
-struct options{
-	char* hostid;       /* host identifier */
-	char* method;       /* bmi method to use */
-};
-
-
-/**************************************************************
- * Internal utility functions
- */
-
-static struct options* parse_args(int argc, char* argv[]);
-
-
-/**************************************************************/
-
-int main(int argc, char **argv)	{
-
-	struct options* user_opts = NULL;
-	struct PVFS_server_req *server_req = NULL;
-	struct PVFS_server_resp *server_resp = NULL;
-	int ret = -1;
-	PVFS_BMI_addr_t server_addr;
-	bmi_op_id_t client_ops[2];
-	int outcount = 0;
-	bmi_error_code_t error_code;
-	bmi_size_t actual_size;
-	struct PINT_encoded_msg encoded_msg;
-	struct PINT_decoded_msg decoded_msg;
-	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(0, 0);
-
-	ret = PINT_encode_initialize();
-	if(ret < 0)
-	{
-	    fprintf(stderr, "PINT_encode_initialize failure.\n");
-	    return(-1);
-	}
-
-	/* initialize local interface */
-	ret = BMI_initialize(user_opts->method, NULL, 0);
-	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);
-	}
-
-	/* get a bmi_addr for the server */
-	ret = BMI_addr_lookup(&server_addr, user_opts->hostid);
-	if(ret < 0){
-		errno = -ret;
-		perror("BMI_addr_lookup");
-		return(-1);
-	}
-
-	server_req = (struct PVFS_server_req*)BMI_memalloc(server_addr, 
-		sizeof(struct PVFS_server_req), BMI_SEND);
-	server_resp = (struct PVFS_server_resp*)BMI_memalloc(server_addr, 
-		sizeof(struct PVFS_server_resp)+8192, BMI_RECV);
-	if(!server_req || !server_resp){
-		fprintf(stderr, "BMI_memalloc failed.\n");
-		return(-1);
-	}
-
-	/* setup create request */
-	server_req->op = PVFS_SERV_GETCONFIG;
-	server_req->credentials.uid = 0;
-	server_req->credentials.gid = 0;
-
-	display_pvfs_structure(server_req,1);
-	ret = PINT_encode(server_req,PINT_ENCODE_REQ,&encoded_msg,server_addr,0);
-	printf("\n---encoded_msg (server_req) ---\n");
-	display_pvfs_structure(encoded_msg.buffer_list[0],1);
-
-	/* send the initial request on its way */
-	ret = BMI_post_sendunexpected(&(client_ops[1]), server_addr, encoded_msg.buffer_list[0], 
-		encoded_msg.total_size, BMI_PRE_ALLOC, 0, NULL, context);
-	if(ret < 0)
-	{
-		errno = -ret;
-		perror("BMI_post_send");
-		return(-1);
-	}
-	if(ret == 0)
-	{
-		/* turning this into a blocking call for testing :) */
-		/* check for completion of request */
-		do
-		{
-			ret = BMI_test(client_ops[1], &outcount, &error_code, &actual_size,
-				NULL, 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);
-		}
-	}
-
-	/* post a recv for the server acknowledgement */
-	ret = BMI_post_recv(&(client_ops[0]), server_addr, server_resp, 
-		sizeof(struct PVFS_server_resp)+8192, &actual_size, BMI_PRE_ALLOC, 0, 
-		NULL, 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(client_ops[0], &outcount, &error_code,
-				&actual_size, NULL, 10, context);
-		} while(ret == 0 && outcount == 0);
-
-		if(ret < 0 || error_code != 0)
-		{
-			fprintf(stderr, "Ack recv failed.\n");
-			fprintf(stderr, "Ret: %d, E_code: %d\n",ret,error_code);
-			return(-1);
-		}
-	}
-	else
-	{
-		if(actual_size != sizeof(struct PVFS_server_resp))
-		{
-			printf("Short recv.\n");
-			return(-1);
-		}
-	}
-
-	ret = PINT_decode(server_resp,PINT_ENCODE_RESP,
-                          &decoded_msg,server_addr,actual_size);
-	printf("Decoded response size: %d\n",(int)actual_size);
-	printf("\n---decoded_msg (server_resp) ---\n");
-	display_pvfs_structure(decoded_msg.buffer,0);
-	BMI_memfree(server_addr, server_resp, sizeof(struct PVFS_server_resp)+8192, 
-		BMI_RECV);
-	server_resp = decoded_msg.buffer;
-	if(server_resp->op != PVFS_SERV_GETCONFIG)
-	{
-		printf("ERROR: received ack of wrong type (%d)\n", (int)server_resp->op);
-	}
-	if(server_resp->status != 0)
-	{
-		printf("ERROR: server returned status: %d\n",
-			(int)server_resp->status);
-	}
-
-	/* free up memory buffers */
-	BMI_memfree(server_addr, server_req, sizeof(struct PVFS_server_req), 
-		BMI_SEND);
-	BMI_memfree(server_addr, server_resp, sizeof(struct PVFS_server_resp)+8192, 
-		BMI_RECV);
-
-	/* shutdown the local interface */
-	BMI_close_context(context);
-	ret = BMI_finalize();
-	if(ret < 0){
-		errno = -ret;
-		perror("BMI_finalize");
-		return(-1);
-	}
-
-	PINT_encode_finalize();
-
-	/* turn off debugging stuff */
-	gossip_disable();
-
-	free(user_opts->hostid);
-	free(user_opts->method);
-	free(user_opts);
-	return(0);
-}
-
-
-static struct options* parse_args(int argc, char* argv[]){
-
-	/* getopt stuff */
-	extern char* optarg;
-	extern int optind, opterr, optopt;
-	char flags[] = "h:m:";
-	int one_opt = 0;
-
-	struct options* tmp_opts = NULL;
-
-	tmp_opts = (struct options*)malloc(sizeof(struct options));
-	if(!tmp_opts){
-		goto parse_args_error;
-	}
-	memset(tmp_opts, 0, sizeof(struct options));
-	tmp_opts->hostid = strdup(DEFAULT_HOSTID);
-	tmp_opts->method = strdup(DEFAULT_METHOD);
-	if (!tmp_opts->method || !tmp_opts->hostid)
-	{
-		goto parse_args_error;
-	}
-
-	/* look at command line arguments */
-	while((one_opt = getopt(argc, argv, flags)) != EOF){
-		switch(one_opt){
-			case('h'):
-				free(tmp_opts->hostid);
-				tmp_opts->hostid = strdup(optarg);
-				break;
-			case('m'):
-				free(tmp_opts->method);
-				tmp_opts->method = strdup(optarg);
-				break;
-			default:
-				break;
-		}
-	}
-	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);
-}
-

--- print-struct.h	2004-07-20 12:47:02.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,184 +0,0 @@
-/*
- * (C) 2001 Clemson University and The University of Chicago
- *
- * See COPYING in top-level directory.
- */
-
-
-#ifndef __PRINT_STRUCT_H
-#define __PRINT_STRUCT_H
-
-#include "pvfs2-req-proto.h"
-
-static inline void dump_attribs(
-    PVFS_object_attr a)
-{
-    printf("\tUserID: %d\n", a.owner);
-    printf("\tGID: %d\n", a.group);
-    printf("\tPerms: %xh\n", a.perms);
-    printf("\tAtime: %lld\n", (long long) a.atime);
-    printf("\tMtime: %lld\n", (long long) a.mtime);
-    printf("\tCtime: %lld\n", (long long) a.ctime);
-    printf("\tType: %d\n", a.objtype);
-    printf("\tMask: %d\n", (int) a.mask);
-}
-
-static inline void display_pvfs_structure(
-    void *s,
-    int r)
-{
-    int i = 0;
-    if (r == 1)	//Request
-    {
-	struct PVFS_server_req *p = s;
-	printf("Op: %d\n", p->op);
-	switch (p->op)
-	{
-	case PVFS_SERV_CREATE:
-	    printf("Create Request Structure\n");
-	    printf("Num Requested Handle Ranges: %d\n",
-		   p->u.create.handle_extent_array.extent_count);
-	    /* todo: print the ranges */
-	    printf("FSid: %d\n", p->u.create.fs_id);
-	    printf("ObjectType: %d\n", p->u.create.object_type);
-	    break;
-	case PVFS_SERV_REMOVE:
-	    printf("Remove Request Structure\n");
-	    printf("Handle: %Lu\n", Lu(p->u.remove.handle));
-	    printf("FSid: %d\n", p->u.remove.fs_id);
-	    break;
-	case PVFS_SERV_IO:
-	    printf("NOT SURE\n");
-	    break;
-	case PVFS_SERV_GETATTR:
-	    printf("Get Attrib Request Struct\n");
-	    printf("Handle: %Lu\n", Lu(p->u.getattr.handle));
-	    printf("FSid: %d\n", p->u.getattr.fs_id);
-	    printf("AttrMsk: %Xh\n", p->u.getattr.attrmask);
-	    break;
-	case PVFS_SERV_SETATTR:
-	    printf("Set Attrib Request Struct\n");
-	    printf("Handle: %Lu\n", Lu(p->u.setattr.handle));
-	    printf("FSid: %d\n", p->u.setattr.fs_id);
-	    printf("Attribs:\n");
-	    dump_attribs(p->u.setattr.attr);
-	    break;
-	case PVFS_SERV_LOOKUP_PATH:
-	    printf("Lookup Path Request Struct\n");
-	    printf("Path: %s\n", p->u.lookup_path.path);
-	    printf("FSid: %d\n", p->u.lookup_path.fs_id);
-	    printf("Start Handle: %Lu\n", Lu(p->u.lookup_path.starting_handle));
-	    printf("Bitmask: %Xh\n", p->u.lookup_path.attrmask);
-	    break;
-	case PVFS_SERV_MKDIR:
-	    printf("Mkdir Req\n");
-	    printf("Num Requested Handle Ranges: %d\n",
-		   p->u.mkdir.handle_extent_array.extent_count);
-	    /* todo: print the ranges */
-	    printf("FSid: %d\n", p->u.mkdir.fs_id);
-	    printf("Attribs:\n");
-	    dump_attribs(p->u.mkdir.attr);
-	    break;
-	case PVFS_SERV_CRDIRENT:
-	    printf("Create Dirent Req\n");
-	    printf("Name: %s\n", p->u.crdirent.name);
-	    printf("New Handle: %Lu\n", Lu(p->u.crdirent.new_handle));
-	    printf("Parent Handle: %Lu\n", Lu(p->u.crdirent.parent_handle));
-	    printf("FSid: %d\n", p->u.crdirent.fs_id);
-	    break;
-	case PVFS_SERV_RMDIRENT:
-	    printf("Remove Dir Entry Req\n");
-	    printf("Entry: %s\n", p->u.rmdirent.entry);
-	    printf("Parent Handle: %Lu\n", Lu(p->u.rmdirent.parent_handle));
-	    printf("FSid: %d\n", p->u.rmdirent.fs_id);
-	    break;
-	case PVFS_SERV_GETCONFIG:
-	    printf("Get Config\n");
-	    break;
-	case PVFS_SERV_READDIR:
-	    printf("Read Dir\n");
-	    printf("Handle: %Lu\n", Lu(p->u.readdir.handle));
-	    printf("FSid: %d\n", p->u.readdir.fs_id);
-	    printf("Token: %d\n", (int) p->u.readdir.token);
-	    printf("Dir Ents: %d\n", p->u.readdir.dirent_count);
-	    break;
-	default:
-	    printf("Invalid Request\n");
-	}
-    }
-    else
-    {
-	struct PVFS_server_resp *p = s;
-	printf("Op: %d\n", p->op);
-	switch (p->op)
-	{
-	case PVFS_SERV_GETATTR:
-	    printf("Get Attrib Response Struct\n");
-	    printf("Attribs:\n");
-	    dump_attribs(p->u.getattr.attr);
-	    break;
-	case PVFS_SERV_CREATE:
-	    printf("Create Resp Structure\n");
-	    printf("Bucket: %Lu\n", Lu(p->u.create.handle));
-	    break;
-	case PVFS_SERV_LOOKUP_PATH:
-	    printf("Lookup Path Resp Struct\n");
-	    printf("Handle Array (Total: %d)\n", p->u.lookup_path.handle_count);
-	    while (i++ < p->u.lookup_path.handle_count)
-	    {
-		printf("%d\t%Lu\n", i, Lu(p->u.lookup_path.handle_array[i - 1]));
-		printf("Attribs:\n");
-		dump_attribs(p->u.lookup_path.attr_array[i - 1]);
-	    }
-	    break;
-	case PVFS_SERV_MKDIR:
-	    printf("Mkdir Resp\n");
-	    printf("Handle: %Lu\n", Lu(p->u.mkdir.handle));
-	    break;
-	case PVFS_SERV_RMDIRENT:
-	    printf("Remove Dir Entry Resp\n");
-	    printf("Entry Handle: %Lu\n", Lu(p->u.rmdirent.entry_handle));
-	    break;
-	case PVFS_SERV_GETCONFIG:
-	    printf("Get Config Resp\n");
-	    printf("FS Config buffer length: %d\n",
-		   p->u.getconfig.fs_config_buf_size);
-	    printf("FS Config buffer:\n%s\n", p->u.getconfig.fs_config_buf);
-	    printf("SERVER Config buffer length: %d\n",
-		   p->u.getconfig.server_config_buf_size);
-	    printf("SERVER Config buffer:\n%s\n",
-		   p->u.getconfig.server_config_buf);
-	    break;
-	case PVFS_SERV_READDIR:
-	    printf("Read dir\n");
-	    printf("Token: %d\n", (int) p->u.readdir.token);
-	    printf("Count: %d\n", p->u.readdir.dirent_count);
-	    while (i++ < p->u.readdir.dirent_count)
-	    {
-		printf("%s\t%Lu\n", p->u.readdir.dirent_array[i - 1].d_name,
-		       Lu(p->u.readdir.dirent_array[i - 1].handle));
-	    }
-	    break;
-
-	case PVFS_SERV_REMOVE:
-	case PVFS_SERV_IO:
-	case PVFS_SERV_SETATTR:
-	case PVFS_SERV_CRDIRENT:
-	    printf("Shouldn't have a response\n");
-	    break;
-	default:
-	    printf("Unsupported operation\n");
-	}
-    }
-}
-
-#endif /* __PRINT_STRUCT_H */
-
-/*
- * Local variables:
- *  c-indent-level: 4
- *  c-basic-offset: 4
- * End:
- *
- * vim: ts=8 sts=4 sw=4 noexpandtab
- */



More information about the PVFS2-CVS mailing list