Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed8a7d84 authored by Colin Cross's avatar Colin Cross
Browse files

init: Move list and log handling to list.h and log.h

Change-Id: I298f575c590d0f28b7ad78747f3ebdbba56b7a27
parent 12541c61
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "devices.h"
#include "parser.h"
#include "util.h"
#include "log.h"

#include <private/android_filesystem_config.h>

+2 −1
Original line number Diff line number Diff line
@@ -32,9 +32,10 @@
#include <sys/time.h>
#include <asm/page.h>

#include "init.h"
#include "devices.h"
#include "util.h"
#include "log.h"
#include "list.h"

#define CMDLINE_PREFIX  "/dev"
#define SYSFS_PREFIX    "/sys"
+2 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@

#include "devices.h"
#include "init.h"
#include "list.h"
#include "log.h"
#include "property_service.h"
#include "bootchart.h"
#include "signal_handler.h"
+2 −39
Original line number Diff line number Diff line
@@ -17,46 +17,9 @@
#ifndef _INIT_INIT_H
#define _INIT_INIT_H

void handle_control_message(const char *msg, const char *arg);

void log_init(void);
void log_set_level(int level);
void log_close(void);
void log_write(int level, const char *fmt, ...)
    __attribute__ ((format(printf, 2, 3)));

#define ERROR(x...)   log_write(3, "<3>init: " x)
#define NOTICE(x...)  log_write(5, "<5>init: " x)
#define INFO(x...)    log_write(6, "<6>init: " x)

#define LOG_DEFAULT_LEVEL  3  /* messages <= this level are logged */
#define LOG_UEVENTS        0  /* log uevent messages if 1. verbose */

struct listnode
{
    struct listnode *next;
    struct listnode *prev;
};

#define node_to_item(node, container, member) \
    (container *) (((char*) (node)) - offsetof(container, member))

#define list_declare(name) \
    struct listnode name = { \
        .next = &name, \
        .prev = &name, \
    }
#include "list.h"

#define list_for_each(node, list) \
    for (node = (list)->next; node != (list); node = node->next)

void list_init(struct listnode *list);
void list_add_tail(struct listnode *list, struct listnode *item);
void list_remove(struct listnode *item);

#define list_empty(list) ((list) == (list)->next)
#define list_head(list) ((list)->next)
#define list_tail(list) ((list)->prev)
void handle_control_message(const char *msg, const char *arg);

struct command
{
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/keychord.h>

#include "init.h"
#include "log.h"
#include "property_service.h"

static struct input_keychord *keychords = 0;
Loading