mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-04 20:45:34 +00:00
marshaller: rename _add_ref() to _add_by_ref()
The spice_marshaller_add_ref() family of functions is confusing since it sounds like you're incrementing a reference on the marshaller. What it is actually doing is adding a data buffer to the marshaller by reference rather than by value. Changing the function names to _add_by_ref() makes this clearer. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
This commit is contained in:
parent
51d0ed6abb
commit
3613ead4d8
@ -893,10 +893,10 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
|
||||
if (dev->priv->cur_write_buf) {
|
||||
uint32_t buf_remaining = dev->priv->cur_write_buf->buf + dev->priv->cur_write_buf->buf_used -
|
||||
dev->priv->cur_write_buf_pos;
|
||||
spice_marshaller_add_ref_full(m2, dev->priv->cur_write_buf_pos, buf_remaining,
|
||||
migrate_data_marshaller_write_buffer_free,
|
||||
red_char_device_write_buffer_ref(dev->priv->cur_write_buf)
|
||||
);
|
||||
spice_marshaller_add_by_ref_full(m2, dev->priv->cur_write_buf_pos, buf_remaining,
|
||||
migrate_data_marshaller_write_buffer_free,
|
||||
red_char_device_write_buffer_ref(dev->priv->cur_write_buf)
|
||||
);
|
||||
*write_to_dev_size_ptr += buf_remaining;
|
||||
if (dev->priv->cur_write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT) {
|
||||
spice_assert(dev->priv->cur_write_buf->client == dev_client->client);
|
||||
@ -907,10 +907,10 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
|
||||
for (item = g_queue_peek_tail_link(&dev->priv->write_queue); item != NULL; item = item->prev) {
|
||||
RedCharDeviceWriteBuffer *write_buf = item->data;
|
||||
|
||||
spice_marshaller_add_ref_full(m2, write_buf->buf, write_buf->buf_used,
|
||||
migrate_data_marshaller_write_buffer_free,
|
||||
red_char_device_write_buffer_ref(write_buf)
|
||||
);
|
||||
spice_marshaller_add_by_ref_full(m2, write_buf->buf, write_buf->buf_used,
|
||||
migrate_data_marshaller_write_buffer_free,
|
||||
red_char_device_write_buffer_ref(write_buf)
|
||||
);
|
||||
*write_to_dev_size_ptr += write_buf->buf_used;
|
||||
if (write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT) {
|
||||
spice_assert(write_buf->client == dev_client->client);
|
||||
|
||||
@ -131,7 +131,7 @@ typedef struct {
|
||||
static void add_buf_from_info(SpiceMarshaller *m, AddBufInfo *info)
|
||||
{
|
||||
if (info->data) {
|
||||
spice_marshaller_add_ref(m, info->data, info->size);
|
||||
spice_marshaller_add_by_ref(m, info->data, info->size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -337,8 +337,8 @@ static void marshaller_add_compressed(SpiceMarshaller *m,
|
||||
spice_return_if_fail(comp_buf);
|
||||
now = MIN(sizeof(comp_buf->buf), max);
|
||||
max -= now;
|
||||
spice_marshaller_add_ref_full(m, comp_buf->buf.bytes, now,
|
||||
marshaller_compress_buf_free, comp_buf);
|
||||
spice_marshaller_add_by_ref_full(m, comp_buf->buf.bytes, now,
|
||||
marshaller_compress_buf_free, comp_buf);
|
||||
comp_buf = comp_buf->send_next;
|
||||
} while (max);
|
||||
}
|
||||
@ -449,7 +449,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
|
||||
spice_marshall_Palette(bitmap_palette_out, palette);
|
||||
}
|
||||
|
||||
spice_marshaller_add_ref_chunks(m, bitmap->data);
|
||||
spice_marshaller_add_chunks_by_ref(m, bitmap->data);
|
||||
pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
|
||||
return FILL_BITS_TYPE_BITMAP;
|
||||
} else {
|
||||
@ -481,7 +481,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
|
||||
&bitmap_palette_out, &lzplt_palette_out);
|
||||
spice_assert(bitmap_palette_out == NULL);
|
||||
spice_assert(lzplt_palette_out == NULL);
|
||||
spice_marshaller_add_ref_chunks(m, image.u.quic.data);
|
||||
spice_marshaller_add_chunks_by_ref(m, image.u.quic.data);
|
||||
pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
|
||||
return FILL_BITS_TYPE_COMPRESS_LOSSLESS;
|
||||
default:
|
||||
@ -1741,8 +1741,8 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
|
||||
rect_debug(&stream_data.dest);
|
||||
spice_marshall_msg_display_stream_data_sized(base_marshaller, &stream_data);
|
||||
}
|
||||
spice_marshaller_add_ref_full(base_marshaller, outbuf->data, outbuf->size,
|
||||
&red_release_video_encoder_buffer, outbuf);
|
||||
spice_marshaller_add_by_ref_full(base_marshaller, outbuf->data, outbuf->size,
|
||||
&red_release_video_encoder_buffer, outbuf);
|
||||
#ifdef STREAM_STATS
|
||||
agent->stats.num_frames_sent++;
|
||||
agent->stats.size_sent += outbuf->size;
|
||||
@ -1984,8 +1984,8 @@ static void red_marshall_image(RedChannelClient *rcc,
|
||||
|
||||
spice_marshall_Image(src_bitmap_out, &red_image,
|
||||
&bitmap_palette_out, &lzplt_palette_out);
|
||||
spice_marshaller_add_ref(src_bitmap_out, item->data,
|
||||
bitmap.y * bitmap.stride);
|
||||
spice_marshaller_add_by_ref(src_bitmap_out, item->data,
|
||||
bitmap.y * bitmap.stride);
|
||||
region_remove(surface_lossy_region, ©.base.box);
|
||||
}
|
||||
spice_chunks_destroy(chunks);
|
||||
|
||||
@ -793,7 +793,7 @@ static void main_channel_marshall_ping(RedChannelClient *rcc,
|
||||
while (size_left > 0) {
|
||||
int now = MIN(ZERO_BUF_SIZE, size_left);
|
||||
size_left -= now;
|
||||
spice_marshaller_add_ref(m, zero_page, now);
|
||||
spice_marshaller_add_by_ref(m, zero_page, now);
|
||||
}
|
||||
}
|
||||
|
||||
@ -838,7 +838,7 @@ static void main_channel_marshall_agent_data(RedChannelClient *rcc,
|
||||
RedAgentDataPipeItem *item)
|
||||
{
|
||||
red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DATA, &item->base);
|
||||
spice_marshaller_add_ref(m, item->data, item->len);
|
||||
spice_marshaller_add_by_ref(m, item->data, item->len);
|
||||
}
|
||||
|
||||
static void main_channel_marshall_migrate_data_item(RedChannelClient *rcc,
|
||||
|
||||
@ -212,7 +212,7 @@ void smartcard_channel_client_send_data(RedChannelClient *rcc,
|
||||
spice_assert(rcc);
|
||||
spice_assert(vheader);
|
||||
red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA, item);
|
||||
spice_marshaller_add_ref(m, (uint8_t*)vheader, sizeof(VSCMsgHeader) + vheader->length);
|
||||
spice_marshaller_add_by_ref(m, (uint8_t*)vheader, sizeof(VSCMsgHeader) + vheader->length);
|
||||
}
|
||||
|
||||
void smartcard_channel_client_send_error(RedChannelClient *rcc, SpiceMarshaller *m, RedPipeItem *item)
|
||||
|
||||
@ -806,8 +806,9 @@ static int snd_playback_send_write(PlaybackChannelClient *playback_client)
|
||||
spice_marshall_msg_playback_data(m, &msg);
|
||||
|
||||
if (playback_client->mode == SPICE_AUDIO_DATA_MODE_RAW) {
|
||||
spice_marshaller_add_ref(m, (uint8_t *)frame->samples,
|
||||
snd_codec_frame_size(playback_client->codec) * sizeof(frame->samples[0]));
|
||||
spice_marshaller_add_by_ref(m, (uint8_t *)frame->samples,
|
||||
snd_codec_frame_size(playback_client->codec) *
|
||||
sizeof(frame->samples[0]));
|
||||
}
|
||||
else {
|
||||
int n = sizeof(playback_client->encode_buf);
|
||||
@ -818,7 +819,7 @@ static int snd_playback_send_write(PlaybackChannelClient *playback_client)
|
||||
snd_disconnect_channel(client);
|
||||
return FALSE;
|
||||
}
|
||||
spice_marshaller_add_ref(m, playback_client->encode_buf, n);
|
||||
spice_marshaller_add_by_ref(m, playback_client->encode_buf, n);
|
||||
}
|
||||
|
||||
return snd_begin_send_message(client);
|
||||
|
||||
@ -645,7 +645,7 @@ static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
|
||||
};
|
||||
spice_marshall_SpiceMsgCompressedData(m, &compressed_msg);
|
||||
}
|
||||
spice_marshaller_add_ref(m, i->buf, i->buf_used);
|
||||
spice_marshaller_add_by_ref(m, i->buf, i->buf_used);
|
||||
}
|
||||
|
||||
static void spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 6b409c4a7979f043a997ae762f16c6edec68345e
|
||||
Subproject commit 86dcd22d334a4992718780417bc574623bd61826
|
||||
Loading…
Reference in New Issue
Block a user