Stephen Hemminger wrote:
On Fri, 08 Jun 2007 16:42:31 -0700
"Kok, Auke" <[EMAIL PROTECTED]> wrote:
Stephen Hemminger wrote:
+#define ndev_printk(kern_level, netif_level, netdev, format, arg...) \
+ do { if ((netdev)->msg_enable & NETIF_MSG_##netif_level) { \
+ printk(kern_level "%s: " format, \
+ (netdev)->name, ## arg); } } while (0)
Could you make a version that doesn't evaluate the arguments twice?
hmm you lost me there a bit; Do you want me to duplicate this code for all the
ndev_err/ndev_info functions instead so that ndev_err doesn't direct back to
ndev_printk?
It is good practice in a macro to avoid potential problems with usage
by only touching the arguments once. Otherwise, something (bogus) like
ndev_printk(KERN_DEBUG, NETIF_MSG_PKTDATA, "got %d\n",
dev++, skb->len)
would increment dev twice.
My preference would be something more like dev_printk or even use that?
... see other reply
You want to show both device name, and physical attachment in the message.
OK, that does make sense, and here it gets interesting and we can get creative,
since for NETIF_MSG_HW and NETIF_MSG_PROBE messages we could add the printout of
netdev->dev->bus_id. I have modeled and toyed around with the message format and
did this (add bus_id to all messages) but it got messy (for LINK messages it's
totally not needed).
However, that is going to make the macro's a bit more complex, and unlikely that
I can make it fit without double-pass evaluation without making it a monster...
unless everyone agrees to just printing everything: both netdev->name and
netdev->dev->bus_id for every message
Auke
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html