mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 16:48:06 +00:00
char-device: Remove "sin" parameter from read_one_msg_from_device
Not much used, can be retrieved from the class if needed. There are some apparent test removal on reds.cpp. The test "if (!reds->vdagent)" apparently disappeared but it's included in the while. reds->agent_dev cannot be NULL as SPICE server allows only one agent and we are into a member of an object so it must be reds->agent_dev.get() == this. As there's only an agent and as the interface (sin) is extracted from that agent it must be reds->agent_dev.get() == sin->st and either reds->vdagent == sin or reds->vdagent == NULL. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@gmail.com>
This commit is contained in:
parent
479a1a74a2
commit
a10e496c46
@ -255,7 +255,7 @@ static bool red_char_device_read_from_device(RedCharDevice *dev)
|
||||
while ((max_send_tokens || (dev->priv->clients == NULL)) && dev->priv->running) {
|
||||
RedPipeItem *msg;
|
||||
|
||||
msg = dev->read_one_msg_from_device(dev->priv->sin);
|
||||
msg = dev->read_one_msg_from_device();
|
||||
if (!msg) {
|
||||
if (dev->priv->during_read_from_device > 1) {
|
||||
dev->priv->during_read_from_device = 1;
|
||||
|
||||
@ -190,7 +190,7 @@ public:
|
||||
|
||||
/* reads from the device till reaching a msg that should be sent to the client,
|
||||
* or till the reading fails */
|
||||
virtual RedPipeItem* read_one_msg_from_device(SpiceCharDeviceInstance *sin) = 0;
|
||||
virtual RedPipeItem* read_one_msg_from_device() = 0;
|
||||
/* After this call, the message is unreferenced.
|
||||
* Can be NULL. */
|
||||
virtual void send_msg_to_client(RedPipeItem *msg, RedCharDeviceClientOpaque *client) {};
|
||||
|
||||
@ -158,7 +158,7 @@ StreamDevice::partial_read()
|
||||
return false;
|
||||
}
|
||||
|
||||
RedPipeItem* StreamDevice::read_one_msg_from_device(SpiceCharDeviceInstance *)
|
||||
RedPipeItem* StreamDevice::read_one_msg_from_device()
|
||||
{
|
||||
while (partial_read()) {
|
||||
continue;
|
||||
|
||||
@ -90,7 +90,7 @@ private:
|
||||
StreamDeviceDisplayInfo device_display_info;
|
||||
|
||||
private:
|
||||
virtual RedPipeItem* read_one_msg_from_device(SpiceCharDeviceInstance *sin) override;
|
||||
virtual RedPipeItem* read_one_msg_from_device() override;
|
||||
virtual void remove_client(RedCharDeviceClientOpaque *client) override;
|
||||
virtual void port_event(uint8_t event) override;
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ struct RedCharDeviceVDIPort: public RedCharDevice
|
||||
RedCharDeviceVDIPort();
|
||||
~RedCharDeviceVDIPort();
|
||||
|
||||
virtual RedPipeItem* read_one_msg_from_device(SpiceCharDeviceInstance *sin) override;
|
||||
virtual RedPipeItem* read_one_msg_from_device() override;
|
||||
virtual void send_msg_to_client(RedPipeItem *msg, RedCharDeviceClientOpaque *opaque) override;
|
||||
virtual void send_tokens_to_client(RedCharDeviceClientOpaque *opaque, uint32_t tokens) override;
|
||||
virtual void remove_client(RedCharDeviceClientOpaque *opaque);
|
||||
@ -760,18 +760,13 @@ static void reds_adjust_agent_capabilities(RedsState *reds, VDAgentMessage *mess
|
||||
/* reads from the device till completes reading a message that is addressed to the client,
|
||||
* or otherwise, when reading from the device fails */
|
||||
RedPipeItem *
|
||||
RedCharDeviceVDIPort::read_one_msg_from_device(SpiceCharDeviceInstance *sin)
|
||||
RedCharDeviceVDIPort::read_one_msg_from_device()
|
||||
{
|
||||
RedsState *reds;
|
||||
RedVDIReadBuf *dispatch_buf;
|
||||
int n;
|
||||
|
||||
reds = get_server();
|
||||
g_assert(reds->agent_dev.get() == sin->st);
|
||||
if (!reds->vdagent) {
|
||||
return NULL;
|
||||
}
|
||||
spice_assert(reds->vdagent == sin);
|
||||
while (reds->vdagent) {
|
||||
switch (priv->read_state) {
|
||||
case VDI_PORT_READ_STATE_READ_HEADER:
|
||||
|
||||
@ -98,7 +98,7 @@ static void smartcard_read_buf_prepare(RedCharDeviceSmartcard *dev, VSCMsgHeader
|
||||
}
|
||||
|
||||
RedPipeItem*
|
||||
RedCharDeviceSmartcard::read_one_msg_from_device(SpiceCharDeviceInstance *)
|
||||
RedCharDeviceSmartcard::read_one_msg_from_device()
|
||||
{
|
||||
RedCharDeviceSmartcard *dev = this;
|
||||
VSCMsgHeader *vheader = (VSCMsgHeader*)dev->priv->buf;
|
||||
|
||||
@ -34,7 +34,7 @@ public:
|
||||
protected:
|
||||
~RedCharDeviceSmartcard();
|
||||
private:
|
||||
RedPipeItem* read_one_msg_from_device(SpiceCharDeviceInstance *sin) override;
|
||||
RedPipeItem* read_one_msg_from_device() override;
|
||||
void send_msg_to_client(RedPipeItem *msg, RedCharDeviceClientOpaque *client) override;
|
||||
void remove_client(RedCharDeviceClientOpaque *client) override;
|
||||
public: // XXX make private
|
||||
|
||||
@ -59,7 +59,7 @@ struct RedCharDeviceSpiceVmc: public RedCharDevice
|
||||
RedCharDeviceSpiceVmc(SpiceCharDeviceInstance *sin, RedsState *reds, RedVmcChannel *channel);
|
||||
~RedCharDeviceSpiceVmc();
|
||||
|
||||
virtual RedPipeItem* read_one_msg_from_device(SpiceCharDeviceInstance *sin) override;
|
||||
virtual RedPipeItem* read_one_msg_from_device() override;
|
||||
virtual void remove_client(RedCharDeviceClientOpaque *opaque) override;
|
||||
virtual void on_free_self_token() override;
|
||||
virtual void port_event(uint8_t event) override;
|
||||
@ -247,7 +247,7 @@ static RedVmcPipeItem* try_compress_lz4(RedVmcChannel *channel, int n, RedVmcPip
|
||||
}
|
||||
#endif
|
||||
|
||||
RedPipeItem* RedCharDeviceSpiceVmc::read_one_msg_from_device(SpiceCharDeviceInstance *)
|
||||
RedPipeItem* RedCharDeviceSpiceVmc::read_one_msg_from_device()
|
||||
{
|
||||
RedVmcPipeItem *msg_item;
|
||||
int n;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user