[PATCH] atm sysfs ifindex entry
Vitja Makarov
vitja.makarov at gmail.com
Sat Jan 13 15:55:52 EST 2007
Hi, all!
I've found that patch atm_sysfs patch was posted here.
I wanna add atm support to hal, that should be nice for adsl-usb modems.
I found that it's not allways possible to determinate interface index.
So for example idt77252 ends with number so i can read index as
77252${realindex}
this could be avoided using separator as in /proc driver eg
idt77252:0, or like ethernet add ifindex entry. I guess second way is
better, as type entry exists.
vitja.
diff -urN orig/net/atm/atm_sysfs.c my/net/atm/atm_sysfs.c
--- orig/net/atm/atm_sysfs.c 2007-01-11 20:39:57.000000000 +0300
+++ my/net/atm/atm_sysfs.c 2007-01-13 23:51:31.188877928 +0300
@@ -1,5 +1,6 @@
/* ATM driver model support. */
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/kobject.h>
@@ -90,11 +91,19 @@
return pos - buf;
}
+static ssize_t show_ifindex(struct class_device *cdev, char *buf)
+{
+ struct atm_dev *adev = to_atm_dev(cdev);
+ return sprintf(buf, "%d\n", adev->number);
+}
+
+
static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
static CLASS_DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
static CLASS_DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
static CLASS_DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
+static CLASS_DEVICE_ATTR(ifindex, S_IRUGO, show_ifindex, NULL);
static struct class_device_attribute *atm_attrs[] = {
&class_device_attr_atmaddress,
@@ -102,6 +111,7 @@
&class_device_attr_carrier,
&class_device_attr_type,
&class_device_attr_link_rate,
+ &class_device_attr_ifindex,
NULL
};
More information about the Usbatm
mailing list