Re: [patch 1/7] BSD Secure Levels: printk overhaul

From: Dave Hansen
Date: Wed May 18 2005 - 20:32:25 EST


On Tue, 2005-05-17 at 10:23 -0500, Michael Halcrow wrote:
> struct seclvl_attribute {
> struct attribute attr;
> - ssize_t(*show) (struct seclvl_obj *, char *);
> - ssize_t(*store) (struct seclvl_obj *, const char *, size_t);
> + ssize_t(*show) (struct seclvl_obj *, char *);
> + ssize_t(*store) (struct seclvl_obj *, const char *, size_t);
> };

You've changed tabs to spaces.

> /**
> @@ -198,15 +196,15 @@
> static int seclvl_sanity(int reqlvl)
> {
> if ((reqlvl < -1) || (reqlvl > 2)) {
> - seclvl_printk(1, KERN_WARNING, "Attempt to set seclvl out of "
> - "range: [%d]\n", reqlvl);
> + seclvl_printk(1, KERN_WARNING "%s: Attempt to set seclvl out "
> + "of range: [%d]\n", __FUNCTION__, reqlvl);

Instead of changing each and every seclvl_printk() call to add
__FUNCTION__, why not do this:

+static void __seclvl_printk(int verb, const char *fmt, ...)
...

#define seclvl_printk(verb, fmt, arg...) \
__seclvl_printk(verb, __FUNCTION__ ": " fmt, arg)

It requires that the fmt be a string literal, but it saves a lot of code
duplication. I'm sure there are some more examples of this around as
well.

-- Dave

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