Re: [PATCH 02/13] mem_copy_n32: safe memcpy, accumulates copied count, tracks remaining space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 11, 2013 at 10:39 AM, FUJITA Tomonori
<fujita.tomonori@xxxxxxxxxxxxx> wrote:

> Alexander Nezhinsky <nezhinsky@xxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux