LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2005, 05:53 PM   #1
alltime
Member
 
Registered: Jan 2005
Distribution: Mandrake 10.1 with kernel 2.6.10
Posts: 60

Rep: Reputation: 15
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.
 
Old 03-12-2005, 09:22 PM   #2
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
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.
 
Old 03-13-2005, 10:34 AM   #3
alltime
Member
 
Registered: Jan 2005
Distribution: Mandrake 10.1 with kernel 2.6.10
Posts: 60

Original Poster
Rep: Reputation: 15
Yes exactly, I believe.

Last edited by alltime; 03-13-2005 at 10:38 AM.
 
Old 03-13-2005, 03:33 PM   #4
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
OHHHH NO MY FILES HAVE HOLES



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



heheh jk :P
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Holes in the file system muthiahm Linux - Newbie 4 07-22-2010 07:27 AM
how to make a chart with holes? caminoix Linux - Software 2 05-24-2005 08:10 AM
holes in firewall? ryedunn Linux - Security 1 10-16-2004 02:37 PM
telnet holes?? r2ii Linux - Security 9 08-11-2004 06:11 PM
Known RedHat Security holes? Volcom Linux - Security 2 06-13-2003 09:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration