diff mbox

[v2,2/2] api: buffer: Change buffer size from size_t to uint32_t

Message ID 1419334146-28747-2-git-send-email-petri.savolainen@linaro.org
State Accepted
Commit 7458d46c4591106385bc0ae66f279ddcd4507698
Headers show

Commit Message

Petri Savolainen Dec. 23, 2014, 11:29 a.m. UTC
Use uint32_t for buffer size to be align with packet API lenghts
and offsets.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 platform/linux-generic/include/api/odp_buffer.h      | 2 +-
 platform/linux-generic/include/odp_buffer_internal.h | 2 +-
 platform/linux-generic/odp_buffer.c                  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Bill Fischofer Dec. 23, 2014, 12:49 p.m. UTC | #1
On Tue, Dec 23, 2014 at 5:29 AM, Petri Savolainen <
petri.savolainen@linaro.org> wrote:
>
> Use uint32_t for buffer size to be align with packet API lenghts
> and offsets.
>
> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>


> ---
>  platform/linux-generic/include/api/odp_buffer.h      | 2 +-
>  platform/linux-generic/include/odp_buffer_internal.h | 2 +-
>  platform/linux-generic/odp_buffer.c                  | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/platform/linux-generic/include/api/odp_buffer.h
> b/platform/linux-generic/include/api/odp_buffer.h
> index 3c23035..0670464 100644
> --- a/platform/linux-generic/include/api/odp_buffer.h
> +++ b/platform/linux-generic/include/api/odp_buffer.h
> @@ -44,7 +44,7 @@ void *odp_buffer_addr(odp_buffer_t buf);
>   *
>   * @return Buffer maximum data size
>   */
> -size_t odp_buffer_size(odp_buffer_t buf);
> +uint32_t odp_buffer_size(odp_buffer_t buf);
>
>  /**
>   * Buffer type
> diff --git a/platform/linux-generic/include/odp_buffer_internal.h
> b/platform/linux-generic/include/odp_buffer_internal.h
> index 60f06c9..a315f00 100644
> --- a/platform/linux-generic/include/odp_buffer_internal.h
> +++ b/platform/linux-generic/include/odp_buffer_internal.h
> @@ -118,7 +118,7 @@ typedef struct odp_buffer_hdr_t {
>                 };
>         } flags;
>         int                      type;       /* buffer type */
> -       size_t                   size;       /* max data size */
> +       uint32_t                 size;       /* max data size */
>         odp_atomic_u32_t         ref_count;  /* reference count */
>         odp_buffer_pool_t        pool_hdl;   /* buffer pool handle */
>         union {
> diff --git a/platform/linux-generic/odp_buffer.c
> b/platform/linux-generic/odp_buffer.c
> index dd37ab3..57ba408 100644
> --- a/platform/linux-generic/odp_buffer.c
> +++ b/platform/linux-generic/odp_buffer.c
> @@ -22,7 +22,7 @@ void *odp_buffer_addr(odp_buffer_t buf)
>  }
>
>
> -size_t odp_buffer_size(odp_buffer_t buf)
> +uint32_t odp_buffer_size(odp_buffer_t buf)
>  {
>         odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
>
> @@ -63,7 +63,7 @@ int odp_buffer_snprint(char *str, uint32_t n,
> odp_buffer_t buf)
>         len += snprintf(&str[len], n-len,
>                         "  addr         %p\n",        hdr->addr);
>         len += snprintf(&str[len], n-len,
> -                       "  size         %zu\n",       hdr->size);
> +                       "  size         %u\n",        hdr->size);
>         len += snprintf(&str[len], n-len,
>                         "  ref_count    %i\n",
>                         odp_atomic_load_u32(&hdr->ref_count));
> --
> 2.2.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes Jan. 9, 2015, 8:50 p.m. UTC | #2
Applied

On 9 January 2015 at 06:21, Savolainen, Petri (NSN - FI/Espoo) <
petri.savolainen@nsn.com> wrote:

> Ping. This patch should be merged. The "patch v2 1/2 api: buffer_pool:
> Correct buf_size pool param documentation" may be hold for now, since event
> definition will change that part anyway.
>
> -Petri
>
> > -----Original Message-----
> > From: ext Petri Savolainen [mailto:petri.savolainen@linaro.org]
> > Sent: Tuesday, December 23, 2014 1:29 PM
> > To: lng-odp@lists.linaro.org
> > Cc: Petri Savolainen
> > Subject: [PATCH v2 2/2] api: buffer: Change buffer size from size_t to
> > uint32_t
> >
> > Use uint32_t for buffer size to be align with packet API lenghts
> > and offsets.
> >
> > Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
> > ---
> >  platform/linux-generic/include/api/odp_buffer.h      | 2 +-
> >  platform/linux-generic/include/odp_buffer_internal.h | 2 +-
> >  platform/linux-generic/odp_buffer.c                  | 4 ++--
> >  3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/platform/linux-generic/include/api/odp_buffer.h
> > b/platform/linux-generic/include/api/odp_buffer.h
> > index 3c23035..0670464 100644
> > --- a/platform/linux-generic/include/api/odp_buffer.h
> > +++ b/platform/linux-generic/include/api/odp_buffer.h
> > @@ -44,7 +44,7 @@ void *odp_buffer_addr(odp_buffer_t buf);
> >   *
> >   * @return Buffer maximum data size
> >   */
> > -size_t odp_buffer_size(odp_buffer_t buf);
> > +uint32_t odp_buffer_size(odp_buffer_t buf);
> >
> >  /**
> >   * Buffer type
> > diff --git a/platform/linux-generic/include/odp_buffer_internal.h
> > b/platform/linux-generic/include/odp_buffer_internal.h
> > index 60f06c9..a315f00 100644
> > --- a/platform/linux-generic/include/odp_buffer_internal.h
> > +++ b/platform/linux-generic/include/odp_buffer_internal.h
> > @@ -118,7 +118,7 @@ typedef struct odp_buffer_hdr_t {
> >               };
> >       } flags;
> >       int                      type;       /* buffer type */
> > -     size_t                   size;       /* max data size */
> > +     uint32_t                 size;       /* max data size */
> >       odp_atomic_u32_t         ref_count;  /* reference count */
> >       odp_buffer_pool_t        pool_hdl;   /* buffer pool handle */
> >       union {
> > diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-
> > generic/odp_buffer.c
> > index dd37ab3..57ba408 100644
> > --- a/platform/linux-generic/odp_buffer.c
> > +++ b/platform/linux-generic/odp_buffer.c
> > @@ -22,7 +22,7 @@ void *odp_buffer_addr(odp_buffer_t buf)
> >  }
> >
> >
> > -size_t odp_buffer_size(odp_buffer_t buf)
> > +uint32_t odp_buffer_size(odp_buffer_t buf)
> >  {
> >       odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
> >
> > @@ -63,7 +63,7 @@ int odp_buffer_snprint(char *str, uint32_t n,
> > odp_buffer_t buf)
> >       len += snprintf(&str[len], n-len,
> >                       "  addr         %p\n",        hdr->addr);
> >       len += snprintf(&str[len], n-len,
> > -                     "  size         %zu\n",       hdr->size);
> > +                     "  size         %u\n",        hdr->size);
> >       len += snprintf(&str[len], n-len,
> >                       "  ref_count    %i\n",
> >                       odp_atomic_load_u32(&hdr->ref_count));
> > --
> > 2.2.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_buffer.h b/platform/linux-generic/include/api/odp_buffer.h
index 3c23035..0670464 100644
--- a/platform/linux-generic/include/api/odp_buffer.h
+++ b/platform/linux-generic/include/api/odp_buffer.h
@@ -44,7 +44,7 @@  void *odp_buffer_addr(odp_buffer_t buf);
  *
  * @return Buffer maximum data size
  */
-size_t odp_buffer_size(odp_buffer_t buf);
+uint32_t odp_buffer_size(odp_buffer_t buf);
 
 /**
  * Buffer type
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index 60f06c9..a315f00 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -118,7 +118,7 @@  typedef struct odp_buffer_hdr_t {
 		};
 	} flags;
 	int                      type;       /* buffer type */
-	size_t                   size;       /* max data size */
+	uint32_t                 size;       /* max data size */
 	odp_atomic_u32_t         ref_count;  /* reference count */
 	odp_buffer_pool_t        pool_hdl;   /* buffer pool handle */
 	union {
diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c
index dd37ab3..57ba408 100644
--- a/platform/linux-generic/odp_buffer.c
+++ b/platform/linux-generic/odp_buffer.c
@@ -22,7 +22,7 @@  void *odp_buffer_addr(odp_buffer_t buf)
 }
 
 
-size_t odp_buffer_size(odp_buffer_t buf)
+uint32_t odp_buffer_size(odp_buffer_t buf)
 {
 	odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
 
@@ -63,7 +63,7 @@  int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t buf)
 	len += snprintf(&str[len], n-len,
 			"  addr         %p\n",        hdr->addr);
 	len += snprintf(&str[len], n-len,
-			"  size         %zu\n",       hdr->size);
+			"  size         %u\n",        hdr->size);
 	len += snprintf(&str[len], n-len,
 			"  ref_count    %i\n",
 			odp_atomic_load_u32(&hdr->ref_count));