[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/utils/filelight/src/part
From:       Martin Tobias Holmedahl Sandsmark <sandsmark () samfundet ! no>
Date:       2010-06-04 20:58:26
Message-ID: 20100604205826.AE003AC8CA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1134661 by sandsmark:

Fix handling of sparse files.

Don't fake the reading of blocks used for a file.

BUG: 135611



 M  +3 -9      localLister.cpp  


--- trunk/playground/utils/filelight/src/part/localLister.cpp #1134660:1134661
@@ -91,14 +91,8 @@
     kDebug() << "Thread terminating ...";
 }
 
-// from system.h in GNU coreutils package
-/* Extract or fake data from a `struct stat'.
-ST_NBLOCKS: Number of blocks in the file, including indirect blocks.
-ST_NBLOCKSIZE: Size of blocks used when calculating ST_NBLOCKS.  */
-#define ST_NBLOCKS(statbuf) ((statbuf).st_size / ST_NBLOCKSIZE + ((statbuf).st_size \
                % ST_NBLOCKSIZE != 0))
-
-#ifndef ST_NBLOCKSIZE
-#define ST_NBLOCKSIZE 512
+#ifndef S_BLKSIZE
+#define S_BLKSIZE 512
 #endif
 
 
@@ -177,7 +171,7 @@
 
         if (S_ISREG(statbuf.st_mode)) //file
             //using units of KiB as 32bit max is 4GiB and 64bit ints are expensive
-            cwd->append(ent->d_name, (ST_NBLOCKS(statbuf) * ST_NBLOCKSIZE) / 1024);
+            cwd->append(ent->d_name, (statbuf.st_blocks * S_BLKSIZE) / 1024);
 
         else if (S_ISDIR(statbuf.st_mode)) //folder
         {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic