net: add module parameter mars_port=

This commit is contained in:
Thomas Schoebel-Theuer 2013-04-09 15:03:46 +02:00
parent eaba743456
commit 07a40e7881
4 changed files with 11 additions and 2 deletions

View File

@ -57,7 +57,8 @@ config MARS_DEFAULT_PORT
default 7777
---help---
Best practice is to uniformly use the same port number
in a cluster. Therefore, this is compiletime constant.
in a cluster. Therefore, this is a compiletime constant.
You may override this at insmod time via the mars_port= parameter.
config MARS_MEM_RETRY
bool "make MARS memory allocation more robust"

View File

@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/moduleparam.h>
#include "mars.h"
#include "mars_net.h"
@ -24,6 +25,10 @@
/* Low-level network traffic
*/
int mars_net_default_port = CONFIG_MARS_DEFAULT_PORT;
EXPORT_SYMBOL_GPL(mars_net_default_port);
module_param_named(mars_port, mars_net_default_port, int, 0);
/* TODO: allow binding to specific source addresses instead of catch-all.
* TODO: make all the socket options configurable.
* TODO: implement signal handling.
@ -58,7 +63,7 @@ int mars_create_sockaddr(struct sockaddr_storage *addr, const char *spec)
memset(addr, 0, sizeof(*addr));
sockaddr->sin_family = AF_INET;
sockaddr->sin_port = htons(CONFIG_MARS_DEFAULT_PORT);
sockaddr->sin_port = htons(mars_net_default_port);
/* Try to translate hostnames to IPs if possible.
*/

View File

@ -8,6 +8,7 @@
#include "brick.h"
extern int mars_net_default_port;
extern bool mars_net_is_alive;
#define MAX_FIELD_LEN 32

View File

@ -232,6 +232,8 @@ ctl_table mars_table[] = {
#ifdef CONFIG_MARS_LOADAVG_LIMIT
INT_ENTRY("loadavg_limit", mars_max_loadavg, 0600),
#endif
// changing makes no sense because the server will immediately start upon modprobe
INT_ENTRY("mars_port", mars_net_default_port, 0400),
INT_ENTRY("network_io_timeout", global_net_io_timeout, 0600),
{
_CTL_NAME