+static ssize_t node_read_distance(struct sys_device * dev, char * buf)
+{
+ int nid = dev->id;
+ int len = 0;
+ int i;
+
+ /* buf currently PAGE_SIZE, need ~4 chars per node */
+ BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2);
+
+ for_each_online_node(i)
+ len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));
+
+ len += sprintf(buf + len, "\n");
+ return len;
+}
+static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
+
+