/** * struct bio_vec - a contiguous range of physical memory addresses * @bv_page: First page associated with the address range. * @bv_len: Number of bytes in the address range. * @bv_offset: Start of the address range relative to the start of @bv_page. * * The following holds for a bvec if n * PAGE_SIZE < bv_offset + bv_len: * * nth_page(@bv_page, n) == @bv_page + n * * This holds because page_is_mergeable() checks the above property.
*/ struct bio_vec { struct page *bv_page; unsignedint bv_len; unsignedint bv_offset;
};
/** * bvec_set_page - initialize a bvec based off a struct page * @bv: bvec to initialize * @page: page the bvec should point to * @len: length of the bvec * @offset: offset into the page
*/ staticinlinevoid bvec_set_page(struct bio_vec *bv, struct page *page, unsignedint len, unsignedint offset)
{
bv->bv_page = page;
bv->bv_len = len;
bv->bv_offset = offset;
}
/** * bvec_set_folio - initialize a bvec based off a struct folio * @bv: bvec to initialize * @folio: folio the bvec should point to * @len: length of the bvec * @offset: offset into the folio
*/ staticinlinevoid bvec_set_folio(struct bio_vec *bv, struct folio *folio,
size_t len, size_t offset)
{ unsignedlong nr = offset / PAGE_SIZE;
/** * bvec_set_virt - initialize a bvec based on a virtual address * @bv: bvec to initialize * @vaddr: virtual address to set the bvec to * @len: length of the bvec
*/ staticinlinevoid bvec_set_virt(struct bio_vec *bv, void *vaddr, unsignedint len)
{
bvec_set_page(bv, virt_to_page(vaddr), len, offset_in_page(vaddr));
}
/* * various member access, note that bio_data should of course not be used * on highmem page vectors
*/ #define __bvec_iter_bvec(bvec, iter) (&(bvec)[(iter).bi_idx])
/** * bvec_kmap_local - map a bvec into the kernel virtual address space * @bvec: bvec to map * * Must be called on single-page bvecs only. Call kunmap_local on the returned * address to unmap.
*/ staticinlinevoid *bvec_kmap_local(struct bio_vec *bvec)
{ return kmap_local_page(bvec->bv_page) + bvec->bv_offset;
}
/** * memcpy_from_bvec - copy data from a bvec * @bvec: bvec to copy from * * Must be called on single-page bvecs only.
*/ staticinlinevoid memcpy_from_bvec(char *to, struct bio_vec *bvec)
{
memcpy_from_page(to, bvec->bv_page, bvec->bv_offset, bvec->bv_len);
}
/** * memcpy_to_bvec - copy data to a bvec * @bvec: bvec to copy to * * Must be called on single-page bvecs only.
*/ staticinlinevoid memcpy_to_bvec(struct bio_vec *bvec, constchar *from)
{
memcpy_to_page(bvec->bv_page, bvec->bv_offset, from, bvec->bv_len);
}
/** * memzero_bvec - zero all data in a bvec * @bvec: bvec to zero * * Must be called on single-page bvecs only.
*/ staticinlinevoid memzero_bvec(struct bio_vec *bvec)
{
memzero_page(bvec->bv_page, bvec->bv_offset, bvec->bv_len);
}
/** * bvec_virt - return the virtual address for a bvec * @bvec: bvec to return the virtual address for * * Note: the caller must ensure that @bvec->bv_page is not a highmem page.
*/ staticinlinevoid *bvec_virt(struct bio_vec *bvec)
{
WARN_ON_ONCE(PageHighMem(bvec->bv_page)); return page_address(bvec->bv_page) + bvec->bv_offset;
}
/** * bvec_phys - return the physical address for a bvec * @bvec: bvec to return the physical address for
*/ staticinline phys_addr_t bvec_phys(conststruct bio_vec *bvec)
{ return page_to_phys(bvec->bv_page) + bvec->bv_offset;
}
#endif/* __LINUX_BVEC_H */
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.