“f844a709a7d8f8be61a571afc31dfaca9e779621”上不存在“drivers/net/wireless/iwlegacy/iwl-3945.c”
提交 1a8cd29b 编写于 作者: Z zhong_ning

modify l2 init

Signed-off-by: Nzhong_ning <zhong_ning@hoperun.com>
上级 91268807
......@@ -146,10 +146,16 @@ if (defined(ohos_lite)) {
part_name = "init"
}
ohos_prebuilt_etc("passwd") {
source = "//base/startup/init_lite/services/etc/passwd"
part_name = "init"
}
group("startup_init") {
deps = [
":init",
":init.cfg",
":passwd",
":updaterueventd",
"//base/startup/init_lite/services/param:getparam",
"//base/startup/init_lite/services/param:paramclient",
......
root:x:0:0:::/bin/false
daemon:x:1:1:::/bin/false
bin:x:2:2:::/bin/false
system:x:1000:1000:::/bin/false
radio:x:1001:1001:::/bin/false
bluetooth:x:1002:1002:::/bin/false
graphics:x:1003:1003:::/bin/false
input:x:1004:1004:::/bin/false
audio:x:1005:1005:::/bin/false
camera:x:1006:1006:::/bin/false
log:x:1007:1007:::/bin/false
compass:x:1008:1008:::/bin/false
mount:x:1009:1009:::/bin/false
wifi:x:1010:1010:::/bin/false
adb:x:1011:1011:::/bin/false
install:x:1012:1012:::/bin/false
media:x:1013:1013:::/bin/false
dhcp:x:1014:1014:::/bin/false
sdcard_rw:x:1015:1015:::/bin/false
vpn:x:1016:1016:::/bin/false
keystore:x:1017:1017:::/bin/false
usb:x:1018:1018:::/bin/false
drm:x:1019:1019:::/bin/false
mdnsr:x:1020:1020:::/bin/false
gps:x:1021:1021:::/bin/false
unused1:x:1022:1022:::/bin/false
media_rw:x:1023:1023:::/bin/false
mtp:x:1024:1024:::/bin/false
unused2:x:1025:1025:::/bin/false
drmrpc:x:1026:1026:::/bin/false
nfc:x:1027:1027:::/bin/false
sdcard_r:x:1028:1028:::/bin/false
clat:x:1029:1029:::/bin/false
loop_radio:x:1030:1030:::/bin/false
media_drm:x:1031:1031:::/bin/false
package_info:x:1032:1032:::/bin/false
sdcard_pics:x:1033:1033:::/bin/false
sdcard_av:x:1034:1034:::/bin/false
sdcard_all:x:1035:1035:::/bin/false
logd:x:1036:1036:::/bin/false
shared_relro:x:1037:1037:::/bin/false
dbus:x:1038:1038:::/bin/false
tlsdate:x:1039:1039:::/bin/false
media_ex:x:1040:1040:::/bin/false
audioserver:x:1041:1041:::/bin/false
metrics_coll:x:1042:1042:::/bin/false
metricsd:x:1043:1043:::/bin/false
webserv:x:1044:1044:::/bin/false
debuggerd:x:1045:1045:::/bin/false
media_codec:x:1046:1046:::/bin/false
cameraserver:x:1047:1047:::/bin/false
firewall:x:1048:1048:::/bin/false
trunks:x:1049:1049:::/bin/false
nvram:x:1050:1050:::/bin/false
dns:x:1051:1051:::/bin/false
dns_tether:x:1052:1052:::/bin/false
webview_zygote:x:1053:1053:::/bin/false
vehicle_network:x:1054:1054:::/bin/false
media_audio:x:1055:1055:::/bin/false
media_video:x:1056:1056:::/bin/false
media_image:x:1057:1057:::/bin/false
tombstoned:x:1058:1058:::/bin/false
media_obb:x:1059:1059:::/bin/false
ese:x:1060:1060:::/bin/false
ota_update:x:1061:1061:::/bin/false
automotive_evs:x:1062:1062:::/bin/false
lowpan:x:1063:1063:::/bin/false
hsm:x:1064:1064:::/bin/false
reserved_disk:x:1065:1065:::/bin/false
statsd:x:1066:1066:::/bin/false
incidentd:x:1067:1067:::/bin/false
secure_element:x:1068:1068:::/bin/false
lmkd:x:1069:1069:::/bin/false
llkd:x:1070:1070:::/bin/false
iorapd:x:1071:1071:::/bin/false
gpu_service:x:1072:1072:::/bin/false
network_stack:x:1073:1073:::/bin/false
gsid:x:1074:1074:::/bin/false
shell:x:2000:2000:::/bin/false
cache:x:2001:2001:::/bin/false
diag:x:2002:2002:::/bin/false
oem_reserved_start:x:2900:2900:::/bin/false
oem_reserved_end:x:2999:2999:::/bin/false
net_bt_admin:x:3001:3001:::/bin/false
net_bt:x:3002:3002:::/bin/false
inet:x:3003:3003:::/bin/false
net_raw:x:3004:3004:::/bin/false
net_admin:x:3005:3005:::/bin/false
net_bw_stats:x:3006:3006:::/bin/false
net_bw_acct:x:3007:3007:::/bin/false
readproc:x:3009:3009:::/bin/false
wakelock:x:3010:3010:::/bin/false
uhid:x:3011:3011:::/bin/false
oem_reserved_2_start:x:5000:5000:::/bin/false
oem_reserved_2_end:x:5999:5999:::/bin/false
everybody:x:9997:9997:::/bin/false
misc:x:9998:9998:::/bin/false
nobody:x:9999:9999:::/bin/false
app:x:10000:10000:::/bin/false
app_start:x:10000:10000:::/bin/false
app_end:x:19999:19999:::/bin/false
cache_gid_start:x:20000:20000:::/bin/false
cache_gid_end:x:29999:29999:::/bin/false
ext_gid_start:x:30000:30000:::/bin/false
ext_gid_end:x:39999:39999:::/bin/false
ext_cache_gid_start:x:40000:40000:::/bin/false
ext_cache_gid_end:x:49999:49999:::/bin/false
shared_gid_start:x:50000:50000:::/bin/false
shared_gid_end:x:59999:59999:::/bin/false
overflowuid:x:65534:65534:::/bin/false
isolated_start:x:90000:90000:::/bin/false
isolated_end:x:99999:99999:::/bin/false
user:x:100000:100000:::/bin/false
user_offset:x:100000:100000:::/bin/false
......@@ -36,17 +36,21 @@ typedef enum InitLogLevel {
#define __FILE_NAME__ (strrchr((__FILE__), '/') ? strrchr((__FILE__), '/') + 1 : (__FILE__))
#ifndef INIT_LOG_TAG
#define INIT_LOG_TAG "[Init]"
#endif
#ifdef OHOS_LITE
#define INIT_LOGE(format, ...) printf("%s %d: "format, __FILE_NAME__, __LINE__, ##__VA_ARGS__)
#define INIT_LOGW(format, ...) printf("%s %d: "format, __FILE_NAME__, __LINE__, ##__VA_ARGS__)
#define INIT_LOGI(format, ...) printf("%s %d: "format, __FILE_NAME__, __LINE__, ##__VA_ARGS__)
#define INIT_LOGD(format, ...) printf("%s %d: "format, __FILE_NAME__, __LINE__, ##__VA_ARGS__)
#else
#define INIT_LOGD(format, ...) InitLog("[Init]", INIT_DEBUG, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGI(format, ...) InitLog("[Init]", INIT_INFO, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGW(format, ...) InitLog("[Init]", INIT_WARN, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGE(format, ...) InitLog("[Init]", INIT_ERROR, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGF(format, ...) InitLog("[Init]", INIT_FATAL, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGD(format, ...) InitLog(INIT_LOG_TAG, INIT_DEBUG, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGI(format, ...) InitLog(INIT_LOG_TAG, INIT_INFO, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGW(format, ...) InitLog(INIT_LOG_TAG, INIT_WARN, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGE(format, ...) InitLog(INIT_LOG_TAG, INIT_ERROR, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
#define INIT_LOGF(format, ...) InitLog(INIT_LOG_TAG, INIT_FATAL, (__FILE_NAME__), (__LINE__), format, ##__VA_ARGS__)
void InitLog(const char *tag, InitLogLevel logLevel, const char *fileName, int line, const char *fmt, ...);
void SetLogLevel(InitLogLevel logLevel);
......
......@@ -221,13 +221,10 @@ int CompareTrieNode(TrieNode *node, const char *key, u_int32_t keyLen)
return strncmp(node->key, key, keyLen);
}
static void GetNextKey(const char **remainingKey, int *hasDot, char **subKey, u_int32_t *subKeyLen)
static void GetNextKey(const char **remainingKey, char **subKey, u_int32_t *subKeyLen)
{
*subKey = strchr(*remainingKey, '.');
if (*subKey != NULL) {
if ((*subKey)[0] == '.') {
*hasDot = 1;
}
*subKeyLen = *subKey - *remainingKey;
} else {
*subKeyLen = strlen(*remainingKey);
......@@ -243,10 +240,9 @@ TrieDataNode *AddTrieDataNode(WorkSpace *workSpace, const char *key, u_int32_t k
TrieDataNode *current = (TrieDataNode *)workSpace->rootNode;
PARAM_CHECK(current != NULL, return NULL, "Invalid current param %s", key);
while (1) {
int hasDot = 0;
u_int32_t subKeyLen = 0;
char *subKey = NULL;
GetNextKey(&remainingKey, &hasDot, &subKey, &subKeyLen);
GetNextKey(&remainingKey, &subKey, &subKeyLen);
if (!subKeyLen) {
return NULL;
}
......@@ -259,11 +255,6 @@ TrieDataNode *AddTrieDataNode(WorkSpace *workSpace, const char *key, u_int32_t k
} else { // 不匹配,需要建立子树
current = (TrieDataNode*)AddToSubTrie(workSpace, current, key, offset);
}
} else if (hasDot) {
u_int32_t offset = workSpace->allocTrieNode(workSpace, remainingKey, subKeyLen);
PARAM_CHECK(offset != 0, return NULL, "Failed to allocate key %s", key);
SaveIndex(&current->child, offset);
current = (TrieDataNode*)GetTrieNode(workSpace, &current->child);
} else {
current = (TrieDataNode*)AddToSubTrie(workSpace, current, key, offset);
}
......@@ -347,10 +338,9 @@ TrieDataNode *FindTrieDataNode(WorkSpace *workSpace, const char *key, u_int32_t
TrieDataNode *current = (TrieDataNode *)workSpace->rootNode;
PARAM_CHECK(current != NULL, return NULL, "Invalid current param %s", key);
while (1) {
int hasDot = 0;
u_int32_t subKeyLen = 0;
char *subKey = NULL;
GetNextKey(&remainingKey, &hasDot, &subKey, &subKeyLen);
GetNextKey(&remainingKey, &subKey, &subKeyLen);
if (!subKeyLen) {
return matchPrefix ? matchNode : NULL;
}
......
......@@ -95,6 +95,7 @@ static u_int32_t AddCommand(TriggerWorkSpace *workSpace, TriggerNode *trigger, c
PARAM_CHECK(workSpace != NULL && trigger != NULL, return 0, "list is null");
u_int32_t size = sizeof(CommandNode) + strlen(cmdName) + 1;
size += (content == NULL) ? 1 : strlen(content) + 1;
size = (size + 0x03) & (~0x03);
PARAM_CHECK((workSpace->area->currOffset + size) < workSpace->area->dataSize,
return 0, "Not enough memory for cmd %u %u", size, workSpace->area->currOffset);
......@@ -148,6 +149,7 @@ static u_int32_t AddTrigger(TriggerWorkSpace *workSpace, int type, const char *n
tmpCond = name;
}
u_int32_t conditionSize = (tmpCond == NULL) ? 1 : strlen(tmpCond) + 1 + CONDITION_EXTEND_LEN;
conditionSize = (conditionSize + 0x03) & (~0x03);
PARAM_CHECK((workSpace->area->currOffset + sizeof(TriggerNode) + conditionSize) < workSpace->area->dataSize,
return -1, "Not enough memory for cmd");
......
......@@ -118,7 +118,6 @@ int GetServiceCaps(const cJSON* curArrItem, Service* curServ)
curServ->servPerm.caps = NULL;
cJSON* filedJ = cJSON_GetObjectItem(curArrItem, "caps");
if (filedJ == NULL) {
INIT_LOGE("GetServiceCaps, caps is not found. but maybe ok.\n");
return SERVICE_SUCCESS;
}
if (!cJSON_IsArray(filedJ)) {
......
......@@ -142,7 +142,6 @@ static cJSON* GetArrItem(const cJSON* fileRoot, int* arrSize, const char* arrNam
{
cJSON* arrItem = cJSON_GetObjectItemCaseSensitive(fileRoot, arrName);
if (!cJSON_IsArray(arrItem)) {
INIT_LOGE("GetArrItem, item %s is not an array!\n", arrName);
return NULL;
}
......@@ -195,7 +194,6 @@ static int GetGidOneItem(const cJSON *curArrItem, Service *curServ) // gi
{
cJSON* filedJ = cJSON_GetObjectItem(curArrItem, GID_STR_IN_CFG);
if (filedJ == NULL) {
INIT_LOGE("GetGidOneItem, gid is not found too, but ok.\n");
return SERVICE_SUCCESS; // not found
}
curServ->servPerm.gIDCnt = 1;
......@@ -235,7 +233,6 @@ static int GetGidArray(const cJSON *curArrItem, Service *curServ) // gid
int gIDCnt = 0;
cJSON* filedJ = GetArrItem(curArrItem, &gIDCnt, GID_STR_IN_CFG); // "gid" must have 1 item.
if (gIDCnt <= 0) { // not a array, but maybe a item?
INIT_LOGE("GetGidArray, gid is not a list.\n");
return GetGidOneItem(curArrItem, curServ);
}
......@@ -398,7 +395,6 @@ static int GetUidStringNumber(const cJSON *curArrItem, Service *curServ)
{
cJSON* filedJ = cJSON_GetObjectItem(curArrItem, UID_STR_IN_CFG);
if (filedJ == NULL) {
INIT_LOGE("GetUidStringNumber, %s not found, but ok.\n", UID_STR_IN_CFG);
return SERVICE_SUCCESS; // uID not found, but ok.
}
......@@ -738,10 +734,8 @@ void StopServiceByName(const char* servName)
void StopAllServices()
{
for (int i = 0; i < g_servicesCnt; i++) {
if (strcmp(g_services[i].name, "console") != 0 && strcmp(g_services[i].name, "ueventd") != 0) {
if (ServiceStop(&g_services[i]) != SERVICE_SUCCESS) {
INIT_LOGE("[Init] StopAllServices, service %s stop failed!\n", g_services[i].name);
}
if (ServiceStop(&g_services[i]) != SERVICE_SUCCESS) {
INIT_LOGE("StopAllServices, service %s stop failed!\n", g_services[i].name);
}
}
}
......@@ -764,7 +758,7 @@ void ReapServiceByPID(int pid)
// important process exit, need to reboot system
g_services[i].pid = -1;
StopAllServices();
// RebootSystem();
RebootSystem();
}
ServiceReap(&g_services[i]);
break;
......
......@@ -123,6 +123,7 @@ int main(int argc, char * const argv[])
INIT_LOGI("main, entering wait.\n");
#ifndef OHOS_LITE
StartTriggerService();
StartParamService();
#endif
while (1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册