[mythtv] [patch] mythbackend MainServer::getFreeSpace

Jim Westfall jwestfall at surrealistic.net
Thu Feb 17 02:55:29 UTC 2005


These are the current calculations for getting totalspace and usedspace, 
which get reported to the frontend.

totalspace = (statbuf.f_blocks - (statbuf.f_bfree - statbuf.f_bavail)) /
                 (1024*1024/statbuf.f_bsize);
usedspace = (statbuf.f_blocks - statbuf.f_bavail) /
                 (1024*1024/statbuf.f_bsize);

totalspace is adjusted to show total space for a non-root user, but 
usedspace isnt.  You can end up with the issue I have been seeing, which 
is usedspace > totalspace when I really have 50G free.

patch attached.
jim  
-------------- next part --------------
--- mythtv.orig/programs/mythbackend/mainserver.cpp	2005-02-09 13:35:13.000000000 -0800
+++ mythtv//programs/mythbackend/mainserver.cpp	2005-02-16 18:39:30.099747320 -0800
@@ -1560,8 +1560,7 @@
         // total space available to user is total blocks - reserved blocks
         totalspace = (statbuf.f_blocks - (statbuf.f_bfree - statbuf.f_bavail)) /
                       (1024*1024/statbuf.f_bsize);
-        usedspace = (statbuf.f_blocks - statbuf.f_bavail) /
-                     (1024*1024/statbuf.f_bsize);
+        usedspace = totalspace - (statbuf.f_bavail / (1024*1024/statbuf.f_bsize));
     }
 
     if (ismaster)


More information about the mythtv-dev mailing list