public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	"Pekka Savola (ipv6)" <pekkas@netcore.fi>,
	James Morris <jmorris@namei.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Patrick McHardy <kaber@trash.net>,
	Nick Piggin <npiggin@kernel.dk>,
	Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@lst.de>,
	Dave Chinner <dchinner@redhat.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Octavian Purdila <opurdila@ixiacom.com>,
	Vlad Dogaru <ddvlad@rosedu.org>
Subject: Re: [PATCH] RFC: ipv4: share sysctl net/ipv4/conf/DEVNAME/ tables
Date: Sat, 15 Jan 2011 12:41:39 +0200	[thread overview]
Message-ID: <20110115104139.GA4816@p183.telecom.by> (raw)
In-Reply-To: <AANLkTikVDn_0c+Ob_XnUauEMBZhsYCh+42QF7FwM=Bey@mail.gmail.com>

On Sat, Jan 15, 2011 at 04:46:11AM +0200, Lucian Adrian Grijincu wrote:
> To gain access to the name of the directory above a file, sysctl
> handlers are passed an extra argument: the 'struct file*'
> corresponding to the file. From the file we walk up one level to find
> the name of the device. None of the other handlers were changed to
> receive this extra parameter, but due to C's calling convention they
> shouldn't care.

We don't do creepy stuff like that.

I wonder where interactions with device renaming are handled.

> +static int devinet_conf_handler(ctl_table *ctl, int write,
> +				void __user *buffer,
> +				size_t *lenp, loff_t *ppos,
> +				struct file *filp,
> +				proc_handler *proc_handler)
> +{
> +	/* The path to this file is of the form /proc/sys/net/ipv4/conf/$DEVNAME/$CTL
> +	 *
> +	 * To save space, ctl_table is shared between all network
> +	 * devices in the same network namespace, but we need to
> +	 * change the data corresponding to the $DEVNAME network
> +	 * device, not any other's.
> +	 *
> +	 * Use $DEVNAME to obtain the coresponding ipv4_devconf.
> +	 */
> +	struct net *net = ctl->extra2;
> +	const char *dev_name = filp->f_path.dentry->d_parent->d_name.name;

  reply	other threads:[~2011-01-15 10:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-15  2:46 [PATCH] RFC: ipv4: share sysctl net/ipv4/conf/DEVNAME/ tables Lucian Adrian Grijincu
2011-01-15 10:41 ` Alexey Dobriyan [this message]
2011-01-15 11:09   ` Lucian Adrian Grijincu
2011-01-28  6:21   ` Lucian Adrian Grijincu

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=20110115104139.GA4816@p183.telecom.by \
    --to=adobriyan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dchinner@redhat.com \
    --cc=ddvlad@rosedu.org \
    --cc=eric.dumazet@gmail.com \
    --cc=hch@lst.de \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=lucian.grijincu@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=npiggin@kernel.dk \
    --cc=opurdila@ixiacom.com \
    --cc=pekkas@netcore.fi \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yoshfuji@linux-ipv6.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