[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH 1/2] compat: introduce stat_to_kilobytes
From:       Junio C Hamano <gitster () pobox ! com>
Date:       2008-08-18 20:40:04
Message-ID: 7vbpzqm50b.fsf () gitster ! siamese ! dyndns ! org
[Download RAW message or body]

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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic