Added ec_device_id_print().

This commit is contained in:
Florian Pose 2007-02-20 13:40:30 +00:00
parent 27f9a4af2d
commit 046d9e7cd5
2 changed files with 24 additions and 0 deletions

View File

@ -197,3 +197,26 @@ int ec_device_id_check(const ec_device_id_t *dev_id,
}
/*****************************************************************************/
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;
}
/*****************************************************************************/

View File

@ -67,6 +67,7 @@ int ec_device_id_process_params(const char *, const char *,
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 *);
/*****************************************************************************/