Re: [spice-server 1/3] utils: Remove get/set/clear_bit

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

 



> 
> These function are used once each by red-qxl.c, they don't need to be
> exported in utils.h
> ---
>  server/red-qxl.c | 17 +++++++++++++++++
>  server/utils.h   | 16 ----------------
>  2 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index 97940611b..4f05abb4e 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -455,6 +455,17 @@ static void qxl_worker_reset_memslots(QXLWorker
> *qxl_worker)
>      red_qxl_reset_memslots(qxl_state);
>  }
>  
> +static void set_bit(int index, uint32_t *addr)
> +{
> +    uint32_t mask = 1 << index;
> +    __sync_or_and_fetch(addr, mask);
> +}
> +
> +static int test_bit(int index, uint32_t val)
> +{
> +    return val & (1u << index);
> +}
> +
>  static bool red_qxl_set_pending(QXLState *qxl_state, int pending)
>  {
>      // this is not atomic but is not an issue
> @@ -922,6 +933,12 @@ Dispatcher *red_qxl_get_dispatcher(QXLInstance *qxl)
>      return qxl->st->dispatcher;
>  }
>  
> +static void clear_bit(int index, uint32_t *addr)
> +{
> +    uint32_t mask = ~(1 << index);
> +    __sync_and_and_fetch(addr, mask);
> +}
> +
>  void red_qxl_clear_pending(QXLState *qxl_state, int pending)
>  {
>      spice_return_if_fail(qxl_state != NULL);
> diff --git a/server/utils.h b/server/utils.h
> index 58d43cafe..36ad1d83f 100644
> --- a/server/utils.h
> +++ b/server/utils.h
> @@ -24,22 +24,6 @@
>  
>  #define SPICE_GNUC_VISIBLE __attribute__ ((visibility ("default")))
>  
> -static inline void set_bit(int index, uint32_t *addr)
> -{
> -    uint32_t mask = 1 << index;
> -    __sync_or_and_fetch(addr, mask);
> -}
> -
> -static inline void clear_bit(int index, uint32_t *addr)
> -{
> -    uint32_t mask = ~(1 << index);
> -    __sync_and_and_fetch(addr, mask);
> -}
> -
> -static inline int test_bit(int index, uint32_t val)
> -{
> -    return val & (1u << index);
> -}
>  /* a generic safe for loop macro  */
>  #define SAFE_FOREACH(link, next, cond, ring, data, get_data)            \
>      for ((((link) = ((cond) ? ring_get_head(ring) : NULL)),             \

I prefer them in utils.h, they don't have something to do specifically
with qxl interface.

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




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