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

Re: [PATCH 4/4] cygwin: Use native Win32 API for stat

From
Johannes Sixt <johannes.sixt@telecom.at>
Date
Sep 27, 2008, 18:35 UTC
Message-ID
<200809272035.03833.johannes.sixt@telecom.at>
In-Reply-To
<20080927084349.GC21650@dpotapov.dyndns.org>
On Samstag, 27. September 2008, Dmitry Potapov wrote:
Show 6 quoted lines
> lstat/stat functions in Cygwin are very slow, because they try to emulate
> some *nix things that Git does not actually need. This patch adds Win32
> specific implementation of these functions for Cygwin.
>
> This implementation handles most situation directly but in some rare cases
> it falls back on the implementation provided for Cygwin.

Even though I was concerned about code duplication earlier, with the factorization that you do in this series this is acceptable, in particular, since working out at a solution that deals with the time_t vs. timespec difference we would need dirty tricks that are not worth it.

(But see my comment about get_file_attr() in a separate mail.)
> +core.cygwinNativeStat::
This name is *really* odd, for two reasons:
- If I read "native" in connection with Windows, I would understand Windows's 
implementation as "native". Cygwin is not native - it's a bolted-on feature.
- This name talks about the implementation, not about its effect.

Perhaps a better name would be core.ignoreCygwinFSFeatures, and the description would only mention that setting this to true (the default) makes many operations much faster, but makes it impossible to use File System Features A and B and C in the repository. "If you need one of these features, set this to false."

(And after writing above paragraphs I notice, that you actually really meant Windows's "native" stat; see how confusing the name is?)

Show 7 quoted lines
> +static inline void filetime_to_timespec(const FILETIME *ft, struct
> timespec *ts) +{
> +	long long winTime = ((long long)ft->dwHighDateTime << 32) +
> ft->dwLowDateTime; +	winTime -= 116444736000000000LL; /* Windows to Unix
> Epoch conversion */ +	ts->tv_sec = (time_t)(winTime/10000000); /*
> 100-nanosecond interval to seconds */ +	ts->tv_nsec = (long)(winTime -
> ts->tv_sec*10000000LL) * 100; /* nanoseconds */ +}

Shorter lines in this function would be appreciated (and not just because my MUA can't deal with them ;).

-- Hannes
Previous: Dmitry PotapovNext: Dmitry Potapov
Message 2 of 11 in “cygwin: Use native Win32 API for stat”
  1. 4/4 cygwin: Use native Win32 API for statDmitry Potapov, Sep 27, 2008
  2. Johannes SixtSep 27, 2008
  3. Dmitry PotapovSep 27, 2008
  4. Johannes SixtSep 28, 2008
  5. Shawn O. PearceSep 29, 2008
  6. Dmitry PotapovSep 29, 2008
  7. 4/4 cygwin: Use native Win32 API for statDmitry Potapov, Sep 30, 2008
  8. Marcus GriepSep 30, 2008
  9. Shawn O. PearceSep 30, 2008
  10. Alex RiesenSep 28, 2008
  11. Dmitry PotapovSep 27, 2008

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.