diff options
author | Jason Wang <jasowang@redhat.com> | 2013-08-06 05:45:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-07 19:52:33 -0400 |
commit | b4bf07771faaf959b0a916d35b1b930c030e30a8 (patch) | |
tree | 9292ea7010fc74fb5c3f5039ee3886b1f42702f3 /drivers/net/macvtap.c | |
parent | 6261d983f226f0a6a8d4d32b57a032bc23a5ebb6 (diff) |
net: move iov_pages() to net/core/iovec.c
To let it be reused and reduce code duplication.
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvtap.c')
-rw-r--r-- | drivers/net/macvtap.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index a98fb0ed6aef..dfec20df17ba 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -698,29 +698,6 @@ static int macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, | |||
698 | return 0; | 698 | return 0; |
699 | } | 699 | } |
700 | 700 | ||
701 | static unsigned long iov_pages(const struct iovec *iv, int offset, | ||
702 | unsigned long nr_segs) | ||
703 | { | ||
704 | unsigned long seg, base; | ||
705 | int pages = 0, len, size; | ||
706 | |||
707 | while (nr_segs && (offset >= iv->iov_len)) { | ||
708 | offset -= iv->iov_len; | ||
709 | ++iv; | ||
710 | --nr_segs; | ||
711 | } | ||
712 | |||
713 | for (seg = 0; seg < nr_segs; seg++) { | ||
714 | base = (unsigned long)iv[seg].iov_base + offset; | ||
715 | len = iv[seg].iov_len - offset; | ||
716 | size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT; | ||
717 | pages += size; | ||
718 | offset = 0; | ||
719 | } | ||
720 | |||
721 | return pages; | ||
722 | } | ||
723 | |||
724 | /* Get packet from user space buffer */ | 701 | /* Get packet from user space buffer */ |
725 | static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | 702 | static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, |
726 | const struct iovec *iv, unsigned long total_len, | 703 | const struct iovec *iv, unsigned long total_len, |