tool: lshal: Replace 'Backend Verification' with 'Compatibility' 77/313377/2 accepted/tizen/unified/20240625.163203 accepted/tizen/unified/x/20240626.052157
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 25 Jun 2024 04:05:40 +0000 (13:05 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 25 Jun 2024 04:55:58 +0000 (13:55 +0900)
------------------------------------------------------------------
                                        | ...  |                 |
 HAL Module Name                        | ...  | Compatibility   |
------------------------------------------------------------------
 HAL_MODULE_TBM                         | ...  |                 |
 HAL_MODULE_TDM                         | ...  |                 |
 ...
 HAL_MODULE_POWER                       | ...  | Compatible      |
 HAL_MODULE_SENSOR                      | ...  | Incompatible    |

The column 'Backend Verification' has been removed and replaced with
'Compatibility'.

Change-Id: I4f364b0d64b24c326101666b0685f2abf4963563
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
tools/lshal/lshal.c

index 4ba2239688ea4384ab188873ac22be358ddc6cab..7ce8aa415d16299e0a8d870bbdb3b165e83a5168 100644 (file)
 #define BIT(x)                                 (1ULL << x)
 #define BUFF_MAX                               256
 
-#define LSHAL_FLAG_BACKEND_VERIFICATION                BIT(0)
-#define LSHAL_FLAG_BACKEND_MODULE_NAME         BIT(1)
-#define LSHAL_FLAG_BACKEND_LIB_NAME            BIT(2)
-#define LSHAL_FLAG_BACKEND_SYMBOL_NAME         BIT(3)
-#define LSHAL_FLAG_BACKEND_NAME                        BIT(4)
-#define LSHAL_FLAG_BACKEND_VENDOR_NAME         BIT(5)
-#define LSHAL_FLAG_BACKEND_USAGE_COUNT         BIT(6)
-#define LSHAL_FLAG_BACKEND_VERSION             BIT(7)
-#define LSHAL_FLAG_MANIFEST_VERSION            BIT(8)
+#define LSHAL_FLAG_BACKEND_MODULE_NAME         BIT(0)
+#define LSHAL_FLAG_BACKEND_LIB_NAME            BIT(1)
+#define LSHAL_FLAG_BACKEND_SYMBOL_NAME         BIT(2)
+#define LSHAL_FLAG_BACKEND_NAME                        BIT(3)
+#define LSHAL_FLAG_BACKEND_VENDOR_NAME         BIT(4)
+#define LSHAL_FLAG_BACKEND_USAGE_COUNT         BIT(5)
+#define LSHAL_FLAG_BACKEND_VERSION             BIT(6)
+#define LSHAL_FLAG_MANIFEST_VERSION            BIT(7)
+#define LSHAL_FLAG_COMPATIBILITY               BIT(8)
 
 struct _hal_backend_module_data {
        /**
@@ -52,21 +52,6 @@ struct _hal_backend_module_data {
        void *unused_buffer[10000];
 } *backend_module_data;
 
-static int lshal_verify_hal_backend(enum hal_module module)
-{
-       int ret;
-
-       ret = hal_common_get_backend(module, (void **)&backend_module_data);
-       if (ret < 0)
-               return ret;
-
-       ret = hal_common_put_backend(module, backend_module_data);
-       if (ret < 0)
-               return ret;
-
-       return 0;
-}
-
 static void lshal_print_border(void) {
        for (int i = 0; i < 287; i++)
                printf("-");
@@ -77,30 +62,29 @@ static void lshal_print_hal_backend_info(u_int32_t flags) {
        int ret;
        enum hal_module module;
        char str[BUFF_MAX];
-       int backend_verification_count = 0;
 
        lshal_print_border();
-       printf(" %-38s |    | %-55s | %-10s | %-15s | %-45s | %-25s | %-25s | %-25s | %-15s |\n",
+       printf(" %-38s |    | %-55s | %-10s | %-45s | %-25s | %-25s | %-25s | %-15s | %-15s |\n",
                        "",
                        "",
                        "Backend",
                        "Backend",
-                       "Backend",
                        "Backend Name",
                        "Vendor Name",
                        "Interface",
-                       "Backend");
+                       "Backend",
+                       "");
 
-       printf(" %-38s | ID | %-55s | %-10s | %-15s | %-45s | %-25s | %-25s | %-25s | %-15s |\n",
+       printf(" %-38s | ID | %-55s | %-10s | %-45s | %-25s | %-25s | %-25s | %-15s | %-15s |\n",
                        "HAL Module Name",
                        "Backend Library Name",
                        "Open Count",
-                       "Verification",
                        "Symbol Name",
                        "(Written by Developer)",
                        "(Written by Developer)",
                        "Versions",
-                       "Version");
+                       "Version",
+                       "Compatibility");
        lshal_print_border();
 
        for (module = HAL_MODULE_UNKNOWN + 1; module < HAL_MODULE_END; module++) {
@@ -132,19 +116,6 @@ static void lshal_print_hal_backend_info(u_int32_t flags) {
                                printf(" %-10d |", count);
                }
 
-               if (LSHAL_FLAG_BACKEND_VERIFICATION & flags) {
-                       ret = lshal_verify_hal_backend(module);
-
-                       if (ret == -ENOENT) {
-                               printf(" %-15s |", "NO  |");
-                       } else if (ret < 0) {
-                               printf(" %-15s |", "    |");
-                       } else {
-                               printf(" %-15s |", "YES | VERIFIED");
-                               backend_verification_count++;
-                       }
-               }
-
                if (LSHAL_FLAG_BACKEND_SYMBOL_NAME & flags) {
                        strncpy(str, "", BUFF_MAX - 1);
 
@@ -226,16 +197,31 @@ static void lshal_print_hal_backend_info(u_int32_t flags) {
                        }
                }
 
+               if (LSHAL_FLAG_COMPATIBILITY & flags) {
+                       enum hal_common_backend_compatibility compatibility;
+
+                       strncpy(str, "", BUFF_MAX - 1);
+
+                       ret = hal_common_check_backend_compatibility(module, &compatibility);
+                       if (ret < 0)
+                               printf(" %-15s |", "");
+                       else if (compatibility == HAL_COMMON_BACKEND_COMPATIBILITY_INCOMPATIBLE)
+                               printf(" %-15s |", "Incompatible");
+                       else if (compatibility == HAL_COMMON_BACKEND_COMPATIBILITY_COMPATIBLE)
+                               printf(" %-15s |", "Compatible");
+                       else
+                               printf(" %-15s |", "");
+               }
+
                printf("\n");
        }
 
        lshal_print_border();
-       printf(" %-38s | %-2d | %-55s | %-10s | %15d | %-45s | %-25s | %-25s | %-25s | %-25s | %-15s |\n",
+       printf(" %-38s | %-2d | %-55s | %-10s | %-45s | %-25s | %-25s | %-25s | %-15s | %-15s |\n",
                        "TOTAL",
                        HAL_MODULE_END - 1,
                        "",
                        "",
-                       backend_verification_count,
                        "",
                        "",
                        "",
@@ -249,15 +235,15 @@ static void lshal_handle_signal(int signal) {}
 
 static void lshal(void)
 {
-       u_int32_t flags = (LSHAL_FLAG_BACKEND_VERIFICATION
-                       | LSHAL_FLAG_BACKEND_LIB_NAME
+       u_int32_t flags = (LSHAL_FLAG_BACKEND_LIB_NAME
                        | LSHAL_FLAG_BACKEND_SYMBOL_NAME
                        | LSHAL_FLAG_BACKEND_NAME
                        | LSHAL_FLAG_BACKEND_VENDOR_NAME
                        | LSHAL_FLAG_BACKEND_USAGE_COUNT
                        | LSHAL_FLAG_BACKEND_MODULE_NAME
                        | LSHAL_FLAG_BACKEND_VERSION
-                       | LSHAL_FLAG_MANIFEST_VERSION);
+                       | LSHAL_FLAG_MANIFEST_VERSION
+                       | LSHAL_FLAG_COMPATIBILITY);
 
        lshal_print_hal_backend_info(flags);
 }