Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
init: Split parser into generic parser and init parser
Browse files Browse the repository at this point in the history
Change-Id: I451ebc4ff12f2ac660eb533fa10ad561fa25c9dd
  • Loading branch information
colincross committed Apr 22, 2010
1 parent 3294bbb commit 6310a82
Show file tree
Hide file tree
Showing 8 changed files with 733 additions and 693 deletions.
3 changes: 2 additions & 1 deletion init/Android.mk
Expand Up @@ -12,7 +12,8 @@ LOCAL_SRC_FILES:= \
parser.c \
logo.c \
keychords.c \
signal_handler.c
signal_handler.c \
init_parser.c

ifeq ($(strip $(INIT_BOOTCHART)),true)
LOCAL_SRC_FILES += bootchart.c
Expand Down
4 changes: 2 additions & 2 deletions init/builtins.c
Expand Up @@ -35,7 +35,7 @@
#include "keywords.h"
#include "property_service.h"
#include "devices.h"
#include "parser.h"
#include "init_parser.h"
#include "util.h"
#include "log.h"

Expand Down Expand Up @@ -221,7 +221,7 @@ int do_insmod(int nargs, char **args)

int do_import(int nargs, char **args)
{
return parse_config_file(args[1]);
return init_parse_config_file(args[1]);
}

int do_mkdir(int nargs, char **args)
Expand Down
10 changes: 5 additions & 5 deletions init/init.c
Expand Up @@ -46,7 +46,7 @@
#include "bootchart.h"
#include "signal_handler.h"
#include "keychords.h"
#include "parser.h"
#include "init_parser.h"
#include "util.h"

static int property_triggers_enabled = 0;
Expand Down Expand Up @@ -253,7 +253,7 @@ void service_start(struct service *svc, const char *dynamic_args)
ERROR("cannot execve('%s'): %s\n", svc->args[0], strerror(errno));
}
} else {
char *arg_ptrs[SVC_MAXARGS+1];
char *arg_ptrs[INIT_PARSER_MAXARGS+1];
int arg_idx = svc->nargs;
char *tmp = strdup(dynamic_args);
char *next = tmp;
Expand All @@ -264,7 +264,7 @@ void service_start(struct service *svc, const char *dynamic_args)

while((bword = strsep(&next, " "))) {
arg_ptrs[arg_idx++] = bword;
if (arg_idx == SVC_MAXARGS)
if (arg_idx == INIT_PARSER_MAXARGS)
break;
}
arg_ptrs[arg_idx] = '\0';
Expand Down Expand Up @@ -748,15 +748,15 @@ int main(int argc, char **argv)
log_init();

INFO("reading config file\n");
parse_config_file("/init.rc");
init_parse_config_file("/init.rc");

/* pull the kernel commandline and ramdisk properties file in */
qemu_init();
import_kernel_cmdline(0);

get_hardware_name();
snprintf(tmp, sizeof(tmp), "/init.%s.rc", hardware);
parse_config_file(tmp);
init_parse_config_file(tmp);

action_for_each_trigger("early-init", action_add_queue_tail);

Expand Down
6 changes: 2 additions & 4 deletions init/init.h
Expand Up @@ -19,6 +19,8 @@

#include "list.h"

#include <sys/stat.h>

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

struct command
Expand Down Expand Up @@ -70,8 +72,6 @@ struct svcenvinfo {

#define NR_SVC_SUPP_GIDS 12 /* twelve supplementary groups */

#define SVC_MAXARGS 64

#define COMMAND_RETRY_TIMEOUT 5

struct service {
Expand Down Expand Up @@ -110,8 +110,6 @@ struct service {
char *args[1];
}; /* ^-------'args' MUST be at the end of this struct! */

int parse_config_file(const char *fn);

void notify_service_state(const char *name, const char *state);

struct service *service_find_by_name(const char *name);
Expand Down

0 comments on commit 6310a82

Please sign in to comment.