LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* include/linux/xattr.h: how much userpace visible?
@ 2006-07-23 18:43 Adrian Bunk
  2006-07-23 19:26 ` Alexey Dobriyan
  2006-07-23 22:57 ` Nathan Scott
  0 siblings, 2 replies; 14+ messages in thread
From: Adrian Bunk @ 2006-07-23 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andreas Gruenbacher, James Morris, Nathan Scott, David Woodhouse

Hi,

how much of include/linux/xattr.h has to be part of the userspace kernel 
headers?

The function prototypes should no longer be visible in userspace.
But how much of the rest of this file is usable for userspace?

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2006-07-23 18:43 include/linux/xattr.h: how much userpace visible? Adrian Bunk
@ 2006-07-23 19:26 ` Alexey Dobriyan
  2006-07-23 22:57 ` Nathan Scott
  1 sibling, 0 replies; 14+ messages in thread
From: Alexey Dobriyan @ 2006-07-23 19:26 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: linux-kernel, Andreas Gruenbacher, James Morris, Nathan Scott,
	David Woodhouse

On Sun, Jul 23, 2006 at 08:43:43PM +0200, Adrian Bunk wrote:
> how much of include/linux/xattr.h has to be part of the userspace kernel
> headers?
>
> The function prototypes should no longer be visible in userspace.
> But how much of the rest of this file is usable for userspace?

XATTR_CREATE, XATTR_REPLACE are passed to sys_setxattr syscall.
struct xattr_handler is ours (it uses struct inode *). Prototypes are
ours.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2006-07-23 18:43 include/linux/xattr.h: how much userpace visible? Adrian Bunk
  2006-07-23 19:26 ` Alexey Dobriyan
@ 2006-07-23 22:57 ` Nathan Scott
  2006-07-24 18:31   ` Andreas Gruenbacher
  1 sibling, 1 reply; 14+ messages in thread
From: Nathan Scott @ 2006-07-23 22:57 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: linux-kernel, Andreas Gruenbacher, James Morris, David Woodhouse

On Sun, Jul 23, 2006 at 08:43:43PM +0200, Adrian Bunk wrote:
> Hi,
> 
> how much of include/linux/xattr.h has to be part of the userspace kernel 
> headers?

None, I think.

> The function prototypes should no longer be visible in userspace.
> But how much of the rest of this file is usable for userspace?

The attr package has its own distinct copy of this file, which has
no kernel pieces - I'm not sure whether libc ended up copying this
or doing its own thing though.

cheers.

-- 
Nathan

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2006-07-23 22:57 ` Nathan Scott
@ 2006-07-24 18:31   ` Andreas Gruenbacher
  2006-07-24 18:45     ` Sam Ravnborg
  2007-02-26 23:28     ` H. Peter Anvin
  0 siblings, 2 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2006-07-24 18:31 UTC (permalink / raw)
  To: Nathan Scott; +Cc: Adrian Bunk, linux-kernel, James Morris, David Woodhouse

On Monday, 24 July 2006 00:57, Nathan Scott wrote:
> On Sun, Jul 23, 2006 at 08:43:43PM +0200, Adrian Bunk wrote:
> > Hi,
> >
> > how much of include/linux/xattr.h has to be part of the userspace kernel
> > headers?
>
> None, I think.

None, indeed. The attr package comes with it own version of xattr.h that also 
includes definitions of XATTR_CREATE and XATTR_REPLACE.

Andreas

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2006-07-24 18:31   ` Andreas Gruenbacher
@ 2006-07-24 18:45     ` Sam Ravnborg
  2006-07-24 18:58       ` Andreas Gruenbacher
  2007-02-26 23:29       ` H. Peter Anvin
  2007-02-26 23:28     ` H. Peter Anvin
  1 sibling, 2 replies; 14+ messages in thread
From: Sam Ravnborg @ 2006-07-24 18:45 UTC (permalink / raw)
  To: Andreas Gruenbacher
  Cc: Nathan Scott, Adrian Bunk, linux-kernel, James Morris, David Woodhouse

On Mon, Jul 24, 2006 at 08:31:11PM +0200, Andreas Gruenbacher wrote:
> On Monday, 24 July 2006 00:57, Nathan Scott wrote:
> > On Sun, Jul 23, 2006 at 08:43:43PM +0200, Adrian Bunk wrote:
> > > Hi,
> > >
> > > how much of include/linux/xattr.h has to be part of the userspace kernel
> > > headers?
> >
> > None, I think.
> 
> None, indeed. The attr package comes with it own version of xattr.h that also 
> includes definitions of XATTR_CREATE and XATTR_REPLACE.
The userspace headers are supposed to hold the part of the kernel
definitions that glibc (and mayby the attr package) uses. If they happen
to have their own copy now should not impct the decision what is part of
the userspace interface for the kernel. So actual usage does not decide
what is part of the userspace kernel headers but what definitionas are
definitions the userspace <-> kernel interface.

	Sam

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2006-07-24 18:45     ` Sam Ravnborg
@ 2006-07-24 18:58       ` Andreas Gruenbacher
  2007-02-26 23:29       ` H. Peter Anvin
  1 sibling, 0 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2006-07-24 18:58 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Nathan Scott, Adrian Bunk, linux-kernel, James Morris, David Woodhouse

On Monday, 24 July 2006 20:45, Sam Ravnborg wrote:
> The userspace headers are supposed to hold the part of the kernel
> definitions that glibc (and mayby the attr package) uses. If they happen
> to have their own copy now should not impct the decision what is part of
> the userspace interface for the kernel. So actual usage does not decide
> what is part of the userspace kernel headers but what definitionas are
> definitions the userspace <-> kernel interface.

Sure, fine by me.

Andreas

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2006-07-24 18:31   ` Andreas Gruenbacher
  2006-07-24 18:45     ` Sam Ravnborg
@ 2007-02-26 23:28     ` H. Peter Anvin
  2007-02-26 23:43       ` David Miller
  1 sibling, 1 reply; 14+ messages in thread
From: H. Peter Anvin @ 2007-02-26 23:28 UTC (permalink / raw)
  To: Andreas Gruenbacher
  Cc: Nathan Scott, Adrian Bunk, linux-kernel, James Morris, David Woodhouse

Andreas Gruenbacher wrote:
> On Monday, 24 July 2006 00:57, Nathan Scott wrote:
>> On Sun, Jul 23, 2006 at 08:43:43PM +0200, Adrian Bunk wrote:
>>> Hi,
>>>
>>> how much of include/linux/xattr.h has to be part of the userspace kernel
>>> headers?
>> None, I think.
> 
> None, indeed. The attr package comes with it own version of xattr.h that also 
> includes definitions of XATTR_CREATE and XATTR_REPLACE.
> 

However, it would be better if the ABI constants were exported, or at 
least *exportable* (using a __KERNEL_XATTR_MACROS test macro or 
something like that.)

	-hpa

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2006-07-24 18:45     ` Sam Ravnborg
  2006-07-24 18:58       ` Andreas Gruenbacher
@ 2007-02-26 23:29       ` H. Peter Anvin
  1 sibling, 0 replies; 14+ messages in thread
From: H. Peter Anvin @ 2007-02-26 23:29 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Andreas Gruenbacher, Nathan Scott, Adrian Bunk, linux-kernel,
	James Morris, David Woodhouse

Sam Ravnborg wrote:
> The userspace headers are supposed to hold the part of the kernel
> definitions that glibc (and mayby the attr package) uses. If they happen
> to have their own copy now should not impct the decision what is part of
> the userspace interface for the kernel. So actual usage does not decide
> what is part of the userspace kernel headers but what definitionas are
> definitions the userspace <-> kernel interface.

glibc, or another libc.

Basically, the kernel should be able to export the things that userspace 
needs to be able to correctly speak the ABI.

	-hpa

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2007-02-26 23:28     ` H. Peter Anvin
@ 2007-02-26 23:43       ` David Miller
  2007-02-26 23:52         ` H. Peter Anvin
  0 siblings, 1 reply; 14+ messages in thread
From: David Miller @ 2007-02-26 23:43 UTC (permalink / raw)
  To: hpa; +Cc: a.gruenbacher, nathans, bunk, linux-kernel, jmorris, dwmw2

From: "H. Peter Anvin" <hpa@zytor.com>
Date: Mon, 26 Feb 2007 15:28:57 -0800

> Andreas Gruenbacher wrote:
> > On Monday, 24 July 2006 00:57, Nathan Scott wrote:
> >> On Sun, Jul 23, 2006 at 08:43:43PM +0200, Adrian Bunk wrote:
> >>> Hi,
> >>>
> >>> how much of include/linux/xattr.h has to be part of the userspace kernel
> >>> headers?
> >> None, I think.
> > 
> > None, indeed. The attr package comes with it own version of xattr.h that also 
> > includes definitions of XATTR_CREATE and XATTR_REPLACE.
> > 
> 
> However, it would be better if the ABI constants were exported, or at 
> least *exportable* (using a __KERNEL_XATTR_MACROS test macro or 
> something like that.)

This is the same situation as the socket.h issue we're trying
to figure out what to do about.

wrt. the socket.h case I think I'm going to revert the guilty
changeset for now until a better scheme is implemented

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2007-02-26 23:43       ` David Miller
@ 2007-02-26 23:52         ` H. Peter Anvin
  2007-02-27  0:03           ` Christoph Hellwig
  0 siblings, 1 reply; 14+ messages in thread
From: H. Peter Anvin @ 2007-02-26 23:52 UTC (permalink / raw)
  To: David Miller; +Cc: a.gruenbacher, nathans, bunk, linux-kernel, jmorris, dwmw2

David Miller wrote:
>>>
>> However, it would be better if the ABI constants were exported, or at 
>> least *exportable* (using a __KERNEL_XATTR_MACROS test macro or 
>> something like that.)
> 
> This is the same situation as the socket.h issue we're trying
> to figure out what to do about.
> 
> wrt. the socket.h case I think I'm going to revert the guilty
> changeset for now until a better scheme is implemented

Indeed it is (as well as <linux/stat.h>).

I believe the use of feature macros is probably the way to go; that way 
userspace can request subsets, which can vary from libc to libc.

There is, of course, the "ABI language" variant, but I don't see that 
happening unless someone has a lot of time to spend on it.

	-hpa

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2007-02-26 23:52         ` H. Peter Anvin
@ 2007-02-27  0:03           ` Christoph Hellwig
  2007-02-27  0:10             ` H. Peter Anvin
  0 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2007-02-27  0:03 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: David Miller, a.gruenbacher, nathans, bunk, linux-kernel, jmorris, dwmw2

On Mon, Feb 26, 2007 at 03:52:42PM -0800, H. Peter Anvin wrote:
> David Miller wrote:
> >>>
> >>However, it would be better if the ABI constants were exported, or at 
> >>least *exportable* (using a __KERNEL_XATTR_MACROS test macro or 
> >>something like that.)
> >
> >This is the same situation as the socket.h issue we're trying
> >to figure out what to do about.
> >
> >wrt. the socket.h case I think I'm going to revert the guilty
> >changeset for now until a better scheme is implemented
> 
> Indeed it is (as well as <linux/stat.h>).
> 
> I believe the use of feature macros is probably the way to go; that way 
> userspace can request subsets, which can vary from libc to libc.
> 
> There is, of course, the "ABI language" variant, but I don't see that 
> happening unless someone has a lot of time to spend on it.

What's the problem of exposing all these APIs unconditionally?
glibcs should either use all information from the linux/ headers
or nothing at all, but not depend on hiding some bits.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2007-02-27  0:03           ` Christoph Hellwig
@ 2007-02-27  0:10             ` H. Peter Anvin
  2007-02-27  1:49               ` Kyle Moffett
  0 siblings, 1 reply; 14+ messages in thread
From: H. Peter Anvin @ 2007-02-27  0:10 UTC (permalink / raw)
  To: Christoph Hellwig, H. Peter Anvin, David Miller, a.gruenbacher,
	bunk, linux-kernel, jmorris, dwmw2

Christoph Hellwig wrote:
> What's the problem of exposing all these APIs unconditionally?
> glibcs should either use all information from the linux/ headers
> or nothing at all, but not depend on hiding some bits.

It's not always that simple.  In particular, in some files there might 
be typedefs or structure tags that step on libc's namespace (but are 
useful to other libcs), but ABI constants that are universally useful.

One way to deal with the particular issue of structure tags which is 
probably even more useful is:

#if defined(__KERNEL__) || defined(__KERNEL_EXPORT_STRUCTURES)
# define __kstruct_stat stat
#endif

struct __kstruct_stat {
	/* ...foo... */
};

... which lets the libc export it into whatever namespace it wants by 
#defining __kstruct macros accordingly.

	-hpa

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2007-02-27  0:10             ` H. Peter Anvin
@ 2007-02-27  1:49               ` Kyle Moffett
  2007-02-27  2:09                 ` H. Peter Anvin
  0 siblings, 1 reply; 14+ messages in thread
From: Kyle Moffett @ 2007-02-27  1:49 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Christoph Hellwig, David Miller, a.gruenbacher, bunk,
	linux-kernel, jmorris, dwmw2

On Feb 26, 2007, at 19:10:16, H. Peter Anvin wrote:
> Christoph Hellwig wrote:
>> What's the problem of exposing all these APIs unconditionally?   
>> glibcs should either use all information from the linux/ headers  
>> or nothing at all, but not depend on hiding some bits.
>
> It's not always that simple.  In particular, in some files there  
> might be typedefs or structure tags that step on libc's namespace  
> (but are useful to other libcs), but ABI constants that are  
> universally useful.
>
> One way to deal with the particular issue of structure tags which  
> is probably even more useful is:
>
> #if defined(__KERNEL__) || defined(__KERNEL_EXPORT_STRUCTURES)
> # define __kstruct_stat stat
> #endif
>
> struct __kstruct_stat {
> 	/* ...foo... */
> };
>
> ... which lets the libc export it into whatever namespace it wants  
> by #defining __kstruct macros accordingly.

Not a bad idea, but it could use some extra error checking to make  
sure that somebody remembers to "#define __kstruct_foo" before  
"#include <linux/foo.h>" (perhaps indirectly through linux/bar.h).   
Maybe something like this (plays nice with the very-basic unifdef  
parsing too):

#ifdef __KERNEL__
# define __kstruct_stat stat
# define __kstruct_foo foo
# define __kstruct_bar bar
#endif

#ifdef __LINUX_KERNEL_EXPORT
# define __kstruct_stat stat
# define __kstruct_foo foo
# define __kstruct_bar bar
#endif

#ifndef __kstruct_stat
# error "Missing definition of __kstruct_stat, please insert:"
# error "  #define __kstruct_stat <name-for-stat-struct>"
# error "into your C file before '#include <linux/foo.h>'"
#endif
struct __kstruct_stat {
}

Someone who wanted to keep the name __kstruct_stat could of course  
"#define __kstruct_stat __kstruct_stat" easily.

Cheers,
Kyle Moffett


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: include/linux/xattr.h: how much userpace visible?
  2007-02-27  1:49               ` Kyle Moffett
@ 2007-02-27  2:09                 ` H. Peter Anvin
  0 siblings, 0 replies; 14+ messages in thread
From: H. Peter Anvin @ 2007-02-27  2:09 UTC (permalink / raw)
  To: Kyle Moffett
  Cc: Christoph Hellwig, David Miller, a.gruenbacher, bunk,
	linux-kernel, jmorris, dwmw2

Kyle Moffett wrote:
> 
> Not a bad idea, but it could use some extra error checking to make sure 
> that somebody remembers to "#define __kstruct_foo" before "#include 
> <linux/foo.h>" (perhaps indirectly through linux/bar.h).  Maybe 
> something like this (plays nice with the very-basic unifdef parsing too):
> 
> #ifdef __KERNEL__
> # define __kstruct_stat stat
> # define __kstruct_foo foo
> # define __kstruct_bar bar
> #endif
> 
> #ifdef __LINUX_KERNEL_EXPORT
> # define __kstruct_stat stat
> # define __kstruct_foo foo
> # define __kstruct_bar bar
> #endif
> 
> #ifndef __kstruct_stat
> # error "Missing definition of __kstruct_stat, please insert:"
> # error "  #define __kstruct_stat <name-for-stat-struct>"
> # error "into your C file before '#include <linux/foo.h>'"
> #endif
> struct __kstruct_stat {
> }
> 
> Someone who wanted to keep the name __kstruct_stat could of course 
> "#define __kstruct_stat __kstruct_stat" easily.
> 

True, but if someone makes errors on that level in your libc, don't you 
think the fact that gcc will throw an error is sufficient?  Writing that 
kind of error generators is a lot of work, and probably for little gain.

	-hpa

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-02-27  2:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-23 18:43 include/linux/xattr.h: how much userpace visible? Adrian Bunk
2006-07-23 19:26 ` Alexey Dobriyan
2006-07-23 22:57 ` Nathan Scott
2006-07-24 18:31   ` Andreas Gruenbacher
2006-07-24 18:45     ` Sam Ravnborg
2006-07-24 18:58       ` Andreas Gruenbacher
2007-02-26 23:29       ` H. Peter Anvin
2007-02-26 23:28     ` H. Peter Anvin
2007-02-26 23:43       ` David Miller
2007-02-26 23:52         ` H. Peter Anvin
2007-02-27  0:03           ` Christoph Hellwig
2007-02-27  0:10             ` H. Peter Anvin
2007-02-27  1:49               ` Kyle Moffett
2007-02-27  2:09                 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).