sf_iova_memset_ex for iov and iovcnt

posix_api
YuQing 2022-02-04 15:37:59 +08:00
parent 5796655ce0
commit fa9e00f3b8
2 changed files with 9 additions and 6 deletions

View File

@ -140,8 +140,8 @@ int sf_iova_next_slice(SFDynamicIOVArray *iova,
return iova_slice(iova, slice_len);
}
int sf_iova_memset(SFDynamicIOVArray *iova, int c,
const int offset, const int length)
int sf_iova_memset_ex(struct iovec *iov, const int iovcnt,
int c, const int offset, const int length)
{
struct iovec *iob;
struct iovec *end;
@ -155,8 +155,8 @@ int sf_iova_memset(SFDynamicIOVArray *iova, int c,
}
sum_bytes = 0;
end = iova->iov + iova->cnt;
for (iob=iova->iov; iob<end; iob++) {
end = iov + iovcnt;
for (iob=iov; iob<end; iob++) {
sum_bytes += iob->iov_len;
if (sum_bytes > offset) {
break;

View File

@ -76,8 +76,11 @@ int sf_iova_first_slice(SFDynamicIOVArray *iova, const int slice_len);
int sf_iova_next_slice(SFDynamicIOVArray *iova,
const int consume_len, const int slice_len);
int sf_iova_memset(SFDynamicIOVArray *iova, int c,
const int offset, const int length);
int sf_iova_memset_ex(struct iovec *iov, const int iovcnt,
int c, const int offset, const int length);
#define sf_iova_memset(iova, c, offset, length) \
sf_iova_memset_ex((iova).iov, (iova).cnt, c, offset, length)
#ifdef __cplusplus
}