boot tagging: minor fixes
msgbufinit may be called multiple times as we initialize the msgbuf into a progressively larger buffer. This doesn't happen as of now on head, but it may happen in the future and we generally support this. As such, only print the boot tag if we've just initialized the buffer for the first time. The boot tag also now has a newline appended to it for better visibility, and has been switched to a normal printf, by requesto f bde, after we've denoted that the msgbuf is mapped.
This commit is contained in:
parent
3d19db5dfb
commit
170bc29131
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=337579
@ -1033,20 +1033,24 @@ void
|
||||
msgbufinit(void *ptr, int size)
|
||||
{
|
||||
char *cp;
|
||||
static struct msgbuf *oldp = NULL;
|
||||
static struct msgbuf *oldp;
|
||||
bool print_boot_tag;
|
||||
|
||||
oldp = NULL;
|
||||
size -= sizeof(*msgbufp);
|
||||
cp = (char *)ptr;
|
||||
print_boot_tag = !msgbufmapped;
|
||||
/* Attempt to fetch kern.boot_tag tunable on first mapping */
|
||||
if (!msgbufmapped)
|
||||
TUNABLE_STR_FETCH("kern.boot_tag", current_boot_tag,
|
||||
sizeof(current_boot_tag));
|
||||
msgbufp = (struct msgbuf *)(cp + size);
|
||||
msgbuf_reinit(msgbufp, cp, size);
|
||||
msgbuf_addstr(msgbufp, -1, current_boot_tag, 0);
|
||||
if (msgbufmapped && oldp != msgbufp)
|
||||
msgbuf_copy(oldp, msgbufp);
|
||||
msgbufmapped = true;
|
||||
if (print_boot_tag)
|
||||
printf("%s\n", current_boot_tag);
|
||||
oldp = msgbufp;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user