platform/hal/api/common.git
4 months agohalcc: Add assertion that open_result_file() always returns valid fd on success 53/319053/1 accepted/tizen_unified_x_asan accepted/tizen/unified/20250205.095531 accepted/tizen/unified/20250205.113511 accepted/tizen/unified/x/20250212.043819 accepted/tizen/unified/x/asan/20250211.003427
Youngjae Cho [Mon, 3 Feb 2025 04:46:11 +0000 (13:46 +0900)]
halcc: Add assertion that open_result_file() always returns valid fd on success

Logically, the file descriptor received from open_result_file() cannot
be invalid(negative) if open_result_file() returned 0.

Change-Id: I1b3180fb6c046bf5e4094b010d98970c513d00ae
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
4 months agodoc: Fix to correctly add anchor of function 52/319052/1
Youngjae Cho [Mon, 3 Feb 2025 04:57:39 +0000 (13:57 +0900)]
doc: Fix to correctly add anchor of function

In case of function, anchor can be generated with function name
followed by parenthesis instead of # prefix.
 • #hal_common_get_backend -> hal_common_get_backend()
 • #hal_common_put_backend -> hal_common_put_backend()

Change-Id: I0e65df750c661c13b4472429a668a9936ace013d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
4 months ago[HALACR-18] Add new HAL_MODULE_SECURITY_CERTS module 08/318908/3 accepted/tizen/unified/20250204.110455
Jan Wojtkowski [Fri, 31 Jan 2025 09:47:47 +0000 (10:47 +0100)]
[HALACR-18] Add new HAL_MODULE_SECURITY_CERTS module

[Role of HAL_MODULE_SECURITY_CERTS]
Security Certs module provides cryptography services (digital certificates)
for authentication and secure communication with another system.

[Detailed description of newly added HAL_MODULE_SECURITY_CERTS module]
- group = HAL_GROUP_SECURITY,
- module = HAL_MODULE_SECURITY_CERTS,
- license = HAL_LICENSE_APACHE_2_0,
- gbm_group = HAL_GBM_GROUP_PUBLIC,
- module_name = "HAL_MODULE_SECURITY_CERTS",
- backend_module_name = "security-certs",
- library_name = "/hal/lib/libhal-backend-security-certs.so",
- library_name_64bit = "/hal/lib64/libhal-backend-security-certs.so",
- symbol_name = "hal_backend_security_certs_data",
- manifest = "/etc/hal/hal-api-security-manifest.xml",
- hal_api = true,

Change-Id: I113705aee91b4191656e4c2443fd3eebd84b495e

4 months agoInitialize ACR docs and elaborate descriptions 82/318282/8 accepted/tizen/unified/20250122.093027 accepted/tizen/unified/x/20250122.173329
Youngjae Cho [Wed, 15 Jan 2025 02:03:12 +0000 (11:03 +0900)]
Initialize ACR docs and elaborate descriptions

Add documentation for ACR and added description.

Change-Id: I25ebd6e3de41866551c64078de1f67f3ce8e9235
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
4 months ago[HALACR-16] Add new HAL_MODULE_CODEC module 91/318491/2 accepted/tizen/unified/20250120.072846 accepted/tizen/unified/x/20250120.085017
Chanwoo Choi [Thu, 16 Jan 2025 05:58:08 +0000 (14:58 +0900)]
[HALACR-16] Add new HAL_MODULE_CODEC module

[Role of HAL_MODULE_CODEC]
Previously, the GStreamer element was used for codec HAL.
But, the element has a dependency of GStreamer which is included in Platform image.
and it should be rebuilt if the GStreamer is upgraded by Platform update.
We can avoid this situation by adding Tizen codec HAL interfaces.
The reference GStreamer element which uses Tizen codec HAL interfaces
will be included in Platform image and no need to rebuild codec HAL backend
in HAL image although the Platform is updated.

[Details description of newly added HAL_MODULE_CODEC module]
- group = HAL_GROUP_MULTIMEDIA,
- module = HAL_MODULE_CODEC,
- license = HAL_LICENSE_APACHE_2_0,
- gbm_group = HAL_GBM_GROUP_PUBLIC,
- module_name = "HAL_MODULE_CODEC",
- backend_module_name = "codec",
- library_name = "/hal/lib/libhal-backend-codec.so",
- library_name_64bit = "/hal/lib64/libhal-backend-codec.so",
- symbol_name = "hal_backend_codec_data",
- manifest = "/etc/hal/hal-api-codec-manifest.xml",
- hal_api = true,

Change-Id: Ic9d3d6ffdefe7902badc8d968818d6b9faa07954
Link: https://jira.sec.samsung.net/browse/HALACR-16
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 months agocommon: Fix argument of `hal_common_get_backend_with_library_name_v2` 73/317973/2
Yongjoo Ahn [Fri, 10 Jan 2025 07:32:43 +0000 (16:32 +0900)]
common: Fix argument of `hal_common_get_backend_with_library_name_v2`

Let the function take a void pointer to `hal_backend_[module]_funcs`
(NOT a double pointer for it).

Change-Id: Ic1e2c6d4b9b11423e147a541486269363835285b
Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
4 months agoRevert "Revert "halapi: common: Remove deprecated global variable and abi_version... 67/318267/1 accepted/tizen/unified/20250117.152454 accepted/tizen/unified/x/20250117.125239
Chanwoo Choi [Wed, 15 Jan 2025 02:22:04 +0000 (11:22 +0900)]
Revert "Revert "halapi: common: Remove deprecated global variable and abi_version in hal_backend""

This reverts commit d2766e216b95a0e4fa7e2cab94ad408548ab9fbd.

The variables related to 'abi_version' has not used anymore.
Remove deprecated global variable and abi_version in hal_backend
structure.

Change-Id: I0ccf04a627feb859d50166e7562425a22ac360fd
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 months agoRevert "halapi: common: Remove deprecated global variable and abi_version in hal_backend" 95/318195/1 accepted/tizen/unified/20250115.124140 accepted/tizen/unified/x/20250115.142720
Chanwoo Choi [Tue, 14 Jan 2025 05:55:26 +0000 (14:55 +0900)]
Revert "halapi: common: Remove deprecated global variable and abi_version in hal_backend"

This reverts commit 293201e2d65c5a44a830bcb2d9953e3057c3e60e.

Change-Id: I4e44a47f1acb3b97b2ba5fc316250a9b1d11eefc
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 months agopackaging: Disable halcc on movable project 41/316841/5
Youngjae Cho [Wed, 18 Dec 2024 08:46:58 +0000 (17:46 +0900)]
packaging: Disable halcc on movable project

Make the movable project an exception to the previous patch that treats
compatibility error as an real error. Therefore the project is not
affected by compatibility error as before.

Change-Id: I12c5b592f3aa5c76614023329090691c57c5cabe
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
5 months agocommon: Fix module_hash hash operations from direct to string 76/315876/6
Youngjae Cho [Thu, 5 Dec 2024 06:57:23 +0000 (15:57 +0900)]
common: Fix module_hash hash operations from direct to string

It matters when it comes to unittest. The unittest code below may
cause an unintended result.

  > char *library_name = g_strdup_printf("libhal-backend-%s-user-specific.so",
  >         info.backend_module_name_);
  > int ret = hal_common_get_backend_with_library_name(info.module_,
            (void **)&backend_module_data,
            library_name);

Over the instantiated testcases, the g_strdup_printf() sometimes returns
same address containing different string. In this case, if the hash and
equal function are g_direct_hash() and g_direct_equal(), then it tests
those different string as equal because both strings are held by the
same address. Therefore, it is not enough to compare the starting
address but needs to compare the entire string.

Change-Id: Ifecbac1db3d03d61137e31b74e356ba0370c345d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
5 months ago[DAPR-74] halapi: Add new HAL_MODULE_DA_ESE module 14/317914/2
Chanwoo Choi [Thu, 9 Jan 2025 12:39:57 +0000 (21:39 +0900)]
[DAPR-74] halapi: Add new HAL_MODULE_DA_ESE module

[Role of HAL_MODULE_DA_ESE module]
- Provide APIs to access certificate and key data stored in the eSE,
and to read/write in the hardware secure storage provided by eSE.
Currently a few system services and apps use these APIs
and there are two different hardware vendors whose eSE is used in our products,
so this abstraction is needed to move the hardware specific code and
vendor libraries into HAL layer.
- ESE (Embedded Secure Element)

[Details description of newly added HAL_MODULE_DA_ESE module]
- group                 : HAL_GROUP_SYSTEM,
- module                : HAL_MODULE_DA_ESE,
- license               : HAL_LICENSE_APACHE_2_0,
- gbm_group             : HAL_GBM_GROUP_DA,
- module_name           : "HAL_MODULE_DA_ESE",
- backend_module_name   : "da-ese",
- library_name          : "/hal/lib/libhal-backend-da-ese.so",
- library_name_64bit    : "/hal/lib64/libhal-backend-da-ese.so",
- symbol_name           : "hal_backend_da_ese_data",
- manifest              : "/etc/hal/hal-api-da-ese-manifest.xml",
- hal_api               : true,

Change-Id: I1d7862c4a03caa768d65b9900ee9e37d9d91903d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 months agohalapi: common: Change .hal-backend-compatibility smack label to '_' from 'System' 28/317728/6
Youngjae Cho [Tue, 7 Jan 2025 02:33:17 +0000 (11:33 +0900)]
halapi: common: Change .hal-backend-compatibility smack label to '_' from 'System'

To allow access from unprivileged process, changed the smack label of
/opt/etc/hal/.hal-backend-compatibility to '_'.
 • Jan 07 10:09:01 localhost audit[9954]: AVC lsm=SMACK fn=smack_inode_permission
    action=denied subject="User" object="System" requested=r pid=9954
    comm="launchpad-loade" name=".hal-backend-compatibility" dev="vda2" ino=128002

To set the file smack label to '_', several options were considered
below, and we selected the 3rd option.
 1) Set the file smack label '_' using setxattr()
    : The setxattr() for changing smack label requires capability
      CAP_MAC_ADMIN. However, the capability is being strictly managed
      and granted exceptionally to those who need to manipulate security
      policy, for example, processes that launching application. Our
      issue is not such case.
 2) Create the directory /opt/etc/hal in advance with smack label '_'
    with transmute flag
    : Instead of granting CAP_MAC_ADMIN to hal-compatibility-checker.service,
      make /opt/etc/hal directory with smack label '_' plus transmute
      flag in advance (by post install script or else). Transmute flag on
      a directory makes a file created on that directory inherit directory's
      smack label instead of a process' smack label that created the file.
      However it additionaly requires smack rule "System _ rwxat" to be
      effective. The trailing 't' must be appended to the current smack
      rule, but security team reviewed and concluded that it might cause
      side effect so it was rejected.
 3) Create the file /opt/etc/hal/.hal-backend-compatibility
    as well as the directory /opt/etc/hal in advance with smack label '_'.
    And introduce additional file that denotes whether it requires update.
    : Create all directory and file in advance with smack label '_'.
      If a file has been created with a specific smack label, the
      smack label of a file is retained while being written by other smack
      labeled process. As the .hal-backend-compatibility file has changed
      to be persistent (we use systemd-tmpfiles to create it so it always
      exists), we need additional information whether it needs to be
      updated. So introduced empty file .hal-backend-compatibility-loaded.
      The file will be created after creating .hal-backend-compatibility.
      If the file exists, hal-compatibility-checker.service won't be processed.

Change-Id: I985675457f40f89a28c9a05cd032e10c6220f8de
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
5 months agohalapi: common: Add missing function prefix 'hal_api_cc_' 28/317828/2
Youngjae Cho [Wed, 8 Jan 2025 08:47:32 +0000 (17:47 +0900)]
halapi: common: Add missing function prefix 'hal_api_cc_'

The functions that are used by unittest was missing prefix.
Added 'hal_api_cc_' to them to be consistent with other functions.

Change-Id: I997fc7360926871e4c5b29fd9fc295534e2146da
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
5 months agohalapi: Fix memleak of hal_module_info->manifest 61/317661/2
Yongjoo Ahn [Mon, 6 Jan 2025 09:41:09 +0000 (18:41 +0900)]
halapi: Fix memleak of hal_module_info->manifest

Let the module_info hashtable's destroy functions release manifest
string allocated by `g_strdup`.

Change-Id: I354644978bc23f912a6434c886a967c3e6cb63ac
Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
5 months agohalapi: common: Remove deprecated global variable and abi_version in hal_backend
Chanwoo Choi [Mon, 16 Dec 2024 04:20:41 +0000 (13:20 +0900)]
halapi: common: Remove deprecated global variable and abi_version in hal_backend

The variables related to 'abi_version' has not used anymore.
Remove deprecated global variable and abi_version in hal_backend
structure.

Change-Id: I1a40fb01cd18d8b3fbbb45f712df3a4b8c786734
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 months agohalapi: common: Add debug log for init/exit/dlopen/dlclose 37/316637/2 accepted/tizen/unified/20241217.171005 accepted/tizen/unified/x/20241218.212016 accepted/tizen/unified/x/asan/20250113.002107
Chanwoo Choi [Mon, 16 Dec 2024 07:50:26 +0000 (16:50 +0900)]
halapi: common: Add debug log for init/exit/dlopen/dlclose

Add debug log for each init/exit/dlopen/dlclose step to catch the
latency issue.

[Details description of newly added log]
(snip) __get_backend(361) > HAL_MODULE_TBM: Prepare to open HAL backend: (snip)
-> Execute dlopen() and dlsym()
(snip) __get_backend(369) > HAL_MODULE_TBM: Open and Prepare to get HAL backend: (snip)
-> Execute 'init' function on hal-backend
(snip) __get_backend(384) > HAL_MODULE_TBM: Get HAL backend: (snip)

(snip) __put_backend(435) > HAL_MODULE_TBM: Prepare to exit HAL backend: (snip)
-> Execute 'exit' function on hal-backend
(snip) __put_backend(450) > HAL_MODULE_TBM: Exit and prepare to put HAL backend: (snip)
-> Execute dlclose()
(snip) __put_backend(462) > HAL_MODULE_TBM: Put HAL backend: (snip)

Change-Id: I91bfab7317bbe4f4600f5bba0475f85219261c21
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 months agoRemove Zigbee/Uwb hal layer 89/315989/2 accepted/tizen/unified/20241217.010335 accepted/tizen/unified/x/20241218.032654 accepted/tizen/unified/x/asan/20241224.004423
Jihoon Jung [Mon, 9 Dec 2024 04:06:43 +0000 (13:06 +0900)]
Remove Zigbee/Uwb hal layer

- Related to TRE-3221 and TRE-3222

Change-Id: Ice48b8a44ac501d21becdcd33f31597551695e9f
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
6 months agohalcc: parser: Use small letter of 'ipc' transport method 25/315925/1
Chanwoo Choi [Thu, 5 Dec 2024 11:49:14 +0000 (20:49 +0900)]
halcc: parser: Use small letter of 'ipc' transport method

The 'transport' property is able to have either 'passthrough' or 'ipc'.
In order to keep the consistent small letter style, replace 'IPC' with 'ipc'.

Change-Id: I2212337e1af49b04c2e23f92825bed602a4ca473
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 months agopackaging: Increase release version-up on Tizen 10.0 15/315415/1 accepted/tizen/unified/20241202.132940
Chanwoo Choi [Fri, 29 Nov 2024 04:17:05 +0000 (13:17 +0900)]
packaging: Increase release version-up on Tizen 10.0

When Tizen major version is up, will increase release version-up of
package. So that increase release version-up on Tizen 10.0.

Change-Id: I57edef9b19c0c22b54e308e494a777acea4452f8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 months ago[DAPR-68] halapi: Add new HAL_MODULE_DA_AB_UPDATE module 14/315414/1
Chanwoo Choi [Fri, 29 Nov 2024 03:58:32 +0000 (12:58 +0900)]
[DAPR-68] halapi: Add new HAL_MODULE_DA_AB_UPDATE module

[Role of HAL_MODULE_DA_AB_UPDATE module]
- Support A/B Partition Update

[Details description of newly added HAL_MODULE_DA_AB_UPDATE module]
- group                 : HAL_GROUP_SYSTEM,
- module                : HAL_MODULE_DA_AB_UPDATE,
- license               : HAL_LICENSE_APACHE_2_0,
- gbm_group             : HAL_GBM_GROUP_DA,
- module_name           : "HAL_MODULE_DA_AB_UPDATE",
- backend_module_name   : "da-ab-update",
- library_name          : "/hal/lib/libhal-backend-da-ab-update.so",
- library_name_64bit    : "/hal/lib64/libhal-backend-da-ab-update.so",
- symbol_name           : "hal_backend_da_ab_update_data",
- manifest              : "/etc/hal/hal-api-da-ab-update-manifest.xml",
- hal_api               : true,

Change-Id: I512ac51429625423c882fc16dfc29298155c14f1
Link: https://jira.sec.samsung.net/browse/DAPR-68
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 months agohal-common: Add new HAL_MODULE_DA_WOW module 06/320906/4
Chanwoo Choi [Mon, 25 Nov 2024 09:29:18 +0000 (18:29 +0900)]
hal-common: Add new HAL_MODULE_DA_WOW module

HAL_MODULE_DA_WOW is supporting WOW (Wake On Wlan) functionality with Wifi Chip.
For using HAL_MODULE_DA_WOW, wifi chip have to support the keepalive
featuer on CPU suspend status and then Wifi chip should filter the
specific packet according to hal-api-wow user request. When receiving
the specific packet, Wifi chip will make the event to wakup CPU from
suspend and then hal-api-wow get the raised the kind of event.

[Details description of newly added HAL_MODULE_DA_WOW module]
- hal module : HAL_MODULE_DA_WOW
- group                 : HAL_GROUP_SYSTEM,
- module                : HAL_MODULE_DA_WOW,
- license               : HAL_LICENSE_APACHE_2_0,
- gbm_group             : HAL_GBM_GROUP_DA,
- module_name           : "HAL_MODULE_DA_WOW",
- backend_module_name   : "da-wow",
- library_name          : "/hal/lib/libhal-backend-da-wow.so",
- library_name_64bit    : "/hal/lib64/libhal-backend-da-wow.so",
- symbol_name           : "hal_backend_da_wow_data",
- manifest              : "/etc/hal/hal-api-da-wow-manifest.xml",
- hal_api               : true,

Change-Id: Iac845235eef4c2871f560016b900c7328babf7d6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 months agocommon: Add new enum hal_gbm_group to indicate owned GBM information 05/320905/2
Chanwoo Choi [Mon, 25 Nov 2024 09:03:45 +0000 (18:03 +0900)]
common: Add new enum hal_gbm_group to indicate owned GBM information

Need to add new HAL-API for each GBM. Each HAL-API need to include
the GBM information. So that add new enum hal_gbm_group to indicate
owned GBM information.

[Detailed of newly added enum hal_gbm_group]
- enum name : enum hal_gbm_group
- Indication of each hal_gbm_group enumeration
 : HAL_GBM_GROUP_PUBLIC indicates Public Tizen.
 : HAL_GBM_GROUP_DA indicates DA (Digital Appliance) Tizen.

Change-Id: I9fa55b3cc99f6f3c33dafb1c7fe25d2e596e2b15
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 months agopackaging: Version 1.0.0 04/320904/2
Chanwoo Choi [Sat, 16 Nov 2024 23:47:01 +0000 (08:47 +0900)]
packaging: Version 1.0.0

Changes:
- Add new hal_common_get/put_backend_v2()
- Add new HALCC (HAL Compatibility Checker)
- Add data migration script for HALCC

Change-Id: Ia929ed2e12360fce8c7f20d5aead10afe961792c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 months agohalcc: Add %enable_halcc to enable/disable the feature selectively 19/319419/5 accepted/tizen/unified/20241108.105514
Youngjae Cho [Wed, 23 Oct 2024 02:49:44 +0000 (11:49 +0900)]
halcc: Add %enable_halcc to enable/disable the feature selectively

There could be some environment that the hal-comaptibility-checker would
not be necessary. For example, a platform image that always accompanies
hal image when building will never worry about ABI compatibility between
them. In such case, the hal-compatibility-checker is pointless and no more
than a thing that degrades booting performance. For such reason,
%enable_halcc has been introduced on the .spec file and can be used to
exclude total halcc feature.

Change-Id: I26510db0374602303874265c2e99cb97c3c71fdc
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
7 months agohalcc: Move execution of halcc from generator to sysinit.target 82/319282/10
Youngjae Cho [Mon, 21 Oct 2024 02:48:21 +0000 (11:48 +0900)]
halcc: Move execution of halcc from generator to sysinit.target

systemd generator is executed in serialized order, not in parallel
like systemd services. So the time consumed by a program run by
systemd generator will throughly added up to the overall booting time.
Therefore, convert hal-compatibility-checker into a systemd service
and make it be pulled in by sysinit.target so it can run in parallel,
improving booting time. On top of this, as the service has change to
run as system_fw/system_fw (uid/gid), the permission of directory
/opt/etc/hal created by the service has changed to 0755 to make it
be able to write a file on that directory.

Change-Id: Ia56b8c2ed845c3321db0d9304a0cb182134f0e75
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
7 months agoAdd dependency to capi-base-common 46/319046/3 accepted/tizen_unified_toolchain accepted/tizen/9.0/unified/20241030.231851 accepted/tizen/unified/20241017.114749 accepted/tizen/unified/toolchain/20241022.122454 accepted/tizen/unified/toolchain/20241022.122925 accepted/tizen/unified/x/20241017.170349 accepted/tizen/unified/x/asan/20241022.113457 tizen_9.0_m2_release
Youngjae Cho [Mon, 14 Oct 2024 07:42:32 +0000 (16:42 +0900)]
Add dependency to capi-base-common

It is required for the header tizen.h and enums such as TIZEN_ERROR_*
defined at the header. Those are accessible by the dependency to the
capi-base-common, which is currently pulled in by the dlog. However,
some build environment lack of such indirect dependency would blame
this. Therefore explicitly state the dependency.

Change-Id: I215b2eb2b16bbb931e7565d0d1adb436a425a6d0
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
7 months agoRevert "tests: Remove unnecessary header <tizen.h>" 45/319045/1
Youngjae Cho [Mon, 14 Oct 2024 07:41:30 +0000 (16:41 +0900)]
Revert "tests: Remove unnecessary header <tizen.h>"

This reverts commit a6e22bdbc0245ddfe066154ac58d8dcf83f26a6e.

Change-Id: I54fae1421d436e19db7ca768b5e0b3259cd7e7b3
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
8 months agotests: Remove unnecessary header <tizen.h> 68/318268/1 accepted/tizen/unified/20240928.111250 accepted/tizen/unified/20240928.221348 accepted/tizen/unified/toolchain/20241004.101715 accepted/tizen/unified/x/20240929.082823 accepted/tizen/unified/x/asan/20241014.000036
Youngjae Cho [Thu, 26 Sep 2024 06:57:28 +0000 (15:57 +0900)]
tests: Remove unnecessary header <tizen.h>

Change-Id: I92cbc7872c9a0062bd58244f2463754c580373cf
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
10 months agohalcc: Remove checking SYSTEMD_SCOPE environment variable 39/314739/1 accepted/tizen_unified_dev accepted/tizen/unified/20240722.104230 accepted/tizen/unified/dev/20240724.110124 accepted/tizen/unified/toolchain/20240812.132717 accepted/tizen/unified/x/20240723.043605 accepted/tizen/unified/x/asan/20240813.231006
Youngjae Cho [Thu, 18 Jul 2024 06:51:42 +0000 (15:51 +0900)]
halcc: Remove checking SYSTEMD_SCOPE environment variable

The environment variable is used for testing whether the execution
context is systemd system generator. And for this, getenv() had been
utilized. However, there was a blame that the getenv() is vulnerable
as the environment variable could be controlled externally. Therefore,
removed using SYSTEMD_SCOPE environment variable.

Due to this, it has become that someone can create compatibility result
file, /opt/etc/hal/.hal-backend-compatibility, outside of systemd system
generator context. Nevertheless, we can screen out the worst case that
unprivileged process generates the file because the directory /opt/etc
has attribute of {root,system_share,0775}.

Change-Id: I89fd5abc5c2445ce827371f61244bbc9e388d438
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agopackaging: Add data migration script to remove /opt/etc/hal/.hal-backend-compatibility 91/314291/2 accepted/tizen/unified/20240711.163723 accepted/tizen/unified/dev/20240712.055812 accepted/tizen/unified/x/20240715.042500
Chanwoo Choi [Wed, 10 Jul 2024 02:18:43 +0000 (11:18 +0900)]
packaging: Add data migration script to remove /opt/etc/hal/.hal-backend-compatibility

Remove /opt/etc/hal/.hal-backend-compatibility for data migration of OS
Upgarde to remove the invalid result of hal backend compatibility.

/opt/etc/hal/.hal-backend-compatibility should be created on first
booting by comparing the supported HAL interface version in HAL manifest
with hal-backend version.

Change-Id: Id6980ced56f7f8c2fee0f7b178e6534ad168b1cb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
11 months agohalapi: common: Fix typo to hal_module 34/313734/1 accepted/tizen/unified/20240702.091855 accepted/tizen/unified/dev/20240703.060352 accepted/tizen/unified/x/20240704.023007
Chanwoo Choi [Mon, 1 Jul 2024 09:26:32 +0000 (18:26 +0900)]
halapi: common: Fix typo to hal_module

Change-Id: I56e70c0676381dde7b5b3dbaf368468a836b14a4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
11 months agohalapi: common: Add hal_common_get/put_backend_v2 to support ABI compatibility 70/313670/2
Chanwoo Choi [Thu, 27 Jun 2024 12:56:46 +0000 (21:56 +0900)]
halapi: common: Add hal_common_get/put_backend_v2 to support ABI compatibility

Add hal_common_get_backend_v2 and put_backend_v2 to support ABI
compatibility between HAL interface and HAL backend.

In order to suport HAL ABI compatibility, need to allocate the memory of
hal interface structure instead of hal bakcend.
So that hal_common_get/put_backend_v2 functions requires the init/exit_backend
function pointer of which initialize and deinitialze the
hal_backend_[module]_funcs instance like allocation/free memory.

[Newly added function to get/put backend]
int hal_common_get_backend_v2(enum hal_module module,
void **data, void *user_data,
int (*init_backend)(void **data, void *user_data));
int hal_common_put_backend_v2(enum hal_module module,
void *data, void *user_data,
int (*exit_backend)(void *data, void *user_data));

int hal_common_get_backend_with_library_name_v2(enum hal_module module,
void **data, void *user_data,
int (*init_backend)(void **data, void *user_data),
const char *library_name);

int hal_common_put_backend_with_library_name_v2(enum hal_module module,
void **data, void *user_data,
int (*exit_backend)(void *data, void *user_data),
const char *library_name);

Change-Id: I71de896383162032bc5b03348888dd97dedb5f52
Suggested-by: Jeongmo Yang <jm80.yang@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
11 months agohalcc: Fix default compatibility to HAL_COMMON_BACKEND_COMPATIBLITY_UNKNOWN 61/313461/1 accepted/tizen/unified/20240627.103703 accepted/tizen/unified/dev/20240701.073006 accepted/tizen/unified/x/20240628.014019
Youngjae Cho [Wed, 26 Jun 2024 06:31:09 +0000 (15:31 +0900)]
halcc: Fix default compatibility to HAL_COMMON_BACKEND_COMPATIBLITY_UNKNOWN

It makes difference when there is no installed backend. Previously it
was regarded as HAL_COMMON_BACKEND_COMPATIBILITY_INCOMPATIBLE, but
it has changed to as HAL_COMMON_BACKEND_COMPATIBILITY_UNKNOWN. This
mainly affects lshal to print 'Compatibility' column empty if there
is no installed backend, which previously printed 'Incompatible' on
that column.

Change-Id: I00d87c66c76b22a35af8f8da87cdb3f75937225a
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Remove unused code 53/313453/1
Youngjae Cho [Wed, 26 Jun 2024 03:40:59 +0000 (12:40 +0900)]
halcc: Remove unused code

Change-Id: I08ed786774a6d0e7f25c1a232d688dd4f71ddac7
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agotests: Separate functions exclusively used for testing 51/313451/3
Youngjae Cho [Wed, 26 Jun 2024 03:26:04 +0000 (12:26 +0900)]
tests: Separate functions exclusively used for testing

Change-Id: Ib3f1c089e1d1cfdbf1aafa4ab95e6cdc05acccf5
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Add cache not to open() file multiple times on a same module 50/313450/1
Youngjae Cho [Tue, 25 Jun 2024 09:53:03 +0000 (18:53 +0900)]
halcc: Add cache not to open() file multiple times on a same module

Change-Id: I623b0a7fd0fb223750aa24ea1737a2c7c2fe0a66
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agotool: lshal: Replace 'Backend Verification' with 'Compatibility' 77/313377/2 accepted/tizen/unified/20240625.163203 accepted/tizen/unified/x/20240626.052157
Youngjae Cho [Tue, 25 Jun 2024 04:05:40 +0000 (13:05 +0900)]
tool: lshal: Replace 'Backend Verification' with 'Compatibility'

------------------------------------------------------------------
                                        | ...  |                 |
 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>
11 months agotool: lshal: Print interface and backend version 52/313352/6
Youngjae Cho [Mon, 24 Jun 2024 10:03:10 +0000 (19:03 +0900)]
tool: lshal: Print interface and backend version

The last 2 columns have been added. For example
--------------------------------------------------------------------
                            | ...  | Interface           | Backend |
 HAL Module Name            | ...  | Versions            | Version |
--------------------------------------------------------------------
 ...                        |      |                     |         |
--------------------------------------------------------------------
 HAL_MODULE_DEVICE_DISPLAY  | ...  | 1.0, 2.3, 3.2, 4.1  | 1.0     |
--------------------------------------------------------------------
 ...                        |      |                     |         |

- Interface Versions
  : Versions specified at the manifest file,
    /etc/hal/hal-api-{module}-manifest.xml. Can be more than one
    if it has specified multiple supporting versions.

- Backend Version
  : Version that an actual backend has been implemented with.

Change-Id: I035617f86396a7b730d26e7e6312d0dd20c86429
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Add hal_common_get_supported_interface_versions() 51/313351/4
Youngjae Cho [Mon, 24 Jun 2024 08:32:09 +0000 (17:32 +0900)]
halcc: Add hal_common_get_supported_interface_versions()

It gets versions specified at manifest file.

Change-Id: Icdaa1e8c4615fa2aa046c1a6cd698f8061905a00
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Add module name info to error log 76/313376/2
Youngjae Cho [Tue, 25 Jun 2024 02:31:08 +0000 (11:31 +0900)]
halcc: Add module name info to error log

Change-Id: Ic1c1992dfc913f205f651c40005240700f9f6c07
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Fix errno not to be overwritten before returning 75/313375/1
Youngjae Cho [Tue, 25 Jun 2024 01:38:37 +0000 (10:38 +0900)]
halcc: Fix errno not to be overwritten before returning

Change-Id: Iddc5f3e1abd43c6a9881fdde55ae354c47850b6a
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Fix file descriptor leak 74/313374/1
Youngjae Cho [Tue, 25 Jun 2024 01:34:15 +0000 (10:34 +0900)]
halcc: Fix file descriptor leak

Change-Id: I5cc2d7f628686d65513a740d4df15ca92cddca3b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agosystemd-hal-compatibility-checker-generator: Remove lost option --redirect-all 29/313229/1
Youngjae Cho [Thu, 20 Jun 2024 07:17:54 +0000 (16:17 +0900)]
systemd-hal-compatibility-checker-generator: Remove lost option --redirect-all

It has changed to have no choice but to emit log to dlog.

Change-Id: Ic15e4c8d47f199ec0410ee8ac19ff9ef78c0ec48
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Fix not to ask for HAL_MODULE_UNKNOWN to prevent error log spam 04/313204/1
Youngjae Cho [Thu, 20 Jun 2024 05:26:54 +0000 (14:26 +0900)]
halcc: Fix not to ask for HAL_MODULE_UNKNOWN to prevent error log spam

Change-Id: Icf874c346b00684960452c2023746bdbb67b4efb
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agotool: hal-compatibility-checker: Fix --skip-if-result-exist to work 03/313203/1
Youngjae Cho [Thu, 20 Jun 2024 03:55:32 +0000 (12:55 +0900)]
tool: hal-compatibility-checker: Fix --skip-if-result-exist to work

To prevent checking repeatedly for every booting, the option skips
checking if there was result file.

Change-Id: If55a3a59c12765591e33c5c2899028af86452907
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Fix error log to dlog instead of stdout 02/313202/1
Youngjae Cho [Thu, 20 Jun 2024 03:47:56 +0000 (12:47 +0900)]
halcc: Fix error log to dlog instead of stdout

It was printf() because it should work before dlog daemon start up.
However, it can be written to dlog even without dlog daemon. Therefore
replace printf() with dlog function. And by this, it becomes
unnecessary for tool hal-compatibility-checker that redirecting outputs.
Thus removed related options and operations.

Change-Id: I0e3a81f666b22b6f9ae909c81f7d62ea7431cc47
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Check only explicitly specified manifest file 65/313165/4
Youngjae Cho [Wed, 19 Jun 2024 12:37:59 +0000 (21:37 +0900)]
halcc: Check only explicitly specified manifest file

halcc has changed to work only on top of manifest file specified in
hal-api-list.h instead of entire xml files at a directory.
Due to above, it becomes necessary that calling parsing function for
every single files, every requested hal module. To make it work,
fixed related function to operates on each single manifest file.

Change-Id: I67e48afb4d0248be37144b127d7068d9dff3452f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agotool: hal-compatibility-checker: Fix file path used by --reset 79/313179/1
Youngjae Cho [Thu, 20 Jun 2024 01:52:27 +0000 (10:52 +0900)]
tool: hal-compatibility-checker: Fix file path used by --reset

Change-Id: I3cd0a7b7d303e6c8d0d1aead41ed1f5cf49f5c8d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agotool: hal-compatibility-checker: Add option --reset to remove result file 58/313158/3 accepted/tizen/unified/20240621.010407 accepted/tizen/unified/toolchain/20240624.121430 accepted/tizen/unified/x/20240624.031935 accepted/tizen/unified/x/asan/20240625.092340
Youngjae Cho [Wed, 19 Jun 2024 11:14:01 +0000 (20:14 +0900)]
tool: hal-compatibility-checker: Add option --reset to remove result file

Change-Id: I023148c4534625a073282324e7567b26e54fe5d2
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Fix default manifest directory to '/etc/hal' 37/313137/1
Youngjae Cho [Wed, 19 Jun 2024 08:19:36 +0000 (17:19 +0900)]
halcc: Fix default manifest directory to '/etc/hal'

Change-Id: I07382d0e890f85924e31f73ae2f77aa46f7d823d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agohalcc: Create directory for .hal-backend-compatibility if not exist 35/313135/1
Youngjae Cho [Wed, 19 Jun 2024 07:08:07 +0000 (16:08 +0900)]
halcc: Create directory for .hal-backend-compatibility if not exist

Change-Id: I1ba61268f2ba5503ef85ef2c106d7bd5f456231d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agohalcc: Fix parser to accept <hal-api> instead of <root> 96/311496/1 accepted/tizen/unified/20240611.122614 accepted/tizen/unified/dev/20240620.010445 accepted/tizen/unified/x/20240612.025918
Youngjae Cho [Wed, 22 May 2024 02:27:11 +0000 (11:27 +0900)]
halcc: Fix parser to accept <hal-api> instead of <root>

Change-Id: Ibe6fbc1c1be51c2133da9eb0abe4772e23fbca2b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agohalcc: Fix parser to accept <hal-module> instead of <hal> 93/311493/1
Youngjae Cho [Wed, 22 May 2024 02:18:59 +0000 (11:18 +0900)]
halcc: Fix parser to accept <hal-module> instead of <hal>

Change-Id: Ie3aabd00c9c25b2f5d5da58719e63821346476d6
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agohalcc: Temporarily allow incompatible backend version 92/311492/1
Youngjae Cho [Wed, 22 May 2024 02:08:13 +0000 (11:08 +0900)]
halcc: Temporarily allow incompatible backend version

It needs time to deploy compatibility manifest to all hal modules.
After that, incompatible cases should terminate the function, returning
error.

Change-Id: I65ecdac80b96c12980e545c95744005db6435203
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agoRevert "halapi: Add hal-api-manifest.xml" 76/311276/8
Youngjae Cho [Fri, 17 May 2024 05:43:20 +0000 (14:43 +0900)]
Revert "halapi: Add hal-api-manifest.xml"

This reverts commit 6204958d8715858d61de3d8b8f94a93e701b203b.

The hal-api-manifest.xml has been removed and it would be deployed to
each repository of hal api module instead. Although the commit has been
reverted, manifest scheme will follows description on that commit.

Change-Id: I5c2121b600ef0f3eccc122913dcf82e6e432a33f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agotests: Add test manifest.xml and testcases for halcc 72/311272/10
Youngjae Cho [Thu, 16 May 2024 06:01:18 +0000 (15:01 +0900)]
tests: Add test manifest.xml and testcases for halcc

Change-Id: Ie2f7f5db53e1a91c35ce22f135d8f591fa89cca5
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agohalcc: Remove spamming error log 71/311271/7
Youngjae Cho [Fri, 17 May 2024 04:31:47 +0000 (13:31 +0900)]
halcc: Remove spamming error log

Those removed logs used to be emitted even when the manifest xml is
well structured because current xml scheme doesn't use all the text
node but selectively on some elements. Therefore such elements that
have no text node used to emit error log quite frequently.

Change-Id: I6e2c256033efbb6033969ace020e2e8a30d45b29
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agohalcc: Rework halcc compatibility checker 82/311182/9
Youngjae Cho [Tue, 14 May 2024 08:39:01 +0000 (17:39 +0900)]
halcc: Rework halcc compatibility checker

 As compatibility manifest has changed to specify multiple version for
hal, the halcc compatibility checker has also been fixed to follow
that scheme.

 1. The result file format has changed so that the halcc can now randomly
    access to module index for which the halcc has requested.

 2. Operation for generating result file will be rejected unless it is
    invoked by generator of systemd system manager. Therefore, if there
    is no result file when checking compatibility, and it is not on
    generator context, compatibility checking will do the entire
    routine, for every invocation, that should have done when creating
    the result file.

 3. For updating manifest file from a hal api repository, add below
    command at %post rpm scriptlet.
      : rm -rf /opt/etc/hal/.hal-backend-compatibility
      : systemctl daemon-reload
    systemctl daemon-reload triggers generator so it is able to create
    a new result file from updated manifest.

Change-Id: Ia8b140c2edc8d6de3c205716b8bed7d0fc92f602
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agohalcc: Fix manifest scheme 81/311181/3
Youngjae Cho [Tue, 14 May 2024 11:27:02 +0000 (20:27 +0900)]
halcc: Fix manifest scheme

Attribute "version" has changed to "platform-version" and attribute
"type" has been removed.
 As-is: <manifest version="1.0" type="platform">
 To-be: <manifest platform-version="9.0">

Change-Id: I296c0b119913d117d1b453e5947ed71c50d76946
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
12 months agohalcc: Remove all operations based on forward/backward semantic 80/311180/2
Youngjae Cho [Mon, 13 May 2024 08:10:40 +0000 (17:10 +0900)]
halcc: Remove all operations based on forward/backward semantic

Those function family
 - halcc_manifest_find_hal_*()
 - halcc_manifest_steal_hal_*()
was given with major/minor specifying which version of hal would be
selected in terms of forward/backward compatibility. However, as
halcc_hal has changed to manage multiple version within a list, it
cannot test a specific version is in the list but can test whether
the version can be compatible with the list using
halcc_hal_is_compatible_with_version().

Logically, all those find functions can be replaced with combination
of below two functions:
  halcc_manifest_find_hal(manifest, hal_name, major, minor, hal)
    -> halcc_manifest_find_hal(manifest, hal_name, hal)
       + halcc_hal_is_compatible_with_version(hal, major, minor)

Additionally, the halcc_manifest_find_hal_by_name() has been renamed to
halcc_manifest_find_hal() as the default behavior of finding hal is
not based on version, but only on name.

Change-Id: Ia7a39b5fd279fd8499cb4482eff7c37fc1a57354
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Add halcc_hal_is_compatible_with_version() 79/311179/1
Youngjae Cho [Mon, 13 May 2024 07:57:09 +0000 (16:57 +0900)]
halcc: Add halcc_hal_is_compatible_with_version()

The function checks whether the given major/minor version is covered
by the given hal. The hal manages version list and one of its element
version can support the given major/minor version if its version
meets BOTH of the below:
  - equal to the given major version
  - equal to or greater than the given minor version

Change-Id: I72198000f6f4574dd96ac8ad1a76fd4a887024a5
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Fix parser to accept multiple version for hal 78/311178/1
Youngjae Cho [Mon, 13 May 2024 05:49:01 +0000 (14:49 +0900)]
halcc: Fix parser to accept multiple version for hal

 Make halcc_hal manage multiple version internally. The parser accepts
versions whenever it meets <version> element, consumes and updates
version list of halcc_hal.
 Currently, the only first incoming version is set as version of a hal,
and all of the version-related operations works on top if it. This is
for making the whole code work in the current structure, but it will be
fixed to take the entire version list into account when it counts
compatibility.

Change-Id: I6b95a7692fc2ffbe3630db04b94dd6dc0f3a66cc
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Remove hal dependency scheme from manifest 19/311019/3
Youngjae Cho [Fri, 3 May 2024 08:53:42 +0000 (17:53 +0900)]
halcc: Remove hal dependency scheme from manifest

It is currently not used. And for support multi-versioning hal manifest,
the current style should be totally reformed somehow. Therefore, removed
the hal dependency scheme and related operations.

Change-Id: I1857b558f6debc9463fb3babfbc1447326dfc4bb
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Fix not to use min-max semantic for minor versioning 18/311018/3
Youngjae Cho [Thu, 2 May 2024 03:10:41 +0000 (12:10 +0900)]
halcc: Fix not to use min-max semantic for minor versioning

Removed use of version format of MAJOR.MIN_MINOR-MAX_MINOR. It has
changed to have only form of MAJOR.MINOR.

Change-Id: I3fa0e0220a97f7a5dcb2c817b291a4fbd96fb5fa
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agoRevert removal of enum hal_abi_version definition 03/311003/2
Youngjae Cho [Fri, 10 May 2024 07:38:00 +0000 (16:38 +0900)]
Revert removal of enum hal_abi_version definition

This has been removed since 70757d52a56abd1e9820c181bfe10aefbeee7caf.
However, the definition is still required as the reference from another
repository hasn't been totally removed yet. Those code referring the
definition and the definition itself would be removed together.

Change-Id: I6d985d2290d6aaf755e4dcca2b3a00f9820a7acb
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Fix thread-unsafe function, getpwnam(), getgpnam() 11/310511/1
Youngjae Cho [Tue, 30 Apr 2024 06:15:04 +0000 (15:15 +0900)]
halcc: Fix thread-unsafe function, getpwnam(), getgpnam()

Change them to getpwnam_r(), getgrnam_r().

Change-Id: I3841bd9018ac30b7adb0701b4cb439009ea74dc3
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Make parser maintain hal to have the latest version 08/310508/2
Youngjae Cho [Tue, 30 Apr 2024 04:44:38 +0000 (13:44 +0900)]
halcc: Make parser maintain hal to have the latest version

If halcc parser picks a hal that can be covered by hal that has been
parsed before, put the hal back. Here 'cover' means that one can
supports the other in terms of backward compatibility, for example,
v2.3 covers v2.0~v2.3. On the other hand, if a hal being picked can
cover a hal that has been parsed before, the previous hal is replaced
with the newly picked one.

Change-Id: Ie273d5065e53cd541b5edb3138b97f3c3deb1ff7
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Fix manifest scheme to have multiple <manifest> element 07/310507/1
Youngjae Cho [Tue, 30 Apr 2024 01:56:21 +0000 (10:56 +0900)]
halcc: Fix manifest scheme to have multiple <manifest> element

To have multiple <manifest> element, halcc parser now recognizes root
element <root> and searches for its children <manifest>.

Change-Id: I72ca77a6331f172c6a0f6e4eb3c660dccef7e71c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Fix directory where halcc searches for manifest.xml 62/310162/2
Youngjae Cho [Tue, 23 Apr 2024 08:22:22 +0000 (17:22 +0900)]
halapi: Fix directory where halcc searches for manifest.xml

The hal manifest install path has changed to a directory, /etc/hal-manifest,
regardless of tizen version specified at /hal/etc/hal-info.ini.

Change-Id: Ib6941b89ed4688e43f954cf278add0dc8008a92b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Add hal-api-manifest.xml 57/310157/2
Youngjae Cho [Tue, 23 Apr 2024 06:41:20 +0000 (15:41 +0900)]
halapi: Add hal-api-manifest.xml

The hal-api specifies which version it requires to a hal backend
module. The manifest file must be installed in the following directory:
 - /etc/hal-manifest/hal-api-manifest.xml

Manifest scheme:
 <manifest version="1.0" type="platform">
     <hal>
         <name>HAL_MODULE_XXX</name>
         <version>1.2</version>
         <version>2.0</version>
         <transport>passthrough</transport>
     </hal>
 </manifest>

 The above specifies that a platform has hal api version of both 1.0-2
and 2.0. The name, in this case the HAL_MODULE_XXX, must be one of an
enum hal_module. (See include/hal-common.h) It expects for hal backend
to have version that specified in <version>. Here the 'compatible' means
that backend version should have major version equal to platform, and
minor equal to or lesser than platform. At the above case, here is
compatible set of backend version:
 - Compatible backend version: 1.0, 1.1, 1.2, 2.0
 - Incompatible backend version: 1.3, 2.1, 3.0, ...

 As aforementioned, a platform must contain all set of apis as it has
specified on manifest <version>. For example, a hal api that specified
the above manifest must have all apis like below.
  // hal-xxx.h
  int hal_xxx_foo(); // Implemented as of v1.0
  int hal_xxx_bar(); // Implemented as of v1.1
  int hal_xxx_baz(); // Implemented as of v1.2
  int hal_xxx_qux(); // Implemented as of v2.0

 Note that, for backward compatibility, all functions with older minor
version as well as the latest minor version must be provided together.
And they cannot be removed as the minor bumps within the same major
version.
 It works based on which backend version would have been. If a platform
works on top of backend version of 1.1, the foo and bar will works
whereas baz and qux won't, returning not supported error, for example.
Note that even though the platform has implemented baz since v1.2, it
won't work as backend has no idea about v1.2.
 For backend version of 1.3, for example, all the foo, bar, and baz
won't work. (qux obviously won't too due to major version mismatch)
The backend v1.3 might have implemented all v1.0 ~ v1.3 functionalities
for backward compatibility though, it is possible that v1.2 platform
could not understand semantic of v1.3 that will have been given in
the future. To prevent this, platform refuses to work with backend
of future minor version.

 If a new hal api is added with major or minor version bump, fix the
manifest file through ACR process.

Change-Id: I9d191f4fe63577eb6ce08aa7fe3ac058f80f0360
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agotools: hal-compatibility-checker: Print error log 47/310147/2
Youngjae Cho [Tue, 23 Apr 2024 05:53:01 +0000 (14:53 +0900)]
tools: hal-compatibility-checker: Print error log

Change-Id: Id7adda83f8625065c2a48f4284265f5525c374b9
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Disable dependency checking between hal-api 90/309990/4
Youngjae Cho [Fri, 19 Apr 2024 02:46:07 +0000 (11:46 +0900)]
halapi: Disable dependency checking between hal-api

Temporarily disable it. For now, it is unclear that dependency checking
is necessary. Because, those hal-api header and manifest.xml aren't
managed by ACR process so they could be transformed anyhow, breaking
dependency. Currently, our policy has no specification that force them
to think about and comply with dependency among hal-apis.

Change-Id: Iab1fc46674e4af0e0b6771c630d6e1a093dda8f9
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Remove 'level' from manifest scheme 89/309989/3
Youngjae Cho [Fri, 19 Apr 2024 02:23:10 +0000 (11:23 +0900)]
halapi: Remove 'level' from manifest scheme

It hasn't been used and had no role.

Change-Id: Ied4007d00e4596618a9f11e993780c343c42b1c7
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agotests: Fix hooking to be done via wrapper provided by linker 31/309731/3
Youngjae Cho [Tue, 16 Apr 2024 06:08:38 +0000 (15:08 +0900)]
tests: Fix hooking to be done via wrapper provided by linker

For MCD(Module Circular Dependency) score, remove direct reference
from hal-api-common to hal-api-common-hook.c.

Change-Id: I1095243186f270cc1fb8d1ed30f7c8e954deb16d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Eliminate HAL abi and its operations 67/309367/14
Youngjae Cho [Tue, 9 Apr 2024 07:16:11 +0000 (16:16 +0900)]
halapi: Eliminate HAL abi and its operations

HAL abi won't be used anymore. Compatibility manifest and compatibility
checker take over the role. However, the .abi_version member variable
of struct __hal_backend has not been removed but just deprecated as it
is referenced by too many modules for now. After completely removing
them, this field will be removed.

Change-Id: I2ad812be1d1b8d8d16eeca776c20837d582aa25f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Separate g_compatibility_info into manifest and backend 39/309639/14
Youngjae Cho [Fri, 12 Apr 2024 11:09:02 +0000 (20:09 +0900)]
halapi: Separate g_compatibility_info into manifest and backend

To load those data separately, manifest and backend, separate their
data structure. It holds major/minor version instead of compatibility.
The compatibility could easily be knonw if major/minor versions of
manifest and backend have been held on memory.

In addition, storing format has been changed. Each segment is separated
by ':'.
 {index}:{module_name}:{manifest_major}.{manifest_minor}:
  {backend_major}.{backend_minor}:{manifest_desciption}:
  {backend_description}:{compatibility}

Change-Id: Ifd59eebc60e092e0c465e92b36ffde81e1185f15
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Fix storing function to accept overwrite parameter 38/309638/5
Youngjae Cho [Fri, 12 Apr 2024 06:39:49 +0000 (15:39 +0900)]
halapi: Fix storing function to accept overwrite parameter

This wipes out the access() for checking existance of file and code
branch. Due to this, code readability becomes more coherent.

Change-Id: I5e4cac06002818677051e8f4cf066d60cf7f1ca0
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Move hal_common family function to hal-api-common.c 37/309637/5
Youngjae Cho [Fri, 12 Apr 2024 05:43:11 +0000 (14:43 +0900)]
halapi: Move hal_common family function to hal-api-common.c

Place the below functions under hal-api-common.c.
 - hal_common_check_backend_compatibility()
 - hal_common_check_backend_compatibility_all()

And their implementation details, which are internal use only, has
been listed on hal-api-compatibility-checker.h.

Change-Id: I208363f860c75627f8b7c3d3e1c564d62e6196f3
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agoRevert "packaging: Add some packages as Requires(post)" 46/309346/2
Youngjae Cho [Tue, 9 Apr 2024 04:46:43 +0000 (13:46 +0900)]
Revert "packaging: Add some packages as Requires(post)"

This reverts commit 2bf62bbf6f24df736e3fc2360abbb70ce90eea6e.

It seems better that the /sbin/ldconfig is taken by the same package
on installing and uninstalling.

Change-Id: Iba4940fcce2ca6e2539bcfbd9897a83cd34e0880

13 months agohalapi: Fix escaping condition to 'ret < 0' for consistency 36/309636/3
Youngjae Cho [Fri, 12 Apr 2024 05:27:07 +0000 (14:27 +0900)]
halapi: Fix escaping condition to 'ret < 0' for consistency

Change-Id: I6ef8a25ffcb54609c42fd21bf214984fb2241002
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Apply compatibility check when __init_backend() 21/309321/13
Youngjae Cho [Mon, 8 Apr 2024 12:07:38 +0000 (21:07 +0900)]
halapi: Apply compatibility check when __init_backend()

Change-Id: Ic4938993fd3a7ce589e6d634423140a9d71bb562
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Add function checking HAL compatibility 20/309320/9
Youngjae Cho [Mon, 8 Apr 2024 11:34:54 +0000 (20:34 +0900)]
halapi: Add function checking HAL compatibility

int hal_common_check_backend_compatibility()
  : It checks compatibility of the given hal module.

Change-Id: I1f4e7a61b709b4bc364400a9ec7f6b920f4eb550
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Add function checking all of the HAL compatibility 19/309319/9
Youngjae Cho [Thu, 11 Apr 2024 03:30:37 +0000 (12:30 +0900)]
halapi: Add function checking all of the HAL compatibility

Previously, the API provides callbacks that give responsibility to
the caller that storing compatibility result in their own way. However,
to provide a unified way of storing and loading HAL compatibility,
hal-api-common has become responsible for storing and loading
compatibility in a unified manner.

int hal_common_check_backend_compatibility_all()
  : It gets compatibility of all the hal modules. Additionally, it
    stores compatibility of all modules to backing storage if there
    hasn't been for later use.

Currently, the result is stored in /opt/etc/hal/.hal-compatibility and
the below is an example of result generated by hal-compatibility-checker:
  root:/opt/etc/hal> cat .hal-compatibility
  0:Not defined:0:Manifest hasn't specified the module
  1:HAL_MODULE_TBM:0:Manifest hasn't specified the module
  2:HAL_MODULE_TDM:0:Manifest hasn't specified the module
  ...
  26:HAL_MODULE_DEVICE_DISPLAY:2:Compatible
  27:HAL_MODULE_DEVICE_IR:0:Manifest hasn't specified the module
  28:HAL_MODULE_DEVICE_TOUCHSCREEN:1:Backend has incompatible version
  29:HAL_MODULE_DEVICE_LED:2:Compatible
  30:HAL_MODULE_DEVICE_BOARD:0:Manifest hasn't specified the module
  ...

It has foramt of
  "{index}:{module_name}:{compatibility}:{description}"

The tool hal-compatibility-checker, therefore, has changed to just call
the API, and removed callback code.

Change-Id: I4e1319bb98c81e1389e22924ae4ed70a66e46f7b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohalcc: Move libhalcc into libhal-api-common 18/309318/4
Youngjae Cho [Mon, 8 Apr 2024 02:59:41 +0000 (11:59 +0900)]
halcc: Move libhalcc into libhal-api-common

There were cyclic dependencies that
 : libhalcc requires libhal-api-common due to loading and checking
   backend version
 : libhal-api-common requires libhalcc due to checking compatibility

To remove dependency on each other, the libhalcc has been added to
the libhal-api-common.

Change-Id: I6b12310e2ffea0e038609d57158b51b973a470ce
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohalapi: Move 'g_platform_curr_abi_version' from header to source code 17/309317/2
Youngjae Cho [Mon, 8 Apr 2024 09:52:34 +0000 (18:52 +0900)]
halapi: Move 'g_platform_curr_abi_version' from header to source code

Declaring variable with initializer on header might cause muiltiple
definition. Linker would be confused when linking multiple object files
that had been compiled seperately with the header included as the linker
can see multiple definitions to which symbol g_platform_curr_abi_version
could be linked. As multiple object files are complied seperately by each
translation unit, #ifndef-#define-#endif guard has no effect in the case.
Therefore, it is general that define variable in source code and provide
getter function or directly with extern keyword.

Change-Id: Ieb30dd5c9452cd846b318c7288221c9455e1f0ae
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agopackaging: Remove hal-rpmdb-checker.service 92/309192/2
Chanwoo Choi [Fri, 5 Apr 2024 10:30:34 +0000 (19:30 +0900)]
packaging: Remove hal-rpmdb-checker.service

hal-rpmdb-checker.service checks the RPM packages version
used by each hal-backend in order to check the compatibility between
hal-backand and used RPM packages. But hal-rpmdb-checker will be
replaced with each HAL module version checker of HAL compatibility
checker. So that remove hal-rpmdb-checker.service.

Change-Id: If33924c83b4d1619d9e8fd80711fe195a846d0a4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
14 months agohalcc: Use major/minor version instead of abi version for checking compatibility 52/308952/1
Youngjae Cho [Tue, 2 Apr 2024 06:48:13 +0000 (15:48 +0900)]
halcc: Use major/minor version instead of abi version for checking compatibility

Change-Id: Ib7fa6ed4e9a482ac5f9cdc356626444d3d762730
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohal-common-interface: Add hal_common_get_backend_abi_version() 30/308130/2
Yunhee Seo [Wed, 21 Feb 2024 06:26:13 +0000 (15:26 +0900)]
hal-common-interface: Add hal_common_get_backend_abi_version()

To apply HAL ABI Versioning, hal-backend major/minor version information is added.
Platform can decide whether to support hal-backend with major/minor version information.
To get major/minor versions from the hal-backend, this function is added.

int hal_common_get_backend_version(enum hal_module module, unsigned int *major_version, unsigned int *minor_version);
 - It obtains version information from hal-backend.

These variables are added to hal_backend structure.
 - const unsigned int major_version;
 - const unsigned int minor_version;

Change-Id: I8e548aabdeb66c27304a3ea99c2853d30e600c63
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
14 months agohalapi: Add checking abi_version pointer existence 29/308129/1
Yunhee Seo [Wed, 21 Feb 2024 06:38:24 +0000 (15:38 +0900)]
halapi: Add checking abi_version pointer existence

When obtainig the backend data, abi_version pointer checking part is necessary.
Although the absence of abi_version is the intended action, it occurs error.
Checking the pointer existence part was omitted.

Change-Id: I5852bdcfd288aec485643e599af56d358b2d7739
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
15 months agotests: Use strict string length for xml input 84/307884/1 accepted/tizen/unified/20240319.140945 accepted/tizen/unified/20240319.154751 accepted/tizen/unified/x/20240320.132940
Youngjae Cho [Thu, 14 Mar 2024 02:25:18 +0000 (11:25 +0900)]
tests: Use strict string length for xml input

 As libxml2 is upgraded to version 2.12.5, there added internal
logic that tests whether the parser would have succssfully reached at
the end of the given string when it completes parsing.

 The previous sizeof(str[]) is always greater by 1 than the sizeof(str[])
as it counts the terminating '\0'. And it makes libxml2 parser see that
there are some stuffs after parsing completion, reporting parse error.

Change-Id: I86cd16cb4a6b5460249900a138a6ee8dcb652d2c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
15 months agotools: hal-compatibility-checker: Add stdout/stderr redirection to dlog 03/306603/3
Youngjae Cho [Fri, 23 Feb 2024 02:40:05 +0000 (11:40 +0900)]
tools: hal-compatibility-checker: Add stdout/stderr redirection to dlog

Options, --redirect-all, --redirect-stdout, --redirect-stderr, can now
recognize special symbol "dlog" as a parameter, which redirects output
to dlog SYSTEM buffer with log tag HAL_COMPATIBILITY_CHECKER.

Change-Id: I80425f5643709d0b0b16f8aaaa98b2a3021d263a
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
15 months agohalcc: Add fail log for halcc-object operations 48/306348/3 accepted/tizen/unified/20240306.011956 accepted/tizen/unified/toolchain/20240311.065828 accepted/tizen/unified/x/20240307.010805
Youngjae Cho [Tue, 20 Feb 2024 10:19:54 +0000 (19:19 +0900)]
halcc: Add fail log for halcc-object operations

Change-Id: I2ced0da3de13b627dc6d8a528bf9a91a102960d6
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
15 months agohalcc: Add checking halcc_manifest_add_hal() return value 78/305978/2
Yunhee Seo [Wed, 14 Feb 2024 10:10:06 +0000 (19:10 +0900)]
halcc: Add checking halcc_manifest_add_hal() return value

If halcc_manifest_add_hal() returns error, halcc_hal should be free.
Omitted handling code is added.

Change-Id: Ic566968760537f2375cd84e25b877115beeaddb3
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
15 months agohalapi: common: Add HAL_ABI_VERSION_TIZEN_9_0 34/306734/1 accepted/tizen/unified/20240228.170403 accepted/tizen/unified/x/20240304.072506 accepted/tizen/unified/x/20240304.072736
Jaehoon Chung [Fri, 23 Feb 2024 06:52:22 +0000 (15:52 +0900)]
halapi: common: Add HAL_ABI_VERSION_TIZEN_9_0

Add HAL_ABI_VERSION_TIZEN_9_0 after released Tizen-8.0.
It needs to add HAL_ABI_VERSION_TIZEN_9_0 for using correct Tizen Version.
If it's not backward compatible, it has to modify a compatible by module
owner.

Change-Id: I65359722e02e88e5deb10ee5358578da0716ff07
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
16 months agohalcc: Rename to systemd-hal-compatibility-checker-generator 63/304463/2 accepted/tizen/unified/20240119.154718 accepted/tizen/unified/x/20240205.063858
Chanwoo Choi [Wed, 17 Jan 2024 23:45:33 +0000 (08:45 +0900)]
halcc: Rename to systemd-hal-compatibility-checker-generator

Use full name of HAL Compatibilicy Checker instead of non-standand short
name as following:
- systemd-hal-compatibility-checker-generator

Change-Id: I04897575f5f2fec964e554ae640d1302834bcd5e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
16 months agosystemd-hal-cc-generator: Fix typo of PATH= environment variable 70/304470/2
Youngjae Cho [Thu, 18 Jan 2024 01:40:33 +0000 (10:40 +0900)]
systemd-hal-cc-generator: Fix typo of PATH= environment variable

Change-Id: I444adc46255d630365d9fa6203fd6505aa2f4366
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
16 months agohalcc: Add support for hal-api dependency checking 71/304171/12 accepted/tizen_unified_riscv accepted/tizen/unified/20240116.155507 accepted/tizen/unified/riscv/20240117.041616
Youngjae Cho [Thu, 11 Jan 2024 08:50:58 +0000 (17:50 +0900)]
halcc: Add support for hal-api dependency checking

Optionally, hal-api can specify dependency, name and version of another
hal-api, that it must work with.

  | <!--hal-api-xxx.xml-->
  |
  | <manifest version="1.0" type="platform" level="2">
  |     <hal>
  |         <name>AAA</name>
  |         <version>1.0</version>
  |         <dependency>
  |             <hal>
  |                 <name>BBB</name>
  |                 <version>1.0</version>
  |             </hal>
  |             ...
  |         </dependency>
  |     </hal>
  |     <hal>
  |         <name>BBB</name>
  |         <version>1.5</version>
  |     </hal>
  |     ...
  | </manifest>

The halcc-object.c now provides
 - halcc_manifest_validate_hal_dependency()

This validates dependencies between hals within manifest. It try to
find compatible hal that specified by hal-api dependency. If it
couldn't find compatible one for the dependency, the resolution fails
and the hal is regarded as not supported.

Let's say a manifest contains below specification about 4 hals
 - AAA@1.5  : success
 - BBB@2.3  : success
 - CCC@3.3  : success
 - DDD@1.0  : success
If there are no dependencies between each other, no problem.

Case1] If AAA@1.5 depends on YYY@1.0.
 - AAA@1.5 -> YYY@1.0  : fail, YYY@1.0 is not specified
 - BBB@2.3  : success
 - CCC@3.3  : success
 - DDD@1.0  : success

Case2] If AAA@1.5 depends on BBB@1.0.
 - AAA@1.5 -> BBB@1.0  : fail, BBB@1.0 isn't compatible with
                         the specified BBB@2.3
 - BBB@2.3  : success
 - CCC@3.3  : success
 - DDD@1.0  : success

Caser3] If AAA@1.5 depends on BBB@2.0, CCC@4.0
 - AAA@1.5 -> BBB@2.0, CCC@4.0 : fail, BBB@2.0 is backward compatible
                         with the specified BBB@2.3, but CCC@4.0 isn't
                         compatible with the specified CCC@3.3.
 - BBB@2.3  : success
 - CCC@3.3  : success
 - DDD@1.0  : success
 If multiple dependencies are specified on a hal, it success only when
 all the dependencies are satisfied.

Case4] If AAA@1.5 depends on BBB@2.0
          and BBB@2.3 depends on CCC@3.0
          and CCC@3.3 depends on DDD@1.5
 - AAA@1.5 -> BBB@2.0  : fail, BBB@2.0 is backward compatible with the
                         specified BBB@2.3, but BBB@2.3 has failed to
                         validate dependency
 - BBB@2.3 -> CCC@3.0  : fail, CCC@3.0 is backward compatible with the
                         specified CCC@3.3, but CCC@3.3 has failed to
                         validate dependency
 - CCC@3.3 -> DDD@1.5  : fail, DDD@1.5 isn't compatible with the
                         specified DDD@1.0
 - DDD@1.0  : success
 The failure is propagated to all hals that have dependency on that
 failed hal.

Case5] If AAA@1.5 depends on BBB@2.1
          and BBB@2.3 depends on CCC@3.0
          and CCC@3.3 depends on AAA@1.0
 - AAA@1.5 -> BBB@2.1  : fail, cyclic dependency
 - BBB@2.3 -> CCC@3.0  : fail, cyclic dependency
 - CCC@3.3 -> AAA@1.0  : fail, cyclic dependency
 - DDD@1.0  : success
 All hals that make dependency cycle are failure.

Case6] If AAA@1.5 depends on BBB@2.0
          and BBB@2.3 depends on CCC@3.0
 - AAA@1.5 -> BBB@2.0  : success
 - BBB@2.3 -> CCC@3.0  : success
 - CCC@3.3  : success
 - DDD@1.0  : success

In addition, the tool hal-compatibility-checker has changed to validate
dependency, by default, before it checks compatibility.

Change-Id: I34ce0f78a9ae9c05f65c77b20199353c93072851
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
16 months agosystemd-hal-cc-generator: Add hal compatibility checker 60/303660/9
Youngjae Cho [Wed, 3 Jan 2024 04:14:45 +0000 (13:14 +0900)]
systemd-hal-cc-generator: Add hal compatibility checker

In early booting state, the hal-compatibility-checker operates aided
by systemd-generator. It checks compatibility manifested by hal-api
and abi-version of hal-backend. Once it successfully checks and stores
result, those next following bootings won't do this again but just
reuse the result.

Change-Id: Id9a50a921f8e0d21de292d1aab81e490973cb2d1
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
16 months agotools: Add hal-compatibility-checker 59/303659/8
Youngjae Cho [Tue, 2 Jan 2024 11:14:35 +0000 (20:14 +0900)]
tools: Add hal-compatibility-checker

Provide tool for executing compatibility checker of libhalcc by command.
See 'hal-compatibility-checker --help'.

Change-Id: I3bfd46496997471dcd41d790cc702cc57664a01b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
16 months agohalcc: Introduce halcc library 64/303164/13
Youngjae Cho [Tue, 19 Dec 2023 06:24:38 +0000 (15:24 +0900)]
halcc: Introduce halcc library

The halcc stands for hal compatibility checker.

Tizen hal-apis can specify what feature and version it expects to
hal-backends in manifest file. The halcc library deserializes and
utilizes the information for checking compatibility between
hal-api and hal-backend.

For example, a hal-api specifies what it needs in xml file:

  | <!--hal-api-xxx.xml-->
  |
  | <manifest version="1.0" type="platform" level="2">
  |     <hal>
  |         <name>AAA</name>
  |         <version>3.1</version>
  |         <transport>passthrough</transport>
  |     </hal>
  |     ...
  | </manifest>

It means that the hal-api expects and requires hal-backend module name
of AAA, and version of 3.x where x >= 1.
(See semantic versioning, https://semver.org)

These are collected and tested by the halcc library.

Currently only the function below is provieded
 - int halcc_check_compatibility(const char *hal_api_manifest_dir,
     halcc_compatibility_cb callback, void *user_data)
   : It collects manifest files at hal_api_manifest_dir and checks
     whether the hal-backends have compatible what hal-apis have
     specified. For each specified <hal> in manifests, callback is
     invoked.

Change-Id: Ibb16c378f6fbe08750b6df7db99ee6626bcfd033
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>