Commit 3e288f56 authored by Sumit Narayan's avatar Sumit Narayan
Browse files

Replaced BMI_QUERY_TRANSPORT_METHOD with BMI_TRANSPORT_METHOD_STRING.

This new get info option returns a comma separated list of protocols
that bmi is configured with.
parent d9d6e53b
......@@ -86,7 +86,7 @@ enum
BMI_OPTIMISTIC_BUFFER_REG = 14,
BMI_TCP_CHECK_UNEXPECTED = 15,
BMI_ZOID_POST_TIMEOUT = 16,
BMI_QUERY_TRANSPORT_METHOD = 17,
BMI_TRANSPORT_METHODS_STRING = 17,
};
enum BMI_io_type
......
......@@ -1428,34 +1428,57 @@ int BMI_get_info(BMI_addr_t addr,
}
break;
case BMI_QUERY_TRANSPORT_METHOD:
case BMI_TRANSPORT_METHODS_STRING:
{
int i = 0;
/*
* [OUT] inout_parameter : contains comma-separated list of transport
* protocols, memory allocated here and must
* be free'd by the caller.
* @return : total number of transport protocols
* supported by bmi.
*/
int kmstring_length = 0;
int kmc = sizeof(static_methods) / sizeof(static_methods[0]) - 1;
int length = strlen("bmi_") + strlen((char*) inout_parameter) + 1;
char *method = malloc(length);
int i = 0;
char **stringptr = (char **) &(*(char*) inout_parameter);
/* Check if there are any transport protocol supported, else return */
if (kmc <= 0)
{
return 0;
}
if (method == NULL)
/* Find out the length the output string will be. */
for (i = 0; i < kmc; ++i)
{
return -1;
kmstring_length += strlen(static_methods[i]->method_name)
- strlen("bmi_") + sizeof(",");
}
memset(method, 0, length);
strcpy(method, "bmi_");
strcat(method, (char*) inout_parameter);
/* +1 for null character */
(*stringptr) = malloc(kmstring_length + 1);
if ((*stringptr) == NULL)
{
return bmi_errno_to_pvfs(-ENOMEM);
}
memset((*stringptr), 0, kmstring_length);
/* The transport protocol's names begins with bmi_, offset the
* method name when concatenating.
*/
for (i = 0; i < kmc; ++i)
{
if (strcmp(static_methods[i]->method_name, method) == 0)
{
free(method);
return 1;
}
strcat((*stringptr), static_methods[i]->method_name + strlen("bmi_"));
strcat((*stringptr), ",");
}
free(method);
return kmc;
}
break;
default:
return (bmi_errno_to_pvfs(-ENOSYS));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment