netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] atm: expose ATM device index in sysfs
@ 2011-05-26 17:47 Dan Williams
  2011-05-26 17:55 ` Eric Dumazet
  2011-05-26 19:06 ` [stable] [PATCH] " Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: Dan Williams @ 2011-05-26 17:47 UTC (permalink / raw)
  To: netdev; +Cc: Chas Williams, David Woodhouse, stable

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;
+}
+
 static ssize_t show_carrier(struct device *cdev,
 			    struct device_attribute *attr, char *buf)
 {
@@ -99,6 +109,7 @@ static ssize_t show_link_rate(struct device *cdev,
 
 static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
 static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
+static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
 static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
 static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
 static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
@@ -106,6 +117,7 @@ static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
 static struct device_attribute *atm_attrs[] = {
 	&dev_attr_atmaddress,
 	&dev_attr_address,
+	&dev_attr_atmindex,
 	&dev_attr_carrier,
 	&dev_attr_type,
 	&dev_attr_link_rate,



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

* Re: [PATCH] atm: expose ATM device index in sysfs
  2011-05-26 17:47 [PATCH] atm: expose ATM device index in sysfs Dan Williams
@ 2011-05-26 17:55 ` Eric Dumazet
  2011-05-26 18:35   ` Dan Williams
  2011-05-26 19:06 ` [stable] [PATCH] " Greg KH
  1 sibling, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2011-05-26 17:55 UTC (permalink / raw)
  To: Dan Williams; +Cc: netdev, Chas Williams, David Woodhouse, stable

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);
}





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

* Re: [PATCH] atm: expose ATM device index in sysfs
  2011-05-26 17:55 ` Eric Dumazet
@ 2011-05-26 18:35   ` Dan Williams
  2011-05-27 14:51     ` [PATCH v2] " Dan Williams
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Williams @ 2011-05-26 18:35 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, Chas Williams, David Woodhouse, stable

On Thu, 2011-05-26 at 19:55 +0200, Eric Dumazet wrote:
> 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);
> }

Sure, will send v2.

Dan


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

* Re: [stable] [PATCH] atm: expose ATM device index in sysfs
  2011-05-26 17:47 [PATCH] atm: expose ATM device index in sysfs Dan Williams
  2011-05-26 17:55 ` Eric Dumazet
@ 2011-05-26 19:06 ` Greg KH
  1 sibling, 0 replies; 8+ messages in thread
From: Greg KH @ 2011-05-26 19:06 UTC (permalink / raw)
  To: Dan Williams; +Cc: netdev, Chas Williams, David Woodhouse, stable

On Thu, May 26, 2011 at 12:47:36PM -0500, Dan Williams wrote:
> 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

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>

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

* [PATCH v2] atm: expose ATM device index in sysfs
  2011-05-26 18:35   ` Dan Williams
@ 2011-05-27 14:51     ` Dan Williams
  2011-05-27 14:57       ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Williams @ 2011-05-27 14:51 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, Chas Williams, David Woodhouse

It's currently 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>
---

diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index f7fa67c..f49da58 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -59,6 +59,14 @@ 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)
+{
+	struct atm_dev *adev = to_atm_dev(cdev);
+
+	return sprintf(buf, "%d\n", adev->number);
+}
+
 static ssize_t show_carrier(struct device *cdev,
 			    struct device_attribute *attr, char *buf)
 {
@@ -99,6 +107,7 @@ static ssize_t show_link_rate(struct device *cdev,
 
 static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
 static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
+static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
 static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
 static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
 static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
@@ -106,6 +115,7 @@ static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
 static struct device_attribute *atm_attrs[] = {
 	&dev_attr_atmaddress,
 	&dev_attr_address,
+	&dev_attr_atmindex,
 	&dev_attr_carrier,
 	&dev_attr_type,
 	&dev_attr_link_rate,



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

* Re: [PATCH v2] atm: expose ATM device index in sysfs
  2011-05-27 14:51     ` [PATCH v2] " Dan Williams
@ 2011-05-27 14:57       ` Eric Dumazet
  2011-05-27 15:05         ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2011-05-27 14:57 UTC (permalink / raw)
  To: Dan Williams; +Cc: netdev, Chas Williams, David Woodhouse

Le vendredi 27 mai 2011 à 09:51 -0500, Dan Williams a écrit :
> It's currently 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>
> ---
> 

Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>



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

* Re: [PATCH v2] atm: expose ATM device index in sysfs
  2011-05-27 14:57       ` Eric Dumazet
@ 2011-05-27 15:05         ` David Woodhouse
  2011-05-27 17:07           ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2011-05-27 15:05 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Dan Williams, netdev, Chas Williams

On Fri, 2011-05-27 at 16:57 +0200, Eric Dumazet wrote:
> Le vendredi 27 mai 2011 à 09:51 -0500, Dan Williams a écrit :
> > It's currently 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>
> > ---
> > 
> 
> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>

Tested-by: David Woodhouse <dwmw2@infradead.org>
Cc: stable@kernel.org

[root@solos atm]# grep ^ /sys/class/atm/*/atmindex
/sys/class/atm/solos-pci0/atmindex:0
/sys/class/atm/solos-pci1/atmindex:1

-- 
dwmw2


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

* Re: [PATCH v2] atm: expose ATM device index in sysfs
  2011-05-27 15:05         ` David Woodhouse
@ 2011-05-27 17:07           ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2011-05-27 17:07 UTC (permalink / raw)
  To: dwmw2; +Cc: eric.dumazet, dcbw, netdev, chas

From: David Woodhouse <dwmw2@infradead.org>
Date: Fri, 27 May 2011 16:05:41 +0100

> On Fri, 2011-05-27 at 16:57 +0200, Eric Dumazet wrote:
>> Le vendredi 27 mai 2011 à 09:51 -0500, Dan Williams a écrit :
>> > It's currently 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>
>> > ---
>> > 
>> 
>> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> Tested-by: David Woodhouse <dwmw2@infradead.org>
> Cc: stable@kernel.org
> 
> [root@solos atm]# grep ^ /sys/class/atm/*/atmindex
> /sys/class/atm/solos-pci0/atmindex:0
> /sys/class/atm/solos-pci1/atmindex:1

Applied, thanks.

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

end of thread, other threads:[~2011-05-27 17:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-26 17:47 [PATCH] atm: expose ATM device index in sysfs Dan Williams
2011-05-26 17:55 ` Eric Dumazet
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

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).