Re: [PATCH 5/6] dyndbg: in dynamic_emit_prefix, change inter-field separator

2012-09-24 Thread Jason Baron
On Tue, Sep 18, 2012 at 07:56:42PM -0700, Joe Perches wrote:
> On Tue, 2012-09-18 at 17:36 -0600, Jim Cromie wrote:
> > dynamic_emit_prefix() currently separates modname, funcname, lineno
> > with ':'.  This is confounds use of cut -d: , since the field
> > positions can change per callsite with dynamic-debug.  So change
> > inter-field separator to '.' and keep the ':' prefix terminator.
> > 
> > This improves the situation, but doesnt solve it entirely; if
> > dyndbg==p is used instead of dyndbg==p[fmlt]+, the callsite is enabled
> > but no prefix is added, so theres one less ':' in the message.
> > Changing the terminator to ',' would fix this, and might be warranted,
> > especially since pr_fmt() typically adds a ':' as well.
> > 
> > Joe Perches wasnt a fan of this, but his complaint was essentially
> > that cut -d: was a poor way to do this kind of thing.  I concede that
> > point, but note that the kernel is not in the habit of needlessly
> > confounding users work, at least when accommodating them is so trivial.
> 
> And I still think this is ugly as it requires different parsing
> by scripts when using combinations of +pfmlt
> 
> 

If this patch doesn't 'solve it entirely', I'm reluctant to ack it,
Would brackets, such as {} around the optional prefix be reasonable?

Thanks,

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


Re: [PATCH 5/6] dyndbg: in dynamic_emit_prefix, change inter-field separator

2012-09-24 Thread Jason Baron
On Tue, Sep 18, 2012 at 07:56:42PM -0700, Joe Perches wrote:
 On Tue, 2012-09-18 at 17:36 -0600, Jim Cromie wrote:
  dynamic_emit_prefix() currently separates modname, funcname, lineno
  with ':'.  This is confounds use of cut -d: logfile, since the field
  positions can change per callsite with dynamic-debug.  So change
  inter-field separator to '.' and keep the ':' prefix terminator.
  
  This improves the situation, but doesnt solve it entirely; if
  dyndbg==p is used instead of dyndbg==p[fmlt]+, the callsite is enabled
  but no prefix is added, so theres one less ':' in the message.
  Changing the terminator to ',' would fix this, and might be warranted,
  especially since pr_fmt() typically adds a ':' as well.
  
  Joe Perches wasnt a fan of this, but his complaint was essentially
  that cut -d: was a poor way to do this kind of thing.  I concede that
  point, but note that the kernel is not in the habit of needlessly
  confounding users work, at least when accommodating them is so trivial.
 
 And I still think this is ugly as it requires different parsing
 by scripts when using combinations of +pfmlt
 
 

If this patch doesn't 'solve it entirely', I'm reluctant to ack it,
Would brackets, such as {} around the optional prefix be reasonable?

Thanks,

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


Re: [PATCH 5/6] dyndbg: in dynamic_emit_prefix, change inter-field separator

2012-09-18 Thread Joe Perches
On Tue, 2012-09-18 at 17:36 -0600, Jim Cromie wrote:
> dynamic_emit_prefix() currently separates modname, funcname, lineno
> with ':'.  This is confounds use of cut -d: , since the field
> positions can change per callsite with dynamic-debug.  So change
> inter-field separator to '.' and keep the ':' prefix terminator.
> 
> This improves the situation, but doesnt solve it entirely; if
> dyndbg==p is used instead of dyndbg==p[fmlt]+, the callsite is enabled
> but no prefix is added, so theres one less ':' in the message.
> Changing the terminator to ',' would fix this, and might be warranted,
> especially since pr_fmt() typically adds a ':' as well.
> 
> Joe Perches wasnt a fan of this, but his complaint was essentially
> that cut -d: was a poor way to do this kind of thing.  I concede that
> point, but note that the kernel is not in the habit of needlessly
> confounding users work, at least when accommodating them is so trivial.

And I still think this is ugly as it requires different parsing
by scripts when using combinations of +pfmlt


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


[PATCH 5/6] dyndbg: in dynamic_emit_prefix, change inter-field separator

2012-09-18 Thread Jim Cromie
dynamic_emit_prefix() currently separates modname, funcname, lineno
with ':'.  This is confounds use of cut -d: , since the field
positions can change per callsite with dynamic-debug.  So change
inter-field separator to '.' and keep the ':' prefix terminator.

This improves the situation, but doesnt solve it entirely; if
dyndbg==p is used instead of dyndbg==p[fmlt]+, the callsite is enabled
but no prefix is added, so theres one less ':' in the message.
Changing the terminator to ',' would fix this, and might be warranted,
especially since pr_fmt() typically adds a ':' as well.

Joe Perches wasnt a fan of this, but his complaint was essentially
that cut -d: was a poor way to do this kind of thing.  I concede that
point, but note that the kernel is not in the habit of needlessly
confounding users work, at least when accommodating them is so trivial.

cc: Joe Perches 
Signed-off-by: Jim Cromie 
---
 lib/dynamic_debug.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 11a8897..f1f7467 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -556,16 +556,18 @@ static char *dynamic_emit_prefix(const struct _ddebug 
*desc, char *buf)
}
pos_after_tid = pos;
if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME)
-   pos += snprintf(buf + pos, remaining(pos), "%s:",
+   pos += snprintf(buf + pos, remaining(pos), "%s.",
desc->modname);
if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
-   pos += snprintf(buf + pos, remaining(pos), "%s:",
+   pos += snprintf(buf + pos, remaining(pos), "%s.",
desc->function);
if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO)
-   pos += snprintf(buf + pos, remaining(pos), "%d:",
+   pos += snprintf(buf + pos, remaining(pos), "%d.",
desc->lineno);
-   if (pos - pos_after_tid)
-   pos += snprintf(buf + pos, remaining(pos), " ");
+   if (pos - pos_after_tid) {
+   pos--;
+   pos += snprintf(buf + pos, remaining(pos), ": ");
+   }
if (pos >= PREFIX_SIZE)
buf[PREFIX_SIZE - 1] = '\0';
 
-- 
1.7.11.4

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


[PATCH 5/6] dyndbg: in dynamic_emit_prefix, change inter-field separator

2012-09-18 Thread Jim Cromie
dynamic_emit_prefix() currently separates modname, funcname, lineno
with ':'.  This is confounds use of cut -d: logfile, since the field
positions can change per callsite with dynamic-debug.  So change
inter-field separator to '.' and keep the ':' prefix terminator.

This improves the situation, but doesnt solve it entirely; if
dyndbg==p is used instead of dyndbg==p[fmlt]+, the callsite is enabled
but no prefix is added, so theres one less ':' in the message.
Changing the terminator to ',' would fix this, and might be warranted,
especially since pr_fmt() typically adds a ':' as well.

Joe Perches wasnt a fan of this, but his complaint was essentially
that cut -d: was a poor way to do this kind of thing.  I concede that
point, but note that the kernel is not in the habit of needlessly
confounding users work, at least when accommodating them is so trivial.

cc: Joe Perches j...@perches.com
Signed-off-by: Jim Cromie jim.cro...@gmail.com
---
 lib/dynamic_debug.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 11a8897..f1f7467 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -556,16 +556,18 @@ static char *dynamic_emit_prefix(const struct _ddebug 
*desc, char *buf)
}
pos_after_tid = pos;
if (desc-flags  _DPRINTK_FLAGS_INCL_MODNAME)
-   pos += snprintf(buf + pos, remaining(pos), %s:,
+   pos += snprintf(buf + pos, remaining(pos), %s.,
desc-modname);
if (desc-flags  _DPRINTK_FLAGS_INCL_FUNCNAME)
-   pos += snprintf(buf + pos, remaining(pos), %s:,
+   pos += snprintf(buf + pos, remaining(pos), %s.,
desc-function);
if (desc-flags  _DPRINTK_FLAGS_INCL_LINENO)
-   pos += snprintf(buf + pos, remaining(pos), %d:,
+   pos += snprintf(buf + pos, remaining(pos), %d.,
desc-lineno);
-   if (pos - pos_after_tid)
-   pos += snprintf(buf + pos, remaining(pos),  );
+   if (pos - pos_after_tid) {
+   pos--;
+   pos += snprintf(buf + pos, remaining(pos), : );
+   }
if (pos = PREFIX_SIZE)
buf[PREFIX_SIZE - 1] = '\0';
 
-- 
1.7.11.4

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


Re: [PATCH 5/6] dyndbg: in dynamic_emit_prefix, change inter-field separator

2012-09-18 Thread Joe Perches
On Tue, 2012-09-18 at 17:36 -0600, Jim Cromie wrote:
 dynamic_emit_prefix() currently separates modname, funcname, lineno
 with ':'.  This is confounds use of cut -d: logfile, since the field
 positions can change per callsite with dynamic-debug.  So change
 inter-field separator to '.' and keep the ':' prefix terminator.
 
 This improves the situation, but doesnt solve it entirely; if
 dyndbg==p is used instead of dyndbg==p[fmlt]+, the callsite is enabled
 but no prefix is added, so theres one less ':' in the message.
 Changing the terminator to ',' would fix this, and might be warranted,
 especially since pr_fmt() typically adds a ':' as well.
 
 Joe Perches wasnt a fan of this, but his complaint was essentially
 that cut -d: was a poor way to do this kind of thing.  I concede that
 point, but note that the kernel is not in the habit of needlessly
 confounding users work, at least when accommodating them is so trivial.

And I still think this is ugly as it requires different parsing
by scripts when using combinations of +pfmlt


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