Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Dan Williams <dcbw@redhat.com>
Cc: netdev@vger.kernel.org, Chas Williams <chas@cmf.nrl.navy.mil>,
	David Woodhouse <dwmw2@infradead.org>,
	stable@kernel.org
Subject: Re: [PATCH] atm: expose ATM device index in sysfs
Date: Thu, 26 May 2011 19:55:09 +0200	[thread overview]
Message-ID: <1306432509.2543.1.camel@edumazet-laptop> (raw)
In-Reply-To: <1306432057.3151.10.camel@dcbw.foobar.com>

Le jeudi 26 mai 2011 à 12:47 -0500, Dan Williams a écrit :
> It's current exposed only through /proc which besides requiring
> screen-scraping doesn't allow userspace to distinguish between two
> identical ATM adapters with different ATM indexes.  The ATM device index
> is required when using PPPoATM on a system with multiple ATM adapters.
> 
> Signed-off-by: Dan Williams <dcbw@redhat.com>
> ---
> 
> PS: -> stable too since it's a minimal change with no backwards
> incompatibility and I'd like to rely on this attribute in NetworkManager
> 
> diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
> index f7fa67c..e5edbde 100644
> --- a/net/atm/atm_sysfs.c
> +++ b/net/atm/atm_sysfs.c
> @@ -59,6 +59,16 @@ static ssize_t show_atmaddress(struct device *cdev,
>  	return pos - buf;
>  }
>  
> +static ssize_t show_atmindex(struct device *cdev,
> +			     struct device_attribute *attr, char *buf)
> +{
> +	char *pos = buf;
> +	struct atm_dev *adev = to_atm_dev(cdev);
> +
> +	pos += sprintf(pos, "%d\n", adev->number);
> +	return pos - buf;
> +}
> +

What about :

{
	struct atm_dev *adev = to_atm_dev(cdev);

	return sprintf(buf, "%d\n", adev->number);
}





  reply	other threads:[~2011-05-26 17:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26 17:47 [PATCH] atm: expose ATM device index in sysfs Dan Williams
2011-05-26 17:55 ` Eric Dumazet [this message]
2011-05-26 18:35   ` Dan Williams
2011-05-27 14:51     ` [PATCH v2] " Dan Williams
2011-05-27 14:57       ` Eric Dumazet
2011-05-27 15:05         ` David Woodhouse
2011-05-27 17:07           ` David Miller
2011-05-26 19:06 ` [stable] [PATCH] " Greg KH

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=1306432509.2543.1.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=dcbw@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@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