mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 07:35:31 +00:00
dm: add string convert API
As function sscanf is banned, to get value from parameter buffer,strto*
is recommended. To reduce the inspection code when using strto*, it's
better to use a string convert API.
Usage:
For virtio-blk, it has parameters:
range=<start lba>/<subfile size>
sscanf:
if (sscanf(cp, "range=%ld/%ld", &sub_file_start_lba,
&sub_file_size) == 2)
sub_file_assign = 1;
string API:
if (strsep(&cp, "=") &&
!dm_strtol(cp, &cp, 10, &sub_file_start_lba) &&
*cp == '/' &&
!dm_strtol(cp + 1, &cp, 10, &sub_file_size))
sub_file_assign = 1;
Tracked-on: #1496
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
@@ -56,6 +56,9 @@ LIBS += -luuid
|
||||
LIBS += -lusb-1.0
|
||||
LIBS += -lacrn-mngr
|
||||
|
||||
# lib
|
||||
SRCS += lib/dm_string.c
|
||||
|
||||
# hw
|
||||
SRCS += hw/block_if.c
|
||||
SRCS += hw/usb_core.c
|
||||
|
||||
Reference in New Issue
Block a user