Skip to contentSkip to conversation

export dev->state via sysfs

PATCH In review Bryan O'Sullivan 2 participants 2 messages Aug 20, 2003

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to Bryan O'Sullivan
Quoted 3 lines · On 19 Aug 2003 22:04:56 -0700 "Bryan O'Sullivan" <[email protected]> wrote:

This trivial patch exports the netdev state field via sysfs. The motivation is to make it possible to check link state from userspace without having to go through the netlink interface.

Please use ethtool.

#0 lore raw

PATCH 1/1 export dev->state via sysfs

This trivial patch exports the netdev state field via sysfs. The motivation is to make it possible to check link state from userspace without having to go through the netlink interface.

	<b
net/core/net-sysfs.c +5 -0
@@ -147,6 +147,10 @@
 
 static CLASS_DEVICE_ATTR(flags, S_IRUGO | S_IWUSR, show_flags, store_flags);
 
+NETDEVICE_SHOW(state, "%#x\n");
+
+static CLASS_DEVICE_ATTR(state, S_IRUGO, show_state, NULL);
+
 NETDEVICE_SHOW(tx_queue_len, "%lu\n");
 
 static int change_tx_queue_len(struct net_device *net, unsigned long new_len)
@@ -172,6 +176,7 @@
 	&class_device_attr_features,
 	&class_device_attr_mtu,
 	&class_device_attr_flags,
+	&class_device_attr_state,
 	&class_device_attr_type,
 	&class_device_attr_address,
 	&class_device_attr_broadcast,