Re: [PATCH 1/4] scatterlist: Introduce some helper functions
From: Baolin Wang
Date: Fri Mar 04 2016 - 01:53:57 EST
>>> + **/
>>> +static inline bool sg_is_contiguous(struct scatterlist *sga,
>>> + struct scatterlist *sgb)
>>> +{
>>> + return ((sga->page_link & ~0x3UL) + sga->offset + sga->length ==
>>> + (sgb->page_link & ~0x3UL));
>>> +}
>> I don't understand that one.
>> sga->page_link is a pointer to a "struct page *". How can it be added to an
>> offset within a page ???
>
>
> Ah, sorry that's a mistake. It should check as below:
> static inline bool sg_is_contiguous(struct scatterlist *sga, struct
> scatterlist *sgb)
> {
> return (unsigned int)sg_virt(sga) + sga->length == (unsigned
> int)sg_virt(sgb);
> }
sorry, it should be:
static inline bool sg_is_contiguous(struct scatterlist *sga,
struct scatterlist *sgb)
{
return (unsigned long)sg_virt(sga) + sga->length ==
(unsigned long)sg_virt(sgb);
}
--
Baolin.wang
Best Regards