From: David Miller <davem@davemloft.net>
To: sam@ravnborg.org
Cc: raa.lkml@gmail.com, linux-kernel@vger.kernel.org,
per.liden@ericsson.com, allan.stephens@windriver.com
Subject: Re: tipc_config.h requires linux/string.h, which does not exist in exported headers
Date: Tue, 30 Oct 2007 21:56:16 -0700 (PDT) [thread overview]
Message-ID: <20071030.215616.241765510.davem@davemloft.net> (raw)
In-Reply-To: <20071030.211404.43558275.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Tue, 30 Oct 2007 21:14:04 -0700 (PDT)
> Unfortunately I have to back it out, it breaks the build.
>
> In file included from net/tipc/core.h:41,
> from net/tipc/addr.c:37:
> include/linux/tipc_config.h: In function 'TLV_SET':
> include/linux/tipc_config.h:306: error: implicit declaration of function 'memcpy'
> include/linux/tipc_config.h:306: warning: incompatible implicit declaration of built-in function 'memcpy'
>
> I truly think adding linux/string.h to unifdef-y along with:
>
> #ifndef __KERNEL__
> #include <string.h>
> #else
> ...
> #endif
>
> in linux/string.h is a much cleaner and less error prone solution :-)
Here is what I mean, specifically. And this is build tested :-)
>From 97ef1bb0c8e371b7988287f38bd107c4aa14d78d Mon Sep 17 00:00:00 2001
From: David S. Miller <davem@sunset.davemloft.net>
Date: Tue, 30 Oct 2007 21:44:00 -0700
Subject: [PATCH] [TIPC]: Fix headercheck wrt. tipc_config.h
It wants string functions like memcpy() for inline
routines, and these define userland interfaces.
The only clean way to deal with this is to simply
put linux/string.h into unifdef-y and have it
include <string.h> when not-__KERNEL__.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/linux/Kbuild | 1 +
include/linux/string.h | 12 +++---------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index bd33c22..37bfa19 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -326,6 +326,7 @@ unifdef-y += sonypi.h
unifdef-y += soundcard.h
unifdef-y += stat.h
unifdef-y += stddef.h
+unifdef-y += string.h
unifdef-y += synclink.h
unifdef-y += sysctl.h
unifdef-y += tcp.h
diff --git a/include/linux/string.h b/include/linux/string.h
index 836062b..c5d3fca 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -3,16 +3,14 @@
/* We don't want strings.h stuff being user by user stuff by accident */
-#ifdef __KERNEL__
+#ifndef __KERNEL__
+#include <string.h>
+#else
#include <linux/compiler.h> /* for inline */
#include <linux/types.h> /* for size_t */
#include <linux/stddef.h> /* for NULL */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern char *strndup_user(const char __user *, long);
/*
@@ -111,9 +109,5 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
extern void argv_free(char **argv);
-#ifdef __cplusplus
-}
-#endif
-
#endif
#endif /* _LINUX_STRING_H_ */
--
1.5.2.5
next prev parent reply other threads:[~2007-10-31 4:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-30 19:13 Alex Riesen
2007-10-30 21:54 ` Sam Ravnborg
2007-10-30 21:59 ` David Miller
2007-10-30 22:05 ` David Miller
2007-10-30 22:20 ` Sam Ravnborg
2007-10-30 22:31 ` David Miller
2007-10-31 4:14 ` David Miller
2007-10-31 4:56 ` David Miller [this message]
2007-10-31 7:37 ` Alex Riesen
2007-10-31 9:46 ` Sam Ravnborg
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=20071030.215616.241765510.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=allan.stephens@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=per.liden@ericsson.com \
--cc=raa.lkml@gmail.com \
--cc=sam@ravnborg.org \
/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
Powered by JetHome