Skip to content

Commit 07264bf

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 b17a69f commit 07264bf

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
@@ -476,6 +476,10 @@ static umf_result_t file_alloc_cb(void *provider, size_t size, size_t alignment,
476476
addr, alloc_offset_fd);
477477
}
478478

479+
LOG_DEBUG("inserted a value to the file descriptor offset map (addr=%p, "
480+
"offset=%zu)",
481+
addr, alloc_offset_fd);
482+
479483
*resultPtr = addr;
480484

481485
return UMF_RESULT_SUCCESS;
@@ -580,23 +584,31 @@ static umf_result_t file_allocation_split_cb(void *provider, void *ptr,
580584

581585
void *value = critnib_get(file_provider->fd_offset_map, (uintptr_t)ptr);
582586
if (value == NULL) {
583-
LOG_ERR("file_allocation_split(): getting a value from the file "
584-
"descriptor offset map failed (addr=%p)",
587+
LOG_ERR("getting a value from the file descriptor offset map failed "
588+
"(addr=%p)",
585589
ptr);
586590
return UMF_RESULT_ERROR_UNKNOWN;
587591
}
588592

593+
LOG_DEBUG("split the value from the file descriptor offset map (addr=%p) "
594+
"from size %zu to %zu + %zu",
595+
ptr, totalSize, firstSize, totalSize - firstSize);
596+
589597
uintptr_t new_key = (uintptr_t)ptr + firstSize;
590598
void *new_value = (void *)((uintptr_t)value + firstSize);
591599
int ret = critnib_insert(file_provider->fd_offset_map, new_key, new_value,
592600
0 /* update */);
593601
if (ret) {
594-
LOG_ERR("file_allocation_split(): inserting a value to the file "
595-
"descriptor offset map failed (addr=%p, offset=%zu)",
602+
LOG_ERR("inserting a value to the file descriptor offset map failed "
603+
"(addr=%p, offset=%zu)",
596604
(void *)new_key, (size_t)new_value - 1);
597605
return UMF_RESULT_ERROR_UNKNOWN;
598606
}
599607

608+
LOG_DEBUG("inserted a value to the file descriptor offset map (addr=%p, "
609+
"offset=%zu)",
610+
(void *)new_key, (size_t)new_value - 1);
611+
600612
return UMF_RESULT_SUCCESS;
601613
}
602614

@@ -619,12 +631,16 @@ static umf_result_t file_allocation_merge_cb(void *provider, void *lowPtr,
619631
void *value =
620632
critnib_remove(file_provider->fd_offset_map, (uintptr_t)highPtr);
621633
if (value == NULL) {
622-
LOG_ERR("file_allocation_merge(): removing a value from the file "
623-
"descriptor offset map failed (addr=%p)",
634+
LOG_ERR("removing a value from the file descriptor offset map failed "
635+
"(addr=%p)",
624636
highPtr);
625637
return UMF_RESULT_ERROR_UNKNOWN;
626638
}
627639

640+
LOG_DEBUG("removed a value from the file descriptor offset map (addr=%p) - "
641+
"merged with %p",
642+
highPtr, lowPtr);
643+
628644
return UMF_RESULT_SUCCESS;
629645
}
630646

@@ -658,9 +674,7 @@ static umf_result_t file_get_ipc_handle(void *provider, const void *ptr,
658674

659675
void *value = critnib_get(file_provider->fd_offset_map, (uintptr_t)ptr);
660676
if (value == NULL) {
661-
LOG_ERR("file_get_ipc_handle(): getting a value from the IPC cache "
662-
"failed (addr=%p)",
663-
ptr);
677+
LOG_ERR("getting a value from the IPC cache failed (addr=%p)", ptr);
664678
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
665679
}
666680

src/provider/provider_os_memory.c

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

11941194
void *value = critnib_get(os_provider->fd_offset_map, (uintptr_t)ptr);
11951195
if (value == NULL) {
1196-
LOG_ERR("os_get_ipc_handle(): getting a value from the IPC cache "
1197-
"failed (addr=%p)",
1198-
ptr);
1196+
LOG_ERR("getting a value from the IPC cache failed (addr=%p)", ptr);
11991197
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
12001198
}
12011199

0 commit comments

Comments
 (0)