@@ -470,6 +470,10 @@ static umf_result_t file_alloc_cb(void *provider, size_t size, size_t alignment,
470470 addr , alloc_offset_fd );
471471 }
472472
473+ LOG_DEBUG ("inserted a value to the file descriptor offset map (addr=%p, "
474+ "offset=%zu)" ,
475+ addr , alloc_offset_fd );
476+
473477 * resultPtr = addr ;
474478
475479 return UMF_RESULT_SUCCESS ;
@@ -570,23 +574,31 @@ static umf_result_t file_allocation_split_cb(void *provider, void *ptr,
570574
571575 void * value = critnib_get (file_provider -> fd_offset_map , (uintptr_t )ptr );
572576 if (value == NULL ) {
573- LOG_ERR ("file_allocation_split(): getting a value from the file "
574- "descriptor offset map failed (addr=%p)" ,
577+ LOG_ERR ("getting a value from the file descriptor offset map failed "
578+ "(addr=%p)" ,
575579 ptr );
576580 return UMF_RESULT_ERROR_UNKNOWN ;
577581 }
578582
583+ LOG_DEBUG ("split the value from the file descriptor offset map (addr=%p) "
584+ "from size %zu to %zu + %zu" ,
585+ ptr , totalSize , firstSize , totalSize - firstSize );
586+
579587 uintptr_t new_key = (uintptr_t )ptr + firstSize ;
580588 void * new_value = (void * )((uintptr_t )value + firstSize );
581589 int ret = critnib_insert (file_provider -> fd_offset_map , new_key , new_value ,
582590 0 /* update */ );
583591 if (ret ) {
584- LOG_ERR ("file_allocation_split(): inserting a value to the file "
585- "descriptor offset map failed (addr=%p, offset=%zu)" ,
592+ LOG_ERR ("inserting a value to the file descriptor offset map failed "
593+ "(addr=%p, offset=%zu)" ,
586594 (void * )new_key , (size_t )new_value - 1 );
587595 return UMF_RESULT_ERROR_UNKNOWN ;
588596 }
589597
598+ LOG_DEBUG ("inserted a value to the file descriptor offset map (addr=%p, "
599+ "offset=%zu)" ,
600+ (void * )new_key , (size_t )new_value - 1 );
601+
590602 return UMF_RESULT_SUCCESS ;
591603}
592604
@@ -604,12 +616,16 @@ static umf_result_t file_allocation_merge_cb(void *provider, void *lowPtr,
604616 void * value =
605617 critnib_remove (file_provider -> fd_offset_map , (uintptr_t )highPtr );
606618 if (value == NULL ) {
607- LOG_ERR ("file_allocation_merge(): removing a value from the file "
608- "descriptor offset map failed (addr=%p)" ,
619+ LOG_ERR ("removing a value from the file descriptor offset map failed "
620+ "(addr=%p)" ,
609621 highPtr );
610622 return UMF_RESULT_ERROR_UNKNOWN ;
611623 }
612624
625+ LOG_DEBUG ("removed a value from the file descriptor offset map (addr=%p) - "
626+ "merged with %p" ,
627+ highPtr , lowPtr );
628+
613629 return UMF_RESULT_SUCCESS ;
614630}
615631
@@ -643,9 +659,7 @@ static umf_result_t file_get_ipc_handle(void *provider, const void *ptr,
643659
644660 void * value = critnib_get (file_provider -> fd_offset_map , (uintptr_t )ptr );
645661 if (value == NULL ) {
646- LOG_ERR ("file_get_ipc_handle(): getting a value from the IPC cache "
647- "failed (addr=%p)" ,
648- ptr );
662+ LOG_ERR ("getting a value from the IPC cache failed (addr=%p)" , ptr );
649663 return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
650664 }
651665
0 commit comments