[stgt] [PATCH 02/13] mem_copy_n32: safe memcpy, accumulates copied count, tracks remaining space
Alexander Nezhinsky
nezhinsky at gmail.com
Mon Feb 11 10:16:23 CET 2013
On Mon, Feb 11, 2013 at 10:39 AM, FUJITA Tomonori
<fujita.tomonori at lab.ntt.co.jp> wrote:
> Alexander Nezhinsky <nezhinsky at gmail.com> wrote:
>> For example, please see build_mode_page() usage pattern.
> I already read that code. Why you can't simply do something like:
> actual_len = mem_copy_n32(data, hdr, hdr_size,
> remain_len);
> *avail_len += hdr_size;
>
> mem_copy_n32 unconditionally adds src_len to avail_len. I don't see
> any point of doing that in mem_copy_n32().
Well, i can do it either way.
Then we are left with this:
>> int spc_memcpy(uint8_t *dst, uint8_t *src, uint32_t src_len, uint32_t
>> *remain_len)
>> {
>> int copy_len = min_t(uint32_t, *remain_len, src_len);
>> if (copy_len) {
>> memcpy(dst, src, copy_len);
>> *remain_len -= copy_len;
>> }
>> return copy_len;
>> }
As such changes affect the entire patchset, I'd prefer to finalize all
decisions before resending, especially regrading names, locations etc.
Is it ok as appears above?
Also regarding the other function:
>> what about safe_set_byte(...) ?
>> i'd leave it in utils.c, but we can move to spc.c as well
Do you have other comments?
Alexander
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list