Re: [PATCH] SCTP: Reduce log spamming for sctp setsockopt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2013-12-16 at 12:02 -0500, Neil Horman wrote:
> On Mon, Dec 16, 2013 at 08:50:35AM -0800, Joe Perches wrote:
[]
> > Does adding a couple of functions like:
> > 
> > void pr_warn_deprecated(const char *old, const char *new)
> > {
> > 	static DEFINE_RATELIMIT_STATE(_rs,
> > 				      DEFAULT_RATELIMIT_INTERVAL,
> > 				      DEFAULT_RATELIMIT_BURST);
> > 
> > 	if (!__ratelimit(&_rs))
> > 		return;
> > 
> > 	if (new)
> > 		printk(KERN_WARNING "%pf: Use of \"%s\" is deprecated - use \"%s\" instead\n",
> > 				    __builtin_return_address(1), old, new); 
> > 	else
> > 		printk(KERN_WARNING "%pf: Use of \"%s\" is deprecated\n",
> > 				    __builtin_return_address(1), old); 
> > }
> > 
> > suit?  Other suggestions?
> > 
> 
> i'm just doing this:
> #define pr_warn_deprecated(fmt, ...) \
> pr_warn_ratelimited("Deprecated: " fmt, ##__VA_ARGS__)
> 
> That will work for every form, giving consistency to the location of a single
> word for ease of searching.  I don't really see the need to institutionalize
> "use <blank> instead", since there may be no drop in replacement for something
> that is deprecated.

That's what the test for non-null "new" was for
but fine, it's your code.

Do what you think appropriate.

Also, using pr_warn_once may be better.  Dunno.

cheers, Joe

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




[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux