Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <johannes.sixt@telecom.at>
Cc: git@vger.kernel.org, "Andreas Färber" <andreas.faerber@web.de>
Subject: Re: [PATCH 1/2] compat: introduce stat_to_kilobytes
Date: Mon, 18 Aug 2008 13:40:04 -0700	[thread overview]
Message-ID: <7vbpzqm50b.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <200808182157.16392.johannes.sixt@telecom.at> (Johannes Sixt's message of "Mon, 18 Aug 2008 21:57:16 +0200")

Johannes Sixt <johannes.sixt@telecom.at> writes:

> From: Junio C Hamano <gitster@pobox.com>
>
> Some platforms do not have st_blocks member in "struct stat"; mingw
> already emulates it by rounding it up to closest 512-byte blocks (even
> though it could overcount when a file has holes).
>
> The reason to use the member is only to figure out how many kilobytes the
> file occupies on-disk, so give a helper in git-compat-util.h to help these
> platforms.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
> ---
> On Sonntag, 17. August 2008, Junio C Hamano wrote:
>>    The comment before "struct mingw_stat" suggests that the only reason
>>    this compatiblity definition exists is to add st_blocks member, so I
>>    suspect we could remove the definition and simplify the compatibility
>>    layer a lot more, but I do not know MinGW, so I am CC'ing j6t here.
>
> Makes sense. Here it is again, with the Makefile fixup noted by Andreas.
>
> But notice that we now underestimated the size of loose objects more than
> we did previously because we now round down individual sizes; previously
> we rounded down only the total size.

Ah, you are right.

Perhaps we should fix this by making the helper stat_to_on_disk_bytes(),
so that on platform with st_blocks counted in 512-byte blocks we multiply
it by 512?

  parent reply	other threads:[~2008-08-18 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-17  8:59 [PATCH 4/6] Don't use struct stat's st_blocks member on Haiku Andreas Färber
2008-08-17  9:28 ` Jakub Narebski
2008-08-17  9:47 ` [PATCH] compat: introduce stat_to_kilobytes Junio C Hamano
2008-08-17 17:27   ` Andreas Färber
2008-08-18 19:57   ` [PATCH 1/2] " Johannes Sixt
2008-08-18 20:01     ` [PATCH 2/2] Revert "Windows: Use a customized struct stat that also has the st_blocks member." Johannes Sixt
2008-08-18 20:44       ` Junio C Hamano
2008-08-18 20:40     ` Junio C Hamano [this message]
2008-08-19  7:31       ` [PATCH 1/2] compat: introduce stat_to_kilobytes Junio C Hamano
2008-08-19  8:39     ` Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vbpzqm50b.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=andreas.faerber@web.de \
    --cc=git@vger.kernel.org \
    --cc=johannes.sixt@telecom.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox