client: Rearrange ring_to_iovec() for clarity
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
8fe2b949e6
commit
53c8794ef8
1 changed files with 7 additions and 8 deletions
|
@ -229,18 +229,17 @@ ring_to_iovec(struct ring *r, struct iovec iov[])
|
|||
return 0;
|
||||
|
||||
iov[0].iov_base = r->buf + cons;
|
||||
if (prod <= cons) {
|
||||
if (prod > cons) {
|
||||
/* r->buf[cons..prod-1] */
|
||||
iov[0].iov_len = prod - cons;
|
||||
return 1;
|
||||
}
|
||||
/* r->buf[cons..] */
|
||||
iov[0].iov_len = RING_SIZE - cons;
|
||||
/* r->buf[..prod-1] */
|
||||
iov[1].iov_base = r->buf;
|
||||
iov[1].iov_len = prod;
|
||||
return 2;
|
||||
} else {
|
||||
/* r->buf[cons..prod-1] */
|
||||
iov[0].iov_len = prod - cons;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue