aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-01-13 15:11:43 +0100
committerBjörn Gustavsson <[email protected]>2016-01-20 12:32:58 +0100
commit56eded8ac675bf0e6f955c291be845f668d2b795 (patch)
treed66168c49672b78f3cdb55f47dd139deb4e312a4 /erts/preloaded
parentb662e8abbdf63390af5173752ea87d7c952f5185 (diff)
downloadotp-56eded8ac675bf0e6f955c291be845f668d2b795.tar.gz
otp-56eded8ac675bf0e6f955c291be845f668d2b795.tar.bz2
otp-56eded8ac675bf0e6f955c291be845f668d2b795.zip
erl_prim_loader: Rename release_archives/0
Rename release_archives/0 to purge_archive_cache/0 to make it clearer what it does and what it doesn't do. Also add a comment about its intended purpose. Note that release_archives/0 is not documented and is part of the experimental archive feature. Furthermore, the only uses I could find were in the test suite. I did not find any uses in the external applications relx and rebar3 applications that are known to use archives. Therefore, I think that the increased clarity is worth the small risk of breaking code.
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/src/erl_prim_loader.erl23
1 files changed, 15 insertions, 8 deletions
diff --git a/erts/preloaded/src/erl_prim_loader.erl b/erts/preloaded/src/erl_prim_loader.erl
index e1c014fee6..824ed3435d 100644
--- a/erts/preloaded/src/erl_prim_loader.erl
+++ b/erts/preloaded/src/erl_prim_loader.erl
@@ -50,7 +50,10 @@
prim_read_file_info/3, prim_get_cwd/2]).
%% Used by escript and code
--export([set_primary_archive/4, release_archives/0]).
+-export([set_primary_archive/4]).
+
+%% Used by test suites
+-export([purge_archive_cache/0]).
-include_lib("kernel/include/file.hrl").
@@ -225,10 +228,13 @@ set_primary_archive(File, ArchiveBin, FileInfo, ParserFun)
when is_list(File), is_binary(ArchiveBin), is_record(FileInfo, file_info) ->
request({set_primary_archive, File, ArchiveBin, FileInfo, ParserFun}).
--spec release_archives() -> 'ok' | {'error', _}.
+%% NOTE: Does not close the primary archive. Only closes all
+%% open zip files kept in the cache. Should be called before an archive
+%% file is to be removed (for example in the test suites).
-release_archives() ->
- request(release_archives).
+-spec purge_archive_cache() -> 'ok' | {'error', _}.
+purge_archive_cache() ->
+ request(purge_archive_cache).
request(Req) ->
Loader = whereis(erl_prim_loader),
@@ -332,8 +338,8 @@ handle_request(Req, Paths, St0) ->
{set_primary_archive,File,ArchiveBin,FileInfo,ParserFun} ->
handle_set_primary_archive(St0, File, ArchiveBin,
FileInfo, ParserFun);
- release_archives ->
- handle_release_archives(St0);
+ purge_archive_cache ->
+ handle_purge_archive_cache(St0);
_ ->
ignore
end.
@@ -346,8 +352,9 @@ handle_get_file(State = #state{loader = inet}, Paths, File) ->
handle_set_primary_archive(State= #state{loader = efile}, File, ArchiveBin, FileInfo, ParserFun) ->
?SAFE2(efile_set_primary_archive(State, File, ArchiveBin, FileInfo, ParserFun), State).
-handle_release_archives(State= #state{loader = efile}) ->
- ?SAFE2(efile_release_archives(State), State).
+handle_purge_archive_cache(#state{loader = efile}=State) ->
+ prim_purge_cache(),
+ {ok,State}.
handle_list_dir(State = #state{loader = efile}, Dir) ->
?SAFE2(efile_list_dir(State, Dir), State);