public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Jones <drjones@redhat.com>,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Cc: christoffer.dall@linaro.org
Subject: Re: [PATCH v5 13/19] libcflat: clean up libcflat.h and add string.h
Date: Thu, 12 Jun 2014 12:52:18 +0200	[thread overview]
Message-ID: <53998662.9070907@redhat.com> (raw)
In-Reply-To: <1402495294-30737-14-git-send-email-drjones@redhat.com>

Il 11/06/2014 16:01, Andrew Jones ha scritto:
> Use libgcc's stddef.h and stdint.h, and then remove the redundant
> defines from libcflat.h. Also separate out the string function
> declarations into a new file string.h. These changes have no affect
> on code including libcflat.h, but are needed in order to compile an
> unmodified libfdt for kvm-unit-tests using an arm cross-compiler.
> While at it, add strcpy.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
>  lib/libcflat.h | 55 +++++++++++++++++++++----------------------------------
>  lib/string.c   |  6 ++++++
>  lib/string.h   | 15 +++++++++++++++
>  3 files changed, 42 insertions(+), 34 deletions(-)
>  create mode 100644 lib/string.h
>
> diff --git a/lib/libcflat.h b/lib/libcflat.h
> index 5939cee54890b..404560cd103e5 100644
> --- a/lib/libcflat.h
> +++ b/lib/libcflat.h
> @@ -21,60 +21,47 @@
>  #define __LIBCFLAT_H
>
>  #include <stdarg.h>
> +#include <stddef.h>
> +#include <stdint.h>
> +#include "string.h"

No need to use quotes here.

>
>  #define __unused __attribute__((__unused__))
>
>  #define xstr(s) xxstr(s)
>  #define xxstr(s) #s
>
> -typedef unsigned char u8;
> -typedef signed char s8;
> -typedef unsigned short u16;
> -typedef signed short s16;
> -typedef unsigned u32;
> -typedef signed s32;
> -typedef unsigned long ulong;
> -typedef unsigned long long u64;
> -typedef signed long long s64;
> -typedef unsigned long size_t;
> -typedef _Bool bool;
> -
> -#define true 1
> +typedef uint8_t		u8;
> +typedef int8_t		s8;
> +typedef uint16_t	u16;
> +typedef int16_t		s16;
> +typedef uint32_t	u32;
> +typedef int32_t		s32;
> +typedef uint64_t	u64;
> +typedef int64_t		s64;
> +typedef unsigned long	ulong;
> +
> +typedef _Bool		bool;
>  #define false 0
> +#define true  1
>
> +extern void puts(const char *s);
>  extern void exit(int code);
>
> -extern unsigned long strlen(const char *buf);
> -extern char *strcat(char *dest, const char *src);
> -extern int strcmp(const char *a, const char *b);
> -extern char *strchr(const char *s, int c);
> -
>  extern int printf(const char *fmt, ...);
>  extern int snprintf(char *buf, int size, const char *fmt, ...);
>  extern int vsnprintf(char *buf, int size, const char *fmt, va_list va);
> +extern long atol(const char *ptr);
>
> -extern void puts(const char *s);
> -
> -extern void *memset(void *s, int c, size_t n);
> -extern void *memcpy(void *dest, const void *src, size_t n);
> -extern int memcmp(const void *s1, const void *s2, size_t n);
> -extern void *memmove(void *dest, const void *src, size_t n);
> -extern void *memchr(const void *s, int c, size_t n);
> +void report(const char *msg_fmt, bool pass, ...);
> +int report_summary(void);
>
> -extern long atol(const char *ptr);
> -#define ARRAY_SIZE(_a)  (sizeof(_a)/sizeof((_a)[0]))
> +#define ARRAY_SIZE(_a) (sizeof(_a)/sizeof((_a)[0]))
>
> -#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
>  #define container_of(ptr, type, member) ({				\
>  	const typeof( ((type *)0)->member ) *__mptr = (ptr);		\
>  	(type *)( (char *)__mptr - offsetof(type,member) );})
>
> -#define NULL ((void *)0UL)
> -
> -void report(const char *msg_fmt, bool pass, ...);
> -int report_summary(void);
> -
> -#define abort() exit(64)		/* 129 exit status from qemu */
> +#define abort() exit(64) /* 129 exit status from qemu */
>  #define assert(cond)							\
>  do {									\
>  	if (!(cond))							\
> diff --git a/lib/string.c b/lib/string.c
> index fe90c8b1289f2..026f50252287c 100644
> --- a/lib/string.c
> +++ b/lib/string.c
> @@ -20,6 +20,12 @@ char *strcat(char *dest, const char *src)
>      return dest;
>  }
>
> +char *strcpy(char *dest, const char *src)
> +{
> +    *dest = 0;
> +    return strcat(dest, src);
> +}
> +
>  int strcmp(const char *a, const char *b)
>  {
>      while (*a == *b) {
> diff --git a/lib/string.h b/lib/string.h
> new file mode 100644
> index 0000000000000..dbab368b1b9e4
> --- /dev/null
> +++ b/lib/string.h
> @@ -0,0 +1,15 @@
> +#ifndef __STRING_H
> +#define __STRING_H
> +
> +extern unsigned long strlen(const char *buf);
> +extern char *strcat(char *dest, const char *src);
> +extern char *strcpy(char *dest, const char *src);
> +extern int strcmp(const char *a, const char *b);
> +extern char *strchr(const char *s, int c);
> +extern void *memset(void *s, int c, size_t n);
> +extern void *memcpy(void *dest, const void *src, size_t n);
> +extern int memcmp(const void *s1, const void *s2, size_t n);
> +extern void *memmove(void *dest, const void *src, size_t n);
> +extern void *memchr(const void *s, int c, size_t n);
> +
> +#endif /* _STRING_H */
>

Please separate the string.h parts and squash them into patch 7.

Otherwise looks good!

Paolo

  reply	other threads:[~2014-06-12 10:52 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 14:01 [PATCH v5 00/19] kvm-unit-tests/arm: initial drop Andrew Jones
2014-06-11 14:01 ` [PATCH v5 01/19] remove unused files Andrew Jones
2014-06-11 14:01 ` [PATCH v5 02/19] makefile and run_tests tweaks Andrew Jones
2014-06-11 14:01 ` [PATCH v5 03/19] clean root dir of all x86-ness Andrew Jones
2014-06-12 10:31   ` Paolo Bonzini
2014-06-12 10:40     ` Andrew Jones
2014-06-12 10:42       ` Paolo Bonzini
2014-06-12 10:54         ` Andrew Jones
2014-06-11 14:01 ` [PATCH v5 04/19] add distclean target and gitignore more Andrew Jones
2014-06-12 10:36   ` Paolo Bonzini
2014-06-14 13:17     ` Christoffer Dall
2014-06-11 14:01 ` [PATCH v5 05/19] add 'make cscope' support Andrew Jones
2014-06-11 14:01 ` [PATCH v5 07/19] libfdt: get libfdt to build Andrew Jones
2014-06-11 14:01 ` [PATCH v5 08/19] add support for Linux device trees Andrew Jones
2014-06-12  9:19   ` Christoffer Dall
2014-06-11 14:01 ` [PATCH v5 09/19] libcflat: add abort() and assert() Andrew Jones
2014-06-12 10:48   ` Paolo Bonzini
2014-06-12 11:07     ` Andrew Jones
2014-06-12 11:09       ` Paolo Bonzini
2014-06-11 14:01 ` [PATCH v5 10/19] Introduce asm-generic/*.h files Andrew Jones
2014-06-11 14:01 ` [PATCH v5 11/19] add minimal virtio support for devtree virtio-mmio Andrew Jones
2014-06-14 13:30   ` Christoffer Dall
2014-06-11 14:01 ` [PATCH v5 12/19] Introduce virtio-testdev Andrew Jones
2014-06-12 10:16   ` Paolo Bonzini
2014-06-12 11:30     ` Andrew Jones
2014-06-12 11:56       ` Paolo Bonzini
2014-06-11 14:01 ` [PATCH v5 13/19] libcflat: clean up libcflat.h and add string.h Andrew Jones
2014-06-12 10:52   ` Paolo Bonzini [this message]
2014-06-12 11:12     ` Andrew Jones
2014-06-11 14:01 ` [PATCH v5 14/19] printf: support field padding Andrew Jones
2014-06-11 14:01 ` [PATCH v5 15/19] arm: initial drop Andrew Jones
2014-06-14 14:16   ` Christoffer Dall
2014-06-16  7:36     ` Andrew Jones
2014-06-11 14:01 ` [PATCH v5 16/19] arm: Add spinlock implementation Andrew Jones
2014-06-11 14:01 ` [PATCH v5 17/19] arm: Add IO accessors to avoid register-writeback Andrew Jones
2014-06-11 14:01 ` [PATCH v5 18/19] arm: add useful headers from the Linux kernel Andrew Jones
2014-06-11 14:01 ` [PATCH v5 19/19] arm: vectors support Andrew Jones
     [not found] ` <1402495294-30737-7-git-send-email-drjones@redhat.com>
2014-06-12 10:44   ` [PATCH v5 06/19] libfdt: Import libfdt source Paolo Bonzini
2014-06-12 10:59     ` Andrew Jones
2014-06-12 14:39       ` Paolo Bonzini
2014-06-12 11:09   ` Paolo Bonzini
2014-06-12 10:54 ` [PATCH v5 00/19] kvm-unit-tests/arm: initial drop Paolo Bonzini
2014-06-14 14:44 ` Christoffer Dall
2014-06-16  7:46   ` Andrew Jones
2014-06-16  7:56     ` Christoffer Dall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53998662.9070907@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=christoffer.dall@linaro.org \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox