From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Cc: mlevitsk@redhat.com
Subject: Re: [PATCH kvm-unit-tests 1/4] libcflat: add a few more runtime functions
Date: Mon, 18 Jan 2021 18:34:46 +0100 [thread overview]
Message-ID: <3f80c41b-30e7-e5e6-e69f-d2fa844b4778@redhat.com> (raw)
In-Reply-To: <20201223010850.111882-2-pbonzini@redhat.com>
On 23/12/2020 02.08, Paolo Bonzini wrote:
> These functions will be used to parse the chaos test's command line.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> lib/alloc.c | 9 +++++++-
> lib/alloc.h | 1 +
> lib/libcflat.h | 4 +++-
> lib/string.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++---
> lib/string.h | 3 +++
> 5 files changed, 71 insertions(+), 5 deletions(-)
>
> diff --git a/lib/alloc.c b/lib/alloc.c
> index a46f464..a56f664 100644
> --- a/lib/alloc.c
> +++ b/lib/alloc.c
> @@ -1,7 +1,7 @@
> #include "alloc.h"
> #include "bitops.h"
> #include "asm/page.h"
> -#include "bitops.h"
> +#include "string.h"
>
> void *malloc(size_t size)
> {
> @@ -50,6 +50,13 @@ void *calloc(size_t nmemb, size_t size)
> return ptr;
> }
>
> +char *strdup(const char *s)
> +{
> + size_t len = strlen(s) + 1;
> + char *d = malloc(len);
> + return strcpy(d, s);
> +}
> +
> void free(void *ptr)
> {
> if (alloc_ops->free)
> diff --git a/lib/alloc.h b/lib/alloc.h
> index 9b4b634..4139465 100644
> --- a/lib/alloc.h
> +++ b/lib/alloc.h
> @@ -34,5 +34,6 @@ void *malloc(size_t size);
> void *calloc(size_t nmemb, size_t size);
> void free(void *ptr);
> void *memalign(size_t alignment, size_t size);
> +char *strdup(const char *s);
Why did you put the prototype in alloc.h and not in string.h?
Thomas
next prev parent reply other threads:[~2021-01-18 17:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 1:08 [RFC PATCH kvm-unit-tests 0/4] add generic stress test Paolo Bonzini
2020-12-23 1:08 ` [PATCH kvm-unit-tests 1/4] libcflat: add a few more runtime functions Paolo Bonzini
2021-01-18 17:34 ` Thomas Huth [this message]
2020-12-23 1:08 ` [PATCH kvm-unit-tests 2/4] chaos: add generic stress test Paolo Bonzini
2020-12-23 1:08 ` [PATCH kvm-unit-tests 3/4] chaos: add timer interrupt to the workload Paolo Bonzini
2020-12-23 1:08 ` [PATCH kvm-unit-tests 4/4] chaos: add edu device " Paolo Bonzini
2020-12-28 22:25 ` [RFC PATCH kvm-unit-tests 0/4] add generic stress test Sean Christopherson
2021-01-02 8:46 ` Paolo Bonzini
2021-01-12 22:28 ` Sean Christopherson
2021-01-13 12:13 ` Paolo Bonzini
2021-01-14 20:13 ` Sean Christopherson
2021-01-14 21:12 ` Paolo Bonzini
2021-01-14 22:13 ` Sean Christopherson
2021-01-15 13:15 ` Paolo Bonzini
2021-01-18 11:09 ` Andrew Jones
2021-01-19 17:37 ` Sean Christopherson
2021-01-19 18:40 ` Andrew Jones
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=3f80c41b-30e7-e5e6-e69f-d2fa844b4778@redhat.com \
--to=thuth@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
/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