diff options
author | Michael Tokarev | 2012-03-11 15:05:12 +0100 |
---|---|---|
committer | Michael Tokarev | 2012-06-07 18:43:38 +0200 |
commit | dcf6f5e15ecee4f593eeacbe0591c1addc004d92 (patch) | |
tree | cac8cb34bdbab1b91ab48847b38433d476393d88 /hw/rtl8139.c | |
parent | virtio-serial-bus: use correct lengths in control_out() message (diff) | |
download | qemu-dcf6f5e15ecee4f593eeacbe0591c1addc004d92.tar.gz qemu-dcf6f5e15ecee4f593eeacbe0591c1addc004d92.tar.xz qemu-dcf6f5e15ecee4f593eeacbe0591c1addc004d92.zip |
change iov_* function prototypes to be more appropriate
Reorder arguments to be more natural, readable and
consistent with other iov_* functions, and change
argument names, from:
iov_from_buf(iov, iov_cnt, buf, iov_off, size)
to
iov_from_buf(iov, iov_cnt, offset, buf, bytes)
The result becomes natural English:
copy data to this `iov' vector with `iov_cnt'
elements starting at byte offset `offset'
from memory buffer `buf', processing `bytes'
bytes max.
(Try to read the original prototype this way).
Also change iov_clear() to more general iov_memset()
(it uses memset() internally anyway).
While at it, add comments to the header file
describing what the routines actually does.
The patch only renames argumens in the header, but
keeps old names in the implementation. The next
patch will touch actual code to match.
Now, it might look wrong to pay so much attention
to so small things. But we've so many badly designed
interfaces already so the whole thing becomes rather
confusing or error prone. One example of this is
previous commit and small discussion which emerged
from it, with an outcome that the utility functions
like these aren't well-understdandable, leading to
strange usage cases. That's why I paid quite some
attention to this set of functions and a few
others in subsequent patches.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/rtl8139.c')
-rw-r--r-- | hw/rtl8139.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/rtl8139.c b/hw/rtl8139.c index eb22d04fad..8128b64a0f 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -1783,7 +1783,7 @@ static void rtl8139_transfer_frame(RTL8139State *s, uint8_t *buf, int size, if (iov) { buf2_size = iov_size(iov, 3); buf2 = g_malloc(buf2_size); - iov_to_buf(iov, 3, buf2, 0, buf2_size); + iov_to_buf(iov, 3, 0, buf2, buf2_size); buf = buf2; } |