common: change file name system_info_no_file.c to system_info_file.c 41/40641/3
authorTaeyoung Kim <ty317.kim@samsung.com>
Sat, 6 Jun 2015 13:00:20 +0000 (22:00 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Tue, 9 Jun 2015 08:50:38 +0000 (01:50 -0700)
- The codes are related with reading information from certain files.
  Thus the name is changed from 'no_file' to 'file'

Change-Id: I238a4338b9494d5349362b7fe98750ea022be730
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
include/system_info_private.h
src/system_info.c
src/system_info_file.c [new file with mode: 0644]
src/system_info_no_file.c [deleted file]

index 1d3625c8900ca402212ad9c374c0aea0c915d93f..00b671b8761e07c2e4828cd5cf3f8119b13c3337 100644 (file)
@@ -107,7 +107,7 @@ int system_info_get_build_date(system_info_key_e key, system_info_data_type_e da
 int system_info_get_build_time(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_tethering_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 
-int system_info_get_no_file(const char *key, void **value);
+int system_info_get_file(const char *key, void **value);
 
 #ifdef __cplusplus
 }
index ecbdd8fec0aec6ed08aac36ab4700265786d3b1f..1e85601c32381407163164869628bfba8dcba158 100644 (file)
@@ -338,7 +338,7 @@ API int system_info_get_platform_string(const char *key, char **value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_no_file(key, (void**)&string);
+       ret = system_info_get_file(key, (void**)&string);
        if (ret == 0) {
                *value = string;
                return SYSTEM_INFO_ERROR_NONE;
diff --git a/src/system_info_file.c b/src/system_info_file.c
new file mode 100644 (file)
index 0000000..e44c2a8
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <dlog.h>
+
+#include <system_info.h>
+#include <system_info_private.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_SYSTEM_INFO"
+
+#define SERIAL_TOK_DELIMITER ","
+#define BUF_MAX 256
+
+static int get_tizenid(char **value)
+{
+       char id[BUF_MAX];
+       FILE *fp;
+
+       fp = fopen(TIZEN_ID_PATH, "r");
+       if (!fp) {
+               LOGE("Failed to open file (%s)", TIZEN_ID_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (fgets(id, sizeof(id), fp) == NULL) {
+               LOGE("Failed to get string (errno:%d)", errno);
+               fclose(fp);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       fclose(fp);
+
+       if (strlen(id) == 0) {
+               LOGE("String length of id is 0");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       *value = strdup(id);
+
+       return 0;
+}
+
+int system_info_get_file(const char *key, void **value)
+{
+       char *p_key;
+
+       if (!key || !value)
+               return -EINVAL;
+
+       p_key = strstr(key, "http://");
+       if (p_key && p_key == key)
+               p_key = (char *)key + strlen("http://");
+       else
+               p_key = (char *)key;
+
+       if (!strncmp(p_key, "tizen.org/system/tizenid", strlen(p_key)))
+               return get_tizenid((char **)value);
+
+       if (!strncmp(p_key, "tizen.org/system/build.date", strlen(p_key)))
+               return system_info_ini_get_string(INFO_FILE_PATH, "build:date", (char **)value);
+
+       if (!strncmp(p_key, "tizen.org/system/build.string", strlen(p_key)))
+               return system_info_ini_get_string(INFO_FILE_PATH, "version:build", (char **)value);
+
+       if (!strncmp(p_key, "tizen.org/system/build.time", strlen(p_key)))
+               return system_info_ini_get_string(INFO_FILE_PATH, "build:time", (char **)value);
+
+       return -ENOENT;
+}
diff --git a/src/system_info_no_file.c b/src/system_info_no_file.c
deleted file mode 100644 (file)
index 583ea70..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <dlog.h>
-
-#include <system_info.h>
-#include <system_info_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_SYSTEM_INFO"
-
-#define SERIAL_TOK_DELIMITER ","
-#define BUF_MAX 256
-
-static int get_tizenid(char **value)
-{
-       char id[BUF_MAX];
-       FILE *fp;
-
-       fp = fopen(TIZEN_ID_PATH, "r");
-       if (!fp) {
-               LOGE("Failed to open file (%s)", TIZEN_ID_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (fgets(id, sizeof(id), fp) == NULL) {
-               LOGE("Failed to get string (errno:%d)", errno);
-               fclose(fp);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       fclose(fp);
-
-       if (strlen(id) == 0) {
-               LOGE("String length of id is 0");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       *value = strdup(id);
-
-       return 0;
-}
-
-int system_info_get_no_file(const char *key, void **value)
-{
-       char *p_key;
-
-       if (!key || !value)
-               return -EINVAL;
-
-       p_key = strstr(key, "http://");
-       if (p_key && p_key == key)
-               p_key = (char *)key + strlen("http://");
-       else
-               p_key = (char *)key;
-
-       if (!strncmp(p_key, "tizen.org/system/tizenid", strlen(p_key)))
-               return get_tizenid((char **)value);
-
-       if (!strncmp(p_key, "tizen.org/system/build.date", strlen(p_key)))
-               return system_info_ini_get_string(INFO_FILE_PATH, "build:date", (char **)value);
-
-       if (!strncmp(p_key, "tizen.org/system/build.string", strlen(p_key)))
-               return system_info_ini_get_string(INFO_FILE_PATH, "version:build", (char **)value);
-
-       if (!strncmp(p_key, "tizen.org/system/build.time", strlen(p_key)))
-               return system_info_ini_get_string(INFO_FILE_PATH, "build:time", (char **)value);
-
-       return -ENOENT;
-}