[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-10-13 Thread Eric W. Biederman
Christoph Hellwig [EMAIL PROTECTED] writes:

 On Tue, Oct 07, 2008 at 03:27:12PM -0700, Eric W. Biederman wrote:
 Al reviewed sysfs with my patchset on top of it.
 
 Al's review found problems in  sysfs with my patchset on top of it.
 
 If you look at what Al found the majority of those problems exist in sysfs
 without my patches.

 And when something is crap your fix it firdt before piling up more shit
 on top of it.  And sysfs is a really severe case of that, and you're
 piling a _lot_ of shit ontop.

Chistoph, your comments and Al's would have been much more productive
if you have had said:

I didn't like sysfs because it doesn't do things the way other filesystems
  with similar problems do things.  Can you please use common idioms?
  Making the code easier to read and making the code easier to maintain.
  Some of those constructs look awfully complex can you recheck you code
  and see if there is a simpler way to implement them.

That would have been honest and productive.  As it sits.  I have partially
inaccurate feedback from Al, useless feedback from you, and only my own
tough skin and determination to keep me going..

The fact that you and Al look at the code and can't easily make sense of
is a good sign that the code as written will be hard to maintain.  Al's
recent breakage of sysctl is a good example of that.

Eric
___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-10-08 Thread Christoph Hellwig
On Tue, Oct 07, 2008 at 03:27:12PM -0700, Eric W. Biederman wrote:
 Al reviewed sysfs with my patchset on top of it.
 
 Al's review found problems in  sysfs with my patchset on top of it.
 
 If you look at what Al found the majority of those problems exist in sysfs
 without my patches.

And when something is crap your fix it firdt before piling up more shit
on top of it.  And sysfs is a really severe case of that, and you're
piling a _lot_ of shit ontop.

___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-10-07 Thread Mark Ryden
Hello,
  So I wonder: the sysfs tagged directory support patch is in GerKH
tree for more than a month.
I cloned today latest Linus tree (2.6.27-rc9) and
it is not there as far as I can see.
It is also not in linux-next tree (from september).
Now, I wonder what is the process of merging this
GregKH tree ? should I watch the LKML list for a pull request
from GregKH? or will it be first merged into the linux-next tree?

Regards,
Mark


On Thu, Sep 4, 2008 at 8:44 AM, Benjamin Thery [EMAIL PROTECTED] wrote:
 David Shwatrz wrote:

 Hi,

 go into my tree this week,

 I am also interested in this patch; may I ask  - what do you mean by
 my  tree ?I am a little newbie in the kernel, as you might understand.
 I looked into
 http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
 for candidates for this git tree you are talking about.

  May I ask: what is the **exact** URL for this git tree you are talking
 about ?

 Greg's tree is there:
 http://git.kernel.org/?p=linux/kernel/git/gregkh/patches.git;a=summary

 You can clone it from here:
 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/patches.git

 It contains the patches serie to be applied on top of
 linux-2.6 (with 'quilt' for example).

 Benjamin


 Thanks,

 Regards,
 DS


 On Tue, Sep 2, 2008 at 8:01 PM, Greg KH [EMAIL PROTECTED] wrote:

 On Tue, Sep 02, 2008 at 04:03:20PM +0200, Benjamin Thery wrote:

 Mark Ryden wrote:

 Hello,
  I hope that this patch (from 4.7.08) was not forgetten... I don't see
 it for example in linux-net (I have an up-to-date linux-next git
 tree).

 I was about to ask the same thing.

 Greg, what is the plan with these remaining patches for sysfs tagged
 dirs? Will you have some time to merge them in your tree soon?

 Yes, they should go into my tree this week, sorry been busy with 2.6.27
 work and Novell's Hackweek.

 thanks,

 greg k-h
 --
 To unsubscribe from this list: send the line unsubscribe netdev in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html





 --
 B e n j a m i n   T h e r y  - BULL/DT/Open Software RD

   http://www.bull.com

___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-10-07 Thread Greg KH
On Tue, Oct 07, 2008 at 06:39:04PM +0200, Mark Ryden wrote:
 Hello,
   So I wonder: the sysfs tagged directory support patch is in GerKH
 tree for more than a month.

I dropped it from my tree 2 days ago, see the thread on lkml for why.

thanks,

greg k-h
___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-10-07 Thread Daniel Lezcano
Mark Ryden wrote:
 Hello,
   So I wonder: the sysfs tagged directory support patch is in GerKH
 tree for more than a month.
 I cloned today latest Linus tree (2.6.27-rc9) and
 it is not there as far as I can see.
 It is also not in linux-next tree (from september).
 Now, I wonder what is the process of merging this
 GregKH tree ? should I watch the LKML list for a pull request
 from GregKH? or will it be first merged into the linux-next tree?

They have been dropped.

http://marc.info/?l=linux-kernelm=122318517411596w=2
___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-10-07 Thread Eric W. Biederman
Greg KH [EMAIL PROTECTED] writes:

 On Tue, Oct 07, 2008 at 06:39:04PM +0200, Mark Ryden wrote:
 Hello,
   So I wonder: the sysfs tagged directory support patch is in GerKH
 tree for more than a month.

 I dropped it from my tree 2 days ago, see the thread on lkml for why.

Greg why did you drop it? 

Eric

___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-10-07 Thread Greg KH
On Tue, Oct 07, 2008 at 01:31:52PM -0700, Eric W. Biederman wrote:
 Greg KH [EMAIL PROTECTED] writes:
 
  On Tue, Oct 07, 2008 at 06:39:04PM +0200, Mark Ryden wrote:
  Hello,
So I wonder: the sysfs tagged directory support patch is in GerKH
  tree for more than a month.
 
  I dropped it from my tree 2 days ago, see the thread on lkml for why.
 
 Greg why did you drop it? 

Because Al said it was full of problems and for us not to accept it.

thanks,

greg k-h
___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-09-08 Thread Mark Ryden
Hello,
 I hope that this patch (from 4.7.08) was not forgetten... I don't see
it for example in linux-net (I have an up-to-date linux-next git
tree).

Regards,
Mark

On Wed, Aug 27, 2008 at 6:18 PM, Benjamin Thery [EMAIL PROTECTED] wrote:
 Eric W. Biederman wrote:

 The problem.  When implementing a network namespace I need to be able
 to have multiple network devices with the same name.  Currently this
 is a problem for /sys/class/net/*, /sys/devices/virtual/net/*, and
 potentially a few other directories of the form /sys/ ... /net/*.

 What this patch does is to add an additional tag field to the
 sysfs dirent structure.  For directories that should show different
 contents depending on the context such as /sys/class/net/, and
 /sys/devices/virtual/net/ this tag field is used to specify the
 context in which those directories should be visible.  Effectively
 this is the same as creating multiple distinct directories with
 the same name but internally to sysfs the result is nicer.

 I am calling the concept of a single directory that looks like multiple
 directories all at the same path in the filesystem tagged directories.

 For the networking namespace the set of directories whose contents I need
 to filter with tags can depend on the presence or absence of hotplug
 hardware or which modules are currently loaded.  Which means I need
 a simple race free way to setup those directories as tagged.

 To achieve a reace free design all tagged directories are created
 and managed by sysfs itself.

 Users of this interface:
 - define a type in the sysfs_tag_type enumeration.
 - call sysfs_register_tag_types with the type and it's operations
 - call sysfs_make_tagged_dir with the tag type on directories
  to be managed by this tag type
 - sysfs_exit_tag when an individual tag is no longer valid

 - Implement mount_tag() which returns the tag of the calling process
  so we can attach it to a sysfs superblock.
 - Implement ktype.sysfs_tag() which returns the tag of a syfs kobject.

 Everything else is left up to sysfs and the driver layer.

 For the network namespace mount_tag and sysfs_tag are essentially
 one line functions, and look to remain that.

 Tags are currently represented a const void * pointers as that is
 both generic, prevides enough information for equality comparisons,
 and is trivial to create for current users, as it is just the
 existing namespace pointer.

 The work needed in sysfs is more extensive.  At each directory
 or symlink creating I need to check if the directory it is being
 created in is a tagged directory and if so generate the appropriate
 tag to place on the sysfs_dirent.  Likewise at each symlink or
 directory removal I need to check if the sysfs directory it is
 being removed from is a tagged directory and if so figure out
 which tag goes along with the name I am deleting.

 Currently only directories which hold kobjects, and
 symlinks are supported.  There is not enough information
 in the current file attribute interfaces to give us anything
 to discriminate on which makes it useless, and there are
 no potential users which makes it an uninteresting problem
 to solve.

 Signed-off-by: Eric W. Biederman [EMAIL PROTECTED]
 Signed-off-by: Benjamin Thery [EMAIL PROTECTED]
 ---
  fs/sysfs/bin.c  |2 +-
  fs/sysfs/dir.c  |  139
 ++-
  fs/sysfs/file.c |   11 +++--
  fs/sysfs/group.c|4 +-
  fs/sysfs/inode.c|7 ++-
  fs/sysfs/mount.c|  115 +--
  fs/sysfs/symlink.c  |2 +-
  fs/sysfs/sysfs.h|   19 ++-
  include/linux/kobject.h |1 +
  include/linux/sysfs.h   |   31 +++
  10 files changed, 298 insertions(+), 33 deletions(-)

 diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
 index 006fc64..86e1128 100644
 --- a/fs/sysfs/bin.c
 +++ b/fs/sysfs/bin.c
 @@ -252,7 +252,7 @@ int sysfs_create_bin_file(struct kobject * kobj,
 struct bin_attribute * attr)
   void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute *
 attr)
  {
 -   sysfs_hash_and_remove(kobj-sd, attr-attr.name);
 +   sysfs_hash_and_remove(kobj, kobj-sd, attr-attr.name);
  }
   EXPORT_SYMBOL_GPL(sysfs_create_bin_file);
 diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
 index 4ffcfd2..dec7586 100644
 --- a/fs/sysfs/dir.c
 +++ b/fs/sysfs/dir.c
 @@ -30,6 +30,30 @@ DEFINE_SPINLOCK(sysfs_assoc_lock);
  static DEFINE_SPINLOCK(sysfs_ino_lock);
  static DEFINE_IDA(sysfs_ino_ida);
  +static const void *sysfs_creation_tag(struct sysfs_dirent *parent_sd,
 + struct sysfs_dirent *sd)
 +{
 +   const void *tag = NULL;
 +
 +   if (sysfs_tag_type(parent_sd)) {
 +   struct kobject *kobj;
 +   switch (sysfs_type(sd)) {
 +   case SYSFS_DIR:
 +   kobj = sd-s_dir.kobj;
 +   break;
 +   case SYSFS_KOBJ_LINK:
 +   kobj = 

[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-09-08 Thread Mark Ryden
Hi,
Well, I believe that again it was somehow forgotten or was not applied for
other reasons, since polling the following URL several times in last
days did not
show this patch (url:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/patches.git)

Regards,
MR




On Thu, Sep 4, 2008 at 9:44 AM, Benjamin Thery [EMAIL PROTECTED] wrote:
 David Shwatrz wrote:

 Hi,

 go into my tree this week,

 I am also interested in this patch; may I ask  - what do you mean by
 my  tree ?I am a little newbie in the kernel, as you might understand.
 I looked into
 http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
 for candidates for this git tree you are talking about.

  May I ask: what is the **exact** URL for this git tree you are talking
 about ?

 Greg's tree is there:
 http://git.kernel.org/?p=linux/kernel/git/gregkh/patches.git;a=summary

 You can clone it from here:
 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/patches.git

 It contains the patches serie to be applied on top of
 linux-2.6 (with 'quilt' for example).

 Benjamin


 Thanks,

 Regards,
 DS


 On Tue, Sep 2, 2008 at 8:01 PM, Greg KH [EMAIL PROTECTED] wrote:

 On Tue, Sep 02, 2008 at 04:03:20PM +0200, Benjamin Thery wrote:

 Mark Ryden wrote:

 Hello,
  I hope that this patch (from 4.7.08) was not forgetten... I don't see
 it for example in linux-net (I have an up-to-date linux-next git
 tree).

 I was about to ask the same thing.

 Greg, what is the plan with these remaining patches for sysfs tagged
 dirs? Will you have some time to merge them in your tree soon?

 Yes, they should go into my tree this week, sorry been busy with 2.6.27
 work and Novell's Hackweek.

 thanks,

 greg k-h
 --
 To unsubscribe from this list: send the line unsubscribe netdev in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html





 --
 B e n j a m i n   T h e r y  - BULL/DT/Open Software RD

   http://www.bull.com

___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-09-08 Thread David Shwatrz
Hi,
go into my tree this week,

I am also interested in this patch; may I ask  - what do you mean by
my  tree ?I am a little newbie in the kernel, as you might understand.
I looked into http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
for candidates for this git tree you are talking about.

 May I ask: what is the **exact** URL for this git tree you are talking about ?

Thanks,

Regards,
DS


On Tue, Sep 2, 2008 at 8:01 PM, Greg KH [EMAIL PROTECTED] wrote:
 On Tue, Sep 02, 2008 at 04:03:20PM +0200, Benjamin Thery wrote:
 Mark Ryden wrote:
 Hello,
  I hope that this patch (from 4.7.08) was not forgetten... I don't see
 it for example in linux-net (I have an up-to-date linux-next git
 tree).

 I was about to ask the same thing.

 Greg, what is the plan with these remaining patches for sysfs tagged
 dirs? Will you have some time to merge them in your tree soon?

 Yes, they should go into my tree this week, sorry been busy with 2.6.27
 work and Novell's Hackweek.

 thanks,

 greg k-h
 --
 To unsubscribe from this list: send the line unsubscribe netdev in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-09-04 Thread Benjamin Thery
David Shwatrz wrote:
 Hi,
 go into my tree this week,
 
 I am also interested in this patch; may I ask  - what do you mean by
 my  tree ?I am a little newbie in the kernel, as you might understand.
 I looked into http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
 for candidates for this git tree you are talking about.
 
  May I ask: what is the **exact** URL for this git tree you are talking about 
 ?

Greg's tree is there:
http://git.kernel.org/?p=linux/kernel/git/gregkh/patches.git;a=summary

You can clone it from here:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/patches.git

It contains the patches serie to be applied on top of
linux-2.6 (with 'quilt' for example).

Benjamin

 
 Thanks,
 
 Regards,
 DS
 
 
 On Tue, Sep 2, 2008 at 8:01 PM, Greg KH [EMAIL PROTECTED] wrote:
 On Tue, Sep 02, 2008 at 04:03:20PM +0200, Benjamin Thery wrote:
 Mark Ryden wrote:
 Hello,
  I hope that this patch (from 4.7.08) was not forgetten... I don't see
 it for example in linux-net (I have an up-to-date linux-next git
 tree).
 I was about to ask the same thing.

 Greg, what is the plan with these remaining patches for sysfs tagged
 dirs? Will you have some time to merge them in your tree soon?
 Yes, they should go into my tree this week, sorry been busy with 2.6.27
 work and Novell's Hackweek.

 thanks,

 greg k-h
 --
 To unsubscribe from this list: send the line unsubscribe netdev in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

 
 


-- 
B e n j a m i n   T h e r y  - BULL/DT/Open Software RD

http://www.bull.com
___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-09-02 Thread Benjamin Thery
Mark Ryden wrote:
 Hello,
  I hope that this patch (from 4.7.08) was not forgetten... I don't see
 it for example in linux-net (I have an up-to-date linux-next git
 tree).

I was about to ask the same thing.

Greg, what is the plan with these remaining patches for sysfs tagged
dirs? Will you have some time to merge them in your tree soon?

I ran my network namespace tests last week with this latest patchset
from Eric applied on top of your tree (which already contains the first
batch of patches). Everything looked good.

Regards,
Benjamin


 
 Regards,
 Mark
 
 On Wed, Aug 27, 2008 at 6:18 PM, Benjamin Thery [EMAIL PROTECTED] wrote:
 Eric W. Biederman wrote:
 The problem.  When implementing a network namespace I need to be able
 to have multiple network devices with the same name.  Currently this
 is a problem for /sys/class/net/*, /sys/devices/virtual/net/*, and
 potentially a few other directories of the form /sys/ ... /net/*.

 What this patch does is to add an additional tag field to the
 sysfs dirent structure.  For directories that should show different
 contents depending on the context such as /sys/class/net/, and
 /sys/devices/virtual/net/ this tag field is used to specify the
 context in which those directories should be visible.  Effectively
 this is the same as creating multiple distinct directories with
 the same name but internally to sysfs the result is nicer.

 I am calling the concept of a single directory that looks like multiple
 directories all at the same path in the filesystem tagged directories.

 For the networking namespace the set of directories whose contents I need
 to filter with tags can depend on the presence or absence of hotplug
 hardware or which modules are currently loaded.  Which means I need
 a simple race free way to setup those directories as tagged.

 To achieve a reace free design all tagged directories are created
 and managed by sysfs itself.

 Users of this interface:
 - define a type in the sysfs_tag_type enumeration.
 - call sysfs_register_tag_types with the type and it's operations
 - call sysfs_make_tagged_dir with the tag type on directories
  to be managed by this tag type
 - sysfs_exit_tag when an individual tag is no longer valid

 - Implement mount_tag() which returns the tag of the calling process
  so we can attach it to a sysfs superblock.
 - Implement ktype.sysfs_tag() which returns the tag of a syfs kobject.

 Everything else is left up to sysfs and the driver layer.

 For the network namespace mount_tag and sysfs_tag are essentially
 one line functions, and look to remain that.

 Tags are currently represented a const void * pointers as that is
 both generic, prevides enough information for equality comparisons,
 and is trivial to create for current users, as it is just the
 existing namespace pointer.

 The work needed in sysfs is more extensive.  At each directory
 or symlink creating I need to check if the directory it is being
 created in is a tagged directory and if so generate the appropriate
 tag to place on the sysfs_dirent.  Likewise at each symlink or
 directory removal I need to check if the sysfs directory it is
 being removed from is a tagged directory and if so figure out
 which tag goes along with the name I am deleting.

 Currently only directories which hold kobjects, and
 symlinks are supported.  There is not enough information
 in the current file attribute interfaces to give us anything
 to discriminate on which makes it useless, and there are
 no potential users which makes it an uninteresting problem
 to solve.

 Signed-off-by: Eric W. Biederman [EMAIL PROTECTED]
 Signed-off-by: Benjamin Thery [EMAIL PROTECTED]
 ---
  fs/sysfs/bin.c  |2 +-
  fs/sysfs/dir.c  |  139
 ++-
  fs/sysfs/file.c |   11 +++--
  fs/sysfs/group.c|4 +-
  fs/sysfs/inode.c|7 ++-
  fs/sysfs/mount.c|  115 +--
  fs/sysfs/symlink.c  |2 +-
  fs/sysfs/sysfs.h|   19 ++-
  include/linux/kobject.h |1 +
  include/linux/sysfs.h   |   31 +++
  10 files changed, 298 insertions(+), 33 deletions(-)

 diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
 index 006fc64..86e1128 100644
 --- a/fs/sysfs/bin.c
 +++ b/fs/sysfs/bin.c
 @@ -252,7 +252,7 @@ int sysfs_create_bin_file(struct kobject * kobj,
 struct bin_attribute * attr)
   void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute *
 attr)
  {
 -   sysfs_hash_and_remove(kobj-sd, attr-attr.name);
 +   sysfs_hash_and_remove(kobj, kobj-sd, attr-attr.name);
  }
   EXPORT_SYMBOL_GPL(sysfs_create_bin_file);
 diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
 index 4ffcfd2..dec7586 100644
 --- a/fs/sysfs/dir.c
 +++ b/fs/sysfs/dir.c
 @@ -30,6 +30,30 @@ DEFINE_SPINLOCK(sysfs_assoc_lock);
  static DEFINE_SPINLOCK(sysfs_ino_lock);
  static DEFINE_IDA(sysfs_ino_ida);
  +static const void *sysfs_creation_tag(struct sysfs_dirent *parent_sd,
 + 

[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-09-02 Thread Greg KH
On Tue, Sep 02, 2008 at 04:03:20PM +0200, Benjamin Thery wrote:
 Mark Ryden wrote:
 Hello,
  I hope that this patch (from 4.7.08) was not forgetten... I don't see
 it for example in linux-net (I have an up-to-date linux-next git
 tree).

 I was about to ask the same thing.

 Greg, what is the plan with these remaining patches for sysfs tagged
 dirs? Will you have some time to merge them in your tree soon?

Yes, they should go into my tree this week, sorry been busy with 2.6.27
work and Novell's Hackweek.

thanks,

greg k-h
___
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH 1/8] sysfs: Implement sysfs tagged directory support.

2008-08-27 Thread Benjamin Thery
Eric W. Biederman wrote:
 The problem.  When implementing a network namespace I need to be able
 to have multiple network devices with the same name.  Currently this
 is a problem for /sys/class/net/*, /sys/devices/virtual/net/*, and
 potentially a few other directories of the form /sys/ ... /net/*.
 
 What this patch does is to add an additional tag field to the
 sysfs dirent structure.  For directories that should show different
 contents depending on the context such as /sys/class/net/, and
 /sys/devices/virtual/net/ this tag field is used to specify the
 context in which those directories should be visible.  Effectively
 this is the same as creating multiple distinct directories with
 the same name but internally to sysfs the result is nicer.
 
 I am calling the concept of a single directory that looks like multiple
 directories all at the same path in the filesystem tagged directories.
 
 For the networking namespace the set of directories whose contents I need
 to filter with tags can depend on the presence or absence of hotplug
 hardware or which modules are currently loaded.  Which means I need
 a simple race free way to setup those directories as tagged.
 
 To achieve a reace free design all tagged directories are created
 and managed by sysfs itself.
 
 Users of this interface:
 - define a type in the sysfs_tag_type enumeration.
 - call sysfs_register_tag_types with the type and it's operations
 - call sysfs_make_tagged_dir with the tag type on directories
   to be managed by this tag type
 - sysfs_exit_tag when an individual tag is no longer valid
 
 - Implement mount_tag() which returns the tag of the calling process
   so we can attach it to a sysfs superblock.
 - Implement ktype.sysfs_tag() which returns the tag of a syfs kobject.
 
 Everything else is left up to sysfs and the driver layer.
 
 For the network namespace mount_tag and sysfs_tag are essentially
 one line functions, and look to remain that.
 
 Tags are currently represented a const void * pointers as that is
 both generic, prevides enough information for equality comparisons,
 and is trivial to create for current users, as it is just the
 existing namespace pointer.
 
 The work needed in sysfs is more extensive.  At each directory
 or symlink creating I need to check if the directory it is being
 created in is a tagged directory and if so generate the appropriate
 tag to place on the sysfs_dirent.  Likewise at each symlink or
 directory removal I need to check if the sysfs directory it is
 being removed from is a tagged directory and if so figure out
 which tag goes along with the name I am deleting.
 
 Currently only directories which hold kobjects, and
 symlinks are supported.  There is not enough information
 in the current file attribute interfaces to give us anything
 to discriminate on which makes it useless, and there are
 no potential users which makes it an uninteresting problem
 to solve.
 
 Signed-off-by: Eric W. Biederman [EMAIL PROTECTED]
 Signed-off-by: Benjamin Thery [EMAIL PROTECTED]
 ---
  fs/sysfs/bin.c  |2 +-
  fs/sysfs/dir.c  |  139 
 ++-
  fs/sysfs/file.c |   11 +++--
  fs/sysfs/group.c|4 +-
  fs/sysfs/inode.c|7 ++-
  fs/sysfs/mount.c|  115 +--
  fs/sysfs/symlink.c  |2 +-
  fs/sysfs/sysfs.h|   19 ++-
  include/linux/kobject.h |1 +
  include/linux/sysfs.h   |   31 +++
  10 files changed, 298 insertions(+), 33 deletions(-)
 
 diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
 index 006fc64..86e1128 100644
 --- a/fs/sysfs/bin.c
 +++ b/fs/sysfs/bin.c
 @@ -252,7 +252,7 @@ int sysfs_create_bin_file(struct kobject * kobj, struct 
 bin_attribute * attr)
  
  void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * 
 attr)
  {
 - sysfs_hash_and_remove(kobj-sd, attr-attr.name);
 + sysfs_hash_and_remove(kobj, kobj-sd, attr-attr.name);
  }
  
  EXPORT_SYMBOL_GPL(sysfs_create_bin_file);
 diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
 index 4ffcfd2..dec7586 100644
 --- a/fs/sysfs/dir.c
 +++ b/fs/sysfs/dir.c
 @@ -30,6 +30,30 @@ DEFINE_SPINLOCK(sysfs_assoc_lock);
  static DEFINE_SPINLOCK(sysfs_ino_lock);
  static DEFINE_IDA(sysfs_ino_ida);
  
 +static const void *sysfs_creation_tag(struct sysfs_dirent *parent_sd,
 +   struct sysfs_dirent *sd)
 +{
 + const void *tag = NULL;
 +
 + if (sysfs_tag_type(parent_sd)) {
 + struct kobject *kobj;
 + switch (sysfs_type(sd)) {
 + case SYSFS_DIR:
 + kobj = sd-s_dir.kobj;
 + break;
 + case SYSFS_KOBJ_LINK:
 + kobj = sd-s_symlink.target_sd-s_dir.kobj;
 + break;
 + default:
 + BUG();
 + }
 + tag = kobj-ktype-sysfs_tag(kobj);
 + /* NULL tags are reserved for internal use */