Skip to content

Commit 533cb5b

Browse files
Eric Dumazetdavem330
authored andcommitted
[XFRM]: constify 'struct xfrm_type'
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2216b48 commit 533cb5b

11 files changed

Lines changed: 22 additions & 22 deletions

File tree

‎include/net/xfrm.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ struct xfrm_state
202202

203203
/* Reference to data common to all the instances of this
204204
* transformer. */
205-
struct xfrm_type *type;
205+
const struct xfrm_type *type;
206206
struct xfrm_mode *inner_mode;
207207
struct xfrm_mode *outer_mode;
208208

@@ -279,7 +279,7 @@ struct xfrm_state_afinfo {
279279
unsigned int proto;
280280
unsigned int eth_proto;
281281
struct module *owner;
282-
struct xfrm_type *type_map[IPPROTO_MAX];
282+
const struct xfrm_type *type_map[IPPROTO_MAX];
283283
struct xfrm_mode *mode_map[XFRM_MODE_MAX];
284284
int (*init_flags)(struct xfrm_state *x);
285285
void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
@@ -322,8 +322,8 @@ struct xfrm_type
322322
u32 (*get_mtu)(struct xfrm_state *, int size);
323323
};
324324

325-
extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
326-
extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family);
325+
extern int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
326+
extern int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
327327

328328
struct xfrm_mode {
329329
/*

‎net/ipv4/ah4.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static void ah_destroy(struct xfrm_state *x)
300300
}
301301

302302

303-
static struct xfrm_type ah_type =
303+
static const struct xfrm_type ah_type =
304304
{
305305
.description = "AH4",
306306
.owner = THIS_MODULE,

‎net/ipv4/esp4.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ static int esp_init_state(struct xfrm_state *x)
600600
return err;
601601
}
602602

603-
static struct xfrm_type esp_type =
603+
static const struct xfrm_type esp_type =
604604
{
605605
.description = "ESP4",
606606
.owner = THIS_MODULE,

‎net/ipv4/ipcomp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ static int ipcomp_init_state(struct xfrm_state *x)
437437
goto out;
438438
}
439439

440-
static struct xfrm_type ipcomp_type = {
440+
static const struct xfrm_type ipcomp_type = {
441441
.description = "IPCOMP4",
442442
.owner = THIS_MODULE,
443443
.proto = IPPROTO_COMP,

‎net/ipv4/xfrm4_tunnel.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static void ipip_destroy(struct xfrm_state *x)
3838
{
3939
}
4040

41-
static struct xfrm_type ipip_type = {
41+
static const struct xfrm_type ipip_type = {
4242
.description = "IPIP",
4343
.owner = THIS_MODULE,
4444
.proto = IPPROTO_IPIP,

‎net/ipv6/ah6.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static void ah6_destroy(struct xfrm_state *x)
515515
kfree(ahp);
516516
}
517517

518-
static struct xfrm_type ah6_type =
518+
static const struct xfrm_type ah6_type =
519519
{
520520
.description = "AH6",
521521
.owner = THIS_MODULE,

‎net/ipv6/esp6.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ static int esp6_init_state(struct xfrm_state *x)
538538
return err;
539539
}
540540

541-
static struct xfrm_type esp6_type =
541+
static const struct xfrm_type esp6_type =
542542
{
543543
.description = "ESP6",
544544
.owner = THIS_MODULE,

‎net/ipv6/ipcomp6.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ static int ipcomp6_init_state(struct xfrm_state *x)
453453
goto out;
454454
}
455455

456-
static struct xfrm_type ipcomp6_type =
456+
static const struct xfrm_type ipcomp6_type =
457457
{
458458
.description = "IPCOMP6",
459459
.owner = THIS_MODULE,

‎net/ipv6/mip6.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static void mip6_destopt_destroy(struct xfrm_state *x)
330330
{
331331
}
332332

333-
static struct xfrm_type mip6_destopt_type =
333+
static const struct xfrm_type mip6_destopt_type =
334334
{
335335
.description = "MIP6DESTOPT",
336336
.owner = THIS_MODULE,
@@ -462,7 +462,7 @@ static void mip6_rthdr_destroy(struct xfrm_state *x)
462462
{
463463
}
464464

465-
static struct xfrm_type mip6_rthdr_type =
465+
static const struct xfrm_type mip6_rthdr_type =
466466
{
467467
.description = "MIP6RT",
468468
.owner = THIS_MODULE,

‎net/ipv6/xfrm6_tunnel.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static void xfrm6_tunnel_destroy(struct xfrm_state *x)
319319
xfrm6_tunnel_free_spi((xfrm_address_t *)&x->props.saddr);
320320
}
321321

322-
static struct xfrm_type xfrm6_tunnel_type = {
322+
static const struct xfrm_type xfrm6_tunnel_type = {
323323
.description = "IP6IP6",
324324
.owner = THIS_MODULE,
325325
.proto = IPPROTO_IPV6,

0 commit comments

Comments
 (0)