[erlang-questions] Fwd: disk tests

Hynek Vychodil <>
Thu Oct 9 16:30:31 CEST 2008


On Thu, Oct 9, 2008 at 4:24 PM, Hynek Vychodil <> wrote:

> It will work also with
>
> zero_file_seqwrite(S, Len, B, Size) when Size < Len ->
>
> but I think better will be
>
> zero_file_seqwrite(Handler, Size, Block, BlockSize) when BlockSize < Size
> ->
>
> and all comes clear.
>
> zero_file_seqwrite(_, 0, _, _) -> ok;
> zero_file_seqwrite(Handler, Size, Block, BlockSize) when BlockSize < Size
> ->
>

oh mistake, there should be BlockSize=<Size and it works as very minor
optimization. Other way previous clause useless.


>
>    file:write(Handler, [Block]),
>    zero_file_seqwrite(Handler, Size-BlockSize, Block, BlockSize);
> zero_file_seqwrite(Handler, Size, _, _) ->
>    Block = list_to_binary(duplicate(Size, 0)),
>    file:write(Handler, [Block]).
>
> On Thu, Oct 9, 2008 at 3:44 PM, Vlad Dumitrescu <>wrote:
>
>> Hi Joe,
>>
>> Shouldn't this
>>
>> > zero_file_seqwrite(S, Len, B, Size) when Size > Len ->
>>
>> be
>>
>> zero_file_seqwrite(S, Len, B, Size) when Size =< Len ->
>>
>> instead?
>>
>> The second version works completely fine.
>>
>> regards,
>> Vlad
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
>
>
>
> --
> --Hynek (Pichi) Vychodil
>



-- 
--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081009/d55f51d6/attachment.html>


More information about the erlang-questions mailing list