summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_file.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-07-06 22:01:23 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-07-06 22:01:23 +0900
commitd15d86e26fadb1c27afde01544b2b3e07d2e4c33 (patch)
tree364a67dfdcbe875c44dc2138c1b07d3e095e3ef3 /src/lib/eina/eina_file.c
parent28c2bd1918e5b8a46408ed17352098b44c76a6a7 (diff)
eina: add eina_file_map_populate()
Diffstat (limited to 'src/lib/eina/eina_file.c')
-rw-r--r--src/lib/eina/eina_file.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/eina/eina_file.c b/src/lib/eina/eina_file.c
index 4cc44eb..6cc1e38 100644
--- a/src/lib/eina/eina_file.c
+++ b/src/lib/eina/eina_file.c
@@ -376,6 +376,9 @@ _eina_file_map_rule_apply(Eina_File_Populate rule, void *addr, unsigned long int
376 case EINA_FILE_SEQUENTIAL: flag = MADV_SEQUENTIAL; break; 376 case EINA_FILE_SEQUENTIAL: flag = MADV_SEQUENTIAL; break;
377 case EINA_FILE_POPULATE: flag = MADV_WILLNEED; break; 377 case EINA_FILE_POPULATE: flag = MADV_WILLNEED; break;
378 case EINA_FILE_WILLNEED: flag = MADV_WILLNEED; break; 378 case EINA_FILE_WILLNEED: flag = MADV_WILLNEED; break;
379 case EINA_FILE_DONTNEED: flag = MADV_DONTNEED; break;
380 case EINA_FILE_REMOVE: flag = MADV_REMOVE; break;
381 default: return tmp; break;
379 } 382 }
380 383
381 madvise(addr, size, flag); 384 madvise(addr, size, flag);
@@ -1079,6 +1082,20 @@ eina_file_map_free(Eina_File *file, void *map)
1079 eina_lock_release(&file->lock); 1082 eina_lock_release(&file->lock);
1080} 1083}
1081 1084
1085EAPI void
1086eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, void *map,
1087 unsigned long int offset, unsigned long int length)
1088{
1089 Eina_File_Map *em;
1090
1091 EINA_SAFETY_ON_NULL_RETURN(file);
1092 eina_lock_take(&file->lock);
1093 em = eina_hash_find(file->rmap, &map);
1094 if (em) _eina_file_map_rule_apply(rule, ((char *)em->map) + offset,
1095 length, em->hugetlb);
1096 eina_lock_release(&file->lock);
1097}
1098
1082EAPI Eina_Bool 1099EAPI Eina_Bool
1083eina_file_map_faulted(Eina_File *file, void *map) 1100eina_file_map_faulted(Eina_File *file, void *map)
1084{ 1101{