Commit Graph

52 Commits

Author SHA1 Message Date
Vincent Torri cdaac43d3a Windows: fix eina_file_map_new()
the offset passed to MapViewOfFile() must be a multiple of the granularity.

https://docs.microsoft.com/en-us/windows/win32/memory/creating-a-view-within-a-file is taken as basis for this patch

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Reviewed-by: Wander Lairson Costa <wander.lairson@gmail.com>
Differential Revision: https://phab.enlightenment.org/D12031
2020-06-26 15:40:57 +02:00
Vincent Torri ce9cad3a3b Eina: replace Evil.h with evil_private.h and remove Evil.h when not necessary
Test Plan: compilation

Reviewers: raster, zmike, cedric

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8903
2019-05-16 13:48:59 -04:00
Vincent Torri 770cede2bf eina_file: speed up listing of directories on Windows
Summary:
forbid the creation of short name (legacy of DOS)

Without optimisation

1. using only Win32 API, just iterating over directories (in micro seconds) :
  10 files : 47
  1000 files : 270
  100000 files : 73227
2. using eina_file_dir_list() with a callback which does nothing :
  10 files : 53
  1000 files : 265
  100000 files : 69624

usually there is a small overhead for eina API, which is normal

With optimisation

1. using only Win32 API, just iterating over directories (in micro seconds) :
  10 files : 51
  1000 files : 256
  100000 files : 33345
2. using eina_file_dir_list() with a callback which does nothing :
  10 files : 53
  1000 files : 251
  100000 files : 33832

speed up with 1000 files and more. Twice faster with 100000 files

Test Plan: benchmark program

Reviewers: raster, cedric, zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8842
2019-05-07 11:15:54 +01:00
Mike Blumenkrantz 598ce966d8 eina_file: set errno on open fail for win32 build
Summary:
windows does not automatically set errno so we must do it ourselves

@fix
Depends on D8103

Reviewers: vtorri

Reviewed By: vtorri

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8104
2019-03-06 08:37:29 -05:00
Vincent Torri 78af66ffb4 Eina: ignore EINA_FILE_LNK on Windows 2018-01-30 16:52:24 +09:00
Vincent Torri 771bb6e6a7 Evil: use static buffer to store error messages
Reviewers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5394
2017-12-11 16:04:02 +09:00
Al Poole 1be1ef168a eina_file_win32: also check for copy before unmapping region. 2017-12-02 11:45:53 +00:00
Cedric BAIL 867ad5000b eina: forgotten label on eina_file_unlink on Windows. 2017-10-19 10:28:45 -07:00
Cedric BAIL 38536c9ae9 eina: downgrad ERR to WRN when not finding a file. 2017-10-19 10:26:26 -07:00
Cedric Bail 6e64a104a6 eina: use a stringshare to store the filename internally.
T6164
2017-10-17 16:15:19 -07:00
Subodh Kumar f418d62af3 eina: comparing less than zero with unsigned long int
Summary:
Unsigned integer should not be compared to less than zero
@fix

Test Plan: NA

Reviewers: cedric

Reviewed By: cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D5269

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2017-10-09 16:37:50 -07:00
Guilherme Iscaro 48443fda8f Eina_File: Avoid using munmap() on file->global_map.
When a virtualized file is created the file->global_map will not
point to a mmapped region, thus it's not safe to use munmap() during
the file cleanup. Only use munmap() if the file is backed by a FD.

Fixes: T5234.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-08-02 16:03:20 -07:00
Ivan Furs 0e7ee821cd eina: For Windows fix crash when the file was opened many times.
Summary:
A similar problem as:
    commit 62b469749a

Reviewers: NikaWhite, t.naumenko, an.kroitor, FurryMyad, cedric, raster, vtorri, rimmed

Reviewed By: raster

Subscribers: artem.popov, cedric, jpeg

Tags: #windows, #efl

Differential Revision: https://phab.enlightenment.org/D4788
2017-04-17 11:51:05 +09:00
Ivan Furs 4d13273e3b eina_file: fixed T2244
Summary:
dirty fix for 'eet' problems with file deletion on WINDOWS
to work with the commit: D4698, D4699

Reviewers: cedric, NikaWhite, rimmed, vtorri, raster

Reviewed By: cedric

Subscribers: artem.popov, cedric, jpeg

Maniphest Tasks: T2244

Differential Revision: https://phab.enlightenment.org/D4701

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-03-15 10:49:55 -07:00
Ivan Furs 8a10ef10cb eina_file: delete handle->fm(handel of function CreateFileMapping)
Summary: CreateFileMapping return handle. The handle before use is always closed. This handle can be immediately closed after use.

Reviewers: cedric, raster, vtorri, rimmed, an.kroitor, FurryMyad, NikaWhite

Reviewed By: raster

Subscribers: artem.popov, cedric, jpeg

Tags: #windows

Differential Revision: https://phab.enlightenment.org/D4699
2017-03-06 19:18:46 +09:00
Ivan Furs 808fcf4dae eina_file: add eina_file_unlink
Test Plan: split  D4423 - unlink

Reviewers: raster, vtorri, an.kroitor, jpeg, reutskiy.v.v, NikaWhite, cedric

Reviewed By: cedric

Subscribers: artem.popov, cedric, vtorri, jpeg

Tags: #windows, #efl

Differential Revision: https://phab.enlightenment.org/D4485

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-07 15:14:54 -08:00
Vyacheslav Reutskiy 56c202614b eina_file_win32: close handler in case of error
Func _eina_file_win32_first_file try to find the first file in directory
but if any file not found the file handler stay open, and func will
return error. But in this case while handle is open impossible to do
any actions. For example call eina_file_ls for empty folder, func will
return error and fold folder open. And if we try to remove this folder
Windows only mark it to delete, and remove it after the process is
complete.

Solution: close handler in error case.
2016-11-23 16:19:55 +02:00
Vincent Torri d8008f4625 Eina: fix memory leak in eina_file_open()
@fix
2015-10-14 09:44:48 +01:00
Vincent Torri 8854b9f727 Eina: fix eina_file_current_directory_get()
the length was not correctly computed and eina_file_path_sanitize() was
was writing beyond the limit of the string

@fix
2015-10-14 09:44:48 +01:00
Vincent Torri c086d505a9 Eina: fix eina_file_split on Windows and update unit test
@fix

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2015-04-29 15:27:47 +09:00
Michelle Legrand f6d870b4c1 eina: win32 release lock in case of error
Summary:
It's better to realese the lock before returning NULL. Otherwise the program
is waiting indefinitely then crashing on Windows ("program not responding").

@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-12 07:43:58 +01:00
Michelle Legrand b36e2fc701 eina: add more access to created file.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-12 07:43:58 +01:00
Nicolas Aguirre 3b52489368 eina: fix directory listing on windows when directory is empty.
Using of INVALID_HANDLE_VALUE and ERROR_NO_MORE_FILES to handle this properlly.

@fix
2015-02-11 17:03:39 +01:00
Adrien Nader f71a78edcb eina: correctly handle and report Eina_File error on Windows.
@fix
2015-02-11 16:38:15 +01:00
Vincent Torri 788d4d6c3f eina: open files in read-onnly for eina_file_open() on Windows
A previous fix added the read-write access of files with eina_file_open,
so revert that part

@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-03 11:05:38 +02:00
Vincent Torri f61f8d30fc eina: make error message more precise. 2014-07-17 17:51:22 +02:00
Cedric BAIL 72aca66f8d eina: win32 and linux version code are the same. Sharing code is better. 2014-07-14 15:46:54 +02:00
Cedric BAIL f15fc9b0a5 eina: simplify logic. 2014-07-14 15:46:54 +02:00
Vincent Torri 4d68dfe603 eina: (Windows) fix creation of files with eina_file_open() in some cases
@fix
2014-07-13 15:17:46 +02:00
Vincent Torri ea8b4c82ed eina: call the function, then return 2014-07-13 15:17:34 +02:00
Cedric BAIL 201d9b567d windows: make those warning explicit about what they imply. 2014-06-27 17:00:23 +02:00
Cedric BAIL 546af159ff eina: silence warning of unused parameter on Windows. 2014-06-27 13:24:39 +02:00
Cedric BAIL 58f424a199 eina: add more debug information when failing to open a file. 2014-02-21 17:13:09 +09:00
Cedric Bail e450a8fec3 eina: Eina_File - don't leak memory when file is not found. 2014-01-05 10:59:43 +09:00
Cedric Bail 0cfb40b7fb eina: cleanup file destruction and reintroduce EINA_MAGIC use. 2013-11-20 20:08:44 +09:00
Jérémy Zurcher 8a3e021298 Revert "eina: fix a possible race condition during eina_file_close."
it breaks everything

This reverts commit 7e8fb93206.
2013-11-20 10:22:00 +01:00
Cedric Bail 7e8fb93206 eina: fix a possible race condition during eina_file_close.
The lock on the main hash was taken to late (after we took the decision
to remove the targeted Eina_File from the cache), this means it was possible
to get an Eina_File from the cache that was going to be removed. This patch
attempt to fix that potential race condition.

Hopefully should fix T461.
2013-11-20 13:02:37 +09:00
Cedric Bail e35c7b19fb eina: long forgotten function in Eina_File for Windows. 2013-10-28 19:47:40 +09:00
Cedric Bail caf934e005 eina: don't try close dummy handle. 2013-09-02 12:33:21 +09:00
Cedric Bail 464c58a1c9 eina: another fix for windows build. 2013-08-08 17:17:58 +09:00
Cedric Bail 4dd259f3b1 eina: add eina_file_refresh(). 2013-07-31 17:16:40 +09:00
Cedric Bail f2de8970a1 eina: add support for in memory only Eina_File. 2013-07-31 11:51:51 +09:00
Cedric Bail 9e745d4a2c efl: add macro to swap Windows and Unix path separators. 2013-03-19 15:15:46 +09:00
Cedric BAIL 0dde9a6574 eina: share eina_file_copy code accross platform. 2013-03-15 16:05:39 +09:00
Cedric BAIL e70502f1a1 eina: improve portability of Eina_File. 2013-03-15 11:05:25 +09:00
Daniel Willmann f90726cf35 Revert "eina: improve portability of Eina_File."
This reverts commit c002d113f1.

This commit reliably breaks builds with clang. Please test with
export CC=clang before you commit again.

export CC=clang
./autogen.sh --enable-multisense && make -j 10

The error Jenkins gets (I confirmed locally):

/bin/bash: line 1: 13549 Segmentation fault      (core dumped) EFL_RUN_IN_TREE=1 ./bin/edje/edje_cc -id . -fd . -id ./tests/emotion/data tests/emotion/data/theme.edc tests/emotion/data/theme.edj
2013-03-14 17:21:48 +00:00
Cedric BAIL 49887271d2 eina: remove duplicated declaration. 2013-03-14 21:00:03 +09:00
Cedric BAIL c002d113f1 eina: improve portability of Eina_File. 2013-03-14 20:52:37 +09:00
Gustavo Sverzut Barbieri 0a2d116119 efl: eina_alloca.h to simplify alloca() usage.
having to replicate 18 lines per file just to access alloca() is
insane. Let's do that in Eina.h and avoid that crap :-/



SVN revision: 82082
2013-01-03 15:10:34 +00:00
Vincent Torri 7fe3d35994 merge: __UNUSED__ --> EINA_UNUSED and some fixes in eo.
SVN revision: 77542
2012-10-05 20:09:47 +00:00