bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Support in du for showing both apparent and on-disk size and


From: James Youngman
Subject: Re: [PATCH] Support in du for showing both apparent and on-disk size and the ratio between them
Date: Thu, 22 Feb 2007 17:54:45 +0000

On 1/31/07, Luca Barbieri <address@hidden> wrote:
This patch allows to display simultaneously both the disk usage and
apparent size and also allows to display the "completeness" (or
"nonsparsity") of file, which is the ratio of the disk usage to the
apparent size.

For what it's worth, findutils-4.3 in CVS implements a similar feature:

static double
file_sparseness(const struct stat *p)
{
 if (0 == p->st_size)
   {
     if (0 == p->st_blocks)
       return 1.0;
     else
       return p->st_blocks < 0 ? -HUGE_VAL : HUGE_VAL;
   }
 else
   {
     double blklen = file_blocksize(p) * (double)p->st_blocks;
     return blklen / p->st_size;
   }
}


For instance, this is useful when dealing with software that download
files by creating sparse files and filling them: the "completeness" then
is approximately the progress of the download.

Personally, I don't like the name "completeness" very much; it
communicates nothing much to me.

James.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]