mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
util: rename netlink.[ch] to virnetlink.[ch]
Rename the src/util/netlink files to src/util/virnetlink to better fit the naming scheme. Also rename nlComm to virNetlinkCommand. Signed-off-by: D. Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
This commit is contained in:
parent
3e952ecc52
commit
d04394288f
@ -116,7 +116,6 @@ src/util/hostusb.c
|
|||||||
src/util/iohelper.c
|
src/util/iohelper.c
|
||||||
src/util/iptables.c
|
src/util/iptables.c
|
||||||
src/util/json.c
|
src/util/json.c
|
||||||
src/util/netlink.c
|
|
||||||
src/util/pci.c
|
src/util/pci.c
|
||||||
src/util/processinfo.c
|
src/util/processinfo.c
|
||||||
src/util/sexpr.c
|
src/util/sexpr.c
|
||||||
@ -132,6 +131,7 @@ src/util/virnetdevbridge.c
|
|||||||
src/util/virnetdevmacvlan.c
|
src/util/virnetdevmacvlan.c
|
||||||
src/util/virnetdevtap.c
|
src/util/virnetdevtap.c
|
||||||
src/util/virnetdevvportprofile.c
|
src/util/virnetdevvportprofile.c
|
||||||
|
src/util/virnetlink.c
|
||||||
src/util/virnodesuspend.c
|
src/util/virnodesuspend.c
|
||||||
src/util/virpidfile.c
|
src/util/virpidfile.c
|
||||||
src/util/virsocketaddr.c
|
src/util/virsocketaddr.c
|
||||||
|
@ -67,7 +67,6 @@ UTIL_SOURCES = \
|
|||||||
util/json.c util/json.h \
|
util/json.c util/json.h \
|
||||||
util/logging.c util/logging.h \
|
util/logging.c util/logging.h \
|
||||||
util/memory.c util/memory.h \
|
util/memory.c util/memory.h \
|
||||||
util/netlink.c util/netlink.h \
|
|
||||||
util/pci.c util/pci.h \
|
util/pci.c util/pci.h \
|
||||||
util/processinfo.c util/processinfo.h \
|
util/processinfo.c util/processinfo.h \
|
||||||
util/hostusb.c util/hostusb.h \
|
util/hostusb.c util/hostusb.h \
|
||||||
@ -101,6 +100,7 @@ UTIL_SOURCES = \
|
|||||||
util/virnetdevtap.h util/virnetdevtap.c \
|
util/virnetdevtap.h util/virnetdevtap.c \
|
||||||
util/virnetdevveth.h util/virnetdevveth.c \
|
util/virnetdevveth.h util/virnetdevveth.c \
|
||||||
util/virnetdevvportprofile.h util/virnetdevvportprofile.c \
|
util/virnetdevvportprofile.h util/virnetdevvportprofile.c \
|
||||||
|
util/virnetlink.c util/virnetlink.h \
|
||||||
util/virrandom.h util/virrandom.c \
|
util/virrandom.h util/virrandom.c \
|
||||||
util/virsocketaddr.h util/virsocketaddr.c \
|
util/virsocketaddr.h util/virsocketaddr.c \
|
||||||
util/virtime.h util/virtime.c
|
util/virtime.h util/virtime.c
|
||||||
|
@ -734,10 +734,6 @@ virResizeN;
|
|||||||
virShrinkN;
|
virShrinkN;
|
||||||
|
|
||||||
|
|
||||||
#netlink.h
|
|
||||||
nlComm;
|
|
||||||
|
|
||||||
|
|
||||||
# netdev_bandwidth_conf.h
|
# netdev_bandwidth_conf.h
|
||||||
virNetDevBandwidthFormat;
|
virNetDevBandwidthFormat;
|
||||||
virNetDevBandwidthParse;
|
virNetDevBandwidthParse;
|
||||||
@ -1260,6 +1256,10 @@ virNetDevVPortProfileOpTypeFromString;
|
|||||||
virNetDevVPortProfileOpTypeToString;
|
virNetDevVPortProfileOpTypeToString;
|
||||||
|
|
||||||
|
|
||||||
|
#virnetlink.h
|
||||||
|
virNetlinkCommand;
|
||||||
|
|
||||||
|
|
||||||
# virnetmessage.h
|
# virnetmessage.h
|
||||||
virNetMessageClear;
|
virNetMessageClear;
|
||||||
virNetMessageDecodeNumFDs;
|
virNetMessageDecodeNumFDs;
|
||||||
|
@ -66,7 +66,7 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST,
|
|||||||
# include "logging.h"
|
# include "logging.h"
|
||||||
# include "uuid.h"
|
# include "uuid.h"
|
||||||
# include "virfile.h"
|
# include "virfile.h"
|
||||||
# include "netlink.h"
|
# include "virnetlink.h"
|
||||||
# include "virnetdev.h"
|
# include "virnetdev.h"
|
||||||
|
|
||||||
# define MACVTAP_NAME_PREFIX "macvtap"
|
# define MACVTAP_NAME_PREFIX "macvtap"
|
||||||
@ -153,7 +153,7 @@ virNetDevMacVLanCreate(const char *ifname,
|
|||||||
|
|
||||||
nla_nest_end(nl_msg, linkinfo);
|
nla_nest_end(nl_msg, linkinfo);
|
||||||
|
|
||||||
if (nlComm(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
|
if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -249,7 +249,7 @@ int virNetDevMacVLanDelete(const char *ifname)
|
|||||||
if (nla_put(nl_msg, IFLA_IFNAME, strlen(ifname)+1, ifname) < 0)
|
if (nla_put(nl_msg, IFLA_IFNAME, strlen(ifname)+1, ifname) < 0)
|
||||||
goto buffer_too_small;
|
goto buffer_too_small;
|
||||||
|
|
||||||
if (nlComm(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
|
if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ VIR_ENUM_IMPL(virNetDevVPortProfileOp, VIR_NETDEV_VPORT_PROFILE_OP_LAST,
|
|||||||
# include <linux/if.h>
|
# include <linux/if.h>
|
||||||
# include <linux/if_tun.h>
|
# include <linux/if_tun.h>
|
||||||
|
|
||||||
# include "netlink.h"
|
# include "virnetlink.h"
|
||||||
# include "virfile.h"
|
# include "virfile.h"
|
||||||
# include "memory.h"
|
# include "memory.h"
|
||||||
# include "logging.h"
|
# include "logging.h"
|
||||||
@ -224,7 +224,7 @@ virNetDevVPortProfileLinkDump(const char *ifname, int ifindex, bool nltarget_ker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nlComm(nl_msg, recvbuf, &recvbuflen, pid) < 0) {
|
if (virNetlinkCommand(nl_msg, recvbuf, &recvbuflen, pid) < 0) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -517,7 +517,7 @@ virNetDevVPortProfileOpSetLink(const char *ifname, int ifindex,
|
|||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nlComm(nl_msg, &recvbuf, &recvbuflen, pid) < 0)
|
if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, pid) < 0)
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
|
|
||||||
if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL)
|
if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
* Copyright (C) 2010 IBM Corporation
|
* Copyright (C) 2010-2012 IBM Corporation
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -18,11 +18,14 @@
|
|||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Stefan Berger <stefanb@us.ibm.com>
|
* Stefan Berger <stefanb@us.ibm.com>
|
||||||
|
* Dirk Herrendoerfer <herrend[at]de[dot]ibm[dot]com>
|
||||||
*
|
*
|
||||||
* Notes:
|
* Notes:
|
||||||
* netlink: http://lovezutto.googlepages.com/netlink.pdf
|
* netlink: http://lovezutto.googlepages.com/netlink.pdf
|
||||||
* iproute2 package
|
* iproute2 package
|
||||||
*
|
*
|
||||||
|
* 2012/02: Renamed from netlink.[ch] to virnetlink.[ch]
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -31,7 +34,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "netlink.h"
|
#include "virnetlink.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "virterror_internal.h"
|
#include "virterror_internal.h"
|
||||||
|
|
||||||
@ -44,7 +47,7 @@
|
|||||||
#define NETLINK_ACK_TIMEOUT_S 2
|
#define NETLINK_ACK_TIMEOUT_S 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nlComm:
|
* virNetlinkCommand:
|
||||||
* @nlmsg: pointer to netlink message
|
* @nlmsg: pointer to netlink message
|
||||||
* @respbuf: pointer to pointer where response buffer will be allocated
|
* @respbuf: pointer to pointer where response buffer will be allocated
|
||||||
* @respbuflen: pointer to integer holding the size of the response buffer
|
* @respbuflen: pointer to integer holding the size of the response buffer
|
||||||
@ -56,9 +59,9 @@
|
|||||||
* buffer will be returned.
|
* buffer will be returned.
|
||||||
*/
|
*/
|
||||||
#if defined(__linux__) && defined(HAVE_LIBNL)
|
#if defined(__linux__) && defined(HAVE_LIBNL)
|
||||||
int nlComm(struct nl_msg *nl_msg,
|
int virNetlinkCommand(struct nl_msg *nl_msg,
|
||||||
unsigned char **respbuf, unsigned int *respbuflen,
|
unsigned char **respbuf, unsigned int *respbuflen,
|
||||||
int nl_pid)
|
int nl_pid)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct sockaddr_nl nladdr = {
|
struct sockaddr_nl nladdr = {
|
||||||
@ -137,16 +140,16 @@ err_exit:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int nlComm(struct nl_msg *nl_msg ATTRIBUTE_UNUSED,
|
int virNetlinkCommand(struct nl_msg *nl_msg ATTRIBUTE_UNUSED,
|
||||||
unsigned char **respbuf ATTRIBUTE_UNUSED,
|
unsigned char **respbuf ATTRIBUTE_UNUSED,
|
||||||
unsigned int *respbuflen ATTRIBUTE_UNUSED,
|
unsigned int *respbuflen ATTRIBUTE_UNUSED,
|
||||||
int nl_pid ATTRIBUTE_UNUSED)
|
int nl_pid ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
netlinkError(VIR_ERR_INTERNAL_ERROR, "%s",
|
netlinkError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
# if defined(__linux__) && !defined(HAVE_LIBNL)
|
# if defined(__linux__) && !defined(HAVE_LIBNL)
|
||||||
_("nlComm is not supported since libnl was not available"));
|
_("virNetlinkCommand is not supported since libnl was not available"));
|
||||||
# else
|
# else
|
||||||
_("nlComm is not supported on non-linux platforms"));
|
_("virNetlinkCommand is not supported on non-linux platforms"));
|
||||||
# endif
|
# endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
* Copyright (C) 2010 IBM Corporation
|
* Copyright (C) 2010-2012 IBM Corporation
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -32,8 +32,8 @@ struct nl_msg;
|
|||||||
|
|
||||||
# endif /* __linux__ */
|
# endif /* __linux__ */
|
||||||
|
|
||||||
int nlComm(struct nl_msg *nl_msg,
|
int virNetlinkCommand(struct nl_msg *nl_msg,
|
||||||
unsigned char **respbuf, unsigned int *respbuflen,
|
unsigned char **respbuf, unsigned int *respbuflen,
|
||||||
int nl_pid);
|
int nl_pid);
|
||||||
|
|
||||||
#endif /* __VIR_NETLINK_H__ */
|
#endif /* __VIR_NETLINK_H__ */
|
Loading…
x
Reference in New Issue
Block a user