]> git.proxmox.com Git - mirror_lxc.git/commitdiff
genl: remove
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 1 May 2018 14:59:19 +0000 (16:59 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 10 May 2018 18:24:36 +0000 (20:24 +0200)
These files have never been used and as such have no dependencies in the
codebase whatsoever. So remove them. If we need them we can simply pull them
out of the git history.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/Makefile.am
src/lxc/genl.c [deleted file]
src/lxc/genl.h [deleted file]

index 0662d83da8690e6c251c322b22665d1361f4a582..f894b7925ebd9ddcefbda53705ccf4779ce5e53c 100644 (file)
@@ -120,7 +120,6 @@ liblxc_la_SOURCES = \
        network.c network.h \
        nl.c nl.h \
        rtnl.c rtnl.h \
-       genl.c genl.h \
        \
        caps.c caps.h \
        lxcseccomp.h \
diff --git a/src/lxc/genl.c b/src/lxc/genl.c
deleted file mode 100644 (file)
index 6afaf40..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * lxc: linux Container library
- *
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * 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
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <string.h>
-#include <stdio.h>
-#include <sys/socket.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <linux/genetlink.h>
-#include <linux/rtnetlink.h>
-
-#include "nl.h"
-#include "genl.h"
-
-static int genetlink_resolve_family(const char *family)
-{
-       struct nl_handler handler;
-       struct nlattr *attr;
-       struct genlmsg *request, *reply;
-       struct genlmsghdr *genlmsghdr;
-
-       int len, ret;
-
-       request = genlmsg_alloc(GENLMSG_GOOD_SIZE);
-       if (!request)
-               return -ENOMEM;
-
-       reply = genlmsg_alloc(GENLMSG_GOOD_SIZE);
-       if (!reply) {
-               genlmsg_free(request);
-               return -ENOMEM;
-       }
-
-       request->nlmsghdr.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-       request->nlmsghdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
-       request->nlmsghdr.nlmsg_type = GENL_ID_CTRL;
-
-       genlmsghdr = NLMSG_DATA(&request->nlmsghdr);
-       genlmsghdr->cmd = CTRL_CMD_GETFAMILY;
-
-       ret = netlink_open(&handler, NETLINK_GENERIC);
-       if (ret)
-               goto out;
-
-       ret = nla_put_string((struct nlmsg *)&request->nlmsghdr,
-                            CTRL_ATTR_FAMILY_NAME, family);
-       if (ret)
-               goto out_close;
-
-       ret = netlink_transaction(&handler, (struct nlmsg *)&request->nlmsghdr,
-                                 (struct nlmsg *)&reply->nlmsghdr);
-       if (ret < 0)
-               goto out_close;
-
-       genlmsghdr = NLMSG_DATA(&reply->nlmsghdr);
-       len = reply->nlmsghdr.nlmsg_len;
-
-       ret = -ENOMSG;
-       if (reply->nlmsghdr.nlmsg_type !=  GENL_ID_CTRL)
-               goto out_close;
-
-       if (genlmsghdr->cmd != CTRL_CMD_NEWFAMILY)
-               goto out_close;
-
-       ret = -EMSGSIZE;
-       len -= NLMSG_LENGTH(GENL_HDRLEN);
-       if (len < 0)
-               goto out_close;
-
-       attr = (struct nlattr *)GENLMSG_DATA(reply);
-       attr = (struct nlattr *)((char *)attr + NLA_ALIGN(attr->nla_len));
-
-       ret = -ENOMSG;
-       if (attr->nla_type != CTRL_ATTR_FAMILY_ID)
-               goto out_close;
-
-       ret =  *(__u16 *) NLA_DATA(attr);
-out_close:
-       netlink_close(&handler);
-out:
-       genlmsg_free(request);
-       genlmsg_free(reply);
-       return ret;
-}
-
-extern int genetlink_open(struct genl_handler *handler, const char *family)
-{
-       int ret;
-       handler->family = genetlink_resolve_family(family);
-       if (handler->family < 0)
-               return handler->family;
-
-       ret = netlink_open(&handler->nlh, NETLINK_GENERIC);
-
-       return ret;
-}
-
-extern int genetlink_close(struct genl_handler *handler)
-{
-       return netlink_close(&handler->nlh);
-}
-
-extern int genetlink_rcv(struct genl_handler *handler, struct genlmsg *genlmsg)
-{
-       return netlink_rcv(&handler->nlh, (struct nlmsg *)&genlmsg->nlmsghdr);
-}
-
-extern int genetlink_send(struct genl_handler *handler, struct genlmsg *genlmsg)
-{
-
-       return netlink_send(&handler->nlh, (struct nlmsg *)&genlmsg->nlmsghdr);
-}
-
-extern int genetlink_transaction(struct genl_handler *handler,
-                         struct genlmsg *request, struct genlmsg *answer)
-{
-       return netlink_transaction(&handler->nlh, (struct nlmsg *)&request->nlmsghdr,
-                                  (struct nlmsg *)&answer->nlmsghdr);
-}
-
-extern struct genlmsg *genlmsg_alloc(size_t size)
-{
-       size_t len = NLMSG_LENGTH(GENL_HDRLEN) + size;
-       return  (struct genlmsg *)nlmsg_alloc(len);
-}
-
-extern void genlmsg_free(struct genlmsg *genlmsg)
-{
-       free(genlmsg);
-}
diff --git a/src/lxc/genl.h b/src/lxc/genl.h
deleted file mode 100644 (file)
index a83b7a7..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * lxc: linux Container library
- *
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * 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
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef __LXC_GENL_H
-#define __LXC_GENL_H
-
-/*
- * Use this as a good size to allocate generic netlink messages
- */
-#define GENLMSG_GOOD_SIZE NLMSG_GOOD_SIZE
-#define GENLMSG_DATA(glh) ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
-
-/*
- * struct genl_handler : the structure which store the netlink handler
- *  and the family number resulting of the auto-generating id family
- *  for the generic netlink protocol
- *
- * @nlh: the netlink socket handler
- * @family: the generic netlink family assigned number
- */
-struct genl_handler
-{
-       struct nl_handler nlh;
-       int family;
-};
-
-/*
- * struct genlmsg : the struct containing the generic netlink message
- *  format
- *
- * @nlmsghdr: a netlink message header
- * @genlmsghdr: a generic netlink message header pointer
- *
- */
-/* __attribute__ ((aligned(4))); */
-struct genlmsg {
-       struct nlmsghdr nlmsghdr;
-       struct genlmsghdr genlmsghdr;
-};
-
-static inline int genetlink_len(const struct genlmsg *genlmsg)
-{
-       return ((genlmsg->nlmsghdr.nlmsg_len) - GENL_HDRLEN - NLMSG_HDRLEN);
-}
-
-/*
- * genetlink_open : resolve family number id and open a generic netlink socket
- *
- * @handler: a struct genl_handler pointer
- * @family: the family name of the generic netlink protocol
- *
- * Returns 0 on success, < 0 otherwise
- */
-int genetlink_open(struct genl_handler *handler, const char *family);
-
-/*
- * genetlink_close : close a generic netlink socket
- *
- * @handler: the handler of the socket to be closed
- *
- * Returns 0 on success, < 0 otherwise
- */
-int genetlink_close(struct genl_handler *handler);
-
-/*
- * genetlink_rcv : receive a generic netlink socket, it is up
- *  to the caller to manage the allocation of the generic netlink message
- *
- * @handler: the handler of the generic netlink socket
- * @genlmsg: the pointer to a generic netlink message pre-allocated
- *
- * Returns 0 on success, < 0 otherwise
- */
-int genetlink_rcv(struct genl_handler *handler, struct genlmsg *genlmsg);
-
-/*
- * genetlink_send : send a generic netlink socket, it is up
- *  to the caller to manage the allocation of the generic netlink message
- *
- * @handler: the handler of the generic netlink socket
- * @genlmsg: the pointer to a generic netlink message pre-allocated
- *
- * Returns 0 on success, < 0 otherwise
- */
-int genetlink_send(struct genl_handler *handler, struct genlmsg *genlmsg);
-
-struct genlmsg *genlmsg_alloc(size_t size);
-
-void genlmsg_free(struct genlmsg *genlmsg);
-
-/*
- * genetlink_transaction : send and receive a generic netlink message in one shot
- *
- * @handler: the handler of the generic netlink socket
- * @request: a generic netlink message containing the request to be sent
- * @answer: a pre-allocated generic netlink message to receive the response
- *
- * Returns 0 on success, < 0 otherwise
- */
-int genetlink_transaction(struct genl_handler *handler,
-                         struct genlmsg *request, struct genlmsg *answer);
-#endif