]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/rtnl.c
spelling: keepdata
[mirror_lxc.git] / src / lxc / rtnl.c
index bc235428764e6685034c824ece719faf701726d7..2f237a73e37796f9bb70ec48363cede6ab3f4a55 100644 (file)
@@ -4,7 +4,7 @@
  * (C) Copyright IBM Corp. 2007, 2008
  *
  * Authors:
- * Daniel Lezcano <dlezcano at fr.ibm.com>
+ * Daniel Lezcano <daniel.lezcano at free.fr>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include <string.h>
-#include <stdio.h>
-#include <sys/socket.h>
-#include <stdlib.h>
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
 #include <errno.h>
-#include <unistd.h>
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
-#include <nl.h>
-#include <rtnl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include "config.h"
+#include "nl.h"
+#include "rtnl.h"
 
 extern int rtnetlink_open(struct rtnl_handler *handler)
 {
@@ -41,6 +47,9 @@ extern int rtnetlink_close(struct rtnl_handler *handler)
        return netlink_close(&handler->nlh);
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-align"
+
 extern int rtnetlink_rcv(struct rtnl_handler *handler, struct rtnlmsg *rtnlmsg)
 {
        return netlink_rcv(&handler->nlh, (struct nlmsg *)&rtnlmsg->nlmsghdr);
@@ -52,21 +61,27 @@ extern int rtnetlink_send(struct rtnl_handler *handler, struct rtnlmsg *rtnlmsg)
        return netlink_send(&handler->nlh, (struct nlmsg *)&rtnlmsg->nlmsghdr);
 }
 
-extern int rtnetlink_transaction(struct rtnl_handler *handler, 
-                         struct rtnlmsg *request, struct rtnlmsg *answer)
+extern int rtnetlink_transaction(struct rtnl_handler *handler,
+                                struct rtnlmsg *request,
+                                struct rtnlmsg *answer)
 {
-       return netlink_transaction(&handler->nlh, (struct nlmsg *)&request->nlmsghdr,
+       return netlink_transaction(&handler->nlh,
+                                  (struct nlmsg *)&request->nlmsghdr,
                                   (struct nlmsg *)&answer->nlmsghdr);
 }
 
+#pragma GCC diagnostic pop
+
 extern struct rtnlmsg *rtnlmsg_alloc(size_t size)
 {
-/*     size_t len = NLMSG_LENGTH(NLMSG_ALIGN(sizeof(struct rtnlmsghdr))) + size; */
-/*     return  (struct rtnlmsg *)nlmsg_alloc(len); */
+       /*
+       size_t len;
+
+       len = NLMSG_LENGTH(NLMSG_ALIGN(sizeof(struct rtnlmsghdr))) + size;
+       return (struct rtnlmsg *)nlmsg_alloc(len);
+       */
+
        return NULL;
 }
 
-extern void rtnlmsg_free(struct rtnlmsg *rtnlmsg)
-{
-       free(rtnlmsg);
-}
+extern void rtnlmsg_free(struct rtnlmsg *rtnlmsg) { free(rtnlmsg); }