git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] read-cache: avoid misaligned reads in index v4

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 23, 2022, 22:04 UTC
Message-ID
<xmqqtu4xsq79.fsf@gitster.g>
In-Reply-To
<Yy4nkEnhuzt2iH+R@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> Here (and elsewhere), you can assume that the offsetof() "sec" in
> cache_time is 0, for two reasons:
>
>   - I didn't look up chapter and verse, but I'm pretty sure the standard
>     does guarantee that the first field of a struct is at the beginning.
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
6.7.2.1 #13 (page 103)
    Within a structure object, the non-bit-field members and the
    units in which bit-fields reside have addresses that increase in
    the order in which they are declared. A pointer to a structure
    object, suitably converted, points to its initial member (or if
    that member is a bit-field, then to the unit in which it
    resides), and vice versa. There may be unnamed padding within a
    structure object, but not at its beginning.
As an initial padding is forbidden, the first member's offset is zero.
Previous: Jeff KingNext: Victoria Dye
Message 3 of 12 in “read-cache: avoid misaligned reads in index v4”
  1. read-cache: avoid misaligned reads in index v4Victoria Dye via GitGitGadget, Sep 23, 2022
  2. Jeff KingSep 23, 2022
  3. Junio C HamanoSep 23, 2022
  4. Victoria DyeSep 26, 2022
  5. Jeff KingSep 26, 2022
  6. Jeff KingSep 26, 2022
  7. Jeff KingSep 26, 2022
  8. Junio C HamanoSep 26, 2022
  9. Phillip WoodSep 25, 2022
  10. Junio C HamanoSep 26, 2022
  11. read-cache: avoid misaligned reads in index v4Victoria Dye via GitGitGadget, Sep 28, 2022
  12. Junio C HamanoSep 28, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.