delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/11/24/06:01:56

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8482385840F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1700823714;
bh=/vz2hhK6InDVa2U5TFqhOB2vlDoVBu4zP7P5RQZcEU4=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=OMoQm87tW1BLXQey6hFceF+4mRMSLpmoRw6Tt9XeWj4e/UySqJCLFGBQ7CO2RNnWP
4lYfcTAk61Pt6fL4PNQ98XMv0aAYBwfvEwc3ixE+aFhUI7aBXGBC+Fjt4OA0wJJ1n+
r+in3O5ytfZvlPGz/vPycPOh65SKotXlgZhTb4zk=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A3B73858D3C
Date: Fri, 24 Nov 2023 12:01:18 +0100
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin api to punch a hole into a file?
Message-ID: <ZWCCfqny4lC11bBJ@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CALXu0Uee2CHeCpthOKFmct+6HnEsKHbSzdK3Jyx8GsnYyt7Lbw AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CALXu0Uee2CHeCpthOKFmct+6HnEsKHbSzdK3Jyx8GsnYyt7Lbw@mail.gmail.com>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Nov 23 23:36, Cedric Blancher via Cygwin wrote:
> Linux has fallocate(fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, ...)
> to punch a hole into a file, i.e. deallocate the blocks given and make
> the file a "sparse file".

We don't support the Linux-specific fallocate(2) call, only ftruncate(2)
and posix_fallocate(3).  Patches, as usual, thoughtfully considered.

> But how can I do that with the Cygwin API? Does anyone have an example
> for Cygwin, which is the Win equivalent to Linux fallocate(fd,
> FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, 1048576, 2097152);?
> 
> I tried with Cygwin 3.5, but the file was not sparse after that.

Do you remember the discussion in August, starting here:
https://cygwin.com/pipermail/cygwin-developers/2023-August/012664.html
especially:
https://cygwin.com/pipermail/cygwin-developers/2023-August/012679.html

So, did you set the sparse mount option per
https://cygwin.com/cygwin-ug-net/using.html#mount-table
?

Also, chattr -S, which is independent from the mount option "sparse":
https://cygwin.com/cygwin-ug-net/chattr.html


Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019