datagram: consolidate datagram copy to iter helpers
authorSagi Grimberg <sagi@lightbitslabs.com>
Tue, 4 Dec 2018 01:52:08 +0000 (17:52 -0800)
committerChristoph Hellwig <hch@lst.de>
Thu, 13 Dec 2018 08:58:53 +0000 (09:58 +0100)
commit950fcaecd5cc6c014bb96506fd0652a501c85276
tree15e815ace068cd74215156fd0957a75ce3a992c1
parentcb002d074dabfaa2248507fd9478d16a542e4f1e
datagram: consolidate datagram copy to iter helpers

skb_copy_datagram_iter and skb_copy_and_csum_datagram are essentialy
the same but with a couple of differences: The first is the copy
operation used which either a simple copy or a csum_and_copy, and the
second are the behavior on the "short copy" path where simply copy
needs to return the number of bytes successfully copied while csum_and_copy
needs to fault immediately as the checksum is partial.

Introduce __skb_datagram_iter that additionally accepts:
1. copy operation function pointer
2. private data that goes with the copy operation
3. fault_short flag to indicate the action on short copy

Suggested-by: David S. Miller <davem@davemloft.net>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sagi Grimberg <sagi@lightbitslabs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
net/core/datagram.c