Added ec_device_id_print().
authorFlorian Pose <fp@igh-essen.com>
Tue, 20 Feb 2007 13:40:30 +0000
changeset 577 db34078f34cc
parent 576 158c5a3d0a2a
child 578 f402b4bd2f4d
Added ec_device_id_print().
master/device_id.c
master/device_id.h
--- a/master/device_id.c	Tue Feb 20 11:28:15 2007 +0000
+++ b/master/device_id.c	Tue Feb 20 13:40:30 2007 +0000
@@ -197,3 +197,26 @@
 }
                 
 /*****************************************************************************/
+
+ssize_t ec_device_id_print(const ec_device_id_t *dev_id, char *buffer)
+{
+    off_t off = 0;
+    unsigned int i;
+    
+    switch (dev_id->type) {
+        case ec_device_id_empty:
+            off += sprintf(buffer + off, "none");
+            break;
+        case ec_device_id_mac:
+            off += sprintf(buffer + off, "MAC ");
+            for (i = 0; i < ETH_ALEN; i++) {
+                off += sprintf(buffer + off, "%02X", dev_id->octets[i]);
+                if (i < ETH_ALEN - 1) off += sprintf(buffer + off, ":");
+            }
+            break;
+    }
+
+    return off;
+}
+                
+/*****************************************************************************/
--- a/master/device_id.h	Tue Feb 20 11:28:15 2007 +0000
+++ b/master/device_id.h	Tue Feb 20 13:40:30 2007 +0000
@@ -67,6 +67,7 @@
 void ec_device_id_clear_list(struct list_head *);
 int ec_device_id_check(const ec_device_id_t *, const struct net_device *,
         const char *, unsigned int);
+ssize_t ec_device_id_print(const ec_device_id_t *, char *);
 
 /*****************************************************************************/