#include "hal-api-compatibility-checker-util.h"
#define HAL_CC_DEFAULT_HAL_INFO_INI_PATH "/hal/etc/hal-info.ini"
+#define HAL_CC_DEFAULT_HAL_MANIFEST_DIR "/etc/hal-manifest"
#define HAL_CC_DEFAULT_COMPATIBILITY_RESULT_PATH "/opt/etc/hal/.hal-backend-compatibility"
#define COMPAT_INFO_MODULE_NAME_MAX 64
manifest_info[module].error_desc = error_desc;
}
-static int get_tizen_hal_version(int *major, int *minor)
-{
- FILE *fp = NULL;
- char *line = NULL;
- size_t len = 0;
- int found = 0;
-
- assert(major);
- assert(minor);
-
- fp = fopen(HAL_CC_DEFAULT_HAL_INFO_INI_PATH, "r");
- if (!fp) {
- _E("Failed to open %s, %m\n", HAL_CC_DEFAULT_HAL_INFO_INI_PATH);
- return -errno;
- }
-
- while (getline(&line, &len, fp) != EOF) {
- if (fscanf(fp, "Model=Tizen%d.%d", major, minor) == 2) {
- found = 1;
- break;
- }
- }
-
- fclose(fp);
- fp = NULL;
- free(line);
- line = NULL;
-
- return found ? 0 : -EINVAL;
-}
-
-static int build_compatibility_manifest_dir(char *manifest_dir, int len)
-{
- int manifest_major = 0;
- int manifest_minor = 0;
- int ret;
-
- if (!manifest_dir || len <= 0)
- return -EINVAL;
-
- ret = get_tizen_hal_version(&manifest_major, &manifest_minor);
- if (ret < 0) {
- _E("Failed to get hal version, ret=%d\n", ret);
- return ret;
- }
-
- ret = snprintf(manifest_dir, len, "/etc/hal/%d.%d", manifest_major, manifest_minor);
- if (ret >= len) {
- _E("Buffer is too small for manifest directory\n");
- return -EOVERFLOW;
- }
-
- return 0;
-}
-
static int set_owner(int fd)
{
static uid_t uid_system_fw = -1;
static int load_hal_manifest(struct compatibility_info *manifest_info, int load_flag)
{
- char manifest_dir[64] = { 0, };
halcc_manifest *manifest = NULL;
int ret = 0;
g_compatibility_result_synced = false;
- ret = build_compatibility_manifest_dir(manifest_dir, sizeof(manifest_dir));
- if (ret < 0)
- return ret;
-
ret = halcc_manifest_new(&manifest);
if (ret < 0)
return ret;
- ret = parse_manifest_directory(manifest_dir, manifest);
+ ret = parse_manifest_directory(HAL_CC_DEFAULT_HAL_MANIFEST_DIR, manifest);
if (ret < 0)
goto out;