Skip to contentSkip to conversation

OBFrom 465b6d8ab9132bab0d8bab5d471d7ad6a9614b62 Mon Sep 17 00:00:00 2001

PATCH Martin Kletzander 1 participant 1 message Sep 29, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Move all pointer-formatting documentation to one place in the code and one place in the documentation instead of keeping it in three places with different level of completeness. Documentation/printk-formats.txt has detailed information about each modifier, docstring above pointer() has short descriptions of %p (as that is the function dealing with %p) and docstring above vsprintf() references pointer() for %p* modifiers and Documentation/printk-formats.txt for all of them. The only other difference to C99 (apart from %p modifications) is the handling of %n. Both docstrings in the code were modified are updated with a reminder of updating the documentation upon any further change.

---
v3:
- Don't mess up %n into %pn
- Minor clean-ups

v2:
- Keep brief documentation in the docstring for pointer()

 Documentation/printk-formats.txt | 29 ++++++++++++++++++++++++++++
 lib/vsprintf.c                   | 41 ++++++++--------------------------------
 2 files changed, 37 insertions(+), 33 deletions(-)
Documentation/printk-formats.txt +29 -0
index 2ec6d84f391c..f6d1ab6b1165 100644
@@ -119,6 +119,7 @@ Raw buffer as an escaped string:
 	If field width is omitted the 1 byte only will be escaped.
 
 Raw buffer as a hex string:
+
 	%*ph	00 01 02  ...  3f
 	%*phC	00:01:02: ... :3f
 	%*phD	00-01-02- ... -3f
@@ -234,6 +235,7 @@ UUID/GUID addresses:
 	Passed by reference.
 
 dentry names:
+
 	%pd{,2,3,4}
 	%pD{,2,3,4}
 
@@ -264,6 +266,8 @@ struct va_format:
 		va_list *va;
 	};
 
+	Implements a "recursive vsnprintf".
+
 	Do not use this feature without some mechanism to verify the
 	correctness of the format string and va_list arguments.
 
@@ -292,6 +296,31 @@ bitmap and its derivatives such as cpumask and nodemask:
 
 	Passed by reference.
 
+Network device features:
+
+	%pNF	0x000000000000c000
+
+	For printing netdev_features_t.
+
+	Passed by reference.
+
+Command from struct task_struct
+
+	%pT	ls
+
+	For printing executable name excluding path from struct
+	task_struct.
+
+	Passed by reference.
+
+Ignored argument:
+
+	%n	%n
+
+	The argument passed will be ignored.  In other words, literal "%n" will
+	be in the output and the argument will be considered for next format
+	specifier.
+
 Thank you for your cooperation and attention.
 
 
lib/vsprintf.c +8 -33

55 lines not on this page · raw message

--
2.5.3