From: Christoph Hellwig Date: Thu, 20 May 2021 12:41:29 +0000 (+0200) Subject: bvec: add memcpy_{from,to}_bvec and memzero_bvec helper X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a72e9976b2c0443774b267af422b48bb565ec103;p=users%2Fhch%2Fblock.git bvec: add memcpy_{from,to}_bvec and memzero_bvec helper Add helpers to perform common memory operation on a bvec. Signed-off-by: Christoph Hellwig --- diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 5048df1b432c..a9c16cabddc0 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -189,4 +189,19 @@ static inline char *bvec_kmap_local(struct bio_vec *bvec) return kmap_local_page(bvec->bv_page) + bvec->bv_offset; } +static inline void memcpy_from_bvec(char *to, struct bio_vec *bvec) +{ + memcpy_from_page(to, bvec->bv_page, bvec->bv_offset, bvec->bv_len); +} + +static inline void memcpy_to_bvec(struct bio_vec *bvec, const char *from) +{ + memcpy_to_page(bvec->bv_page, bvec->bv_offset, from, bvec->bv_len); +} + +static inline void memzero_bvec(struct bio_vec *bvec) +{ + memzero_page(bvec->bv_page, bvec->bv_offset, bvec->bv_len); +} + #endif /* __LINUX_BVEC_H */