@@ -439,6 +439,10 @@ static umf_result_t file_alloc(void *provider, size_t size, size_t alignment,
439439 addr , alloc_offset_fd );
440440 }
441441
442+ LOG_DEBUG ("inserted a value to the file descriptor offset map (addr=%p, "
443+ "offset=%zu)" ,
444+ addr , alloc_offset_fd );
445+
442446 * resultPtr = addr ;
443447
444448 return UMF_RESULT_SUCCESS ;
@@ -538,23 +542,31 @@ static umf_result_t file_allocation_split(void *provider, void *ptr,
538542
539543 void * value = critnib_get (file_provider -> fd_offset_map , (uintptr_t )ptr );
540544 if (value == NULL ) {
541- LOG_ERR ("file_allocation_split(): getting a value from the file "
542- "descriptor offset map failed (addr=%p)" ,
545+ LOG_ERR ("getting a value from the file descriptor offset map failed "
546+ "(addr=%p)" ,
543547 ptr );
544548 return UMF_RESULT_ERROR_UNKNOWN ;
545549 }
546550
551+ LOG_DEBUG ("split the value from the file descriptor offset map (addr=%p) "
552+ "from size %zu to %zu + %zu" ,
553+ ptr , totalSize , firstSize , totalSize - firstSize );
554+
547555 uintptr_t new_key = (uintptr_t )ptr + firstSize ;
548556 void * new_value = (void * )((uintptr_t )value + firstSize );
549557 int ret = critnib_insert (file_provider -> fd_offset_map , new_key , new_value ,
550558 0 /* update */ );
551559 if (ret ) {
552- LOG_ERR ("file_allocation_split(): inserting a value to the file "
553- "descriptor offset map failed (addr=%p, offset=%zu)" ,
560+ LOG_ERR ("inserting a value to the file descriptor offset map failed "
561+ "(addr=%p, offset=%zu)" ,
554562 (void * )new_key , (size_t )new_value - 1 );
555563 return UMF_RESULT_ERROR_UNKNOWN ;
556564 }
557565
566+ LOG_DEBUG ("inserted a value to the file descriptor offset map (addr=%p, "
567+ "offset=%zu)" ,
568+ (void * )new_key , (size_t )new_value - 1 );
569+
558570 return UMF_RESULT_SUCCESS ;
559571}
560572
@@ -572,12 +584,16 @@ static umf_result_t file_allocation_merge(void *provider, void *lowPtr,
572584 void * value =
573585 critnib_remove (file_provider -> fd_offset_map , (uintptr_t )highPtr );
574586 if (value == NULL ) {
575- LOG_ERR ("file_allocation_merge(): removing a value from the file "
576- "descriptor offset map failed (addr=%p)" ,
587+ LOG_ERR ("removing a value from the file descriptor offset map failed "
588+ "(addr=%p)" ,
577589 highPtr );
578590 return UMF_RESULT_ERROR_UNKNOWN ;
579591 }
580592
593+ LOG_DEBUG ("removed a value from the file descriptor offset map (addr=%p) - "
594+ "merged with %p" ,
595+ highPtr , lowPtr );
596+
581597 return UMF_RESULT_SUCCESS ;
582598}
583599
@@ -611,9 +627,7 @@ static umf_result_t file_get_ipc_handle(void *provider, const void *ptr,
611627
612628 void * value = critnib_get (file_provider -> fd_offset_map , (uintptr_t )ptr );
613629 if (value == NULL ) {
614- LOG_ERR ("file_get_ipc_handle(): getting a value from the IPC cache "
615- "failed (addr=%p)" ,
616- ptr );
630+ LOG_ERR ("getting a value from the IPC cache failed (addr=%p)" , ptr );
617631 return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
618632 }
619633
0 commit comments