On Mon, Feb 07, 2005 at 01:21:08PM -0600, Michael Halcrow wrote:
> This is the first in a series of eight patches to the BSD Secure
> Levels LSM.  It overhauls the printk mechanism in order to reduce the
> unnecessary usage of the .text area.  Thanks to Brad Spengler for the
> suggestion.
> 
> Signed off by: Michael Halcrow <[EMAIL PROTECTED]>

> Index: linux-2.6.11-rc2-mm1-modules/security/seclvl.c
> ===================================================================
> --- linux-2.6.11-rc2-mm1-modules.orig/security/seclvl.c       2005-02-03 
> 14:55:44.799527472 -0600
> +++ linux-2.6.11-rc2-mm1-modules/security/seclvl.c    2005-02-03 
> 14:56:18.527400056 -0600
> @@ -101,22 +101,20 @@
>  
>  #define MY_NAME "seclvl"
>  
> -/**
> - * This time-limits log writes to one per second.
> - */
> -#define seclvl_printk(verb, type, fmt, arg...)                       \
> -     do {                                                    \
> -             if (verbosity >= verb) {                        \
> -                     static unsigned long _prior;            \
> -                     unsigned long _now = jiffies;           \
> -                     if ((_now - _prior) > HZ) {             \
> -                             printk(type "%s: %s: " fmt,     \
> -                                     MY_NAME, __FUNCTION__ , \
> -                                     ## arg);                \
> -                             _prior = _now;                  \
> -                     }                                       \
> -             }                                               \
> -     } while (0)
> +static void seclvl_printk( int verb, const char * fmt, ... )
> +{
> +     va_list args;
> +     va_start( args, fmt );
> +     if (verbosity >= verb) {
> +             static unsigned long _prior;
> +             unsigned long _now = jiffies;
> +             if ((_now - _prior) > HZ) {
> +                     vprintk( fmt, args );
> +             }
> +             _prior = _now;
> +     }
> +     va_end( args );
> +}

This could be done with a seclvl_printk macro wrapping a
__seclvl_printk function that provides __FUNCTION__, leaving the
callers the same.

-- 
Mathematics is the supreme nostalgia of our time.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to