Re: [PATCH 10/14] char-device: Remove RedCharDeviceClass::{un, }ref_msg_to_client

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

On Thu, 2016-04-07 at 17:11 -0500, Jonathon Jongsma wrote:
> From: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> 
> Now that client messages are always RedPipeItem, we don't need virtual
> functions to know how to ref/unref them.
> ---
>  server/char-device.c | 26 ++++----------------------
>  server/char-device.h |  4 ----
>  server/reds.c        |  2 --
>  server/smartcard.c   |  2 --
>  server/spicevmc.c    |  2 --
>  5 files changed, 4 insertions(+), 32 deletions(-)
> 
> diff --git a/server/char-device.c b/server/char-device.c
> index 2427de6..04b672c 100644
> --- a/server/char-device.c
> +++ b/server/char-device.c
> @@ -110,24 +110,6 @@ red_char_device_read_one_msg_from_device(RedCharDevice
> *dev)
>     return klass->read_one_msg_from_device(dev->priv->sin, dev->priv->opaque);
>  }
>  
> -static RedPipeItem *
> -red_char_device_ref_msg_to_client(RedCharDevice *dev,
> -                                    RedPipeItem *msg)
> -{
> -   RedCharDeviceClass *klass = RED_CHAR_DEVICE_GET_CLASS(dev);
> -
> -   return klass->ref_msg_to_client(msg, dev->priv->opaque);
> -}
> -
> -static void
> -red_char_device_unref_msg_to_client(RedCharDevice *dev,
> -                                      RedPipeItem *msg)
> -{
> -   RedCharDeviceClass *klass = RED_CHAR_DEVICE_GET_CLASS(dev);
> -
> -   klass->unref_msg_to_client(msg, dev->priv->opaque);
> -}
> -
>  static void
>  red_char_device_send_msg_to_client(RedCharDevice *dev,
>                                       RedPipeItem *msg,
> @@ -215,7 +197,7 @@ static void
> red_char_device_client_send_queue_free(RedCharDevice *dev,
>                                                                     link);
>  
>          ring_remove(item);
> -        red_char_device_unref_msg_to_client(dev, msg_item->msg);
> +        red_pipe_item_unref(msg_item->msg);
>          free(msg_item);
>      }
>      dev_client->num_send_tokens += dev_client->send_queue_size;
> @@ -331,7 +313,7 @@ static void
> red_char_device_add_msg_to_client_queue(RedCharDeviceClient *dev_cli
>      }
>  
>      msg_item = spice_new0(RedCharDeviceMsgToClientItem, 1);
> -    msg_item->msg = red_char_device_ref_msg_to_client(dev, msg);
> +    msg_item->msg = red_pipe_item_ref(msg);
>      ring_add(&dev_client->send_queue, &msg_item->link);
>      dev_client->send_queue_size++;
>      if (!dev_client->wait_for_tokens_started) {
> @@ -401,7 +383,7 @@ static int red_char_device_read_from_device(RedCharDevice
> *dev)
>          }
>          did_read = TRUE;
>          red_char_device_send_msg_to_clients(dev, msg);
> -        red_char_device_unref_msg_to_client(dev, msg);
> +        red_pipe_item_unref(msg);
>          max_send_tokens--;
>      }
>      dev->priv->during_read_from_device = 0;
> @@ -426,7 +408,7 @@ static void
> red_char_device_client_send_queue_push(RedCharDeviceClient *dev_clie
>          red_char_device_send_msg_to_client(dev_client->dev,
>                                             msg_item->msg,
>                                             dev_client->client);
> -        red_char_device_unref_msg_to_client(dev_client->dev, msg_item->msg);
> +        red_pipe_item_unref(msg_item->msg);
>          dev_client->send_queue_size--;
>          free(msg_item);
>      }
> diff --git a/server/char-device.h b/server/char-device.h
> index c6496cb..8e8285d 100644
> --- a/server/char-device.h
> +++ b/server/char-device.h
> @@ -47,8 +47,6 @@ struct SpiceCharDeviceState
>  
>  typedef RedPipeItem*
> (*RedCharDeviceReadOneMsgFromDevice)(SpiceCharDeviceInstance *sin,
>                                                                           void
> *opaque);
> -typedef RedPipeItem* (*RedCharDeviceRefMsgToClient)(RedPipeItem *msg, void
> *opaque);
> -typedef void (*RedCharDeviceUnrefMsgToClient)(RedPipeItem *msg, void
> *opaque);
>  typedef void (*RedCharDeviceSendMsgToClient)(RedPipeItem *msg, RedClient
> *client, void *opaque);
>  typedef void (*RedCharDeviceSendTokensToClient)(RedClient *client, uint32_t
> tokens, void *opaque);
>  typedef void (*RedCharDeviceOnFreeSelfToken)(void *opaque);
> @@ -66,8 +64,6 @@ struct RedCharDeviceClass
>      /* reads from the device till reaching a msg that should be sent to the
> client,
>       * or till the reading fails */
>      RedCharDeviceReadOneMsgFromDevice read_one_msg_from_device;
> -    RedCharDeviceRefMsgToClient ref_msg_to_client;
> -    RedCharDeviceUnrefMsgToClient unref_msg_to_client;
>      /* after this call, the message is unreferenced */
>      RedCharDeviceSendMsgToClient send_msg_to_client;
>      /* The cb is called when a predefined number of write buffers were
> consumed by the
> diff --git a/server/reds.c b/server/reds.c
> index 97aaeeb..2326112 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -4314,8 +4314,6 @@
> red_char_device_vdi_port_class_init(RedCharDeviceVDIPortClass *klass)
>      object_class->constructed = red_char_device_vdi_port_constructed;
>  
>      char_dev_class->read_one_msg_from_device =
> vdi_port_read_one_msg_from_device;
> -    char_dev_class->ref_msg_to_client =
> (RedCharDeviceRefMsgToClient)red_pipe_item_ref;
> -    char_dev_class->unref_msg_to_client =
> (RedCharDeviceUnrefMsgToClient)red_pipe_item_unref;
>      char_dev_class->send_msg_to_client = vdi_port_send_msg_to_client;
>      char_dev_class->send_tokens_to_client = vdi_port_send_tokens_to_client;
>      char_dev_class->remove_client = vdi_port_remove_client;
> diff --git a/server/smartcard.c b/server/smartcard.c
> index 1ec67cb..4207af8 100644
> --- a/server/smartcard.c
> +++ b/server/smartcard.c
> @@ -846,8 +846,6 @@
> red_char_device_smartcard_class_init(RedCharDeviceSmartcardClass *klass)
>      object_class->finalize = red_char_device_smartcard_finalize;
>  
>      char_dev_class->read_one_msg_from_device =
> smartcard_read_msg_from_device;
> -    char_dev_class->ref_msg_to_client =
> (RedCharDeviceRefMsgToClient)red_pipe_item_ref;
> -    char_dev_class->unref_msg_to_client =
> (RedCharDeviceUnrefMsgToClient)red_pipe_item_unref;
>      char_dev_class->send_msg_to_client = smartcard_send_msg_to_client;
>      char_dev_class->send_tokens_to_client = smartcard_send_tokens_to_client;
>      char_dev_class->remove_client = smartcard_remove_client;
> diff --git a/server/spicevmc.c b/server/spicevmc.c
> index 807cd8f..1015588 100644
> --- a/server/spicevmc.c
> +++ b/server/spicevmc.c
> @@ -587,8 +587,6 @@
> red_char_device_spicevmc_class_init(RedCharDeviceSpiceVmcClass *klass)
>      RedCharDeviceClass *char_dev_class = RED_CHAR_DEVICE_CLASS(klass);
>  
>      char_dev_class->read_one_msg_from_device =
> spicevmc_chardev_read_msg_from_dev;
> -    char_dev_class->ref_msg_to_client =
> (RedCharDeviceRefMsgToClient)red_pipe_item_ref;
> -    char_dev_class->unref_msg_to_client =
> (RedCharDeviceUnrefMsgToClient)red_pipe_item_unref;
>      char_dev_class->send_msg_to_client = spicevmc_chardev_send_msg_to_client;
>      char_dev_class->send_tokens_to_client =
> spicevmc_char_dev_send_tokens_to_client;
>      char_dev_class->remove_client = spicevmc_char_dev_remove_client;
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]