mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: David Miller <davem@davemloft.net>
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 23:20:25 +0100	[thread overview]
Message-ID: <20071030222025.GA19792@uranus.ravnborg.org> (raw)
In-Reply-To: <20071030.150537.240140474.davem@davemloft.net>

On Tue, Oct 30, 2007 at 03:05:37PM -0700, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Tue, 30 Oct 2007 14:59:26 -0700 (PDT)
> 
> > I think the thing to do is just __KERNEL__ protect the
> > <linux/string.h> include and require userspace to
> > include <string.h> itself when using these headers.
> > 
> > That's what I'm testing right now.
> > 
> > I'm pretty sure those inlines are indeed used by userspace.
> 
> Actually, I'm tempted to put <string.h> in the ifndef __KERNEL__
> block of that header.

Something like this..
I like it - much better than adding string.h to unidef-y.
PS - had not pulled latest -linus - so you must update Kbuild.
PPS - tipc.h should be exported too as I understood Stephen.

	Sam

diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index b0c916d..30ddf1e 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -38,7 +38,6 @@
 #define _LINUX_TIPC_CONFIG_H_
 
 #include <linux/types.h>
-#include <linux/string.h>
 #include <asm/byteorder.h>
 
 /*
@@ -390,7 +389,8 @@ struct tipc_cfg_msg_hdr
 #define TCM_LENGTH(datalen) (sizeof(struct tipc_cfg_msg_hdr) + datalen)
 #define TCM_SPACE(datalen)  (TCM_ALIGN(TCM_LENGTH(datalen)))
 #define TCM_DATA(tcm_hdr)   ((void *)((char *)(tcm_hdr) + TCM_LENGTH(0)))
-
+#ifndef __KERNEL__
+#include <string.h>
 static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags,
 			  void *data, __u16 data_len)
 {
@@ -406,5 +406,5 @@ static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags,
 		memcpy(TCM_DATA(msg), data, data_len);
 	return TCM_SPACE(data_len);
 }
-
+#endif /* ifndef __KERNEL__ */
 #endif

  reply	other threads:[~2007-10-30 22:18 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 [this message]
2007-10-30 22:31         ` David Miller
2007-10-31  4:14           ` David Miller
2007-10-31  4:56             ` David Miller
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=20071030222025.GA19792@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=allan.stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=per.liden@ericsson.com \
    --cc=raa.lkml@gmail.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

Powered by JetHome