aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-11-25 20:29:59 +0100
committerLukas Larsson <[email protected]>2011-12-01 14:10:06 +0100
commita5b3d81936ab85edb8713f29baf85307ae0b25b8 (patch)
treee3905e38972d900084858312b01af56ac0b87bc1 /erts/preloaded
parent9322161952ed25a96578f163cc383be605e7f75c (diff)
downloadotp-a5b3d81936ab85edb8713f29baf85307ae0b25b8.tar.gz
otp-a5b3d81936ab85edb8713f29baf85307ae0b25b8.tar.bz2
otp-a5b3d81936ab85edb8713f29baf85307ae0b25b8.zip
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.
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/src/prim_file.erl35
1 files changed, 9 insertions, 26 deletions
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, <<?FILE_SENDFILE, DestFD:32,
- (get_bit(Nodiskio)):1,
- (get_bit(MNowait)):1,
- (get_bit(Sync)):1,0:5,
- Offset:64/unsigned,
- Bytes:64/unsigned,
- ChunkSize:64,
- (encode_hdtl(Headers))/binary,
- (encode_hdtl(Trailers))/binary>>).
+ drv_command(Port, [<<?FILE_SENDFILE, DestFD:32,
+ (get_bit(Nodiskio)):1,
+ (get_bit(MNowait)):1,
+ (get_bit(Sync)):1,0:5,
+ Offset:64/unsigned,
+ Bytes:64/unsigned,
+ (iolist_size(Headers)):32/unsigned,
+ (iolist_size(Trailers)):32/unsigned>>,
+ 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) ->
- <<Cnt:8, Acc/binary>>;
-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).
-
-
-
%%%-----------------------------------------------------------------