Skip to contentSkip to conversation

introduce pr_cont macro

RFC In review Cyrill Gorcunov 4 participants 11 messages Feb 25, 2009 – Feb 26, 2009

lore
Share & tools
lore
#0 lore raw

RFC 1/1 introduce pr_cont macro

We cover all log-levels by pr_... macros except KERN_CONT one. Add it for convenience.

---

I think start printing with some pr_... macro and continue with printk(KERN_CONT ...) look not that clear -- better to continue with same pr_... slogan. Thoughts? I hope I didn't miss anything.

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/kernel.h +2 -0
Index: linux-2.6.git/include/linux/kernel.h
===================================================================
@@ -370,6 +370,8 @@ static inline char *pack_hex_byte(char *
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+        printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
 
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(DEBUG)
Acked-by on v1 1/1
#1 lore raw
Quoted 20 lines · Cyrill Gorcunov

We cover all log-levels by pr_... macros except KERN_CONT one. Add it for convenience.

---

I think start printing with some pr_... macro and continue with printk(KERN_CONT ...) look not that clear -- better to continue with same pr_... slogan. Thoughts? I hope I didn't miss anything.

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.git/include/linux/kernel.h
===================================================================

include/linux/kernel.h static inline char *pack_hex_byte(char * · line 374

Quoted 5 lines
include/linux/kernel.h +2 -0
@@ -370,6 +370,8 @@ static inline char *pack_hex_byte(char *
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+        printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)

Makes sense.

Ingo

#2 lore raw
Quoted 30 lines · Ingo Molnar
Quoted 20 lines · Cyrill Gorcunov

We cover all log-levels by pr_... macros except KERN_CONT one. Add it for convenience.

---

I think start printing with some pr_... macro and continue with printk(KERN_CONT ...) look not that clear -- better to continue with same pr_... slogan. Thoughts? I hope I didn't miss anything.

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.git/include/linux/kernel.h
===================================================================

include/linux/kernel.h static inline char *pack_hex_byte(char * · line 374

Quoted 5 lines
include/linux/kernel.h +2 -0
@@ -370,6 +370,8 @@ static inline char *pack_hex_byte(char *
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+        printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)

Makes sense.

Quoted 2 lines

Don't you want to omit the pr_fmt() from the KERN_CONT case?

Harvey

#3 lore raw
Quoted 31 lines · Harvey Harrison
Quoted 30 lines · Ingo Molnar
Quoted 20 lines · Cyrill Gorcunov

We cover all log-levels by pr_... macros except KERN_CONT one. Add it for convenience.

---

I think start printing with some pr_... macro and continue with printk(KERN_CONT ...) look not that clear -- better to continue with same pr_... slogan. Thoughts? I hope I didn't miss anything.

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.git/include/linux/kernel.h
===================================================================

include/linux/kernel.h static inline char *pack_hex_byte(char * · line 374

Quoted 5 lines
include/linux/kernel.h +2 -0
@@ -370,6 +370,8 @@ static inline char *pack_hex_byte(char *
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+        printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)

Makes sense.

Quoted 4 lines
Quoted 2 lines

Don't you want to omit the pr_fmt() from the KERN_CONT case?

indeed, good catch. It should be:

#define pr_cont(fmt, ...) \
	printk(KERN_CONT ##__VA_ARGS__)

To not introduce stale subsystem tags in the printout. Perhaps it should even be:

#define __pr_cont(fmt, ...) \
	printk(KERN_CONT ##__VA_ARGS__)

To make it stand out more clearly that this is special.

Ingo

#4 lore raw
Quoted 36 lines · Ingo Molnar
Quoted 34 lines · Harvey Harrison
Quoted 32 lines · Ingo Molnar
Quoted 20 lines · Cyrill Gorcunov

We cover all log-levels by pr_... macros except KERN_CONT one. Add it for convenience.

---

I think start printing with some pr_... macro and continue with printk(KERN_CONT ...) look not that clear -- better to continue with same pr_... slogan. Thoughts? I hope I didn't miss anything.

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.git/include/linux/kernel.h
===================================================================

include/linux/kernel.h static inline char *pack_hex_byte(char * · line 374

Quoted 5 lines
include/linux/kernel.h +2 -0
@@ -370,6 +370,8 @@ static inline char *pack_hex_byte(char *
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+        printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)

Makes sense.

Quoted 6 lines
Quoted 1 line

Don't you want to omit the pr_fmt() from the KERN_CONT case?

indeed, good catch. It should be:

#define pr_cont(fmt, ...) \
	printk(KERN_CONT ##__VA_ARGS__)

Missing fmt entirely?

Harvey

#5 lore raw
Quoted 37 lines · Harvey Harrison
Quoted 36 lines · Ingo Molnar
Quoted 34 lines · Harvey Harrison
Quoted 32 lines · Ingo Molnar
Quoted 20 lines · Cyrill Gorcunov

We cover all log-levels by pr_... macros except KERN_CONT one. Add it for convenience.

---

I think start printing with some pr_... macro and continue with printk(KERN_CONT ...) look not that clear -- better to continue with same pr_... slogan. Thoughts? I hope I didn't miss anything.

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.git/include/linux/kernel.h
===================================================================

include/linux/kernel.h static inline char *pack_hex_byte(char * · line 374

Quoted 5 lines
include/linux/kernel.h +2 -0
@@ -370,6 +370,8 @@ static inline char *pack_hex_byte(char *
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+        printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)

Makes sense.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Don't you want to omit the pr_fmt() from the KERN_CONT case?

indeed, good catch. It should be:

#define pr_cont(fmt, ...) \
	printk(KERN_CONT ##__VA_ARGS__)

Missing fmt entirely?

yeah ...

Btw., why do those macros use ##__VA_ARGS__ ? Why not a straightforward:

#define __pr_cont(args...) \
printk(KERN_CONT args)

?

Ingo

#6 lore raw
Quoted 54 lines · Ingo Molnar
Quoted 37 lines · Harvey Harrison
Quoted 36 lines · Ingo Molnar
Quoted 34 lines · Harvey Harrison
Quoted 32 lines · Ingo Molnar
Quoted 20 lines · Cyrill Gorcunov

We cover all log-levels by pr_... macros except KERN_CONT one. Add it for convenience.

---

I think start printing with some pr_... macro and continue with printk(KERN_CONT ...) look not that clear -- better to continue with same pr_... slogan. Thoughts? I hope I didn't miss anything.

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.git/include/linux/kernel.h
===================================================================

include/linux/kernel.h static inline char *pack_hex_byte(char * · line 374

Quoted 5 lines
include/linux/kernel.h +2 -0
@@ -370,6 +370,8 @@ static inline char *pack_hex_byte(char *
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+        printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)

Makes sense.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Don't you want to omit the pr_fmt() from the KERN_CONT case?

indeed, good catch. It should be:

#define pr_cont(fmt, ...) \
	printk(KERN_CONT ##__VA_ARGS__)

Missing fmt entirely?

yeah ...

Btw., why do those macros use ##__VA_ARGS__ ? Why not a straightforward:

Quoted 6 lines

#define __pr_cont(args...) \
printk(KERN_CONT args)

?

Ingo

Grr... Thanks for catching me! Ingo, Harvey could you drop this patch and make new one in good shape?

#7 lore raw
Quoted 1 line · Cyrill Gorcunov

On 2/26/09, Ingo Molnar <[email protected]> wrote:

...

Quoted 7 lines
Quoted 7 lines

Btw., why do those macros use ##__VA_ARGS__ ? Why not a straightforward:

#define __pr_cont(args...) \
printk(KERN_CONT args)

Quoted 7 lines
Quoted 3 lines

?

Ingo

Grr... Thanks for catching me! Ingo, Harvey could you drop this patch and make new one in good shape?

I'll make new one today evening then. Drop all this. Thanks!

#8 lore raw
In reply to Ingo Molnar
Quoted 6 lines · Ingo Molnar

Btw., why do those macros use ##__VA_ARGS__ ? Why not a straightforward:

#define __pr_cont(args...) \
printk(KERN_CONT args)

Don't know if anyone cares, but __VA_ARGS__ is C99 whereas args... is a gcc extension, AFAIK.

-hpa

#9 lore raw
Quoted 4 lines · H. Peter Anvin
Quoted 3 lines · Ingo Molnar

Btw., why do those macros use ##__VA_ARGS__ ? Why not a straightforward:

Quoted 9 lines
Quoted 3 lines

#define __pr_cont(args...) \
printk(KERN_CONT args)

Don't know if anyone cares, but __VA_ARGS__ is C99 whereas args... is a gcc extension, AFAIK.

-hpa

I think in a sake of consistency better would be using __VA_ARGS__ here too (since all prevous pr_...'s use it).

#10 lore raw
In reply to H. Peter Anvin

[H. Peter Anvin - Wed, Feb 25, 2009 at 09:28:57PM -0800]

Quoted 5 lines
Quoted 4 lines · Ingo Molnar

Btw., why do those macros use ##__VA_ARGS__ ? Why not a straightforward:

Quoted 9 lines
Quoted 3 lines

#define __pr_cont(args...) \
printk(KERN_CONT args)

Don't know if anyone cares, but __VA_ARGS__ is C99 whereas args... is a gcc extension, AFAIK.

-hpa

This one should be fine.

- Cyrill -
---

Subject: [PATCH] introduce pr_cont macro v2

We cover all log-levels by pr_... macros except
KERN_CONT one. Add it for convenience.

---

Using 'fmt' here make this macro look similar
to others (same missioned) macros. Which is
good :)

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/kernel.h +2 -0
Index: linux-2.6.git/include/linux/kernel.h
===================================================================
@@ -370,6 +370,8 @@ static inline char *pack_hex_byte(char *
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+        printk(KERN_CONT fmt, ##__VA_ARGS__)
 
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(DEBUG)