@@ -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
0 commit comments