Skip to content

Commit 0e7ef65

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 fb53918 commit 0e7ef65

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
@@ -519,6 +519,10 @@ static umf_result_t file_alloc_cb(void *provider, size_t size, size_t alignment,
519519
addr, alloc_offset_fd);
520520
}
521521

522+
LOG_DEBUG("inserted a value to the file descriptor offset map (addr=%p, "
523+
"offset=%zu)",
524+
addr, alloc_offset_fd);
525+
522526
*resultPtr = addr;
523527

524528
return UMF_RESULT_SUCCESS;
@@ -623,23 +627,31 @@ static umf_result_t file_allocation_split_cb(void *provider, void *ptr,
623627

624628
void *value = critnib_get(file_provider->fd_offset_map, (uintptr_t)ptr);
625629
if (value == NULL) {
626-
LOG_ERR("file_allocation_split(): getting a value from the file "
627-
"descriptor offset map failed (addr=%p)",
630+
LOG_ERR("getting a value from the file descriptor offset map failed "
631+
"(addr=%p)",
628632
ptr);
629633
return UMF_RESULT_ERROR_UNKNOWN;
630634
}
631635

636+
LOG_DEBUG("split the value from the file descriptor offset map (addr=%p) "
637+
"from size %zu to %zu + %zu",
638+
ptr, totalSize, firstSize, totalSize - firstSize);
639+
632640
uintptr_t new_key = (uintptr_t)ptr + firstSize;
633641
void *new_value = (void *)((uintptr_t)value + firstSize);
634642
int ret = critnib_insert(file_provider->fd_offset_map, new_key, new_value,
635643
0 /* update */);
636644
if (ret) {
637-
LOG_ERR("file_allocation_split(): inserting a value to the file "
638-
"descriptor offset map failed (addr=%p, offset=%zu)",
645+
LOG_ERR("inserting a value to the file descriptor offset map failed "
646+
"(addr=%p, offset=%zu)",
639647
(void *)new_key, (size_t)new_value - 1);
640648
return UMF_RESULT_ERROR_UNKNOWN;
641649
}
642650

651+
LOG_DEBUG("inserted a value to the file descriptor offset map (addr=%p, "
652+
"offset=%zu)",
653+
(void *)new_key, (size_t)new_value - 1);
654+
643655
return UMF_RESULT_SUCCESS;
644656
}
645657

@@ -662,12 +674,16 @@ static umf_result_t file_allocation_merge_cb(void *provider, void *lowPtr,
662674
void *value =
663675
critnib_remove(file_provider->fd_offset_map, (uintptr_t)highPtr);
664676
if (value == NULL) {
665-
LOG_ERR("file_allocation_merge(): removing a value from the file "
666-
"descriptor offset map failed (addr=%p)",
677+
LOG_ERR("removing a value from the file descriptor offset map failed "
678+
"(addr=%p)",
667679
highPtr);
668680
return UMF_RESULT_ERROR_UNKNOWN;
669681
}
670682

683+
LOG_DEBUG("removed a value from the file descriptor offset map (addr=%p) - "
684+
"merged with %p",
685+
highPtr, lowPtr);
686+
671687
return UMF_RESULT_SUCCESS;
672688
}
673689

@@ -701,9 +717,7 @@ static umf_result_t file_get_ipc_handle(void *provider, const void *ptr,
701717

702718
void *value = critnib_get(file_provider->fd_offset_map, (uintptr_t)ptr);
703719
if (value == NULL) {
704-
LOG_ERR("file_get_ipc_handle(): getting a value from the IPC cache "
705-
"failed (addr=%p)",
706-
ptr);
720+
LOG_ERR("getting a value from the IPC cache failed (addr=%p)", ptr);
707721
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
708722
}
709723

src/provider/provider_os_memory.c

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

12871287
void *value = critnib_get(os_provider->fd_offset_map, (uintptr_t)ptr);
12881288
if (value == NULL) {
1289-
LOG_ERR("os_get_ipc_handle(): getting a value from the IPC cache "
1290-
"failed (addr=%p)",
1291-
ptr);
1289+
LOG_ERR("getting a value from the IPC cache failed (addr=%p)", ptr);
12921290
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
12931291
}
12941292

0 commit comments

Comments
 (0)