[util] Replace kutil with util

Now that kutil has no kernel-specific code in it anymore, it can
actually be linked to by anything, so I'm renaming it 'util'.

Also, I've tried to unify the way that the system libraries from
src/libraries are #included using <> instead of "".

Other small change: util::bip_buffer got a spinlock to guard against
state corruption.
This commit is contained in:
Justin C. Miller
2022-01-03 00:03:29 -08:00
parent 5f88f5ed02
commit cd9b85b555
68 changed files with 231 additions and 203 deletions

View File

@@ -1,16 +1,16 @@
#include <string.h>
#include "kutil/constexpr_hash.h"
#include "printf/printf.h"
#include <util/constexpr_hash.h>
#include "assert.h"
#include "logger.h"
#include "printf/printf.h"
namespace logs {
#define LOG(name, lvl) \
const log::area_t name = #name ## _h; \
const char * name ## _name = #name;
#include "j6/tables/log_areas.inc"
#include <j6/tables/log_areas.inc>
#undef LOG
}
@@ -42,7 +42,7 @@ logger::logger(uint8_t *buffer, size_t size, logger::immediate_cb output) :
#define LOG(name, lvl) \
register_area(logs::name, logs::name ## _name, log::level::lvl);
#include "j6/tables/log_areas.inc"
#include <j6/tables/log_areas.inc>
#undef LOG
}
@@ -89,7 +89,7 @@ logger::output(level severity, area_t area, const char *fmt, va_list args)
header->bytes +=
vsnprintf(header->message, sizeof(buffer) - sizeof(entry), fmt, args);
kutil::scoped_lock lock {m_lock};
util::scoped_lock lock {m_lock};
if (m_immediate) {
buffer[header->bytes] = 0;
@@ -117,7 +117,7 @@ logger::output(level severity, area_t area, const char *fmt, va_list args)
size_t
logger::get_entry(void *buffer, size_t size)
{
kutil::scoped_lock lock {m_lock};
util::scoped_lock lock {m_lock};
void *out;
size_t out_size = m_buffer.get_block(&out);