Commit Graph

519 Commits

Author SHA1 Message Date
liujinye 853f4a4eaf chore: sync .github, .gitee and LICENSE from dev branch
Change-Id: Ifa2d43f7d4cc8d3179b21bd0042ccb2a352e4f79
2026-04-22 16:55:28 +08:00
wangxingxing 8e1b8b1992 kvdb/client:fix the code quality issues: unchecked return value from library
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
2026-04-20 14:51:00 +08:00
dongjiuzhu1 57a7c1d584 kvdb/client: fix compile warning about property_connect_one
client.c:85:12: warning: property_connect_one defined but not used -Wunused-function

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:51:00 +08:00
jingfei 685ee48a5e kvdb: optimize property_connect() for BMP/AMP scenarios
Instead of trying all socket types (local + rpmsg), select the
correct one based on the net type. And use getsockname() at runtime
to decide when both net_local and net_rpmsg are enabled, if on
the same core as KVDB server, use local socket; otherwise use rpmsg socket.

Increase KVDB_BACKLOG_CONNS to 256

Signed-off-by: jingfei <jingfei@xiaomi.com>
2026-04-20 14:51:00 +08:00
huangcaihua 896e2d737c Gdbus:add debug for dump remove watch caller
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:51:00 +08:00
Bowen Wang 2bc0ee4043 utils/kvdb: change the default timeout from 0.5s to 5s
500ms is too short

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-20 14:51:00 +08:00
zhangbo56 94b5d7c7cf kvdb: Add CONFIG_NET_RPMSG macro
To be compatible with latest kvdb code.

Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
2026-04-20 14:51:00 +08:00
ligd e9540c7bc5 kvdb: add KVERR logs at all exit points for debugging
Add KVERR error logs at all exit positions in server.c to help debug
unexpected server exits. This includes:
- kvdb_monitor_open: zalloc and epoll_ctl failures
- kvdb_recv: recv failures and connection close
- kvdb_client: malloc, recv failures, and exit command
- kvdb_loop: epoll_create, epoll_ctl, pthread_create failures and loop exit
- kvdb_bind: socket, bind, listen failures
- main: kvdb_bind, kvdb_init failures and exit

All logs include detailed context (function name, error codes, errno)
to help quickly identify the root cause of server crashes.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-20 14:51:00 +08:00
wangxingxing 125e97d1ca fs/kvdb:check the return of setsockopt to fix code quality issues
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
2026-04-20 14:51:00 +08:00
dongjiuzhu1 f9a02eeb20 kvdb/client: fix fd leak when connect fails reported by Coverity
Fixed a file descriptor leak issue reported by Coverity static analysis
tool. The problem occurs in property_connect_one() when connect() fails
but the file descriptor is not properly closed in certain error paths.

Root cause:
Previously, the code checked if errno equals ENOENT before closing the fd,
allowing it to retry connect() in a while loop in the caller. However,
with the refactored connect_one approach, this function is called once
per attempt, so ALL connect() failures must close the fd before returning
the error code. The ENOENT check was preventing proper cleanup, causing
fd leaks when connect() failed with ENOENT.

Changes:
- Remove errno != ENOENT condition check in error path
- Always close(fd) when connect() fails, regardless of errno value
- Simplify control flow: return fd on success, close and return error on failure
- Prevent file descriptor leak detected by Coverity scan

The connect retry logic (if needed) should be handled by the caller,
not within property_connect_one().

Tool: Coverity static analysis

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:51:00 +08:00
hujun5 8483eb6068 fix compile error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-20 14:50:59 +08:00
xuxingliang 6f6064e060 trace: fix sched_note_printf API change
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-20 14:50:59 +08:00
dongjiuzhu1 269482a578 kvdb/connect: add default timeout for kvdb connect
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:59 +08:00
dongjiuzhu1 7c122154fc bmp/kvdb: try net local and net rpmsg for kvdb client to compitable bmp mode
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:59 +08:00
huangcaihua 63aa5e82f6 gdbus:Add get_all_prop pending object to hold get proxy proper
Get proxy properties after interface added, before reply, if
recieved interface removed message, it's safer to cancel
pending_call object of get_all_prop at proxy free process.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:57 +08:00
huangcaihua 4325564119 gdbus:Get proxy prop when interface adding
Even if a proxy has already been added, the properties
should still be retrieved when adding the interface.
because the proxy maybe not got prop before.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:54 +08:00
huangcaihua 95f7ae14e4 gdbus:recover method call timer
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:50 +08:00
huangcaihua fa14d158fe gdbus:Fix method call noreply by keep one uv hanlder for read and write dbus_watch
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:45 +08:00
huangcaihua 63486b57f2 gdbus:Fix double free userdata when dbus send return false.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:43 +08:00
huangcaihua 9164c02b25 gdbus:Add NULL check for destory point when send msg return false.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:43 +08:00
yintao cc42dd74ae kvdb: Set the maximum listening count for kvdb separately
kvdbd is single threaded.
If CP calls property_list, AP'S kvdbd will continue to send to cp,
then accept will not be executed.
If another thread at CP loops to call property_set,
the AP server-side's pending queue will be full and reject next connection.

Bluetooth now loops through 15 times to call 'property_set',
So to avoid rejecting the connection,
set a macro to separately manage the listening count of kvdb

Signed-off-by: yintao <yintao@xiaomi.com>
2026-04-20 14:50:43 +08:00
ligd 7d8673be51 kvdb: enhance server fault tolerance
When server recv msg header, there maybe recv only one byte.
Then we should continue the full header use kvdb_recv()

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-20 14:50:42 +08:00
zhangbo56 ce70a05082 kvdb: Support kvdb server identified by device
Should be passed from device specific setting.

Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
2026-04-20 14:50:42 +08:00
zhangbo56 a42381793f kvdb: Export include/utils to other android module
Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
2026-04-20 14:50:42 +08:00
zhangbo56 6be3254f87 kvdb: Add kernel module headers to kvdb build
Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 08da67f884 gdbus:Fix coverty for check return of asprintf
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 99e5730ccf Fix coverity for return value check
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 46a4c04b2a Fix coverity for mistake free dbus watcher
Only free just alloced data variable here. No need call filter_data_free which maybe free watcher.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 3ccc8e7469 Fix coverity for FORWARD_NULL
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua b20cb7e892 gdbus:Add new gdbus config with depend on uv-ext
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 733e4f985c Fix: Compile warning and memory leak
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua e09eba8530 refactor object file for open vela
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua df5657181d refactor watch file for open source
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 52af58e631 refactor polkit file for open source
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
hongfengchen 788cbf7a19 utils:KVDB_NVS should depend on MTD_CONFIG_NAMED
KVDB_NVS should depend on MTD_CONFIG_NAMED. If choose
select MTD_CONFIG_NAMED and CONFIG_MTD is not set, it
will lead to compile error like:

dev-system/nuttx/include/nuttx/mtd/configdata.h:79:20: error: 'CONFIG_MTD_CONFIG_NAME_LEN' undeclared here (not in a function); did you mean 'CONFIG_MTD_CONFIG_NAMED'?
   79 |   char        name[CONFIG_MTD_CONFIG_NAME_LEN];
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                    CONFIG_MTD_CONFIG_NAMED

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-04-20 14:50:41 +08:00
wangxuedong 1fd4001293 kvdb: add retry if recv's errno is EAGAIN
Signed-off-by: wangxuedong <wangxuedong@xiaomi.com>
2026-04-20 14:50:41 +08:00
wushenhui 5562ae6035 utils/kvdb: fix build error when CONFIG_NET_LOCAL not set and CONFIG_NET_RPMSG=y
Signed-off-by: wushenhui <wushenhui@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua 1a3af6d20c GDBus:Set DBUS_TIMEOUT_INFINITE timer that is no dbus timeout
No need add reply timer for async method call.
if set -1, that is dbus default timer(25s).

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua b82a073fec revert debug assert for method call no reply.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua bb17aa2c6c GDBus:No need add reply timer for async method call
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua 79fa23f209 Fix:Get New Added proxy proper need add getting_all_prop flag
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua 56c05a2344 Fix:gdbus notify proxy_added after proxy all properties got.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
zhangyu117 987b402337 frameworks/system: Fix some minor issues when features on specific product-dev are switched to dev-system
Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-04-20 14:50:41 +08:00
zhangbo56 ebe4be95a5 kvdb: Add more apis for kvdb handle error case
Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
2026-04-20 14:50:41 +08:00
yukangzhi e269a22a01 frameworks/system/utils: Resolve compilation warnings
clang-format the file include/cutils/trace.h

"/home/mi/workspace_vela/nuttx/../apps/frameworks/
system/utils/include/cutils/trace.h", line 154: warning #1731-D:
          function must be declared at file scope
          void atrace_begin_body(const char*);
               ^
"/home/mi/workspace_vela/nuttx/../apps/frameworks/
system/utils/include/cutils/trace.h", line 167: warning #1731-D:
          function must be declared at file scope
          void atrace_end_body(void);
               ^
"/home/mi/workspace_vela/nuttx/../apps/frameworks/
system/utils/include/cutils/trace.h", line 185: warning #1731-D:
          function must be declared at file scope
          void atrace_async_begin_body(const char*, int32_t);
               ^
"/home/mi/workspace_vela/nuttx/../apps/frameworks/
system/utils/include/cutils/trace.h", line 198: warning #1731-D:
          function must be declared at file scope
          void atrace_async_end_body(const char*, int32_t);
               ^

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-20 14:50:41 +08:00
daichuan 32c0f5b9a5 add for the vendor partition code can use kvdb
Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-04-20 14:50:41 +08:00
zhangbo56 50b592b3fe trace: Default enable trace.c compile
Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
2026-04-20 14:50:41 +08:00
zhaoxingyu1 00f8a002ea framework/kvdb: modify kvdb depends on !MTD_CONFIG_NONE
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 14:50:41 +08:00
hongfengchen 79e75e648b change murmurhash to static inline
Change murmurhash to static inline.

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-04-20 14:50:40 +08:00
hongfengchen ecb135e795 utils:add unistd.h
Add unistd.h for files in kvdb and log.

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-04-20 14:50:40 +08:00