Skip to content

Commit 0f0d0a7

Browse files
mhiramatrostedt
authored andcommitted
tools/bootconfig: Show the number of bootconfig nodes
Show the number of bootconfig nodes when applying new bootconfig to initrd. Since there are limitations of bootconfig not only in its filesize, but also the number of nodes, the number should be shown when applying so that user can get the feeling of scale of current bootconfig. Link: http://lkml.kernel.org/r/158091061337.27924.10886706631693823982.stgit@devnote2 Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 597c0e3 commit 0f0d0a7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/bootconfig.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,8 @@ void __init xbc_destroy_all(void)
728728
*
729729
* This parses the boot config text in @buf. @buf must be a
730730
* null terminated string and smaller than XBC_DATA_MAX.
731-
* Return 0 if succeeded, or -errno if there is any error.
731+
* Return the number of stored nodes (>0) if succeeded, or -errno
732+
* if there is any error.
732733
*/
733734
int __init xbc_init(char *buf)
734735
{
@@ -788,6 +789,8 @@ int __init xbc_init(char *buf)
788789

789790
if (ret < 0)
790791
xbc_destroy_all();
792+
else
793+
ret = xbc_node_num;
791794

792795
return ret;
793796
}

tools/bootconfig/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ int apply_xbc(const char *path, const char *xbc_path)
268268
return ret;
269269
}
270270
printf("Apply %s to %s\n", xbc_path, path);
271+
printf("\tNumber of nodes: %d\n", ret);
271272
printf("\tSize: %u bytes\n", (unsigned int)size);
272273
printf("\tChecksum: %d\n", (unsigned int)csum);
273274

0 commit comments

Comments
 (0)