summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-15 14:38:29 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-18 11:58:53 +0900
commitb2ea60691e45674a4e283e0535634bdd699544ea (patch)
tree56192cae005bf061cb23e5bb8a5f093d143cbc91 /src/lib
parent81f3099f32f8014b2f222cf1c784baf42fdf2c0f (diff)
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
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eina/eina_file.c23
-rw-r--r--src/lib/eina/eina_file_common.h1
2 files changed, 19 insertions, 5 deletions
diff --git a/src/lib/eina/eina_file.c b/src/lib/eina/eina_file.c
index c2c7f8f..97dec3e 100644
--- a/src/lib/eina/eina_file.c
+++ b/src/lib/eina/eina_file.c
@@ -936,6 +936,11 @@ eina_file_map_all(Eina_File *file, Eina_File_Populate rule)
936#ifdef MAP_HUGETLB 936#ifdef MAP_HUGETLB
937 hugetlb = !!(flags & MAP_HUGETLB); 937 hugetlb = !!(flags & MAP_HUGETLB);
938#endif 938#endif
939 if (!file->global_refcount)
940 file->global_hugetlb = hugetlb;
941 else
942 hugetlb = file->global_hugetlb;
943
939 _eina_file_map_rule_apply(rule, file->global_map, file->length, hugetlb); 944 _eina_file_map_rule_apply(rule, file->global_map, file->length, hugetlb);
940 file->global_refcount++; 945 file->global_refcount++;
941 ret = file->global_map; 946 ret = file->global_map;
@@ -1059,13 +1064,21 @@ EAPI void
1059eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map, 1064eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map,
1060 unsigned long int offset, unsigned long int length) 1065 unsigned long int offset, unsigned long int length)
1061{ 1066{
1062 Eina_File_Map *em;
1063
1064 EINA_SAFETY_ON_NULL_RETURN(file); 1067 EINA_SAFETY_ON_NULL_RETURN(file);
1065 eina_lock_take(&file->lock); 1068 eina_lock_take(&file->lock);
1066 em = eina_hash_find(file->rmap, &map); 1069 if (map == file->global_map)
1067 if (em) _eina_file_map_rule_apply(rule, ((char *)em->map) + offset, 1070 {
1068 length, em->hugetlb); 1071 _eina_file_map_rule_apply(rule, ((char*) map) + offset, length,
1072 file->global_hugetlb);
1073 }
1074 else
1075 {
1076 Eina_File_Map *em;
1077
1078 em = eina_hash_find(file->rmap, &map);
1079 if (em) _eina_file_map_rule_apply(rule, ((char *) em->map) + offset,
1080 length, em->hugetlb);
1081 }
1069 eina_lock_release(&file->lock); 1082 eina_lock_release(&file->lock);
1070} 1083}
1071 1084
diff --git a/src/lib/eina/eina_file_common.h b/src/lib/eina/eina_file_common.h
index 0502029..93ba274 100644
--- a/src/lib/eina/eina_file_common.h
+++ b/src/lib/eina/eina_file_common.h
@@ -101,6 +101,7 @@ struct _Eina_File
101 Eina_Bool shared : 1; /**< Indicates whether this file can be shared */ 101 Eina_Bool shared : 1; /**< Indicates whether this file can be shared */
102 Eina_Bool delete_me : 1; /**< Indicates that this file should be deleted */ 102 Eina_Bool delete_me : 1; /**< Indicates that this file should be deleted */
103 Eina_Bool global_faulty : 1; /**< Indicates whether #global_map is bad */ 103 Eina_Bool global_faulty : 1; /**< Indicates whether #global_map is bad */
104 Eina_Bool global_hugetlb : 1; /**< Indicates whether #global_map uses HugeTLB */
104 Eina_Bool virtual : 1; /**< Indicates that this is a virtual file */ 105 Eina_Bool virtual : 1; /**< Indicates that this is a virtual file */
105 Eina_Bool copied : 1; /**< Indicates whether this file has copied data */ 106 Eina_Bool copied : 1; /**< Indicates whether this file has copied data */
106}; 107};