neutrino: fix boxinfo for rootfs != JFFS2

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1374 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Commit: 0fb7db27ec
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-04-02 (Sat, 02 Apr 2011)
This commit is contained in:
Stefan Seyfried
2011-04-02 13:21:40 +00:00
parent 80b0233d03
commit bbb99a21ec

View File

@@ -205,6 +205,8 @@ void CDBoxInfoWidget::paint()
perror("/proc/mounts"); perror("/proc/mounts");
} else { } else {
while ((mnt = getmntent(mountFile)) != NULL) { while ((mnt = getmntent(mountFile)) != NULL) {
if (strcmp(mnt->mnt_fsname, "rootfs") == 0)
continue;
if (::statfs(mnt->mnt_dir, &s) == 0) { if (::statfs(mnt->mnt_dir, &s) == 0) {
switch (s.f_type) /* f_type is long */ switch (s.f_type) /* f_type is long */
{ {
@@ -218,8 +220,6 @@ void CDBoxInfoWidget::paint()
case 0x4d44L: /*msdos*/ case 0x4d44L: /*msdos*/
break; break;
case 0x72b6L: /*jffs2*/ case 0x72b6L: /*jffs2*/
if (strcmp(mnt->mnt_fsname, "rootfs") == 0)
continue;
height += mheight; height += mheight;
break; break;
default: default:
@@ -354,6 +354,11 @@ void CDBoxInfoWidget::paint()
char c=' '; char c=' ';
while ((mnt = getmntent(mountFile)) != 0) { while ((mnt = getmntent(mountFile)) != 0) {
if (::statfs(mnt->mnt_dir, &s) == 0) { if (::statfs(mnt->mnt_dir, &s) == 0) {
if (strcmp(mnt->mnt_fsname, "rootfs") == 0) {
strcpy(mnt->mnt_fsname, "memory");
memory_flag = true;
}
switch (s.f_type) switch (s.f_type)
{ {
case (int) 0xEF53: /*EXT2 & EXT3*/ case (int) 0xEF53: /*EXT2 & EXT3*/
@@ -368,11 +373,6 @@ void CDBoxInfoWidget::paint()
c = 'G'; c = 'G';
break; break;
case (int) 0x72b6: /*jffs2*/ case (int) 0x72b6: /*jffs2*/
if (strcmp(mnt->mnt_fsname, "rootfs") == 0){
strcpy(mnt->mnt_fsname,"memory");
memory_flag = true;
}
gb = 1024.0; gb = 1024.0;
c = 'M'; c = 'M';
break; break;
@@ -385,6 +385,8 @@ void CDBoxInfoWidget::paint()
blocks_used = s.f_blocks - s.f_bfree; blocks_used = s.f_blocks - s.f_bfree;
if(memory_flag){ if(memory_flag){
blocks_percent_used = (info.totalram/1024 - info.freeram/1024)*100/(info.totalram/1024); blocks_percent_used = (info.totalram/1024 - info.freeram/1024)*100/(info.totalram/1024);
gb = 1024.0;
c = 'M';
}else }else
blocks_percent_used = (long)(blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5); blocks_percent_used = (long)(blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
//paint mountpoints //paint mountpoints