On Mon, 2008-02-25 at 10:53 +0100, Johannes Berg wrote: > Maybe we should just add a new printf modifier like %M for MAC > addresses? Then we could use sprintf, snprintf, printk and whatever we > please without any of the macro stuff...
Could gcc validate the printf %M arguments? Another possibility without changing printf argument validation is to use a MAC_FMT macro in place of "%s" #ifdef CONFIG_INLINE_MAC #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" #define DECLARE_MAC_BUF(var) #define print_mac(buf, addr) (addr)[0], (addr)[1], (addr)[2], (addr)[3], (addr)[4], (addr)[5] #else #define MAC_FMT "%s" #define DECLARE_MAC_BUF(var) char var[18]; extern char *print_mac(char *buf, const unsigned char *addr); #endif use: DECLARE_MAC_BUF(mac); printk(KERN_INFO "Mac address is: " MAC_FMT "\n", print_mac(mac, addr)); -- 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