Re: [PATCH v2 2/7] reftable: explicitly handle hash format IDs

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

 



Patrick Steinhardt <ps@xxxxxx> writes:

> The hash format IDs are used for two different things across the
> reftable codebase:
>
>   - They are used as a 32 bit unsigned integer when reading and writing
>     the header in order to identify the hash function.
>
>   - They are used internally to identify which hash function is in use.
>
> When one only considers the second usecase one might think that one can
> easily change the representation of those hash IDs. But because those
> IDs end up in the reftable header and footer on disk it is important
> that those never change.
>
> Create separate constants `REFTABLE_FORMAT_ID_*` and use them in
> contexts where we read or write reftable headers. This serves multiple
> purposes:
>
>   - It allows us to more easily discern cases where we actually use
>     those constants for the on-disk format.
>
>   - It detangles us from the same constants that are defined in
>     libgit.a, which is another required step to convert the reftable
>     library to become standalone.
>
>   - It makes the next step easier where we stop using `GIT_*_FORMAT_ID`
>     constants in favor of a custom enum.
>

So this patch tackles the first scenario mentioned above (for
reading/writing the header), changing the second scenario
(identification of which hash function) is handled in the next step by
introducing a custom enum. Makes sense.

- Karthik

Attachment: signature.asc
Description: PGP signature


[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