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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 14 Oct 2014 12:13:40 -0700
From:	Joe Perches <joe@...ches.com>
To:	Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>
Cc:	Artem Bityutskiy <dedekind1@...il.com>,
	Tanya Brokhman <tlinder@...eaurora.org>,
	linux-mtd@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
	David Woodhouse <dwmw2@...radead.org>,
	Brian Norris <computersforpeace@...il.com>,
	Richard Weinberger <richard@....at>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4] mtd: ubi: Extend UBI layer debug/messaging
 capabilities

On Tue, 2014-10-14 at 15:47 -0300, Ezequiel Garcia wrote:
> On 14 Oct 06:09 PM, Artem Bityutskiy wrote:
> > On Tue, 2014-10-14 at 11:39 -0300, Ezequiel Garcia wrote:
> > > Please use some pr_fmt for this. Something like this before the headers
> > > should be enough:
> > > 
> > > #define pr_fmt(fmt) "UBI: block:" fmt
> > 
> > Sinc ubiblock is a device, there should be a 'struct device' somewhere,
> > so probably dev_printk() and other dev_*() printing functions would be a
> > better choice?
> > 
> 
> A quick code dig shows you should get the struct device associated
> to the struct gendisk, with the disk_to_dev() macro.
> 
> In other words, something like this should work, provided 'dev' is defined
> in the scope as a struct ubiblock:
> 
>   #define ubiblock_err(x) dev_err(disk_to_dev(dev->gd), x)
> 
> When the gendisk is not available, a simple pr_{} would work.

Or maybe combine these in the ubi_<level> calls passing
NULL when there is no struct ubi_device *

void ubi_err(const struct ubi_device *ubi, fmt. ...)
{
	struct va_format vaf;
	va_list args;

	va_start(args, fmt);

	vaf.fmt = fmt;
	vaf.va = &args;

	if (ubi && ubi->gd)
		dev_err(disk_to_dev(dev->gd), "UBI-%d error: %pF %pV",
			ubi->ubi_num, __builtin_return_address(0), &vaf);
	else if (ubi)
		printk(KERN_ERR "UBI-%d error: %pf: %pV",
		       ubi->ubi_num, __builtin_return_address(0), &vaf);
	else
		printk(KERN_ERR "UBI: error: %pf: %pV",
		       __builtin_return_address(0), &vaf);

	va_end(args);
}




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ