Skip to content

Commit 8c45f26

Browse files
committed
Remove use of prim_file:list_dir/2
The use of it was a hack of some sort - which is not presently understood. It is no longer valid due to erlang/otp@ebbd26e removing the export. It is assumed that list_dir was originally added to avoid problems no solved via dirty NIF scheduling for file I/O
1 parent fa9db57 commit 8c45f26

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ _build/*
1212
/.eqc-info
1313
/current_counterexample.eqc
1414
.pulse
15+
rebar.lock

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: erlang
22
otp_release:
33
- 20.3.8
4+
- 21.3
5+
- 22.1
46
script:
57
- chmod u+x rebar3
6-
- ./rebar3 do upgrade, compile, dialyzer, xref, eunit
7-
notifications:
8-
slack:
9-
secure: SE0EMU9HenZlLBuNg7l6WLMxJPkfyAEGgodvAqMEuQmICtrh1nV019D/A8ykejYYPPsJafWVOfypOSDrSHCndzXvEZvU8l45nJ6XLdUdrDYEmvcSqN3EqmVSsuf9H3g99bvKygXaY27MkTS5ixLil7PzybG+YpwMnQGcQxYo5Eg=
8+
- ./rebar3 do upgrade, compile, xref, dialyzer, eunit

rebar.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{erl_opts, [debug_info, warn_untyped_record,
2-
{platform_define, "^[0-9]+", namespaced_types}]}.
2+
{platform_define, "^[0-9]+", namespaced_types},
3+
{platform_define, "^[2-9][1-9]\..*", dirty_file_nif}]}.
34
{port_specs, [{"priv/bitcask.so", ["c_src/*.c"]}]}.
45

56
{port_env,

src/bitcask.erl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3073,6 +3073,11 @@ corrupt_file(Path, Offset, Data) ->
30733073

30743074
% Verify that if the cached efile port goes away, we can recover
30753075
% and not get stuck opening casks
3076+
3077+
-ifdef(dirty_file_nif).
3078+
efile_error_test() ->
3079+
ok.
3080+
-else.
30763081
efile_error_test() ->
30773082
Dir = setup_testfolder("bc.efile.error"),
30783083
B = bitcask:open(Dir, [read_write]),
@@ -3089,6 +3094,8 @@ efile_error_test() ->
30893094
B2 when is_reference(B2) ->
30903095
ok = bitcask:close(B2)
30913096
end.
3097+
-endif.
3098+
30923099

30933100
%% About leak_t0():
30943101
%%

src/bitcask_fileops.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,10 @@ ensure_dir(F) ->
837837
end
838838
end.
839839

840+
-ifdef(dirty_file_nif).
841+
list_dir(Dir) ->
842+
file:list_dir(Dir).
843+
-else.
840844
list_dir(Dir) ->
841845
list_dir(Dir, 1).
842846

@@ -881,3 +885,4 @@ prim_file_drv_open(Driver, Portopts) ->
881885
{error, Reason}
882886
end.
883887

888+
-endif.

0 commit comments

Comments
 (0)