public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-developers@cygwin.com
Subject: Re: SEEK_HOLE Support in Cygwin?
Date: Fri, 25 Aug 2023 13:43:49 +0200	[thread overview]
Message-ID: <ZOiT9ZinstgoOiG0@calimero.vinschen.de> (raw)
In-Reply-To: <ZOiPNvvEH3FmDlcF@calimero.vinschen.de>

On Aug 25 13:23, Corinna Vinschen wrote:
> On Aug 25 13:09, Roland Mainz wrote:
> > On Fri, Aug 25, 2023 at 11:05 AM Corinna Vinschen
> > <corinna-cygwin@cygwin.com> wrote:
> > >
> > > On Aug 24 14:03, Roland Mainz wrote:
> > > > Question for Corinna:
> > >
> > > Everybody involved in the project could answer this question, but...
> > >
> > > > Does Cygwin support allocation/deallocation of filesystem blocks via
> > > > Linux's |fallocate()|-API ?
> > >
> > > ...just try this:
> > >
> > > $ cat > a.c <<EOF
> > > extern void fallocate();
> > > extern void posix_fallocate();
> > >
> > > int main()
> > > {
> > >   fallocate();
> > >   posix_fallocate();
> > > }
> > > EOF
> > > $ gcc -o a a.c
> > 
> > Thanks...
> > ... I saw that the functions are there,
> 
> So you didn't actually run the test?
> 
> > but my question was more like
> > "supports"=="calls native Windows API".
> > 
> > |fallocate()| support seems to be in
> > ./newlib-cygwin/winsup/cygwin/fhandler/disk_file.cc, and supports the
> > allocation of blocks - but I couldn't find support for
> > |FALLOC_FL_PUNCH_HOLE|, e.g. deallocation of blocks (to "punch" a hole
> > into the file).
> > Is this an oversight, or does Window's native API not support that ?
> 
> If you found fallocate() in fhandler/disk_file.cc, I need new glasses.

No, we don't support fallocate, we only support posix_fallocate.
The flags to fallocate can be supported like this:

  0				== posix_fallocate
  FALLOC_FL_KEEP_SIZE		posix_fallocate with forcing sparse
  FALLOC_FL_UNSHARE_RANGE	no-op
  FALLOC_FL_PUNCH_HOLE		use Windows ioctl FSCTL_SET_ZERO_DATA

https://cygwin.com/acronyms/#SHTDI


Corinna

      reply	other threads:[~2023-08-25 11:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-06 17:14 Cedric Blancher
2023-08-07  8:33 ` Corinna Vinschen
2023-08-09 15:30   ` Corinna Vinschen
2023-08-10  2:43     ` Cedric Blancher
2023-08-10  8:28       ` Corinna Vinschen
2023-08-21  4:33         ` Cedric Blancher
2023-08-21  8:32           ` Corinna Vinschen
2023-08-24 12:03           ` Roland Mainz
2023-08-25  9:05             ` Corinna Vinschen
2023-08-25 11:09               ` Roland Mainz
2023-08-25 11:23                 ` Corinna Vinschen
2023-08-25 11:43                   ` Corinna Vinschen [this message]

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=ZOiT9ZinstgoOiG0@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-developers@cygwin.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).