summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-03-04 20:00:15 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-05 16:28:06 +0100
commit26224692c14d25291b0bf7fee72c9988b2060fea (patch)
treece453f0e09c1359f18dce695dfc681be62435ae2 /lib
parent8d242311041cc0224cc1bab2634723233e25a12f (diff)
downloadbarebox-26224692c14d25291b0bf7fee72c9988b2060fea.tar.gz
barebox-26224692c14d25291b0bf7fee72c9988b2060fea.tar.xz
lib: vsprintf: align documentation with current feature set
The documentation lists modifiers unsupported by barebox and lacks modifiers that are actually supported. Align the documentation with the currently supported feature set and reorder it to the same order used inside the pointer() main switch statement. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-91-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b12d04e378..4458616e44 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -472,8 +472,6 @@ char *device_node_string(char *buf, const char *end, const struct device_node *n
*
* Right now we handle:
*
- * - 'I' [4] for IPv4 addresses printed in the usual way
- * IPv4 uses dot-separated decimal without leading 0's (1.2.3.4)
* - 'S' For symbolic direct pointers
* - 'U' For a 16 byte UUID/GUID, it prints the UUID/GUID in the form
* "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
@@ -493,12 +491,18 @@ char *device_node_string(char *buf, const char *end, const struct device_node *n
* correctness of the format string and va_list arguments.
* - 'a[pd]' For address types [p] phys_addr_t, [d] dma_addr_t and derivatives
* (default assumed to be phys_addr_t, passed by reference)
+ * - 'I' [4] for IPv4 addresses printed in the usual way
+ * IPv4 uses dot-separated decimal without leading 0's (1.2.3.4)
+ * - 'e' For formatting error pointers as string descriptions
+ * - 'OF' For a device tree node
+ * - 'h[CDN]' For a variable-length buffer, it prints it as a hex string with
+ * a certain separator (' ' by default):
+ * C colon
+ * D dash
+ * N no separator
+ * - 'JP' For a JSON path
* - 'M' For a 6-byte MAC address, it prints the address in the
* usual colon-separated hex notation
- *
- * Note: The difference between 'S' and 'F' is that on ia64 and ppc64
- * function pointers are really function descriptors, which contain a
- * pointer to the real address.
*/
static char *pointer(const char *fmt, char *buf, const char *end, const void *ptr,
int field_width, int precision, int flags)
@@ -573,10 +577,11 @@ static char *errno_string(char *buf, const char *end, int field_width, int preci
* @fmt: The format string to use
* @args: Arguments for the format string
*
- * This function follows C99 vsnprintf, but has some extensions:
- * %pS output the name of a text symbol
- * %pF output the name of a function pointer
- * %pR output the address range in a struct resource
+ * This function generally follows C99 vsnprintf, but has some
+ * extensions and a few limitations:
+ *
+ * - ``%n`` is unsupported
+ * - ``%p*`` is handled by pointer()
*
* The return value is the number of characters which would
* be generated for the given input, excluding the trailing