audiod: Fix status item parsing for long status items.
authorAndre Noll <maan@systemlinux.org>
Mon, 19 Apr 2010 21:50:51 +0000 (23:50 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 19 Apr 2010 21:50:51 +0000 (23:50 +0200)
commit45b4e8b0ba410fd929a341a9bf84b1ac3995d734
tree1fd12aa763439a45a4300347cad9614ff785090d
parentce20ee3c755b47f753f122b0fb58a481a0a9d7b9
audiod: Fix status item parsing for long status items.

This was broken since audiod started to use the buffer tree API. Actually there are
two bugs which are both fixed by this patch:

- for_each_stat_item() copies the remaining part of the buffer containing
the incomplete part of the last status item to the beginning of the buffer.
This is necessary if the buffer tree API is not used but messes up the buffer
contents if it _is_ used. Move this memmove()  call from for_each_status_item(),
which is called from audiod.c and gui.c,  to gui.c, as only gui.c needs it.

- Secondly, audiod.c called btr_node_status() with an minimum input queue
size of zero, which is does not work if a status item crosses a buffer
boundary. In this case for_each_status_item() will only ever see the first buffer
containing the incomplete status item, hence it can never make progress.
Fix this by introducing  the min_iqs field of struct status_task. Set  this field
to non-zero if the full buffer size was returned by for_each_status_item(),
indicating that the next status item is spread out over two or more buffers.
audiod.c
gui.c
stat.c