LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Files with holes (https://www.linuxquestions.org/questions/programming-9/files-with-holes-300903/)

alltime 03-12-2005 05:53 PM

Files with holes
 
I have a small job to do and that is to create a program that would open a file and look to see if the file has holes in it.

I am trying to think how I would do this. Could someone please give a decent explanation of what a hole is exactly because although I have created a program which generated holes, my understanding is still a little blurred.

aluser 03-12-2005 09:22 PM

I would guess that if you stat() it and st_size > st_blksize * st_blocks, then it has holes in it.

I'm assuming that by hole you mean one of the disk blocks in the file is entirely 0s, and the filesystem doesn't bother to write such a block to disk but rather keeps a record of the fact that it should be there. Or I could be completely off base.

alltime 03-13-2005 10:34 AM

Yes exactly, I believe.

exvor 03-13-2005 03:33 PM

OHHHH NO MY FILES HAVE HOLES



DONT TELL MS CUSTOMERS THIS THEY WILL CALL ME AND WANT ME TO FIX IT!



heheh jk :P


All times are GMT -5. The time now is 07:26 AM.