Re: [PATCH RESEND x3 v9 1/9] iov_iter: add copy_struct_from_iter()
From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2021-06-18 19:50:06
Also in:
linux-btrfs, linux-fsdevel
From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2021-06-18 19:50:06
Also in:
linux-btrfs, linux-fsdevel
On Fri, Jun 18, 2021 at 07:42:41PM +0000, Al Viro wrote:
Pipe ones are strictly destinations - they can't be sources. So if you see it called for one of those, you've a bug. Xarray ones are *not* - they can be sources, and that's missing here. Much more unpleasant, though, is that this thing has hard dependency on nr_seg == 1 *AND* openly suggests the use of iov_iter_single_seg_count(), which is completely wrong. That sucker has some weird users left (as of #work.iov_iter), but all of them are actually due to API deficiencies and I very much hope to kill that thing off. Why not simply add iov_iter_check_zeroes(), that would be called after copy_from_iter() and verified that all that's left in the iterator consists of zeroes? Then this copy_struct_from_...() would be trivial to express through those two. And check_zeroes would also be trivial, especially on top of #work.iov_iter. With no calls of iov_iter_advance() at all, while we are at it... IDGI... Omar, what semantics do you really want from that primitive?
And for pity sake, let's not do that EXPORT_SYMBOL_GPL() posturing there. If it's a sane general-purpose API, it doesn't matter who uses it; if it's not, it shouldn't be exported in the first place. It can be implemented via the already exported primitives, so it's not as if we prevented anyone from doing an equivalent...