Re: [PATCH v2 09/17] midx: return success/failure in chunk write methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Derrick Stolee <dstolee@xxxxxxxxxxxxx>
>
> Historically, the chunk-writing methods in midx.c have returned the
> amount of data written so the writer method could compare this with the
> table of contents. This presents with some interesting issues:
>
> 1. If a chunk writing method has a bug that miscalculates the written
>    bytes, then we can satisfy the table of contents without actually
>    writing the right amount of data to the hashfile. The commit-graph
>    writing code checks the hashfile struct directly for a more robust
>    verification.
>
> 2. There is no way for a chunk writing method to gracefully fail.
>    Returning an int presents an opportunity to fail without a die().
>
> 3. The current pattern doesn't match chunk_write_fn type exactly, so we
>    cannot share code with commit-graph.c
>
> For these reasons, convert the midx chunk writer methods to return an
> 'int'. Since none of them fail at the moment, they all return 0.

OK, that makes sense.

In this step I see the same "f->total + f->offset" sprinkled in some
places, but they will all go away in the "midx: use chunk-format API
in write_midx_internal()" step, so it is not such a huge deal.

Thanks.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux