[ovs-dev] [optimize 1/2] netlink-socket: Remove unused nl_sock_sendv() function.

Ethan Jackson ethan at nicira.com
Wed Jul 27 20:28:38 UTC 2011


Looks Good.

Ethan

On Wed, Jul 20, 2011 at 13:16, Ben Pfaff <blp at nicira.com> wrote:
> This function hasn't been used for ages.
> ---
>  lib/netlink-socket.c |   33 ---------------------------------
>  lib/netlink-socket.h |    3 ---
>  2 files changed, 0 insertions(+), 36 deletions(-)
>
> diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
> index f4bf864..95b2401 100644
> --- a/lib/netlink-socket.c
> +++ b/lib/netlink-socket.c
> @@ -245,39 +245,6 @@ nl_sock_send(struct nl_sock *sock, const struct ofpbuf *msg, bool wait)
>     return nl_sock_send__(sock, msg, wait);
>  }
>
> -/* Tries to send the 'n_iov' chunks of data in 'iov' to the kernel on 'sock' as
> - * a single Netlink message.  (The message must be fully formed and not require
> - * finalization of its nlmsg_len or nlmsg_pid fields.)
> - *
> - * Returns 0 if successful, otherwise a positive errno value.  If 'wait' is
> - * true, then the send will wait until buffer space is ready; otherwise,
> - * returns EAGAIN if the 'sock' send buffer is full. */
> -int
> -nl_sock_sendv(struct nl_sock *sock, const struct iovec iov[], size_t n_iov,
> -              bool wait)
> -{
> -    struct msghdr msg;
> -    int error;
> -
> -    COVERAGE_INC(netlink_send);
> -    memset(&msg, 0, sizeof msg);
> -    msg.msg_iov = (struct iovec *) iov;
> -    msg.msg_iovlen = n_iov;
> -    do {
> -        int retval;
> -        retval = sendmsg(sock->fd, &msg, wait ? 0 : MSG_DONTWAIT);
> -        error = retval < 0 ? errno : 0;
> -    } while (error == EINTR);
> -    if (error != EAGAIN) {
> -        log_nlmsg(__func__, error, iov[0].iov_base, iov[0].iov_len,
> -                  sock->protocol);
> -        if (!error) {
> -            COVERAGE_INC(netlink_sent);
> -        }
> -    }
> -    return error;
> -}
> -
>  /* This stress option is useful for testing that OVS properly tolerates
>  * -ENOBUFS on NetLink sockets.  Such errors are unavoidable because they can
>  * occur if the kernel cannot temporarily allocate enough GFP_ATOMIC memory to
> diff --git a/lib/netlink-socket.h b/lib/netlink-socket.h
> index 49d4b39..43b4b02 100644
> --- a/lib/netlink-socket.h
> +++ b/lib/netlink-socket.h
> @@ -35,7 +35,6 @@
>  #include <stdbool.h>
>  #include <stddef.h>
>  #include <stdint.h>
> -#include <sys/uio.h>
>
>  struct ofpbuf;
>  struct nl_sock;
> @@ -53,8 +52,6 @@ int nl_sock_join_mcgroup(struct nl_sock *, unsigned int multicast_group);
>  int nl_sock_leave_mcgroup(struct nl_sock *, unsigned int multicast_group);
>
>  int nl_sock_send(struct nl_sock *, const struct ofpbuf *, bool wait);
> -int nl_sock_sendv(struct nl_sock *sock, const struct iovec iov[], size_t n_iov,
> -                  bool wait);
>  int nl_sock_recv(struct nl_sock *, struct ofpbuf **, bool wait);
>  int nl_sock_transact(struct nl_sock *, const struct ofpbuf *request,
>                      struct ofpbuf **reply);
> --
> 1.7.4.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list