/*
 * Copyright (c) 2026, Chloe M.
 * Provided under the BSD-3 clause.
 *
 * Description:  Object manager init funcs
 * Author:       Chloe M.
 */

#include <ob/object.h>
#include <ob/cache.h>
#include <ex/trace.h>
#include <ke/knot.h>

#define DTRACE(Fmt, ...) \
    TRACE("[ OB ]: " Fmt, ##__VA_ARGS__)

/* Globals */
static ST_OBJECT *RootDirectory;
OBJECT_CACHE gObCache;

VOID
ObInitManager(VOID)
{
    ST_STATUS Status;

    ObInitCache(&gObCache);
    Status = ObCreateDirectory(
        "/",
        &RootDirectory
    );

    if (Status != STATUS_SUCCESS) {
        KeKnot(KNOT_MISC, "failed to initialize object manager\n");
    }

    DTRACE("mounted root at '/'\n");
}
