init/cutils: move list utility code to cutils from init
Change-Id: I357ceee813700297d8343159f22a07659e768d41 Signed-off-by: Dima Zavin <dima@android.com>
This commit is contained in:
parent
8f91282ebe
commit
da04c52ab1
11 changed files with 45 additions and 30 deletions
|
@ -14,8 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _INIT_LIST_H_
|
||||
#define _INIT_LIST_H_
|
||||
#ifndef _CUTILS_LIST_H_
|
||||
#define _CUTILS_LIST_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
|
@ -34,12 +34,12 @@
|
|||
#include <asm/page.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <cutils/list.h>
|
||||
#include <cutils/uevent.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "util.h"
|
||||
#include "log.h"
|
||||
#include "list.h"
|
||||
|
||||
#define SYSFS_PREFIX "/sys"
|
||||
#define FIRMWARE_DIR1 "/etc/firmware"
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <sys/un.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include <cutils/list.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <cutils/iosched_policy.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
|
@ -42,7 +43,6 @@
|
|||
|
||||
#include "devices.h"
|
||||
#include "init.h"
|
||||
#include "list.h"
|
||||
#include "log.h"
|
||||
#include "property_service.h"
|
||||
#include "bootchart.h"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef _INIT_INIT_H
|
||||
#define _INIT_INIT_H
|
||||
|
||||
#include "list.h"
|
||||
#include <cutils/list.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
#include "parser.h"
|
||||
#include "init_parser.h"
|
||||
#include "log.h"
|
||||
#include "list.h"
|
||||
#include "property_service.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <cutils/iosched_policy.h>
|
||||
#include <cutils/list.h>
|
||||
|
||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||
#include <sys/_system_properties.h>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "parser.h"
|
||||
#include "list.h"
|
||||
#include "log.h"
|
||||
|
||||
#define RAW(x...) log_write(6, x)
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#include <sys/wait.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <cutils/android_reboot.h>
|
||||
#include <cutils/list.h>
|
||||
|
||||
#include "init.h"
|
||||
#include "list.h"
|
||||
#include "util.h"
|
||||
#include "log.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "ueventd_parser.h"
|
||||
#include "parser.h"
|
||||
#include "log.h"
|
||||
#include "list.h"
|
||||
#include "util.h"
|
||||
|
||||
static void parse_line_device(struct parse_state *state, int nargs, char **args);
|
||||
|
|
21
init/util.c
21
init/util.c
|
@ -34,7 +34,6 @@
|
|||
#include <private/android_filesystem_config.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "list.h"
|
||||
#include "util.h"
|
||||
|
||||
/*
|
||||
|
@ -156,26 +155,6 @@ oops:
|
|||
return 0;
|
||||
}
|
||||
|
||||
void list_init(struct listnode *node)
|
||||
{
|
||||
node->next = node;
|
||||
node->prev = node;
|
||||
}
|
||||
|
||||
void list_add_tail(struct listnode *head, struct listnode *item)
|
||||
{
|
||||
item->next = head;
|
||||
item->prev = head->prev;
|
||||
head->prev->next = item;
|
||||
head->prev = item;
|
||||
}
|
||||
|
||||
void list_remove(struct listnode *item)
|
||||
{
|
||||
item->next->prev = item->prev;
|
||||
item->prev->next = item->next;
|
||||
}
|
||||
|
||||
#define MAX_MTD_PARTITIONS 16
|
||||
|
||||
static struct {
|
||||
|
|
|
@ -40,6 +40,7 @@ commonSources := \
|
|||
cpu_info.c \
|
||||
load_file.c \
|
||||
klog.c \
|
||||
list.c \
|
||||
open_memstream.c \
|
||||
strdup16to8.c \
|
||||
strdup8to16.c \
|
||||
|
|
37
libcutils/list.c
Normal file
37
libcutils/list.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cutils/list.h>
|
||||
|
||||
void list_init(struct listnode *node)
|
||||
{
|
||||
node->next = node;
|
||||
node->prev = node;
|
||||
}
|
||||
|
||||
void list_add_tail(struct listnode *head, struct listnode *item)
|
||||
{
|
||||
item->next = head;
|
||||
item->prev = head->prev;
|
||||
head->prev->next = item;
|
||||
head->prev = item;
|
||||
}
|
||||
|
||||
void list_remove(struct listnode *item)
|
||||
{
|
||||
item->next->prev = item->prev;
|
||||
item->prev->next = item->next;
|
||||
}
|
Loading…
Reference in a new issue