netlink-protocol: Move CTRL_ATTR_MCAST definitions for consistency.
authorBen Pfaff <blp@nicira.com>
Tue, 6 Sep 2011 16:33:26 +0000 (09:33 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 6 Sep 2011 16:33:26 +0000 (09:33 -0700)
One of the current goals of netlink-protocol.h, for better or for worse, is
to ensure that the same definitions are available whether a Linux kernel is
in use or not.  One of the ways it accomplishes this is by putting the
conditional definitions that test for features missing in old kernels at
the very end, after the dummy definitions used on non-Linux platforms.
However, commit b0025c8389f "netlink-protocol: Define missing symbols"
added new conditional definitions only in the Linux platform case, which
means that those definitions won't be available on non-Linux platforms.
This commit moves them to the end, instead.

The symbols that are moved are only used from netlink-socket.c, which is
only built on Linux platforms, so this does not change an actual bug.  It
only makes the location of the definitions consistent with prior practice.

lib/netlink-protocol.h

index 64f773e..521c5bf 100644 (file)
 #include <linux/netlink.h>
 #include <linux/genetlink.h>
 
-/* Some Xenddks have an outdated genetlink header file which doesn't have some
- * symbols it should. */
-#ifndef CTRL_ATTR_MCAST_GRP_MAX
-
-#undef CTRL_ATTR_MAX
-#define CTRL_ATTR_MAX 7
-#define CTRL_ATTR_MCAST_GROUPS 7
-
-enum {
-       CTRL_ATTR_MCAST_GRP_UNSPEC,
-       CTRL_ATTR_MCAST_GRP_NAME,
-       CTRL_ATTR_MCAST_GRP_ID,
-       __CTRL_ATTR_MCAST_GRP_MAX,
-};
-
-#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
-#endif /* CTRL_ATTR_MCAST_GRP_MAX */
-
 #else
 #define NETLINK_GENERIC         16
 
@@ -179,4 +161,22 @@ enum {
 #define NETLINK_DROP_MEMBERSHIP 2
 #endif
 
+/* These were introduced all together in 2.6.23.  (We want our programs to
+ * support the newer kernel features even if compiled with older headers.) */
+#ifndef CTRL_ATTR_MCAST_GRP_MAX
+
+#undef CTRL_ATTR_MAX
+#define CTRL_ATTR_MAX 7
+#define CTRL_ATTR_MCAST_GROUPS 7
+
+enum {
+       CTRL_ATTR_MCAST_GRP_UNSPEC,
+       CTRL_ATTR_MCAST_GRP_NAME,
+       CTRL_ATTR_MCAST_GRP_ID,
+       __CTRL_ATTR_MCAST_GRP_MAX,
+};
+
+#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
+#endif /* CTRL_ATTR_MCAST_GRP_MAX */
+
 #endif /* netlink-protocol.h */