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:
D. Herrendoerfer 2012-02-03 15:13:19 +01:00 committed by Laine Stump
parent 3e952ecc52
commit d04394288f
7 changed files with 28 additions and 25 deletions

View File

@ -116,7 +116,6 @@ src/util/hostusb.c
src/util/iohelper.c
src/util/iptables.c
src/util/json.c
src/util/netlink.c
src/util/pci.c
src/util/processinfo.c
src/util/sexpr.c
@ -132,6 +131,7 @@ src/util/virnetdevbridge.c
src/util/virnetdevmacvlan.c
src/util/virnetdevtap.c
src/util/virnetdevvportprofile.c
src/util/virnetlink.c
src/util/virnodesuspend.c
src/util/virpidfile.c
src/util/virsocketaddr.c

View File

@ -67,7 +67,6 @@ UTIL_SOURCES = \
util/json.c util/json.h \
util/logging.c util/logging.h \
util/memory.c util/memory.h \
util/netlink.c util/netlink.h \
util/pci.c util/pci.h \
util/processinfo.c util/processinfo.h \
util/hostusb.c util/hostusb.h \
@ -101,6 +100,7 @@ UTIL_SOURCES = \
util/virnetdevtap.h util/virnetdevtap.c \
util/virnetdevveth.h util/virnetdevveth.c \
util/virnetdevvportprofile.h util/virnetdevvportprofile.c \
util/virnetlink.c util/virnetlink.h \
util/virrandom.h util/virrandom.c \
util/virsocketaddr.h util/virsocketaddr.c \
util/virtime.h util/virtime.c

View File

@ -734,10 +734,6 @@ virResizeN;
virShrinkN;
#netlink.h
nlComm;
# netdev_bandwidth_conf.h
virNetDevBandwidthFormat;
virNetDevBandwidthParse;
@ -1260,6 +1256,10 @@ virNetDevVPortProfileOpTypeFromString;
virNetDevVPortProfileOpTypeToString;
#virnetlink.h
virNetlinkCommand;
# virnetmessage.h
virNetMessageClear;
virNetMessageDecodeNumFDs;

View File

@ -66,7 +66,7 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST,
# include "logging.h"
# include "uuid.h"
# include "virfile.h"
# include "netlink.h"
# include "virnetlink.h"
# include "virnetdev.h"
# define MACVTAP_NAME_PREFIX "macvtap"
@ -153,7 +153,7 @@ virNetDevMacVLanCreate(const char *ifname,
nla_nest_end(nl_msg, linkinfo);
if (nlComm(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
rc = -1;
goto cleanup;
}
@ -249,7 +249,7 @@ int virNetDevMacVLanDelete(const char *ifname)
if (nla_put(nl_msg, IFLA_IFNAME, strlen(ifname)+1, ifname) < 0)
goto buffer_too_small;
if (nlComm(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
rc = -1;
goto cleanup;
}

View File

@ -55,7 +55,7 @@ VIR_ENUM_IMPL(virNetDevVPortProfileOp, VIR_NETDEV_VPORT_PROFILE_OP_LAST,
# include <linux/if.h>
# include <linux/if_tun.h>
# include "netlink.h"
# include "virnetlink.h"
# include "virfile.h"
# include "memory.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;
goto cleanup;
}
@ -517,7 +517,7 @@ virNetDevVPortProfileOpSetLink(const char *ifname, int ifindex,
goto err_exit;
}
if (nlComm(nl_msg, &recvbuf, &recvbuflen, pid) < 0)
if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, pid) < 0)
goto err_exit;
if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL)

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU Lesser General Public
@ -18,11 +18,14 @@
*
* Authors:
* Stefan Berger <stefanb@us.ibm.com>
* Dirk Herrendoerfer <herrend[at]de[dot]ibm[dot]com>
*
* Notes:
* netlink: http://lovezutto.googlepages.com/netlink.pdf
* iproute2 package
*
* 2012/02: Renamed from netlink.[ch] to virnetlink.[ch]
*
*/
#include <config.h>
@ -31,7 +34,7 @@
#include <unistd.h>
#include <sys/types.h>
#include "netlink.h"
#include "virnetlink.h"
#include "memory.h"
#include "virterror_internal.h"
@ -44,7 +47,7 @@
#define NETLINK_ACK_TIMEOUT_S 2
/**
* nlComm:
* virNetlinkCommand:
* @nlmsg: pointer to netlink message
* @respbuf: pointer to pointer where response buffer will be allocated
* @respbuflen: pointer to integer holding the size of the response buffer
@ -56,9 +59,9 @@
* buffer will be returned.
*/
#if defined(__linux__) && defined(HAVE_LIBNL)
int nlComm(struct nl_msg *nl_msg,
unsigned char **respbuf, unsigned int *respbuflen,
int nl_pid)
int virNetlinkCommand(struct nl_msg *nl_msg,
unsigned char **respbuf, unsigned int *respbuflen,
int nl_pid)
{
int rc = 0;
struct sockaddr_nl nladdr = {
@ -137,16 +140,16 @@ err_exit:
#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 int *respbuflen ATTRIBUTE_UNUSED,
int nl_pid ATTRIBUTE_UNUSED)
{
netlinkError(VIR_ERR_INTERNAL_ERROR, "%s",
# 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
_("nlComm is not supported on non-linux platforms"));
_("virNetlinkCommand is not supported on non-linux platforms"));
# endif
return -1;
}

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU Lesser General Public
@ -32,8 +32,8 @@ struct nl_msg;
# endif /* __linux__ */
int nlComm(struct nl_msg *nl_msg,
unsigned char **respbuf, unsigned int *respbuflen,
int nl_pid);
int virNetlinkCommand(struct nl_msg *nl_msg,
unsigned char **respbuf, unsigned int *respbuflen,
int nl_pid);
#endif /* __VIR_NETLINK_H__ */