lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 29 Jan 2010 20:25:07 +0000
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Joe Perches <joe@...ches.com>
Cc:	netdev <netdev@...r.kernel.org>,
	David Miller <davem@...emloft.net>,
	Greg Kroah-Hartman <gregkh@...e.de>
Subject: Re: RFC: Convert printks with net_device to dev_<level>

On Fri, 2010-01-29 at 12:01 -0800, Joe Perches wrote:
> I've been playing with a cocci script and some additional
> scripts to automate a conversion of printk and pr_<level>
> logging messages with a reference to a struct net_device
> to dev_<level>(&net_device->dev, ...)
> 
> A sample conversion:
> 
> -	printk(KERN_INFO "%s: Using MII transceiver %d, status %4.4x.\n",
> -	       dev->name, tp->phys[0], tulip_mdio_read(dev, tp->phys[0], 1));
> +	dev_info(&dev->dev, "Using MII transceiver %d, status %04x\n",
> +		 tp->phys[0], tulip_mdio_read(dev, tp->phys[0], 1));
[...]

My understanding is that dev_* should be given a bus device (pci_device,
usb_device, ...), not a class device (net_device).  Of course, the net
device name is rather useful as well.  In sfc we print both once the net
device is registered.

It might be useful to add netdev_* print macros along the lines of:

#define netdev_name(dev)					\
	(((dev)->reg_state == NETREG_REGISTERED) ? (dev)->name : "")

#define netdev_info(dev, fmt, ...)				\
	dev_info((dev)->dev.parent, "%s " fmt, 			\
		 netdev_name(dev), __VA_ARGS__)

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ