* [XFRM] Convert XFRM_MSG_* macros to an enum
@ 2004-07-03 9:52 Herbert Xu
2004-07-03 10:00 ` YOSHIFUJI Hideaki / 吉藤英明
2004-07-05 23:11 ` David S. Miller
0 siblings, 2 replies; 8+ messages in thread
From: Herbert Xu @ 2004-07-03 9:52 UTC (permalink / raw)
To: David S. Miller, netdev
[-- Attachment #1: Type: text/plain, Size: 536 bytes --]
Hi Dave:
I'd like to add two new xfrm_user messages, FLUSHSA and FLUSHPOLICY.
I've cleaned up the existing MSG definitions by converting them to
an enum. This should make future additions slightly easier in that
XFRM_MSG_MAX won't have to be touched again.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1229 bytes --]
===== include/linux/xfrm.h 1.20 vs edited =====
--- 1.20/include/linux/xfrm.h 2004-05-30 05:35:21 +10:00
+++ edited/include/linux/xfrm.h 2004-07-03 19:43:11 +10:00
@@ -103,26 +103,28 @@
};
/* Netlink configuration messages. */
-#define XFRM_MSG_BASE 0x10
+enum {
+ XFRM_MSG_BASE = 0x10,
-#define XFRM_MSG_NEWSA (XFRM_MSG_BASE + 0)
-#define XFRM_MSG_DELSA (XFRM_MSG_BASE + 1)
-#define XFRM_MSG_GETSA (XFRM_MSG_BASE + 2)
+ XFRM_MSG_NEWSA = 0x10,
+ XFRM_MSG_DELSA,
+ XFRM_MSG_GETSA,
-#define XFRM_MSG_NEWPOLICY (XFRM_MSG_BASE + 3)
-#define XFRM_MSG_DELPOLICY (XFRM_MSG_BASE + 4)
-#define XFRM_MSG_GETPOLICY (XFRM_MSG_BASE + 5)
+ XFRM_MSG_NEWPOLICY,
+ XFRM_MSG_DELPOLICY,
+ XFRM_MSG_GETPOLICY,
-#define XFRM_MSG_ALLOCSPI (XFRM_MSG_BASE + 6)
-#define XFRM_MSG_ACQUIRE (XFRM_MSG_BASE + 7)
-#define XFRM_MSG_EXPIRE (XFRM_MSG_BASE + 8)
+ XFRM_MSG_ALLOCSPI,
+ XFRM_MSG_ACQUIRE,
+ XFRM_MSG_EXPIRE,
-#define XFRM_MSG_UPDPOLICY (XFRM_MSG_BASE + 9)
-#define XFRM_MSG_UPDSA (XFRM_MSG_BASE + 10)
+ XFRM_MSG_UPDPOLICY,
+ XFRM_MSG_UPDSA,
-#define XFRM_MSG_POLEXPIRE (XFRM_MSG_BASE + 11)
+ XFRM_MSG_POLEXPIRE,
-#define XFRM_MSG_MAX (XFRM_MSG_POLEXPIRE+1)
+ XFRM_MSG_MAX
+};
struct xfrm_user_tmpl {
struct xfrm_id id;
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [XFRM] Convert XFRM_MSG_* macros to an enum
2004-07-03 9:52 [XFRM] Convert XFRM_MSG_* macros to an enum Herbert Xu
@ 2004-07-03 10:00 ` YOSHIFUJI Hideaki / 吉藤英明
2004-07-03 10:02 ` Herbert Xu
2004-07-03 10:04 ` YOSHIFUJI Hideaki / 吉藤英明
2004-07-05 23:11 ` David S. Miller
1 sibling, 2 replies; 8+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-07-03 10:00 UTC (permalink / raw)
To: herbert; +Cc: davem, netdev
In article <20040703095215.GA16195@gondor.apana.org.au> (at Sat, 3 Jul 2004 19:52:15 +1000), Herbert Xu <herbert@gondor.apana.org.au> says:
> I've cleaned up the existing MSG definitions by converting them to
> an enum. This should make future additions slightly easier in that
> XFRM_MSG_MAX won't have to be touched again.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Well, I think we'd better to do
#define XFRM_MSG_GETSA XFRM_MSG_GETSA
etc. because this would break (future) applications which do
#ifdef.
--yoshfuji
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [XFRM] Convert XFRM_MSG_* macros to an enum
2004-07-03 10:00 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2004-07-03 10:02 ` Herbert Xu
2004-07-03 10:10 ` Herbert Xu
2004-07-03 10:04 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2004-07-03 10:02 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / ?$B5HF#1QL@; +Cc: davem, netdev
On Sat, Jul 03, 2004 at 07:00:42PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
>
> Well, I think we'd better to do
>
> #define XFRM_MSG_GETSA XFRM_MSG_GETSA
>
> etc. because this would break (future) applications which do
> #ifdef.
I think such applications are broken.
They should compile with headers that define these symbols and
test for their support at run-time.
Applications should not detect kernel features at compile-time.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [XFRM] Convert XFRM_MSG_* macros to an enum
2004-07-03 10:02 ` Herbert Xu
@ 2004-07-03 10:10 ` Herbert Xu
0 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2004-07-03 10:10 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / ?$B5HF#1QL@; +Cc: davem, netdev
[-- Attachment #1: Type: text/plain, Size: 708 bytes --]
On Sat, Jul 03, 2004 at 08:02:08PM +1000, herbert wrote:
>
> I think such applications are broken.
>
> They should compile with headers that define these symbols and
> test for their support at run-time.
>
> Applications should not detect kernel features at compile-time.
Well, I guess there are always going to be broken applications.
I'd move on rather than dwell on this point.
So here is an add-on patch to add the macros.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1010 bytes --]
===== include/linux/xfrm.h 1.21 vs edited =====
--- 1.21/include/linux/xfrm.h 2004-07-03 19:53:19 +10:00
+++ edited/include/linux/xfrm.h 2004-07-03 20:07:15 +10:00
@@ -107,21 +107,33 @@
XFRM_MSG_BASE = 0x10,
XFRM_MSG_NEWSA = 0x10,
+#define XFRM_MSG_NEWSA XFRM_MSG_NEWSA
XFRM_MSG_DELSA,
+#define XFRM_MSG_DELSA XFRM_MSG_DELSA
XFRM_MSG_GETSA,
+#define XFRM_MSG_GETSA XFRM_MSG_GETSA
XFRM_MSG_NEWPOLICY,
+#define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY
XFRM_MSG_DELPOLICY,
+#define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY
XFRM_MSG_GETPOLICY,
+#define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY
XFRM_MSG_ALLOCSPI,
+#define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI
XFRM_MSG_ACQUIRE,
+#define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE
XFRM_MSG_EXPIRE,
+#define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE
XFRM_MSG_UPDPOLICY,
+#define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY
XFRM_MSG_UPDSA,
+#define XFRM_MSG_UPDSA XFRM_MSG_UPDSA
XFRM_MSG_POLEXPIRE,
+#define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE
XFRM_MSG_MAX
};
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [XFRM] Convert XFRM_MSG_* macros to an enum
2004-07-03 10:00 ` YOSHIFUJI Hideaki / 吉藤英明
2004-07-03 10:02 ` Herbert Xu
@ 2004-07-03 10:04 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 0 replies; 8+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-07-03 10:04 UTC (permalink / raw)
To: herbert; +Cc: davem, netdev
To clarify:
In article <20040703.190042.70899669.yoshfuji@linux-ipv6.org> (at Sat, 03 Jul 2004 19:00:42 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> says:
> > I've cleaned up the existing MSG definitions by converting them to
> > an enum. This should make future additions slightly easier in that
> > XFRM_MSG_MAX won't have to be touched again.
:
> Well, I think we'd better to do
>
> #define XFRM_MSG_GETSA XFRM_MSG_GETSA
>
> etc. because this would break (future) applications which do
> #ifdef.
I meant, the change (without #define) would break (future) applications
which do #ifdef.
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [XFRM] Convert XFRM_MSG_* macros to an enum
2004-07-03 9:52 [XFRM] Convert XFRM_MSG_* macros to an enum Herbert Xu
2004-07-03 10:00 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2004-07-05 23:11 ` David S. Miller
2004-07-05 23:21 ` Herbert Xu
1 sibling, 1 reply; 8+ messages in thread
From: David S. Miller @ 2004-07-05 23:11 UTC (permalink / raw)
To: Herbert Xu; +Cc: netdev
On Sat, 3 Jul 2004 19:52:15 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> I'd like to add two new xfrm_user messages, FLUSHSA and FLUSHPOLICY.
>
> I've cleaned up the existing MSG definitions by converting them to
> an enum. This should make future additions slightly easier in that
> XFRM_MSG_MAX won't have to be touched again.
If we end up needing the define macros anyways, after that discussion
with Yoshifuji, I don't see the point to this change any more and
therefore I'm not going to apply it.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-07-05 23:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-03 9:52 [XFRM] Convert XFRM_MSG_* macros to an enum Herbert Xu
2004-07-03 10:00 ` YOSHIFUJI Hideaki / 吉藤英明
2004-07-03 10:02 ` Herbert Xu
2004-07-03 10:10 ` Herbert Xu
2004-07-03 10:04 ` YOSHIFUJI Hideaki / 吉藤英明
2004-07-05 23:11 ` David S. Miller
2004-07-05 23:21 ` Herbert Xu
2004-07-05 23:47 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).