Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
2381-Inline-always-required-layer-in-raw_file_i...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2381-Inline-always-required-layer-in-raw_file_io.patch of Package erlang
From b4198551e41a84207e2914316b0818fde50af9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= <jose.valim@dashbit.co> Date: Tue, 4 Aug 2020 23:48:56 +0200 Subject: [PATCH] Inline always required layer in raw_file_io The raw option is always available to raw_file_io:open/2 but the previous implementation made it look like it was optional as the other layers. This commit inlines raw_file_io_raw into raw_file_io so it is clear it always ends up by calling prim_file:open/2. --- bootstrap/lib/kernel/ebin/kernel.app | 1 - lib/kernel/src/Makefile | 1 - lib/kernel/src/kernel.app.src | 1 - lib/kernel/src/raw_file_io.erl | 12 ++++-------- lib/kernel/src/raw_file_io_raw.erl | 25 ------------------------- 5 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 lib/kernel/src/raw_file_io_raw.erl diff --git a/bootstrap/lib/kernel/ebin/kernel.app b/bootstrap/lib/kernel/ebin/kernel.app index 7288d0e0ba..0c43873cce 100644 --- a/bootstrap/lib/kernel/ebin/kernel.app +++ b/bootstrap/lib/kernel/ebin/kernel.app @@ -113,7 +113,6 @@ raw_file_io_delayed, raw_file_io_inflate, raw_file_io_list, - raw_file_io_raw, seq_trace, socket, standard_error, diff --git a/lib/kernel/src/Makefile b/lib/kernel/src/Makefile index 6c75bcffee..ccda3b8312 100644 --- a/lib/kernel/src/Makefile +++ b/lib/kernel/src/Makefile @@ -146,7 +146,6 @@ MODULES = \ raw_file_io_deflate \ raw_file_io_delayed \ raw_file_io_list \ - raw_file_io_raw \ wrap_log_reader HRL_FILES= ../include/file.hrl ../include/inet.hrl ../include/inet_sctp.hrl \ diff --git a/lib/kernel/src/kernel.app.src b/lib/kernel/src/kernel.app.src index e9f6049d5f..ec6d7743a3 100644 --- a/lib/kernel/src/kernel.app.src +++ b/lib/kernel/src/kernel.app.src @@ -113,7 +113,6 @@ raw_file_io_delayed, raw_file_io_inflate, raw_file_io_list, - raw_file_io_raw, seq_trace, socket, standard_error, diff --git a/lib/kernel/src/raw_file_io.erl b/lib/kernel/src/raw_file_io.erl index e3c07c8f78..8faaa6b37f 100644 --- a/lib/kernel/src/raw_file_io.erl +++ b/lib/kernel/src/raw_file_io.erl @@ -24,14 +24,13 @@ open(Filename, Modes) -> %% Layers are applied in this order, and the listed modules will call this %% function again as necessary. eg. a raw compressed delayed file in list - %% mode will walk through [_list -> _compressed -> _delayed -> _raw]. + %% mode will walk through [_list -> _compressed -> _delayed]. ModuleOrder = [{raw_file_io_list, fun match_list/1}, {raw_file_io_compressed, fun match_compressed/1}, - {raw_file_io_delayed, fun match_delayed/1}, - {raw_file_io_raw, fun match_raw/1}], + {raw_file_io_delayed, fun match_delayed/1}], open_1(ModuleOrder, Filename, add_implicit_modes(Modes)). -open_1([], _Filename, _Modes) -> - error(badarg); +open_1([], Filename, Modes) -> + prim_file:open(Filename, Modes); open_1([{Module, Match} | Rest], Filename, Modes) -> case lists:any(Match, Modes) of true -> @@ -63,9 +62,6 @@ match_delayed({delayed_write, _Size, _Timeout}) -> true; match_delayed(delayed_write) -> true; match_delayed(_Other) -> false. -match_raw(raw) -> true; -match_raw(_Other) -> false. - match_writable(write) -> true; match_writable(append) -> true; match_writable(exclusive) -> true; diff --git a/lib/kernel/src/raw_file_io_raw.erl b/lib/kernel/src/raw_file_io_raw.erl deleted file mode 100644 index 9a9fe78eb1..0000000000 --- a/lib/kernel/src/raw_file_io_raw.erl +++ /dev/null @@ -1,25 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2017. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% --module(raw_file_io_raw). - --export([open_layer/3]). - -open_layer(Filename, Modes, [raw]) -> - prim_file:open(Filename, [raw | Modes]). -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor