Commit 533cb5b0 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

[XFRM]: constify 'struct xfrm_type'

Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2216b483
...@@ -202,7 +202,7 @@ struct xfrm_state ...@@ -202,7 +202,7 @@ struct xfrm_state
/* Reference to data common to all the instances of this /* Reference to data common to all the instances of this
* transformer. */ * transformer. */
struct xfrm_type *type; const struct xfrm_type *type;
struct xfrm_mode *inner_mode; struct xfrm_mode *inner_mode;
struct xfrm_mode *outer_mode; struct xfrm_mode *outer_mode;
...@@ -279,7 +279,7 @@ struct xfrm_state_afinfo { ...@@ -279,7 +279,7 @@ struct xfrm_state_afinfo {
unsigned int proto; unsigned int proto;
unsigned int eth_proto; unsigned int eth_proto;
struct module *owner; struct module *owner;
struct xfrm_type *type_map[IPPROTO_MAX]; const struct xfrm_type *type_map[IPPROTO_MAX];
struct xfrm_mode *mode_map[XFRM_MODE_MAX]; struct xfrm_mode *mode_map[XFRM_MODE_MAX];
int (*init_flags)(struct xfrm_state *x); int (*init_flags)(struct xfrm_state *x);
void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
...@@ -322,8 +322,8 @@ struct xfrm_type ...@@ -322,8 +322,8 @@ struct xfrm_type
u32 (*get_mtu)(struct xfrm_state *, int size); u32 (*get_mtu)(struct xfrm_state *, int size);
}; };
extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); extern int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); extern int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
struct xfrm_mode { struct xfrm_mode {
/* /*
......
...@@ -300,7 +300,7 @@ static void ah_destroy(struct xfrm_state *x) ...@@ -300,7 +300,7 @@ static void ah_destroy(struct xfrm_state *x)
} }
static struct xfrm_type ah_type = static const struct xfrm_type ah_type =
{ {
.description = "AH4", .description = "AH4",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -600,7 +600,7 @@ error: ...@@ -600,7 +600,7 @@ error:
return err; return err;
} }
static struct xfrm_type esp_type = static const struct xfrm_type esp_type =
{ {
.description = "ESP4", .description = "ESP4",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -437,7 +437,7 @@ error: ...@@ -437,7 +437,7 @@ error:
goto out; goto out;
} }
static struct xfrm_type ipcomp_type = { static const struct xfrm_type ipcomp_type = {
.description = "IPCOMP4", .description = "IPCOMP4",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.proto = IPPROTO_COMP, .proto = IPPROTO_COMP,
......
...@@ -38,7 +38,7 @@ static void ipip_destroy(struct xfrm_state *x) ...@@ -38,7 +38,7 @@ static void ipip_destroy(struct xfrm_state *x)
{ {
} }
static struct xfrm_type ipip_type = { static const struct xfrm_type ipip_type = {
.description = "IPIP", .description = "IPIP",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.proto = IPPROTO_IPIP, .proto = IPPROTO_IPIP,
......
...@@ -515,7 +515,7 @@ static void ah6_destroy(struct xfrm_state *x) ...@@ -515,7 +515,7 @@ static void ah6_destroy(struct xfrm_state *x)
kfree(ahp); kfree(ahp);
} }
static struct xfrm_type ah6_type = static const struct xfrm_type ah6_type =
{ {
.description = "AH6", .description = "AH6",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -538,7 +538,7 @@ error: ...@@ -538,7 +538,7 @@ error:
return err; return err;
} }
static struct xfrm_type esp6_type = static const struct xfrm_type esp6_type =
{ {
.description = "ESP6", .description = "ESP6",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -453,7 +453,7 @@ error: ...@@ -453,7 +453,7 @@ error:
goto out; goto out;
} }
static struct xfrm_type ipcomp6_type = static const struct xfrm_type ipcomp6_type =
{ {
.description = "IPCOMP6", .description = "IPCOMP6",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -330,7 +330,7 @@ static void mip6_destopt_destroy(struct xfrm_state *x) ...@@ -330,7 +330,7 @@ static void mip6_destopt_destroy(struct xfrm_state *x)
{ {
} }
static struct xfrm_type mip6_destopt_type = static const struct xfrm_type mip6_destopt_type =
{ {
.description = "MIP6DESTOPT", .description = "MIP6DESTOPT",
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -462,7 +462,7 @@ static void mip6_rthdr_destroy(struct xfrm_state *x) ...@@ -462,7 +462,7 @@ static void mip6_rthdr_destroy(struct xfrm_state *x)
{ {
} }
static struct xfrm_type mip6_rthdr_type = static const struct xfrm_type mip6_rthdr_type =
{ {
.description = "MIP6RT", .description = "MIP6RT",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -319,7 +319,7 @@ static void xfrm6_tunnel_destroy(struct xfrm_state *x) ...@@ -319,7 +319,7 @@ static void xfrm6_tunnel_destroy(struct xfrm_state *x)
xfrm6_tunnel_free_spi((xfrm_address_t *)&x->props.saddr); xfrm6_tunnel_free_spi((xfrm_address_t *)&x->props.saddr);
} }
static struct xfrm_type xfrm6_tunnel_type = { static const struct xfrm_type xfrm6_tunnel_type = {
.description = "IP6IP6", .description = "IP6IP6",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.proto = IPPROTO_IPV6, .proto = IPPROTO_IPV6,
......
...@@ -216,10 +216,10 @@ static void xfrm_state_unlock_afinfo(struct xfrm_state_afinfo *afinfo) ...@@ -216,10 +216,10 @@ static void xfrm_state_unlock_afinfo(struct xfrm_state_afinfo *afinfo)
write_unlock_bh(&xfrm_state_afinfo_lock); write_unlock_bh(&xfrm_state_afinfo_lock);
} }
int xfrm_register_type(struct xfrm_type *type, unsigned short family) int xfrm_register_type(const struct xfrm_type *type, unsigned short family)
{ {
struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family); struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family);
struct xfrm_type **typemap; const struct xfrm_type **typemap;
int err = 0; int err = 0;
if (unlikely(afinfo == NULL)) if (unlikely(afinfo == NULL))
...@@ -235,10 +235,10 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family) ...@@ -235,10 +235,10 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family)
} }
EXPORT_SYMBOL(xfrm_register_type); EXPORT_SYMBOL(xfrm_register_type);
int xfrm_unregister_type(struct xfrm_type *type, unsigned short family) int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family)
{ {
struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family); struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family);
struct xfrm_type **typemap; const struct xfrm_type **typemap;
int err = 0; int err = 0;
if (unlikely(afinfo == NULL)) if (unlikely(afinfo == NULL))
...@@ -254,11 +254,11 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family) ...@@ -254,11 +254,11 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
} }
EXPORT_SYMBOL(xfrm_unregister_type); EXPORT_SYMBOL(xfrm_unregister_type);
static struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family) static const struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family)
{ {
struct xfrm_state_afinfo *afinfo; struct xfrm_state_afinfo *afinfo;
struct xfrm_type **typemap; const struct xfrm_type **typemap;
struct xfrm_type *type; const struct xfrm_type *type;
int modload_attempted = 0; int modload_attempted = 0;
retry: retry:
...@@ -281,7 +281,7 @@ retry: ...@@ -281,7 +281,7 @@ retry:
return type; return type;
} }
static void xfrm_put_type(struct xfrm_type *type) static void xfrm_put_type(const struct xfrm_type *type)
{ {
module_put(type->owner); module_put(type->owner);
} }
......
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