tizen: Search for configuration files in /hal dir 02/248702/7 accepted/tizen/unified/20201210.124556 submit/tizen/20201209.021155
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Tue, 1 Dec 2020 11:34:31 +0000 (12:34 +0100)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Wed, 9 Dec 2020 01:58:06 +0000 (01:58 +0000)
Since Tizen 6.5, a HAL image is mounted on the /hal directory,
which contains hardware-specific configurations and drivers,
for better portability of Tizen.

This is the priority of path searching for configuration file.
 1. /etc/
 2. /run/
 3. /usr/local/lib/
 4. /usr/lib/
 5. /hal/lib/

When the same file exists, the higher priority file is used.
In this case, "/etc" is the highest priority.

Because hal can never override platform,
hal has a lower priority than platform.

Change-Id: Ie5e6cf98e64b4317bda23d49571b5c0f60084569
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
[ Change search order for /hal to be searched last ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
src/basic/def.h
src/basic/tizenhal.h [new file with mode: 0644]
src/tmpfiles/tmpfiles.c
src/udev/udev-rules.c

index 970654a..e7a9be1 100644 (file)
@@ -63,3 +63,5 @@
                 .un.sun_family = AF_UNIX,                       \
                 .un.sun_path = "\0/org/freedesktop/plymouthd",  \
         }
+
+#include "tizenhal.h"
diff --git a/src/basic/tizenhal.h b/src/basic/tizenhal.h
new file mode 100644 (file)
index 0000000..7983235
--- /dev/null
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+/* Since Tizen 6.5, a HAL image is mounted on the /hal directory,
+ * which contains hardware-specific configurations and drivers,
+ * for better portability of Tizen.
+ */
+#pragma once
+
+#define CONF_HAL_PATHS(n)                       \
+        CONF_PATHS(n),                          \
+        "/hal/lib/" n
+
+#define CONF_HAL_PATHS_NULSTR(n)                \
+        CONF_PATHS_NULSTR(n)                    \
+        "/hal/lib/" n "\0"
+
+#define CONF_HAL_PATHS_STRV(n)                  \
+        STRV_MAKE(CONF_HAL_PATHS(n))
index 193ed0b..3500fb8 100644 (file)
@@ -3183,7 +3183,7 @@ static int run(int argc, char *argv[]) {
                 if (r < 0)
                         return log_error_errno(r, "Failed to initialize configuration directory list: %m");
         } else {
-                config_dirs = strv_split_nulstr(CONF_PATHS_NULSTR("tmpfiles.d"));
+                config_dirs = strv_split_nulstr(CONF_HAL_PATHS_NULSTR("tmpfiles.d"));
                 if (!config_dirs)
                         return log_oom();
         }
index e50d56a..c9871e8 100644 (file)
@@ -31,7 +31,7 @@
 #include "user-util.h"
 #include "virt.h"
 
-#define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d")
+#define RULES_DIRS (const char* const*) CONF_HAL_PATHS_STRV("udev/rules.d")
 
 typedef enum {
         OP_MATCH,        /* == */