[irqbalance] Re: [RFC][PATCH 4/5] log: sane version of systemd-journal loglevels

  • From: Neil Horman <nhorman@xxxxxxxxxxxxx>
  • To: irqbalance@xxxxxxxxxxxxx
  • Date: Tue, 3 Mar 2015 14:19:52 -0500

On Tue, Mar 03, 2015 at 01:30:37PM -0500, Andrej Manduch wrote:
> Hi,
> 
> That's weird because it seems to be working for me
> 
> burlak@borg /m/c/irqbalance (master) $ git pull
> Already up-to-date.
> burlak@borg /m/c/irqbalance (master) $ git checkout -b test-patchet-journal
> Switched to a new branch 'test-patchet-journal'
> burlak@borg /m/c/irqbalance (test-patchet-journal) $ git log -n1
> commit d97006c50cd8024a9b308f371c37cdc8ced32cd7
> Merge: eeb1ea9 856435e
> Author: Neil Horman <nhorman@xxxxxxxxx>
> Date:   Thu Jan 22 09:32:06 2015 -0500
> 
>     Merge pull request #16 from yangoliver/pci
> 
>     Follow latest PCI class code spec
> burlak@borg /m/c/irqbalance (test-patchet-journal) $ git am
> \[RFC\]\[PATCH\ 1_5\]\ Added\ option\ for\ journal-style\ logging.eml
> Applying: Added option for journal-style logging
> burlak@borg /m/c/irqbalance (test-patchet-journal) $ git am
> \[irqbalance\]\ \[RFC\]\[PATCH\ 2_5\]\ Optimized\ indentation\ for\
> systemd\ journal.eml
> Applying: Optimized indentation for systemd journal
> burlak@borg /m/c/irqbalance (test-patchet-journal) $ git am
> \[RFC\]\[PATCH\ 3_5\]\ log\:\ added\ support\ for\ systemd-journal\
> loglevels.eml
> Applying: log: added support for systemd-journal loglevels
> burlak@borg /m/c/irqbalance (test-patchet-journal) $ git am
> \[irqbalance\]\ \[RFC\]\[PATCH\ 4_5\]\ log\:\ sane\ version\ of\
> systemd-journal\ loglevels.eml
> Applying: log: sane version of systemd-journal loglevels
> burlak@borg /m/c/irqbalance (test-patchet-journal) $ git am
> \[irqbalance\]\ \[RFC\]\[PATCH\ 5_5\]\ log\:\ systemd-style\ logs\ are\
> handled\ by\ systemd-lib.eml
> Applying: log: systemd-style logs are handled by systemd-lib
> 
> 
> 
> Did you applied it in correct order ?
> 
Yeah, I reversed 4 and 5 to put them in the correct order.  Let me try again
Neil

> 
> On 03/03/2015 01:24 PM, Neil Horman wrote:
> > On Tue, Mar 03, 2015 at 01:06:10PM -0500, Andrej Manduch wrote:
> >> I dropped support of partial lines when logging but
> >> log macro now looks way mor nicier.
> >>
> >> Signed-off-by: Andrej Manduch <amanduch@xxxxxxxxx>
> > This patch doesn't seem to apply against the upstream head.  Can you respin 
> > it
> > please?
> > 
> > Thanks!
> > Neil
> > 
> >> ---
> >>  cputree.c    |  9 ++++++---
> >>  irqbalance.c |  9 ---------
> >>  irqbalance.h | 12 ++----------
> >>  3 files changed, 8 insertions(+), 22 deletions(-)
> >>
> >> diff --git a/cputree.c b/cputree.c
> >> index df40d1a..8b8cf5e 100644
> >> --- a/cputree.c
> >> +++ b/cputree.c
> >> @@ -294,10 +294,13 @@ static void dump_irq(struct irq_info *info, void 
> >> *data)
> >>  {
> >>    int spaces = (long int)data;
> >>    int i;
> >> -  char indent_char[2] = {log_indent[0], '\0'};
> >> +  char * indent = malloc (sizeof(char) * (spaces + 1));
> >>  
> >> -  for (i=0; i<spaces; i++) log(TO_CONSOLE, LOG_INFO, indent_char);
> >> -  log(TO_CONSOLE, LOG_INFO, "Interrupt %i node_num is %d (%s/%u) \n",
> >> +  for ( i = 0; i < spaces; i++ )
> >> +          indent[i] = log_indent[0];
> >> +
> >> +  indent[i] = '\0';
> >> +  log(TO_CONSOLE, LOG_INFO, "%sInterrupt %i node_num is %d (%s/%u) \n", 
> >> indent,
> >>        info->irq, irq_numa_node(info)->number, classes[info->class], 
> >> (unsigned int)info->load);
> >>  }
> >>  
> >> diff --git a/irqbalance.c b/irqbalance.c
> >> index 60f5411..f25e9a9 100644
> >> --- a/irqbalance.c
> >> +++ b/irqbalance.c
> >> @@ -59,11 +59,6 @@ char *banscript = NULL;
> >>  char *polscript = NULL;
> >>  long HZ;
> >>  
> >> -#ifdef HAVE_SYSTEMD
> >> -  char *line_buffer_7ee22e61_f183;
> >> -  char *log_buffer_4c93_8665;
> >> -#endif /* HAVE_SYSTEMD */
> >> -
> >>  static void sleep_approx(int seconds)
> >>  {
> >>    struct timespec ts;
> >> @@ -264,10 +259,6 @@ int main(int argc, char** argv)
> >>    sigaddset(&sigset,SIGUSR1);
> >>    sigaddset(&sigset,SIGUSR2);
> >>    sigprocmask(SIG_BLOCK, &sigset, &old_sigset);
> >> -#ifdef HAVE_SYSTEMD
> >> -  line_buffer_7ee22e61_f183 = malloc(sizeof(char) * 2048);
> >> -  log_buffer_4c93_8665 = malloc(sizeof(char) * 2048);
> >> -#endif /* HAVE_SYSTEMD */
> >>  #ifdef HAVE_GETOPT_LONG
> >>    parse_command_line(argc, argv);
> >>  #else /* ! HAVE_GETOPT_LONG */
> >> diff --git a/irqbalance.h b/irqbalance.h
> >> index c301427..98d2193 100644
> >> --- a/irqbalance.h
> >> +++ b/irqbalance.h
> >> @@ -138,18 +138,10 @@ static inline void for_each_object(GList *list, void 
> >> (*cb)(struct topo_obj *obj,
> >>  extern char * log_indent;
> >>  extern unsigned int log_mask;
> >>  #ifdef HAVE_SYSTEMD
> >> -extern char *line_buffer_7ee22e61_f183;
> >> -extern char *log_buffer_4c93_8665;
> >>  #define log(mask, lvl, fmt, args...) do {                                 
> >> \
> >>    if (journal_logging) {                                                  
> >> \
> >> -          sprintf(log_buffer_4c93_8665,fmt, ##args);                      
> >> \
> >> -          strcat(line_buffer_7ee22e61_f183, log_buffer_4c93_8665);        
> >> \
> >> -          if 
> >> (line_buffer_7ee22e61_f183[strlen(line_buffer_7ee22e61_f183)-1]\
> >> -               == '\n' || strlen(line_buffer_7ee22e61_f183) > 256 ) {     
> >> \
> >> -                  printf("<%d>%s", lvl, line_buffer_7ee22e61_f183);       
> >> \
> >> -                  line_buffer_7ee22e61_f183[0] = '\0';                    
> >> \
> >> -                  line_buffer_7ee22e61_f183[0] = '\0';                    
> >> \
> >> -          }                                                               
> >> \
> >> +          printf("<%d>", lvl);                                            
> >> \
> >> +          printf(fmt, ##args);                                            
> >> \
> >>    } else {                                                                
> >> \
> >>            if (log_mask & mask & TO_SYSLOG)                                
> >> \
> >>                    syslog(lvl, fmt, ##args);                               
> >> \
> >> -- 
> >> 2.1.0
> >>
> >>
> >>
> > 
> 
> -- 
> Kind regards,
> b.
> 
> 

Other related posts: