netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: tj@kernel.org
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	kay@vrfy.org, ebiederm@xmission.com, netdev@vger.kernel.org,
	lizefan@huawei.com
Subject: Re: [PATCH 2/7] sysfs: make attr namespace interface less convoluted
Date: Thu, 12 Sep 2013 15:46:22 -0400 (EDT)	[thread overview]
Message-ID: <20130912.154622.1374963493079488096.davem@davemloft.net> (raw)
In-Reply-To: <1378952949-7900-3-git-send-email-tj@kernel.org>

From: Tejun Heo <tj@kernel.org>
Date: Wed, 11 Sep 2013 22:29:04 -0400

> sysfs ns (namespace) implementation became more convoluted than
> necessary while trying to hide ns information from visible interface.
> The relatively recent attr ns support is a good example.
> 
> * attr ns tag is determined by sysfs_ops->namespace() callback while
>   dir tag is determined by kobj_type->namespace().  The placement is
>   arbitrary.
> 
> * Instead of performing operations with explicit ns tag, the namespace
>   callback is routed through sysfs_attr_ns(), sysfs_ops->namespace(),
>   class_attr_namespace(), class_attr->namespace().  It's not simpler
>   in any sense.  The only thing this convolution does is traversing
>   the whole stack backwards.
> 
> The namespace callbacks are unncessary because the operations involved
> are inherently synchronous.  The information can be provided in in
> straight-forward top-down direction and reversing that direction is
> unnecessary and against basic design principles.
> 
> This backward interface is unnecessarily convoluted and hinders
> properly separating out sysfs from driver model / kobject for proper
> layering.  This patch updates attr ns support such that
> 
> * sysfs_ops->namespace() and class_attr->namespace() are dropped.
> 
> * sysfs_{create|remove}_file_ns(), which take explicit @ns param, are
>   added and sysfs_{create|remove}_file() are now simple wrappers
>   around the ns aware functions.
> 
> * ns handling is dropped from sysfs_chmod_file().  Nobody uses it at
>   this point.  sysfs_chmod_file_ns() can be added later if necessary.
> 
> * Explicit @ns is propagated through class_{create|remove}_file_ns()
>   and netdev_class_{create|remove}_file_ns().
> 
> * driver/net/bonding which is currently the only user of attr
>   namespace is updated to use netdev_class_{create|remove}_file_ns()
>   with @bh->net as the ns tag instead of using the namespace callback.
> 
> This patch should be an equivalent conversion without any functional
> difference.  It makes the code easier to follow, reduces lines of code
> a bit and helps proper separation and layering.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>

For networking bits:

Acked-by: David S. Miller <davem@davemloft.net>

  reply	other threads:[~2013-09-12 19:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12  2:29 [PATCHSET] sysfs: disentangle kobject namespace handling from sysfs Tejun Heo
2013-09-12  2:29 ` [PATCH 1/7] sysfs: drop semicolon from to_sysfs_dirent() definition Tejun Heo
2013-09-12  2:29 ` [PATCH 2/7] sysfs: make attr namespace interface less convoluted Tejun Heo
2013-09-12 19:46   ` David Miller [this message]
2013-09-12  2:29 ` [PATCH 3/7] sysfs: remove ktype->namespace() invocations in directory code Tejun Heo
2013-09-12  2:29 ` [PATCH 4/7] sysfs: remove ktype->namespace() invocations in symlink code Tejun Heo
2013-09-12  2:29 ` [PATCH 5/7] sysfs: drop kobj_ns_type handling Tejun Heo
2013-09-12  2:29 ` [PATCH 6/7] sysfs: clean up sysfs_get_dirent() Tejun Heo
2013-09-12  3:22   ` [PATCH v2 " Tejun Heo
2013-09-12  2:29 ` [PATCH 7/7] sysfs: @name comes before @ns Tejun Heo
2013-09-12  3:39   ` Eric W. Biederman
2013-09-12  3:49     ` Tejun Heo
2013-09-26 22:32       ` Greg KH
2013-09-12  3:19 ` [PATCHSET] sysfs: disentangle kobject namespace handling from sysfs Greg KH
2013-09-12  3:23   ` Tejun Heo
2013-09-12  3:33     ` Greg KH
2013-09-12  3:34       ` Tejun Heo
2013-09-12  3:38   ` Eric W. Biederman
2013-09-12  4:17     ` Greg KH
2013-09-12  3:37 ` Eric W. Biederman
2013-09-12  3:47   ` Tejun Heo

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=20130912.154622.1374963493079488096.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kay@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=tj@kernel.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;
as well as URLs for NNTP newsgroup(s).