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

Re: [XEN][PATCH 2/2] xen: libfdt: Changes to make libfdt v1.6.1 compatible with Xen



On Fri, 5 Nov 2021, Vikram Garhwal wrote:
> A few minor changes are done to make it compatible with Xen:
>     fdt_overlay.c: overlay_fixup_phandle()
> 
>         Replace strtoul() with simple_strtoul() as strtoul() is not available 
> in
>         Xen lib and included lib.h.
> 
>         Change char *endptr to const char *endptr.
> 
>     libfdt_env.h:
>         Changed path for config.h and stdbool.h. Remaining Xen changes to
>         libfdt_env.h carried over from existing libfdt (v1.4.0)
> 
> Signed-off-by: Vikram Garhwal <fnu.vikram@xxxxxxxxxx>

Thanks! All makes sense to me.


> ---
>  xen/common/libfdt/fdt_overlay.c     |  6 ++++--
>  xen/include/xen/libfdt/libfdt.h     |  4 ++--
>  xen/include/xen/libfdt/libfdt_env.h | 14 ++++++++------
>  3 files changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/xen/common/libfdt/fdt_overlay.c b/xen/common/libfdt/fdt_overlay.c
> index d217e79..7b95e2b 100644
> --- a/xen/common/libfdt/fdt_overlay.c
> +++ b/xen/common/libfdt/fdt_overlay.c
> @@ -8,6 +8,7 @@
>  
>  #include <fdt.h>
>  #include <libfdt.h>
> +#include <xen/lib.h>
>  
>  #include "libfdt_internal.h"
>  
> @@ -446,7 +447,8 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, 
> int symbols_off,
>               const char *fixup_str = value;
>               uint32_t path_len, name_len;
>               uint32_t fixup_len;
> -             char *sep, *endptr;
> +             char *sep;
> +             const char *endptr;
>               int poffset, ret;
>  
>               fixup_end = memchr(value, '\0', len);
> @@ -476,7 +478,7 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, 
> int symbols_off,
>               if (!name_len)
>                       return -FDT_ERR_BADOVERLAY;
>  
> -             poffset = strtoul(sep + 1, &endptr, 10);
> +             poffset = simple_strtoul(sep + 1, &endptr, 10);
>               if ((*endptr != '\0') || (endptr <= (sep + 1)))
>                       return -FDT_ERR_BADOVERLAY;
>  
> diff --git a/xen/include/xen/libfdt/libfdt.h b/xen/include/xen/libfdt/libfdt.h
> index 73467f7..c71689e 100644
> --- a/xen/include/xen/libfdt/libfdt.h
> +++ b/xen/include/xen/libfdt/libfdt.h
> @@ -6,8 +6,8 @@
>   * Copyright (C) 2006 David Gibson, IBM Corporation.
>   */
>  
> -#include <libfdt_env.h>
> -#include <fdt.h>
> +#include <xen/libfdt/libfdt_env.h>
> +#include <xen/libfdt/fdt.h>
>  
>  #ifdef __cplusplus
>  extern "C" {
> diff --git a/xen/include/xen/libfdt/libfdt_env.h 
> b/xen/include/xen/libfdt/libfdt_env.h
> index 73b6d40..03380d5 100644
> --- a/xen/include/xen/libfdt/libfdt_env.h
> +++ b/xen/include/xen/libfdt/libfdt_env.h
> @@ -7,12 +7,11 @@
>   * Copyright 2012 Kim Phillips, Freescale Semiconductor.
>   */
>  
> -#include <stdbool.h>
> -#include <stddef.h>
> -#include <stdint.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <limits.h>
> +#include <xen/config.h>
> +#include <xen/types.h>
> +#include <xen/string.h>
> +#include <asm/byteorder.h>
> +#include <xen/stdbool.h>
>  
>  #ifdef __CHECKER__
>  #define FDT_FORCE __attribute__((force))
> @@ -35,6 +34,9 @@ typedef uint64_t FDT_BITWISE fdt64_t;
>                        (EXTRACT_BYTE(x, 4) << 24) | (EXTRACT_BYTE(x, 5) << 
> 16) | \
>                        (EXTRACT_BYTE(x, 6) << 8) | EXTRACT_BYTE(x, 7))
>  
> +/* Xen-specific libfdt error code. */
> +#define FDT_ERR_XEN(err) (FDT_ERR_MAX + (err))
> +
>  static inline uint16_t fdt16_to_cpu(fdt16_t x)
>  {
>       return (FDT_FORCE uint16_t)CPU_TO_FDT16(x);
> -- 
> 2.7.4
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.