参照元†
- page_link は何を指しているか?
- 連結する場合: 次の scatterlist の先頭(struct scatterlist *)
- 連結しない場合: ページのかたまりの先頭ページ(struct page *)
- page_link の下位 2ビットをフラグとして使っているため、scatterlist の配列の先頭は必ず 4バイト境界に合わせる必要がある。
返り値†
/**
* sg_next - return the next scatterlist entry in a list
* @sg: The current sg entry
*
* Description:
* Usually the next entry will be @sg@ + 1, but if this sg element is part
* of a chained scatterlist, it could jump to the start of a new
* scatterlist array.
*
**/
struct scatterlist *sg_next(struct scatterlist *sg)
{
#ifdef CONFIG_DEBUG_SG
BUG_ON(sg->sg_magic != SG_MAGIC);
#endif
if (sg_is_last(sg))
return NULL;
sg++;
if (unlikely(sg_is_chain(sg)))
sg = sg_chain_ptr(sg);
- sg は配列になっているので、次の要素を指すポインタは sg++ で得られる。
return sg;
}
EXPORT_SYMBOL(sg_next);
コメント†