<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 23, 2017 at 6:16 AM, Daniel Stone <span dir="ltr"><<a href="mailto:daniel@fooishbar.org" target="_blank">daniel@fooishbar.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span class=""><br>
On 8 March 2017 at 05:31, Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>> wrote:<br>
> Unlike stride, there was no previous offset getter, so it can be right<br>
> on the first try.<br>
><br>
> v2: Return EINVAL when plane is greater than total planes to make it<br>
> match the similar APIs.<br>
> Avoid leak after fromPlanar (Daniel)<br>
> Make sure when getting offsets we consider dumb images (Daniel)<br>
><br>
> v3: Use Jason's recommendation for handling the non-planar case.<br>
><br>
> v4: Return int64_t so we can get real errors<br>
<br>
</span>I really wish I'd caught this earlier. :(<br>
<br>
Returning int64_t is annoying because the relevant interface demands<br>
we need uint32_t, so we need to do casts in users. Given that the<br>
offset is useless without the handle/fd, and we have real error values<br>
for those (0 for handle, -1 for fd) which don't require casts, I'd<br>
much rather this was just a uint32_t returning 0 on failure.<br>
<br>
Oh well. If it's too late to change then fine, but if we could change<br>
it, it would make life a little easier.<br></blockquote><div><br></div><div>I'm ok with changing it given that we know there are zero users and it's been in-tree for all of a week.<br><br></div><div>The only problem is that 0 is a perfectly valid offset.  I think we could use (uint32_t)-1 and that would probably be safe. <br></div></div><br></div></div>