All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] xfrm/af_key constify patches
@ 2013-06-26 21:56 Mathias Krause
  2013-06-26 21:56 ` [PATCH 1/2] xfrm: constify mark argument of xfrm_find_acq() Mathias Krause
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mathias Krause @ 2013-06-26 21:56 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: Mathias Krause, David S. Miller, Herbert Xu, netdev

Hi Steffen,

two small patches, constifying af_key lookup tables and a xfrm function
argument. All material for ipsec-next.

Please apply!

Thanks,

Mathias Krause (2):
  xfrm: constify mark argument of xfrm_find_acq()
  af_key: constify lookup tables

 include/net/xfrm.h    |    2 +-
 net/key/af_key.c      |    6 +++---
 net/xfrm/xfrm_state.c |   12 +++++++-----
 3 files changed, 11 insertions(+), 9 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] xfrm: constify mark argument of xfrm_find_acq()
  2013-06-26 21:56 [PATCH 0/2] xfrm/af_key constify patches Mathias Krause
@ 2013-06-26 21:56 ` Mathias Krause
  2013-06-26 21:56 ` [PATCH 2/2] af_key: constify lookup tables Mathias Krause
  2013-06-28  8:50 ` [PATCH 0/2] xfrm/af_key constify patches Steffen Klassert
  2 siblings, 0 replies; 4+ messages in thread
From: Mathias Krause @ 2013-06-26 21:56 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: Mathias Krause, netdev, David S. Miller, Herbert Xu

The mark argument is read only, so constify it. Also make dummy_mark in
af_key const -- only used as dummy argument for this very function.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 include/net/xfrm.h    |    2 +-
 net/key/af_key.c      |    2 +-
 net/xfrm/xfrm_state.c |   12 +++++++-----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 94ce082..89d3d8a 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1548,7 +1548,7 @@ struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32
 int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
 u32 xfrm_get_acqseq(void);
 extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
-struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark,
+struct xfrm_state *xfrm_find_acq(struct net *net, const struct xfrm_mark *mark,
 				 u8 mode, u32 reqid, u8 proto,
 				 const xfrm_address_t *daddr,
 				 const xfrm_address_t *saddr, int create,
diff --git a/net/key/af_key.c b/net/key/af_key.c
index c5fbd75..5490d97 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -45,7 +45,7 @@ struct netns_pfkey {
 static DEFINE_MUTEX(pfkey_mutex);
 
 #define DUMMY_MARK 0
-static struct xfrm_mark dummy_mark = {0, 0};
+static const struct xfrm_mark dummy_mark = {0, 0};
 struct pfkey_sock {
 	/* struct sock must be the first member of struct pfkey_sock */
 	struct sock	sk;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 78f66fa..b2cd806 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -990,11 +990,13 @@ void xfrm_state_insert(struct xfrm_state *x)
 EXPORT_SYMBOL(xfrm_state_insert);
 
 /* xfrm_state_lock is held */
-static struct xfrm_state *__find_acq_core(struct net *net, struct xfrm_mark *m,
+static struct xfrm_state *__find_acq_core(struct net *net,
+					  const struct xfrm_mark *m,
 					  unsigned short family, u8 mode,
 					  u32 reqid, u8 proto,
 					  const xfrm_address_t *daddr,
-					  const xfrm_address_t *saddr, int create)
+					  const xfrm_address_t *saddr,
+					  int create)
 {
 	unsigned int h = xfrm_dst_hash(net, daddr, saddr, reqid, family);
 	struct xfrm_state *x;
@@ -1399,9 +1401,9 @@ xfrm_state_lookup_byaddr(struct net *net, u32 mark,
 EXPORT_SYMBOL(xfrm_state_lookup_byaddr);
 
 struct xfrm_state *
-xfrm_find_acq(struct net *net, struct xfrm_mark *mark, u8 mode, u32 reqid, u8 proto,
-	      const xfrm_address_t *daddr, const xfrm_address_t *saddr,
-	      int create, unsigned short family)
+xfrm_find_acq(struct net *net, const struct xfrm_mark *mark, u8 mode, u32 reqid,
+	      u8 proto, const xfrm_address_t *daddr,
+	      const xfrm_address_t *saddr, int create, unsigned short family)
 {
 	struct xfrm_state *x;
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] af_key: constify lookup tables
  2013-06-26 21:56 [PATCH 0/2] xfrm/af_key constify patches Mathias Krause
  2013-06-26 21:56 ` [PATCH 1/2] xfrm: constify mark argument of xfrm_find_acq() Mathias Krause
@ 2013-06-26 21:56 ` Mathias Krause
  2013-06-28  8:50 ` [PATCH 0/2] xfrm/af_key constify patches Steffen Klassert
  2 siblings, 0 replies; 4+ messages in thread
From: Mathias Krause @ 2013-06-26 21:56 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: Mathias Krause, netdev, David S. Miller, Herbert Xu

The lookup tables for minimum sizes of extensions and for the pfkey
handler functions are read only, therefore can be const.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 net/key/af_key.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 5490d97..8432eb1 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -338,7 +338,7 @@ static int pfkey_error(const struct sadb_msg *orig, int err, struct sock *sk)
 	return 0;
 }
 
-static u8 sadb_ext_min_len[] = {
+static const u8 sadb_ext_min_len[] = {
 	[SADB_EXT_RESERVED]		= (u8) 0,
 	[SADB_EXT_SA]			= (u8) sizeof(struct sadb_sa),
 	[SADB_EXT_LIFETIME_CURRENT]	= (u8) sizeof(struct sadb_lifetime),
@@ -2734,7 +2734,7 @@ static int pfkey_spdflush(struct sock *sk, struct sk_buff *skb, const struct sad
 
 typedef int (*pfkey_handler)(struct sock *sk, struct sk_buff *skb,
 			     const struct sadb_msg *hdr, void * const *ext_hdrs);
-static pfkey_handler pfkey_funcs[SADB_MAX + 1] = {
+static const pfkey_handler pfkey_funcs[SADB_MAX + 1] = {
 	[SADB_RESERVED]		= pfkey_reserved,
 	[SADB_GETSPI]		= pfkey_getspi,
 	[SADB_UPDATE]		= pfkey_add,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] xfrm/af_key constify patches
  2013-06-26 21:56 [PATCH 0/2] xfrm/af_key constify patches Mathias Krause
  2013-06-26 21:56 ` [PATCH 1/2] xfrm: constify mark argument of xfrm_find_acq() Mathias Krause
  2013-06-26 21:56 ` [PATCH 2/2] af_key: constify lookup tables Mathias Krause
@ 2013-06-28  8:50 ` Steffen Klassert
  2 siblings, 0 replies; 4+ messages in thread
From: Steffen Klassert @ 2013-06-28  8:50 UTC (permalink / raw)
  To: Mathias Krause; +Cc: David S. Miller, Herbert Xu, netdev

On Wed, Jun 26, 2013 at 11:56:57PM +0200, Mathias Krause wrote:
> Hi Steffen,
> 
> two small patches, constifying af_key lookup tables and a xfrm function
> argument. All material for ipsec-next.
> 
> Please apply!
> 
> Thanks,
> 
> Mathias Krause (2):
>   xfrm: constify mark argument of xfrm_find_acq()
>   af_key: constify lookup tables
> 

All applied to ipsec-next, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-28  8:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26 21:56 [PATCH 0/2] xfrm/af_key constify patches Mathias Krause
2013-06-26 21:56 ` [PATCH 1/2] xfrm: constify mark argument of xfrm_find_acq() Mathias Krause
2013-06-26 21:56 ` [PATCH 2/2] af_key: constify lookup tables Mathias Krause
2013-06-28  8:50 ` [PATCH 0/2] xfrm/af_key constify patches Steffen Klassert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.