Skip to contentSkip to conversation

: Do not define km_migrate() if !CONFIG_XFRM_MIGRATE

XFRM Applied Eric Dumazet 2 participants 2 messages Jan 3, 2008 – Jan 4, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

In include/net/xfrm.h we find :

#ifdef CONFIG_XFRM_MIGRATE
extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,

                      struct xfrm_migrate *m, int num_bundles);

...
#endif

We can also guard the function body itself in net/xfrm/xfrm_state.c with same condition.

(Problem spoted by sparse checker)
make C=2 net/xfrm/xfrm_state.o
...
net/xfrm/xfrm_state.c:1765:5: warning: symbol 'km_migrate' was not declared. Should it be static?
...

net/xfrm/xfrm_state.c +2 -0
index 4dec655..65f5ea4 100644
@@ -1762,6 +1762,7 @@ void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid)
 }
 EXPORT_SYMBOL(km_policy_expired);
 
+#ifdef CONFIG_XFRM_MIGRATE
 int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
 	       struct xfrm_migrate *m, int num_migrate)
 {
@@ -1781,6 +1782,7 @@ int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
 	return err;
 }
 EXPORT_SYMBOL(km_migrate);
+#endif
 
 int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr)
 {
maintainer Applied
#1 lore raw

From: Eric Dumazet <[email protected]>
Date: Thu, 3 Jan 2008 18:24:49 +0100

Quoted 11 lines

In include/net/xfrm.h we find :

#ifdef CONFIG_XFRM_MIGRATE
extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,

                      struct xfrm_migrate *m, int num_bundles);

...
#endif

We can also guard the function body itself in net/xfrm/xfrm_state.c with same condition.

Quoted 7 lines

(Problem spoted by sparse checker)
make C=2 net/xfrm/xfrm_state.o
...
net/xfrm/xfrm_state.c:1765:5: warning: symbol 'km_migrate' was not declared. Should it be static?
...

Applied to net-2.6, thanks Eric.