forked from enlightenment/efl
eina file: Fix map_populate on the global map
If eina_file_map_all() is called, the map isn't added to the internal hash "rmap" and so _eina_file_map_rule_apply() would never be called. @fix asa
This commit is contained in:
parent
81f3099f32
commit
b2ea60691e
|
@ -936,6 +936,11 @@ eina_file_map_all(Eina_File *file, Eina_File_Populate rule)
|
|||
#ifdef MAP_HUGETLB
|
||||
hugetlb = !!(flags & MAP_HUGETLB);
|
||||
#endif
|
||||
if (!file->global_refcount)
|
||||
file->global_hugetlb = hugetlb;
|
||||
else
|
||||
hugetlb = file->global_hugetlb;
|
||||
|
||||
_eina_file_map_rule_apply(rule, file->global_map, file->length, hugetlb);
|
||||
file->global_refcount++;
|
||||
ret = file->global_map;
|
||||
|
@ -1059,13 +1064,21 @@ EAPI void
|
|||
eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map,
|
||||
unsigned long int offset, unsigned long int length)
|
||||
{
|
||||
Eina_File_Map *em;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(file);
|
||||
eina_lock_take(&file->lock);
|
||||
em = eina_hash_find(file->rmap, &map);
|
||||
if (em) _eina_file_map_rule_apply(rule, ((char *)em->map) + offset,
|
||||
length, em->hugetlb);
|
||||
if (map == file->global_map)
|
||||
{
|
||||
_eina_file_map_rule_apply(rule, ((char*) map) + offset, length,
|
||||
file->global_hugetlb);
|
||||
}
|
||||
else
|
||||
{
|
||||
Eina_File_Map *em;
|
||||
|
||||
em = eina_hash_find(file->rmap, &map);
|
||||
if (em) _eina_file_map_rule_apply(rule, ((char *) em->map) + offset,
|
||||
length, em->hugetlb);
|
||||
}
|
||||
eina_lock_release(&file->lock);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ struct _Eina_File
|
|||
Eina_Bool shared : 1; /**< Indicates whether this file can be shared */
|
||||
Eina_Bool delete_me : 1; /**< Indicates that this file should be deleted */
|
||||
Eina_Bool global_faulty : 1; /**< Indicates whether #global_map is bad */
|
||||
Eina_Bool global_hugetlb : 1; /**< Indicates whether #global_map uses HugeTLB */
|
||||
Eina_Bool virtual : 1; /**< Indicates that this is a virtual file */
|
||||
Eina_Bool copied : 1; /**< Indicates whether this file has copied data */
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue