Every place where "struct lnet_lnd" appears, "const" is
added in front. Now all those structs can be in read-only
memory which is generally more secure.
Linux-commit
07499855083e ("lnet: make "struct lnet_lnd"
always "const".")
Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I54a73d5b12de8c6b9a98182577c3c30d05c00222
Reviewed-on: https://review.whamcloud.com/36832
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Chris Horn <hornc@cray.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
((1U << the_lnet.ln_remote_nets_hbits) - 1)];
}
((1U << the_lnet.ln_remote_nets_hbits) - 1)];
}
-extern struct lnet_lnd the_lolnd;
+extern const struct lnet_lnd the_lolnd;
extern int avoid_asym_router_failure;
extern unsigned int lnet_nid_cpt_hash(lnet_nid_t nid, unsigned int number);
extern int avoid_asym_router_failure;
extern unsigned int lnet_nid_cpt_hash(lnet_nid_t nid, unsigned int number);
int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset);
unsigned int lnet_get_lnd_timeout(void);
int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset);
unsigned int lnet_get_lnd_timeout(void);
-void lnet_register_lnd(struct lnet_lnd *lnd);
-void lnet_unregister_lnd(struct lnet_lnd *lnd);
+void lnet_register_lnd(const struct lnet_lnd *lnd);
+void lnet_unregister_lnd(const struct lnet_lnd *lnd);
int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
__u32 local_ip, __u32 peer_ip, int peer_port, struct net *ns);
int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
__u32 local_ip, __u32 peer_ip, int peer_port, struct net *ns);
bool net_tunables_set;
/* procedural interface */
bool net_tunables_set;
/* procedural interface */
- struct lnet_lnd *net_lnd;
+ const struct lnet_lnd *net_lnd;
/* list of NIs on this net */
struct list_head net_ni_list;
/* list of NIs on this net */
struct list_head net_ni_list;
/* uniquely identifies this ni in this epoch */
__u64 ln_interface_cookie;
/* registered LNDs */
/* uniquely identifies this ni in this epoch */
__u64 ln_interface_cookie;
/* registered LNDs */
- struct lnet_lnd *ln_lnds[NUM_LNDS];
+ const struct lnet_lnd *ln_lnds[NUM_LNDS];
/* test protocol compatibility flags */
int ln_testprotocompat;
/* test protocol compatibility flags */
int ln_testprotocompat;
#include "gnilnd.h"
/* Primary entry points from LNET. There are no guarantees against reentrance. */
#include "gnilnd.h"
/* Primary entry points from LNET. There are no guarantees against reentrance. */
-struct lnet_lnd the_kgnilnd = {
+const struct lnet_lnd the_kgnilnd = {
.lnd_type = GNILND,
.lnd_startup = kgnilnd_startup,
.lnd_shutdown = kgnilnd_shutdown,
.lnd_type = GNILND,
.lnd_startup = kgnilnd_startup,
.lnd_shutdown = kgnilnd_shutdown,
-static struct lnet_lnd the_o2iblnd;
+static const struct lnet_lnd the_o2iblnd;
struct kib_data kiblnd_data;
struct kib_data kiblnd_data;
-static struct lnet_lnd the_o2iblnd = {
+static const struct lnet_lnd the_o2iblnd = {
.lnd_type = O2IBLND,
.lnd_startup = kiblnd_startup,
.lnd_shutdown = kiblnd_shutdown,
.lnd_type = O2IBLND,
.lnd_startup = kiblnd_startup,
.lnd_shutdown = kiblnd_shutdown,
#include "socklnd.h"
#include <linux/inetdevice.h>
#include "socklnd.h"
#include <linux/inetdevice.h>
-static struct lnet_lnd the_ksocklnd;
+static const struct lnet_lnd the_ksocklnd;
struct ksock_nal_data ksocknal_data;
static struct ksock_interface *
struct ksock_nal_data ksocknal_data;
static struct ksock_interface *
lnet_unregister_lnd(&the_ksocklnd);
}
lnet_unregister_lnd(&the_ksocklnd);
}
-static struct lnet_lnd the_ksocklnd = {
+static const struct lnet_lnd the_ksocklnd = {
.lnd_type = SOCKLND,
.lnd_startup = ksocknal_startup,
.lnd_shutdown = ksocknal_shutdown,
.lnd_type = SOCKLND,
.lnd_startup = ksocknal_startup,
.lnd_shutdown = ksocknal_shutdown,
BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_ni) != 0);
}
BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_ni) != 0);
}
-static struct lnet_lnd *lnet_find_lnd_by_type(__u32 type)
+static const struct lnet_lnd *lnet_find_lnd_by_type(__u32 type)
+ const struct lnet_lnd *lnd;
/* holding lnd mutex */
if (type >= NUM_LNDS)
/* holding lnd mutex */
if (type >= NUM_LNDS)
EXPORT_SYMBOL(lnet_get_lnd_timeout);
void
EXPORT_SYMBOL(lnet_get_lnd_timeout);
void
-lnet_register_lnd(struct lnet_lnd *lnd)
+lnet_register_lnd(const struct lnet_lnd *lnd)
{
mutex_lock(&the_lnet.ln_lnd_mutex);
{
mutex_lock(&the_lnet.ln_lnd_mutex);
EXPORT_SYMBOL(lnet_register_lnd);
void
EXPORT_SYMBOL(lnet_register_lnd);
void
-lnet_unregister_lnd(struct lnet_lnd *lnd)
+lnet_unregister_lnd(const struct lnet_lnd *lnd)
{
mutex_lock(&the_lnet.ln_lnd_mutex);
{
mutex_lock(&the_lnet.ln_lnd_mutex);
int rc;
int ni_count = 0;
__u32 lnd_type;
int rc;
int ni_count = 0;
__u32 lnd_type;
+ const struct lnet_lnd *lnd;
int peer_timeout =
net->net_tunables.lct_peer_timeout;
int maxtxcredits =
int peer_timeout =
net->net_tunables.lct_peer_timeout;
int maxtxcredits =
-struct lnet_lnd the_lolnd = {
+const struct lnet_lnd the_lolnd = {
.lnd_type = LOLND,
.lnd_startup = lolnd_startup,
.lnd_shutdown = lolnd_shutdown,
.lnd_type = LOLND,
.lnd_startup = lolnd_startup,
.lnd_shutdown = lolnd_shutdown,