Skip to content

Commit f3ba213

Browse files
committed
Fix and add error messages
Fix two error messages and add some new ones. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 333d7b6 commit f3ba213

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

src/provider/provider_file_memory.c

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ static umf_result_t file_alloc(void *provider, size_t size, size_t alignment,
448448
addr, alloc_offset_fd);
449449
}
450450

451+
LOG_DEBUG("inserted a value to the file descriptor offset map (addr=%p, "
452+
"offset=%zu)",
453+
addr, alloc_offset_fd);
454+
451455
*resultPtr = addr;
452456

453457
return UMF_RESULT_SUCCESS;
@@ -552,23 +556,31 @@ static umf_result_t file_allocation_split(void *provider, void *ptr,
552556

553557
void *value = critnib_get(file_provider->fd_offset_map, (uintptr_t)ptr);
554558
if (value == NULL) {
555-
LOG_ERR("file_allocation_split(): getting a value from the file "
556-
"descriptor offset map failed (addr=%p)",
559+
LOG_ERR("getting a value from the file descriptor offset map failed "
560+
"(addr=%p)",
557561
ptr);
558562
return UMF_RESULT_ERROR_UNKNOWN;
559563
}
560564

565+
LOG_DEBUG("split the value from the file descriptor offset map (addr=%p) "
566+
"from size %zu to %zu + %zu",
567+
ptr, totalSize, firstSize, totalSize - firstSize);
568+
561569
uintptr_t new_key = (uintptr_t)ptr + firstSize;
562570
void *new_value = (void *)((uintptr_t)value + firstSize);
563571
int ret = critnib_insert(file_provider->fd_offset_map, new_key, new_value,
564572
0 /* update */);
565573
if (ret) {
566-
LOG_ERR("file_allocation_split(): inserting a value to the file "
567-
"descriptor offset map failed (addr=%p, offset=%zu)",
574+
LOG_ERR("inserting a value to the file descriptor offset map failed "
575+
"(addr=%p, offset=%zu)",
568576
(void *)new_key, (size_t)new_value - 1);
569577
return UMF_RESULT_ERROR_UNKNOWN;
570578
}
571579

580+
LOG_DEBUG("inserted a value to the file descriptor offset map (addr=%p, "
581+
"offset=%zu)",
582+
(void *)new_key, (size_t)new_value - 1);
583+
572584
return UMF_RESULT_SUCCESS;
573585
}
574586

@@ -586,12 +598,16 @@ static umf_result_t file_allocation_merge(void *provider, void *lowPtr,
586598
void *value =
587599
critnib_remove(file_provider->fd_offset_map, (uintptr_t)highPtr);
588600
if (value == NULL) {
589-
LOG_ERR("file_allocation_merge(): removing a value from the file "
590-
"descriptor offset map failed (addr=%p)",
601+
LOG_ERR("removing a value from the file descriptor offset map failed "
602+
"(addr=%p)",
591603
highPtr);
592604
return UMF_RESULT_ERROR_UNKNOWN;
593605
}
594606

607+
LOG_DEBUG("removed a value from the file descriptor offset map (addr=%p) - "
608+
"merged with %p",
609+
highPtr, lowPtr);
610+
595611
return UMF_RESULT_SUCCESS;
596612
}
597613

@@ -633,9 +649,7 @@ static umf_result_t file_get_ipc_handle(void *provider, const void *ptr,
633649

634650
void *value = critnib_get(file_provider->fd_offset_map, (uintptr_t)ptr);
635651
if (value == NULL) {
636-
LOG_ERR("file_get_ipc_handle(): getting a value from the IPC cache "
637-
"failed (addr=%p)",
638-
ptr);
652+
LOG_ERR("getting a value from the IPC cache failed (addr=%p)", ptr);
639653
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
640654
}
641655

src/provider/provider_os_memory.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,9 +1221,7 @@ static umf_result_t os_get_ipc_handle(void *provider, const void *ptr,
12211221

12221222
void *value = critnib_get(os_provider->fd_offset_map, (uintptr_t)ptr);
12231223
if (value == NULL) {
1224-
LOG_ERR("os_get_ipc_handle(): getting a value from the IPC cache "
1225-
"failed (addr=%p)",
1226-
ptr);
1224+
LOG_ERR("getting a value from the IPC cache failed (addr=%p)", ptr);
12271225
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
12281226
}
12291227

0 commit comments

Comments
 (0)