Skip to content
Snippets Groups Projects
Commit 1e3bb0fb authored by Takuya ASADA's avatar Takuya ASADA Committed by Pekka Enberg
Browse files

Add linearize_uio_write

parent 593f26d6
No related branches found
No related tags found
No related merge requests found
......@@ -65,4 +65,26 @@ int uiomove(void *cp, int n, struct uio *uio);
__END_DECLS
#ifdef __cplusplus
template <typename F>
static inline void linearize_uio_write(struct uio *uio, int ioflag, F f)
{
while (uio->uio_resid > 0) {
struct iovec *iov = uio->uio_iov;
if (iov->iov_len) {
f(reinterpret_cast<const char *>(iov->iov_base),
iov->iov_len);
}
uio->uio_iov++;
uio->uio_iovcnt--;
uio->uio_resid -= iov->iov_len;
uio->uio_offset += iov->iov_len;
}
}
#endif
#endif /* !_UIO_H_ */
......@@ -12,8 +12,8 @@
#include <osv/debug.hh>
#include "tst-hub.hh"
#include <bsd/porting/netport.h>
extern "C" {
#include <bsd/porting/netport.h>
#include <bsd/porting/synch.h>
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment