Re: [PATCH 08/22] memslot: prefix memslot function with memslot_

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

 



There is a typo in the short-log. Please, do: s/function/functions/

On Wed, Dec 2, 2015 at 5:19 PM, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/red_memslots.c   |  34 ++++++++--------
>  server/red_memslots.h   |  30 +++++++-------
>  server/red_parse_qxl.c  |  70 ++++++++++++++++-----------------
>  server/red_record_qxl.c | 102 ++++++++++++++++++++++++------------------------
>  server/red_worker.c     |  46 +++++++++++-----------
>  5 files changed, 141 insertions(+), 141 deletions(-)
>
> diff --git a/server/red_memslots.c b/server/red_memslots.c
> index 1b3ec62..2fd939e 100644
> --- a/server/red_memslots.c
> +++ b/server/red_memslots.c
> @@ -49,8 +49,8 @@ static void print_memslots(RedMemSlotInfo *info)
>  }
>
>  /* return 1 if validation successfull, 0 otherwise */
> -int validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id,
> -                  uint32_t add_size, uint32_t group_id)
> +int memslot_validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id,
> +                          uint32_t add_size, uint32_t group_id)
>  {
>      MemSlot *slot;
>
> @@ -76,8 +76,8 @@ int validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id,
>   * return virtual address if successful, which may be 0.
>   * returns 0 and sets error to 1 if an error condition occurs.
>   */
> -unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size,
> -                       int group_id, int *error)
> +unsigned long memslot_get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size,
> +                               int group_id, int *error)
>  {
>      int slot_id;
>      int generation;
> @@ -92,7 +92,7 @@ unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size
>          return 0;
>      }
>
> -    slot_id = get_memslot_id(info, addr);
> +    slot_id = memslot_get_id(info, addr);
>      if (slot_id > info->num_memslots) {
>          print_memslots(info);
>          spice_critical("slot_id %d too big, addr=%" PRIx64, slot_id, addr);
> @@ -102,7 +102,7 @@ unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size
>
>      slot = &info->mem_slots[group_id][slot_id];
>
> -    generation = get_generation(info, addr);
> +    generation = memslot_get_generation(info, addr);
>      if (generation != slot->generation) {
>          print_memslots(info);
>          spice_critical("address generation is not valid, group_id %d, slot_id %d, gen %d, slot_gen %d\n",
> @@ -114,7 +114,7 @@ unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size
>      h_virt = __get_clean_virt(info, addr);
>      h_virt += slot->address_delta;
>
> -    if (!validate_virt(info, h_virt, slot_id, add_size, group_id)) {
> +    if (!memslot_validate_virt(info, h_virt, slot_id, add_size, group_id)) {
>          *error = 1;
>          return 0;
>      }
> @@ -122,11 +122,11 @@ unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size
>      return h_virt;
>  }
>
> -void red_memslot_info_init(RedMemSlotInfo *info,
> -                           uint32_t num_groups, uint32_t num_slots,
> -                           uint8_t generation_bits,
> -                           uint8_t id_bits,
> -                           uint8_t internal_groupslot_id)
> +void memslot_info_init(RedMemSlotInfo *info,
> +                       uint32_t num_groups, uint32_t num_slots,
> +                       uint8_t generation_bits,
> +                       uint8_t id_bits,
> +                       uint8_t internal_groupslot_id)
>  {
>      uint32_t i;
>
> @@ -153,9 +153,9 @@ void red_memslot_info_init(RedMemSlotInfo *info,
>                                         (info->mem_slot_bits + info->generation_bits));
>  }
>
> -void red_memslot_info_add_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id,
> -                               uint64_t addr_delta, unsigned long virt_start, unsigned long virt_end,
> -                               uint32_t generation)
> +void memslot_info_add_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id,
> +                           uint64_t addr_delta, unsigned long virt_start, unsigned long virt_end,
> +                           uint32_t generation)
>  {
>      spice_assert(info->num_memslots_groups > slot_group_id);
>      spice_assert(info->num_memslots > slot_id);
> @@ -166,7 +166,7 @@ void red_memslot_info_add_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uin
>      info->mem_slots[slot_group_id][slot_id].generation = generation;
>  }
>
> -void red_memslot_info_del_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id)
> +void memslot_info_del_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id)
>  {
>      spice_assert(info->num_memslots_groups > slot_group_id);
>      spice_assert(info->num_memslots > slot_id);
> @@ -175,7 +175,7 @@ void red_memslot_info_del_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uin
>      info->mem_slots[slot_group_id][slot_id].virt_end_addr = 0;
>  }
>
> -void red_memslot_info_reset(RedMemSlotInfo *info)
> +void memslot_info_reset(RedMemSlotInfo *info)
>  {
>          uint32_t i;
>          for (i = 0; i < info->num_memslots_groups; ++i) {
> diff --git a/server/red_memslots.h b/server/red_memslots.h
> index 27443a6..a40050c 100644
> --- a/server/red_memslots.h
> +++ b/server/red_memslots.h
> @@ -43,30 +43,30 @@ typedef struct RedMemSlotInfo {
>      unsigned long memslot_clean_virt_mask;
>  } RedMemSlotInfo;
>
> -static inline int get_memslot_id(RedMemSlotInfo *info, uint64_t addr)
> +static inline int memslot_get_id(RedMemSlotInfo *info, uint64_t addr)
>  {
>      return addr >> info->memslot_id_shift;
>  }
>
> -static inline int get_generation(RedMemSlotInfo *info, uint64_t addr)
> +static inline int memslot_get_generation(RedMemSlotInfo *info, uint64_t addr)
>  {
>      return (addr >> info->memslot_gen_shift) & info->memslot_gen_mask;
>  }
>
> -int validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id,
> -                  uint32_t add_size, uint32_t group_id);
> -unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size,
> +int memslot_validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id,
> +                          uint32_t add_size, uint32_t group_id);
> +unsigned long memslot_get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size,
>                         int group_id, int *error);
>
> -void red_memslot_info_init(RedMemSlotInfo *info,
> -                           uint32_t num_groups, uint32_t num_slots,
> -                           uint8_t generation_bits,
> -                           uint8_t id_bits,
> -                           uint8_t internal_groupslot_id);
> -void red_memslot_info_add_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id,
> -                               uint64_t addr_delta, unsigned long virt_start, unsigned long virt_end,
> -                               uint32_t generation);
> -void red_memslot_info_del_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id);
> -void red_memslot_info_reset(RedMemSlotInfo *info);
> +void memslot_info_init(RedMemSlotInfo *info,
> +                       uint32_t num_groups, uint32_t num_slots,
> +                       uint8_t generation_bits,
> +                       uint8_t id_bits,
> +                       uint8_t internal_groupslot_id);
> +void memslot_info_add_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id,
> +                           uint64_t addr_delta, unsigned long virt_start, unsigned long virt_end,
> +                           uint32_t generation);
> +void memslot_info_del_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id);
> +void memslot_info_reset(RedMemSlotInfo *info);
>
>  #endif
> diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
> index 2cfd5ea..6e2ca99 100644
> --- a/server/red_parse_qxl.c
> +++ b/server/red_parse_qxl.c
> @@ -52,7 +52,7 @@ static void hexdump_qxl(RedMemSlotInfo *slots, int group_id,
>      uint8_t *hex;
>      int i;
>
> -    hex = (uint8_t*)get_virt(slots, addr, bytes, group_id);
> +    hex = (uint8_t*)memslot_get_virt(slots, addr, bytes, group_id);
>      for (i = 0; i < bytes; i++) {
>          if (0 == i % 16) {
>              fprintf(stderr, "%lx: ", addr+i);
> @@ -118,7 +118,7 @@ static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
>      data_size += red->data_size;
>      red->data = qxl->data;
>      red->prev_chunk = red->next_chunk = NULL;
> -    if (!validate_virt(slots, (intptr_t)red->data, memslot_id, red->data_size, group_id)) {
> +    if (!memslot_validate_virt(slots, (intptr_t)red->data, memslot_id, red->data_size, group_id)) {
>          red->data = NULL;
>          return 0;
>      }
> @@ -132,9 +132,9 @@ static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
>              goto error;
>          }
>
> -        memslot_id = get_memslot_id(slots, next_chunk);
> -        qxl = (QXLDataChunk *)get_virt(slots, next_chunk, sizeof(*qxl),
> -                                       group_id, &error);
> +        memslot_id = memslot_get_id(slots, next_chunk);
> +        qxl = (QXLDataChunk *)memslot_get_virt(slots, next_chunk, sizeof(*qxl),
> +                                               group_id, &error);
>          if (error)
>              goto error;
>
> @@ -161,7 +161,7 @@ static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
>              spice_warning("too much data inside chunks, avoiding DoS\n");
>              goto error;
>          }
> -        if (!validate_virt(slots, (intptr_t)red->data, memslot_id, red->data_size, group_id))
> +        if (!memslot_validate_virt(slots, (intptr_t)red->data, memslot_id, red->data_size, group_id))
>              goto error;
>      }
>
> @@ -185,9 +185,9 @@ static size_t red_get_data_chunks(RedMemSlotInfo *slots, int group_id,
>  {
>      QXLDataChunk *qxl;
>      int error;
> -    int memslot_id = get_memslot_id(slots, addr);
> +    int memslot_id = memslot_get_id(slots, addr);
>
> -    qxl = (QXLDataChunk *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLDataChunk *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return 0;
>      }
> @@ -242,12 +242,12 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
>      uint32_t count;
>      int error;
>
> -    qxl = (QXLPath *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLPath *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return NULL;
>      }
>      size = red_get_data_chunks_ptr(slots, group_id,
> -                                   get_memslot_id(slots, addr),
> +                                   memslot_get_id(slots, addr),
>                                     &chunks, &qxl->chunk);
>      data = red_linearize_chunk(&chunks, size, &free_data);
>      red_put_data_chunks(&chunks);
> @@ -321,12 +321,12 @@ static SpiceClipRects *red_get_clip_rects(RedMemSlotInfo *slots, int group_id,
>      int error;
>      uint32_t num_rects;
>
> -    qxl = (QXLClipRects *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLClipRects *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return NULL;
>      }
>      size = red_get_data_chunks_ptr(slots, group_id,
> -                                   get_memslot_id(slots, addr),
> +                                   memslot_get_id(slots, addr),
>                                     &chunks, &qxl->chunk);
>      data = red_linearize_chunk(&chunks, size, &free_data);
>      red_put_data_chunks(&chunks);
> @@ -355,7 +355,7 @@ static SpiceChunks *red_get_image_data_flat(RedMemSlotInfo *slots, int group_id,
>
>      data = spice_chunks_new(1);
>      data->data_size      = size;
> -    data->chunk[0].data  = (void*)get_virt(slots, addr, size, group_id, &error);
> +    data->chunk[0].data  = (void*)memslot_get_virt(slots, addr, size, group_id, &error);
>      if (error) {
>          return 0;
>      }
> @@ -445,7 +445,7 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
>          return NULL;
>      }
>
> -    qxl = (QXLImage *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLImage *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return NULL;
>      }
> @@ -488,15 +488,15 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
>          if (palette) {
>              QXLPalette *qp;
>              int i, num_ents;
> -            qp = (QXLPalette *)get_virt(slots, palette,
> -                                        sizeof(*qp), group_id, &error);
> +            qp = (QXLPalette *)memslot_get_virt(slots, palette,
> +                                                sizeof(*qp), group_id, &error);
>              if (error) {
>                  goto error;
>              }
>              num_ents = qp->num_ents;
> -            if (!validate_virt(slots, (intptr_t)qp->ents,
> -                               get_memslot_id(slots, palette),
> -                               num_ents * sizeof(qp->ents[0]), group_id)) {
> +            if (!memslot_validate_virt(slots, (intptr_t)qp->ents,
> +                                       memslot_get_id(slots, palette),
> +                                       num_ents * sizeof(qp->ents[0]), group_id)) {
>                  goto error;
>              }
>              rp = spice_malloc_n_m(num_ents, sizeof(rp->ents[0]), sizeof(*rp));
> @@ -544,7 +544,7 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
>      case SPICE_IMAGE_TYPE_QUIC:
>          red->u.quic.data_size = qxl->quic.data_size;
>          size = red_get_data_chunks_ptr(slots, group_id,
> -                                       get_memslot_id(slots, addr),
> +                                       memslot_get_id(slots, addr),
>                                         &chunks, (QXLDataChunk *)qxl->quic.data);
>          spice_assert(size == red->u.quic.data_size);
>          if (size != red->u.quic.data_size) {
> @@ -741,7 +741,7 @@ static bool get_transform(RedMemSlotInfo *slots,
>      if (qxl_transform == 0)
>          return FALSE;
>
> -    t = (uint32_t *)get_virt(slots, qxl_transform, sizeof(*dst_transform), group_id, &error);
> +    t = (uint32_t *)memslot_get_virt(slots, qxl_transform, sizeof(*dst_transform), group_id, &error);
>
>      if (!t || error)
>          return FALSE;
> @@ -816,8 +816,8 @@ static int red_get_stroke_ptr(RedMemSlotInfo *slots, int group_id,
>          red->attr.style = spice_malloc_n(style_nseg, sizeof(SPICE_FIXED28_4));
>          red->attr.style_nseg  = style_nseg;
>          spice_assert(qxl->attr.style);
> -        buf = (uint8_t *)get_virt(slots, qxl->attr.style,
> -                                  style_nseg * sizeof(QXLFIXED), group_id, &error);
> +        buf = (uint8_t *)memslot_get_virt(slots, qxl->attr.style,
> +                                          style_nseg * sizeof(QXLFIXED), group_id, &error);
>          if (error) {
>              return error;
>          }
> @@ -858,12 +858,12 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
>      int error;
>      uint16_t qxl_flags, qxl_length;
>
> -    qxl = (QXLString *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLString *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return NULL;
>      }
>      chunk_size = red_get_data_chunks_ptr(slots, group_id,
> -                                         get_memslot_id(slots, addr),
> +                                         memslot_get_id(slots, addr),
>                                           &chunks, &qxl->chunk);
>      if (!chunk_size) {
>          /* XXX could be a zero sized string.. */
> @@ -1013,7 +1013,7 @@ static int red_get_native_drawable(RedMemSlotInfo *slots, int group_id,
>      int i;
>      int error = 0;
>
> -    qxl = (QXLDrawable *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLDrawable *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return error;
>      }
> @@ -1096,7 +1096,7 @@ static int red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
>      QXLCompatDrawable *qxl;
>      int error;
>
> -    qxl = (QXLCompatDrawable *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLCompatDrawable *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return error;
>      }
> @@ -1244,7 +1244,7 @@ int red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
>      QXLUpdateCmd *qxl;
>      int error;
>
> -    qxl = (QXLUpdateCmd *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLUpdateCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return 1;
>      }
> @@ -1273,7 +1273,7 @@ int red_get_message(RedMemSlotInfo *slots, int group_id,
>       *   luckily this is for debug logging only,
>       *   so we can just ignore it by default.
>       */
> -    qxl = (QXLMessage *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLMessage *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return 1;
>      }
> @@ -1312,8 +1312,8 @@ int red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
>      int error;
>      unsigned int bpp;
>
> -    qxl = (QXLSurfaceCmd *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                    &error);
> +    qxl = (QXLSurfaceCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                            &error);
>      if (error) {
>          return 1;
>      }
> @@ -1350,7 +1350,7 @@ int red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
>              return 1;
>          }
>          red->u.surface_create.data =
> -            (uint8_t*)get_virt(slots, qxl->u.surface_create.data, size, group_id, &error);
> +            (uint8_t*)memslot_get_virt(slots, qxl->u.surface_create.data, size, group_id, &error);
>          if (error) {
>              return 1;
>          }
> @@ -1374,7 +1374,7 @@ static int red_get_cursor(RedMemSlotInfo *slots, int group_id,
>      bool free_data;
>      int error;
>
> -    qxl = (QXLCursor *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLCursor *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return 1;
>      }
> @@ -1389,7 +1389,7 @@ static int red_get_cursor(RedMemSlotInfo *slots, int group_id,
>      red->flags = 0;
>      red->data_size = qxl->data_size;
>      size = red_get_data_chunks_ptr(slots, group_id,
> -                                   get_memslot_id(slots, addr),
> +                                   memslot_get_id(slots, addr),
>                                     &chunks, &qxl->chunk);
>      red->data_size = MIN(red->data_size, size);
>      data = red_linearize_chunk(&chunks, size, &free_data);
> @@ -1414,7 +1414,7 @@ int red_get_cursor_cmd(RedMemSlotInfo *slots, int group_id,
>      QXLCursorCmd *qxl;
>      int error;
>
> -    qxl = (QXLCursorCmd *)get_virt(slots, addr, sizeof(*qxl), group_id, &error);
> +    qxl = (QXLCursorCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
>      if (error) {
>          return error;
>      }
> diff --git a/server/red_record_qxl.c b/server/red_record_qxl.c
> index b35b462..17f17bd 100644
> --- a/server/red_record_qxl.c
> +++ b/server/red_record_qxl.c
> @@ -35,8 +35,8 @@ static void hexdump_qxl(RedMemSlotInfo *slots, int group_id,
>      int i;
>      int error;
>
> -    hex = (uint8_t*)get_virt(slots, addr, bytes, group_id,
> -                             &error);
> +    hex = (uint8_t*)memslot_get_virt(slots, addr, bytes, group_id,
> +                                     &error);
>      for (i = 0; i < bytes; i++) {
>          if (0 == i % 16) {
>              fprintf(stderr, "%lx: ", addr+i);
> @@ -139,21 +139,21 @@ static size_t red_record_data_chunks_ptr(FILE *fd, const char *prefix,
>
>      while (cur->next_chunk) {
>          cur =
> -            (QXLDataChunk*)get_virt(slots, cur->next_chunk, sizeof(*cur), group_id,
> -                                    &error);
> +            (QXLDataChunk*)memslot_get_virt(slots, cur->next_chunk, sizeof(*cur), group_id,
> +                                            &error);
>          data_size += cur->data_size;
>          count_chunks++;
>      }
>      fprintf(fd, "data_chunks %d %ld\n", count_chunks, data_size);
> -    validate_virt(slots, (intptr_t)qxl->data, memslot_id, qxl->data_size, group_id);
> +    memslot_validate_virt(slots, (intptr_t)qxl->data, memslot_id, qxl->data_size, group_id);
>      write_binary(fd, prefix, qxl->data_size, qxl->data);
>
>      while (qxl->next_chunk) {
> -        memslot_id = get_memslot_id(slots, qxl->next_chunk);
> -        qxl = (QXLDataChunk*)get_virt(slots, qxl->next_chunk, sizeof(*qxl), group_id,
> -                                      &error);
> +        memslot_id = memslot_get_id(slots, qxl->next_chunk);
> +        qxl = (QXLDataChunk*)memslot_get_virt(slots, qxl->next_chunk, sizeof(*qxl), group_id,
> +                                              &error);
>
> -        validate_virt(slots, (intptr_t)qxl->data, memslot_id, qxl->data_size, group_id);
> +        memslot_validate_virt(slots, (intptr_t)qxl->data, memslot_id, qxl->data_size, group_id);
>          write_binary(fd, prefix, qxl->data_size, qxl->data);
>      }
>
> @@ -165,11 +165,11 @@ static size_t red_record_data_chunks(FILE *fd, const char *prefix,
>                                       QXLPHYSICAL addr)
>  {
>      QXLDataChunk *qxl;
> -    int memslot_id = get_memslot_id(slots, addr);
> +    int memslot_id = memslot_get_id(slots, addr);
>      int error;
>
> -    qxl = (QXLDataChunk*)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                  &error);
> +    qxl = (QXLDataChunk*)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                          &error);
>      return red_record_data_chunks_ptr(fd, prefix, slots, group_id, memslot_id, qxl);
>  }
>
> @@ -195,10 +195,10 @@ static void red_record_path(FILE *fd, RedMemSlotInfo *slots, int group_id,
>      QXLPath *qxl;
>      int error;
>
> -    qxl = (QXLPath *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                              &error);
> +    qxl = (QXLPath *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                      &error);
>      red_record_data_chunks_ptr(fd, "path", slots, group_id,
> -                                   get_memslot_id(slots, addr),
> +                                   memslot_get_id(slots, addr),
>                                     &qxl->chunk);
>  }
>
> @@ -208,11 +208,11 @@ static void red_record_clip_rects(FILE *fd, RedMemSlotInfo *slots, int group_id,
>      QXLClipRects *qxl;
>      int error;
>
> -    qxl = (QXLClipRects *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                   &error);
> +    qxl = (QXLClipRects *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                           &error);
>      fprintf(fd, "num_rects %d\n", qxl->num_rects);
>      red_record_data_chunks_ptr(fd, "clip_rects", slots, group_id,
> -                                   get_memslot_id(slots, addr),
> +                                   memslot_get_id(slots, addr),
>                                     &qxl->chunk);
>  }
>
> @@ -223,8 +223,8 @@ static void red_record_virt_data_flat(FILE *fd, const char *prefix,
>      int error;
>
>      write_binary(fd, prefix,
> -                 size, (uint8_t*)get_virt(slots, addr, size, group_id,
> -                                          &error));
> +                 size, (uint8_t*)memslot_get_virt(slots, addr, size, group_id,
> +                                                  &error));
>  }
>
>  static void red_record_image_data_flat(FILE *fd, RedMemSlotInfo *slots, int group_id,
> @@ -253,8 +253,8 @@ static void red_record_image(FILE *fd, RedMemSlotInfo *slots, int group_id,
>          return;
>      }
>
> -    qxl = (QXLImage *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                               &error);
> +    qxl = (QXLImage *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                       &error);
>      fprintf(fd, "descriptor.id %ld\n", qxl->descriptor.id);
>      fprintf(fd, "descriptor.type %d\n", qxl->descriptor.type);
>      fprintf(fd, "descriptor.flags %d\n", qxl->descriptor.flags);
> @@ -273,12 +273,12 @@ static void red_record_image(FILE *fd, RedMemSlotInfo *slots, int group_id,
>          if (qxl->bitmap.palette) {
>              QXLPalette *qp;
>              int i, num_ents;
> -            qp = (QXLPalette *)get_virt(slots, qxl->bitmap.palette,
> -                                        sizeof(*qp), group_id, &error);
> +            qp = (QXLPalette *)memslot_get_virt(slots, qxl->bitmap.palette,
> +                                                sizeof(*qp), group_id, &error);
>              num_ents = qp->num_ents;
>              fprintf(fd, "qp.num_ents %d\n", qp->num_ents);
> -            validate_virt(slots, (intptr_t)qp->ents,
> -                          get_memslot_id(slots, qxl->bitmap.palette),
> +            memslot_validate_virt(slots, (intptr_t)qp->ents,
> +                          memslot_get_id(slots, qxl->bitmap.palette),
>                            num_ents * sizeof(qp->ents[0]), group_id);
>              fprintf(fd, "unique %ld\n", qp->unique);
>              for (i = 0; i < num_ents; i++) {
> @@ -302,7 +302,7 @@ static void red_record_image(FILE *fd, RedMemSlotInfo *slots, int group_id,
>      case SPICE_IMAGE_TYPE_QUIC:
>          fprintf(fd, "quic.data_size %d\n", qxl->quic.data_size);
>          size = red_record_data_chunks_ptr(fd, "quic.data", slots, group_id,
> -                                       get_memslot_id(slots, addr),
> +                                       memslot_get_id(slots, addr),
>                                         (QXLDataChunk *)qxl->quic.data);
>          spice_assert(size == qxl->quic.data_size);
>          break;
> @@ -426,9 +426,9 @@ static void red_record_stroke_ptr(FILE *fd, RedMemSlotInfo *slots, int group_id,
>
>          fprintf(fd, "attr.style_nseg %d\n", qxl->attr.style_nseg);
>          spice_assert(qxl->attr.style);
> -        buf = (uint8_t *)get_virt(slots, qxl->attr.style,
> -                                  style_nseg * sizeof(QXLFIXED), group_id,
> -                                  &error);
> +        buf = (uint8_t *)memslot_get_virt(slots, qxl->attr.style,
> +                                          style_nseg * sizeof(QXLFIXED), group_id,
> +                                          &error);
>          write_binary(fd, "style", style_nseg * sizeof(QXLFIXED), buf);
>      }
>      red_record_brush_ptr(fd, slots, group_id, &qxl->brush, flags);
> @@ -443,14 +443,14 @@ static void red_record_string(FILE *fd, RedMemSlotInfo *slots, int group_id,
>      size_t chunk_size;
>      int error;
>
> -    qxl = (QXLString *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                &error);
> +    qxl = (QXLString *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                        &error);
>      fprintf(fd, "data_size %d\n", qxl->data_size);
>      fprintf(fd, "length %d\n", qxl->length);
>      fprintf(fd, "flags %d\n", qxl->flags);
>      chunk_size = red_record_data_chunks_ptr(fd, "string", slots, group_id,
> -                                         get_memslot_id(slots, addr),
> -                                         &qxl->chunk);
> +                                            memslot_get_id(slots, addr),
> +                                            &qxl->chunk);
>      spice_assert(chunk_size == qxl->data_size);
>  }
>
> @@ -521,8 +521,8 @@ static void red_record_native_drawable(FILE *fd, RedMemSlotInfo *slots, int grou
>      int i;
>      int error;
>
> -    qxl = (QXLDrawable *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                  &error);
> +    qxl = (QXLDrawable *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                          &error);
>
>      red_record_rect_ptr(fd, "bbox", &qxl->bbox);
>      red_record_clip_ptr(fd, slots, group_id, &qxl->clip);
> @@ -597,8 +597,8 @@ static void red_record_compat_drawable(FILE *fd, RedMemSlotInfo *slots, int grou
>      QXLCompatDrawable *qxl;
>      int error;
>
> -    qxl = (QXLCompatDrawable *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                        &error);
> +    qxl = (QXLCompatDrawable *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                                &error);
>
>      red_record_rect_ptr(fd, "bbox", &qxl->bbox);
>      red_record_clip_ptr(fd, slots, group_id, &qxl->clip);
> @@ -676,8 +676,8 @@ static void red_record_update_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
>      QXLUpdateCmd *qxl;
>      int error;
>
> -    qxl = (QXLUpdateCmd *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                   &error);
> +    qxl = (QXLUpdateCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                           &error);
>
>      fprintf(fd, "update\n");
>      red_record_rect_ptr(fd, "area", &qxl->area);
> @@ -697,8 +697,8 @@ static void red_record_message(FILE *fd, RedMemSlotInfo *slots, int group_id,
>       *   luckily this is for debug logging only,
>       *   so we can just ignore it by default.
>       */
> -    qxl = (QXLMessage *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                 &error);
> +    qxl = (QXLMessage *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                         &error);
>      write_binary(fd, "message", strlen((char*)qxl->data), (uint8_t*)qxl->data);
>  }
>
> @@ -709,8 +709,8 @@ static void red_record_surface_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id
>      size_t size;
>      int error;
>
> -    qxl = (QXLSurfaceCmd *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                    &error);
> +    qxl = (QXLSurfaceCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                            &error);
>
>      fprintf(fd, "surface_cmd\n");
>      fprintf(fd, "surface_id %d\n", qxl->surface_id);
> @@ -726,8 +726,8 @@ static void red_record_surface_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id
>          size = qxl->u.surface_create.height * abs(qxl->u.surface_create.stride);
>          if ((qxl->flags & QXL_SURF_FLAG_KEEP_DATA) != 0) {
>              write_binary(fd, "data", size,
> -                (uint8_t*)get_virt(slots, qxl->u.surface_create.data, size, group_id,
> -                                   &error));
> +                (uint8_t*)memslot_get_virt(slots, qxl->u.surface_create.data, size, group_id,
> +                                           &error));
>          }
>          break;
>      }
> @@ -739,8 +739,8 @@ static void red_record_cursor(FILE *fd, RedMemSlotInfo *slots, int group_id,
>      QXLCursor *qxl;
>      int error;
>
> -    qxl = (QXLCursor *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                &error);
> +    qxl = (QXLCursor *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                        &error);
>
>      fprintf(fd, "header.unique %ld\n", qxl->header.unique);
>      fprintf(fd, "header.type %d\n", qxl->header.type);
> @@ -751,7 +751,7 @@ static void red_record_cursor(FILE *fd, RedMemSlotInfo *slots, int group_id,
>
>      fprintf(fd, "data_size %d\n", qxl->data_size);
>      red_record_data_chunks_ptr(fd, "cursor", slots, group_id,
> -                                   get_memslot_id(slots, addr),
> +                                   memslot_get_id(slots, addr),
>                                     &qxl->chunk);
>  }
>
> @@ -761,8 +761,8 @@ void red_record_cursor_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
>      QXLCursorCmd *qxl;
>      int error;
>
> -    qxl = (QXLCursorCmd *)get_virt(slots, addr, sizeof(*qxl), group_id,
> -                                   &error);
> +    qxl = (QXLCursorCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
> +                                           &error);
>
>      fprintf(fd, "cursor_cmd\n");
>      fprintf(fd, "type %d\n", qxl->type);
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 69486bf..7ae13f0 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -771,7 +771,7 @@ static void handle_dev_del_memslot(void *opaque, void *payload)
>      uint32_t slot_id = msg->slot_id;
>      uint32_t slot_group_id = msg->slot_group_id;
>
> -    red_memslot_info_del_slot(&worker->mem_slots, slot_group_id, slot_id);
> +    memslot_info_del_slot(&worker->mem_slots, slot_group_id, slot_id);
>  }
>
>  static void handle_dev_destroy_surface_wait(void *opaque, void *payload)
> @@ -844,9 +844,9 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
>      spice_warn_if(((uint64_t)abs(surface.stride) * (uint64_t)surface.height) !=
>               abs(surface.stride) * surface.height);
>
> -    line_0 = (uint8_t*)get_virt(&worker->mem_slots, surface.mem,
> -                                surface.height * abs(surface.stride),
> -                                surface.group_id, &error);
> +    line_0 = (uint8_t*)memslot_get_virt(&worker->mem_slots, surface.mem,
> +                                        surface.height * abs(surface.stride),
> +                                        surface.group_id, &error);
>      if (error) {
>          return;
>      }
> @@ -1121,9 +1121,9 @@ static void handle_dev_monitors_config_async(void *opaque, void *payload)
>      int error;
>      uint16_t count, max_allowed;
>      QXLMonitorsConfig *dev_monitors_config =
> -        (QXLMonitorsConfig*)get_virt(&worker->mem_slots, msg->monitors_config,
> -                                     qxl_monitors_config_size(1),
> -                                     msg->group_id, &error);
> +        (QXLMonitorsConfig*)memslot_get_virt(&worker->mem_slots, msg->monitors_config,
> +                                             qxl_monitors_config_size(1),
> +                                             msg->group_id, &error);
>
>      if (error) {
>          /* TODO: raise guest bug (requires added QXL interface) */
> @@ -1145,9 +1145,9 @@ static void handle_dev_monitors_config_async(void *opaque, void *payload)
>      }
>      /* get pointer again to check virtual size */
>      dev_monitors_config =
> -        (QXLMonitorsConfig*)get_virt(&worker->mem_slots, msg->monitors_config,
> -                                     qxl_monitors_config_size(count),
> -                                     msg->group_id, &error);
> +        (QXLMonitorsConfig*)memslot_get_virt(&worker->mem_slots, msg->monitors_config,
> +                                             qxl_monitors_config_size(count),
> +                                             msg->group_id, &error);
>      if (error) {
>          /* TODO: raise guest bug (requires added QXL interface) */
>          return;
> @@ -1249,9 +1249,9 @@ static void handle_dev_set_mouse_mode(void *opaque, void *payload)
>
>  static void dev_add_memslot(RedWorker *worker, QXLDevMemSlot mem_slot)
>  {
> -    red_memslot_info_add_slot(&worker->mem_slots, mem_slot.slot_group_id, mem_slot.slot_id,
> -                              mem_slot.addr_delta, mem_slot.virt_start, mem_slot.virt_end,
> -                              mem_slot.generation);
> +    memslot_info_add_slot(&worker->mem_slots, mem_slot.slot_group_id, mem_slot.slot_id,
> +                          mem_slot.addr_delta, mem_slot.virt_start, mem_slot.virt_end,
> +                          mem_slot.generation);
>  }
>
>  static void handle_dev_add_memslot(void *opaque, void *payload)
> @@ -1260,9 +1260,9 @@ static void handle_dev_add_memslot(void *opaque, void *payload)
>      RedWorkerMessageAddMemslot *msg = payload;
>      QXLDevMemSlot mem_slot = msg->mem_slot;
>
> -    red_memslot_info_add_slot(&worker->mem_slots, mem_slot.slot_group_id, mem_slot.slot_id,
> -                              mem_slot.addr_delta, mem_slot.virt_start, mem_slot.virt_end,
> -                              mem_slot.generation);
> +    memslot_info_add_slot(&worker->mem_slots, mem_slot.slot_group_id, mem_slot.slot_id,
> +                          mem_slot.addr_delta, mem_slot.virt_start, mem_slot.virt_end,
> +                          mem_slot.generation);
>  }
>
>  static void handle_dev_add_memslot_async(void *opaque, void *payload)
> @@ -1277,7 +1277,7 @@ static void handle_dev_reset_memslots(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>
> -    red_memslot_info_reset(&worker->mem_slots);
> +    memslot_info_reset(&worker->mem_slots);
>  }
>
>  static void handle_dev_driver_unload(void *opaque, void *payload)
> @@ -1589,12 +1589,12 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
>      worker->watches[0].watch_func = handle_dev_input;
>      worker->watches[0].watch_func_opaque = worker;
>
> -    red_memslot_info_init(&worker->mem_slots,
> -                          init_info.num_memslots_groups,
> -                          init_info.num_memslots,
> -                          init_info.memslot_gen_bits,
> -                          init_info.memslot_id_bits,
> -                          init_info.internal_groupslot_id);
> +    memslot_info_init(&worker->mem_slots,
> +                      init_info.num_memslots_groups,
> +                      init_info.num_memslots,
> +                      init_info.memslot_gen_bits,
> +                      init_info.memslot_id_bits,
> +                      init_info.internal_groupslot_id);
>
>      spice_warn_if(init_info.n_surfaces > NUM_SURFACES);
>
> --
> 2.4.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]