Re: [zfs-discuss] test for holes in a file?

2012-03-27 Thread Casper . Dik
On Mon, 26 Mar 2012, Andrew Gabriel wrote: I just played and knocked this up (note the stunning lack of comments, missing optarg processing, etc)... Give it a list of files to check... This is a cool program, but programmers were asking (and answering) this same question 20+ years ago

Re: [zfs-discuss] test for holes in a file?

2012-03-27 Thread Bob Friesenhahn
On Mon, 26 Mar 2012, Mike Gerdts wrote: If file space usage is less than file directory size then it must contain a hole.  Even for compressed files, I am pretty sure that Solaris reports the uncompressed space usage. That's not the case. You are right. I should have tested this prior to

[zfs-discuss] test for holes in a file?

2012-03-26 Thread ольга крыжановская
How can I test if a file on ZFS has holes, i.e. is a sparse file, using the C api? Olga --       ,   _                                    _   ,      { \/`o;-    Olga Kryzhanovska   -;o`\/ } .'-/`-/     olga.kryzhanov...@gmail.com   \-`\-'.  `'-..-| /      

Re: [zfs-discuss] test for holes in a file?

2012-03-26 Thread Mike Gerdts
2012/3/26 ольга крыжановская olga.kryzhanov...@gmail.com: How can I test if a file on ZFS has holes, i.e. is a sparse file, using the C api? See SEEK_HOLE in lseek(2). -- Mike Gerdts http://mgerdts.blogspot.com/ ___ zfs-discuss mailing list

Re: [zfs-discuss] test for holes in a file?

2012-03-26 Thread ольга крыжановская
Mike, I was hoping that some one has a complete example for a bool has_file_one_or_more_holes(const char *path) function. Olga 2012/3/26 Mike Gerdts mger...@gmail.com: 2012/3/26 ольга крыжановская olga.kryzhanov...@gmail.com: How can I test if a file on ZFS has holes, i.e. is a sparse file,

Re: [zfs-discuss] test for holes in a file?

2012-03-26 Thread Joerg Schilling
? olga.kryzhanov...@gmail.com wrote: How can I test if a file on ZFS has holes, i.e. is a sparse file, using the C api? See star . ftp://ftp.berlios.de/pub/star/ or http://hg.berlios.de/repos/schillix-on/file/e3829115a7a4/usr/src/cmd/star/hole.c The interface was

Re: [zfs-discuss] test for holes in a file?

2012-03-26 Thread Andrew Gabriel
I just played and knocked this up (note the stunning lack of comments, missing optarg processing, etc)... Give it a list of files to check... #define _FILE_OFFSET_BITS 64 #includesys/types.h #includeunistd.h #includestdio.h #includesys/stat.h #includefcntl.h int main(int argc, char

Re: [zfs-discuss] test for holes in a file?

2012-03-26 Thread Bob Friesenhahn
On Mon, 26 Mar 2012, Andrew Gabriel wrote: I just played and knocked this up (note the stunning lack of comments, missing optarg processing, etc)... Give it a list of files to check... This is a cool program, but programmers were asking (and answering) this same question 20+ years ago

Re: [zfs-discuss] test for holes in a file?

2012-03-26 Thread Mike Gerdts
On Mon, Mar 26, 2012 at 6:18 PM, Bob Friesenhahn bfrie...@simple.dallas.tx.us wrote: On Mon, 26 Mar 2012, Andrew Gabriel wrote: I just played and knocked this up (note the stunning lack of comments, missing optarg processing, etc)... Give it a list of files to check... This is a cool

Re: [zfs-discuss] test for holes in a file?

2012-03-26 Thread Richard Elling
On Mar 26, 2012, at 4:18 PM, Bob Friesenhahn wrote: On Mon, 26 Mar 2012, Andrew Gabriel wrote: I just played and knocked this up (note the stunning lack of comments, missing optarg processing, etc)... Give it a list of files to check... This is a cool program, but programmers were