From a5b3d81936ab85edb8713f29baf85307ae0b25b8 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 25 Nov 2011 20:29:59 +0100 Subject: Preliminary work on header/trailer Have to figure out how to represent progress in header writing when using non-blocking, not sure how to do this. --- erts/preloaded/src/prim_file.erl | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'erts/preloaded/src') diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl index 6bdf5f6e2e..fb19521382 100644 --- a/erts/preloaded/src/prim_file.erl +++ b/erts/preloaded/src/prim_file.erl @@ -547,38 +547,21 @@ write_file(_, _) -> sendfile(#file_descriptor{module = ?MODULE, data = {Port, _}}, DestFD, Offset, Bytes, ChunkSize, Headers, Trailers, Nodiskio, MNowait, Sync) -> - drv_command(Port, <>). + drv_command(Port, [<>, + Headers,Trailers]). get_bit(true) -> 1; get_bit(false) -> 0. -encode_hdtl(undefined) -> - <<0>>; -encode_hdtl([]) -> - <<0>>; -encode_hdtl(List) -> - encode_hdtl(List,<<>>,0). - -encode_hdtl([], Acc, Cnt) -> - <>; -encode_hdtl([Bin|T], Acc, Cnt) when is_binary(Bin) -> - encode_hdtl(T, <<(byte_size(Bin)):32, Bin/binary, Acc/binary>>,Cnt + 1); -encode_hdtl([Bin|T], Acc, Cnt) -> - encode_hdtl(T, <<(iolist_size(Bin)):32, (iolist_to_binary(Bin))/binary, - Acc/binary>>,Cnt + 1). - - - %%%----------------------------------------------------------------- -- cgit v1.2.3