@@ -373,6 +373,7 @@ typedef struct devdax_ipc_data_t {
373373 size_t size ; // size of the /dev/dax
374374 unsigned protection ; // combination of OS-specific memory protection flags
375375 size_t offset ; // offset of the data
376+ size_t length ; // length of the data
376377} devdax_ipc_data_t ;
377378
378379static umf_result_t devdax_get_ipc_handle_size (void * provider , size_t * size ) {
@@ -403,6 +404,7 @@ static umf_result_t devdax_get_ipc_handle(void *provider, const void *ptr,
403404 devdax_ipc_data -> path [PATH_MAX - 1 ] = '\0' ;
404405 devdax_ipc_data -> size = devdax_provider -> size ;
405406 devdax_ipc_data -> protection = devdax_provider -> protection ;
407+ devdax_ipc_data -> length = size ;
406408
407409 return UMF_RESULT_SUCCESS ;
408410}
@@ -453,27 +455,27 @@ static umf_result_t devdax_open_ipc_handle(void *provider,
453455 utils_translate_mem_visibility_flag (UMF_MEM_MAP_SYNC , & map_sync_flag );
454456
455457 // mmap /dev/dax with the MAP_SYNC xor MAP_SHARED flag (if MAP_SYNC fails)
456- char * base = utils_mmap_file (NULL , devdax_ipc_data -> size ,
458+ char * base = utils_mmap_file (NULL , devdax_ipc_data -> length ,
457459 devdax_ipc_data -> protection , map_sync_flag , fd ,
458- 0 /* offset */ );
460+ devdax_ipc_data -> offset );
459461 if (base == NULL ) {
460462 devdax_store_last_native_error (UMF_DEVDAX_RESULT_ERROR_ALLOC_FAILED ,
461463 errno );
462464 LOG_PERR ("devdax mapping failed (path: %s, size: %zu, protection: %i, "
463- "fd: %i)" ,
464- devdax_ipc_data -> path , devdax_ipc_data -> size ,
465- devdax_ipc_data -> protection , fd );
465+ "fd: %i, offset: %zu )" ,
466+ devdax_ipc_data -> path , devdax_ipc_data -> length ,
467+ devdax_ipc_data -> protection , fd , devdax_ipc_data -> offset );
466468 ret = UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC ;
467469 }
468470
469471 LOG_DEBUG ("devdax mapped (path: %s, size: %zu, protection: %i, fd: %i, "
470472 "offset: %zu)" ,
471- devdax_ipc_data -> path , devdax_ipc_data -> size ,
473+ devdax_ipc_data -> path , devdax_ipc_data -> length ,
472474 devdax_ipc_data -> protection , fd , devdax_ipc_data -> offset );
473475
474476 (void )utils_close_fd (fd );
475477
476- * ptr = base + devdax_ipc_data -> offset ;
478+ * ptr = base ;
477479
478480 return ret ;
479481}
0 commit comments