author | llornkcor <llornkcor> | 2002-05-04 14:13:06 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-04 14:13:06 (UTC) |
commit | 4fe6b62e42697c68cd54ac3954ffc536e6f2c0f7 (patch) (unidiff) | |
tree | 861d1cda54cb859ad88c160f12a933ae97c701d1 | |
parent | 27f8629d4e6e16e9a33410ffe650f4a6d0bb17be (diff) | |
download | opie-4fe6b62e42697c68cd54ac3954ffc536e6f2c0f7.zip opie-4fe6b62e42697c68cd54ac3954ffc536e6f2c0f7.tar.gz opie-4fe6b62e42697c68cd54ac3954ffc536e6f2c0f7.tar.bz2 |
hacked some changes for openzaurus, root fs should work, /mnt/ram shows something, but I dont know if its correct. At least it shows more than it did
-rw-r--r-- | noncore/settings/sysinfo/storage.cpp | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp index 4e81170..0a07a3b 100644 --- a/noncore/settings/sysinfo/storage.cpp +++ b/noncore/settings/sysinfo/storage.cpp | |||
@@ -18,5 +18,5 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | // additions copyright 2002 by L.J. Potter | |
21 | #include <qlabel.h> | 21 | #include <qlabel.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
@@ -58,6 +58,5 @@ static bool isCF(const QString& m) | |||
58 | while ( fgets( line, 1024, f ) ) { | 58 | while ( fgets( line, 1024, f ) ) { |
59 | // 0 ide ide-cs 0 hda 3 0 | 59 | // 0 ide ide-cs 0 hda 3 0 |
60 | if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) | 60 | if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) { |
61 | { | ||
62 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) { | 61 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) { |
63 | fclose(f); | 62 | fclose(f); |
@@ -78,4 +77,6 @@ void StorageInfo::updateMounts() | |||
78 | QStringList curdisks; | 77 | QStringList curdisks; |
79 | QStringList curfs; | 78 | QStringList curfs; |
79 | QStringList mountList; | ||
80 | QStringList fsT; | ||
80 | bool rebuild = FALSE; | 81 | bool rebuild = FALSE; |
81 | int n=0; | 82 | int n=0; |
@@ -84,10 +85,14 @@ void StorageInfo::updateMounts() | |||
84 | QString fs = me->mnt_fsname; | 85 | QString fs = me->mnt_fsname; |
85 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" | 86 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" |
86 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" ) | 87 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" |
87 | { | 88 | || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs") { |
88 | n++; | 89 | n++; |
89 | curdisks.append(fs); | 90 | curdisks.append(fs); |
90 | QString d = me->mnt_dir; | 91 | QString d = me->mnt_dir; |
91 | curfs.append(d); | 92 | curfs.append(d); |
93 | QString mount = me->mnt_dir; | ||
94 | mountList.append(mount); | ||
95 | QString t = me->mnt_type; | ||
96 | fsT.append(t); | ||
92 | if ( !disks.find(d) ) | 97 | if ( !disks.find(d) ) |
93 | rebuild = TRUE; | 98 | rebuild = TRUE; |
@@ -104,4 +109,7 @@ void StorageInfo::updateMounts() | |||
104 | QStringList::ConstIterator it=curdisks.begin(); | 109 | QStringList::ConstIterator it=curdisks.begin(); |
105 | QStringList::ConstIterator fsit=curfs.begin(); | 110 | QStringList::ConstIterator fsit=curfs.begin(); |
111 | QStringList::ConstIterator fsmount=mountList.begin(); | ||
112 | QStringList::ConstIterator fsTit=fsT.begin(); | ||
113 | |||
106 | for (; it!=curdisks.end(); ++it, ++fsit) { | 114 | for (; it!=curdisks.end(); ++it, ++fsit) { |
107 | if ( !frst ) { | 115 | if ( !frst ) { |
@@ -114,19 +122,21 @@ void StorageInfo::updateMounts() | |||
114 | QString humanname=*it; | 122 | QString humanname=*it; |
115 | if ( isCF(humanname) ) | 123 | if ( isCF(humanname) ) |
116 | humanname = tr("CF Card"); | 124 | humanname = tr("CF Card: "+*fsmount+" "+*fsTit+" "); |
117 | else if ( humanname == "/dev/hda1" ) | 125 | else if ( humanname == "/dev/hda1" ) |
118 | humanname = tr("Hard Disk"); | 126 | humanname = tr("Hard Disk "+*fsmount+" "+*fsTit+" "); |
119 | else if ( humanname.left(9) == "/dev/mmcd" ) | 127 | else if ( humanname.left(9) == "/dev/mmcd" ) |
120 | humanname = tr("SD Card"); | 128 | humanname = tr("SD Card "+*fsmount+" "+*fsTit+" "); |
121 | else if ( humanname.left(7) == "/dev/hd" ) | 129 | else if ( humanname.left(7) == "/dev/hd" ) |
122 | humanname = tr("Hard Disk") + " " + humanname.mid(7); | 130 | humanname = tr("Hard Disk") + " " + humanname.mid(7)+" "+*fsmount+" "+*fsTit+" "; |
123 | else if ( humanname.left(7) == "/dev/sd" ) | 131 | else if ( humanname.left(7) == "/dev/sd" ) |
124 | humanname = tr("SCSI Hard Disk") + " " + humanname.mid(7); | 132 | humanname = tr("SCSI Hard Disk") + " " + humanname.mid(7)+" "+*fsmount+" "+*fsTit+" "; |
125 | else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) | 133 | else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) |
126 | humanname = tr("Internal Storage"); | 134 | humanname = tr("Internal Storage "+*fsmount+" "+*fsTit+"\n"); |
127 | else if ( humanname.left(14) == "/dev/mtdblock/" ) | 135 | else if ( humanname.left(14) == "/dev/mtdblock/" ) |
128 | humanname = tr("Internal Storage") + " " + humanname.mid(14); | 136 | humanname = tr("Internal Storage") + " " + humanname.mid(14)+" "+*fsmount+" "+*fsTit+" "; |
129 | else if ( humanname.left(13) == "/dev/mtdblock" ) | 137 | else if ( humanname.left(13) == "/dev/mtdblock" ) |
130 | humanname = tr("Internal Storage") + " " + humanname.mid(13); | 138 | humanname = tr("Internal Storage") + " " + humanname.mid(13)+" "+*fsmount+" "+*fsTit+" "; |
139 | else if ( humanname.left(9) == "/dev/root" ) | ||
140 | humanname = tr("Internal Storage "+*fsmount+" "+*fsTit+" "); | ||
131 | // etc. | 141 | // etc. |
132 | MountInfo* mi = new MountInfo( *fsit, humanname, this ); | 142 | MountInfo* mi = new MountInfo( *fsit, humanname, this ); |
@@ -134,4 +144,5 @@ void StorageInfo::updateMounts() | |||
134 | disks.insert(*fsit,mi); | 144 | disks.insert(*fsit,mi); |
135 | mi->show(); | 145 | mi->show(); |
146 | fsmount++;fsTit++; | ||
136 | } | 147 | } |
137 | vb->addStretch(); | 148 | vb->addStretch(); |
@@ -148,4 +159,5 @@ MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, | |||
148 | : QWidget( parent, name ), title(ttl) | 159 | : QWidget( parent, name ), title(ttl) |
149 | { | 160 | { |
161 | qDebug("new path is "+path); | ||
150 | fs = new FileSystem( path ); | 162 | fs = new FileSystem( path ); |
151 | QVBoxLayout *vb = new QVBoxLayout( this, 3 ); | 163 | QVBoxLayout *vb = new QVBoxLayout( this, 3 ); |
@@ -185,5 +197,5 @@ void MountInfo::updateData() | |||
185 | long avail = fs->availBlocks() * mult / div; | 197 | long avail = fs->availBlocks() * mult / div; |
186 | long used = total - avail; | 198 | long used = total - avail; |
187 | totalSize->setText( title + tr(" total: %1 kB").arg( total ) ); | 199 | totalSize->setText( title + tr("Total: %1 kB").arg( total ) ); |
188 | data->clear(); | 200 | data->clear(); |
189 | data->addItem( tr("Used (%1 kB)").arg(used), used ); | 201 | data->addItem( tr("Used (%1 kB)").arg(used), used ); |
@@ -208,7 +220,13 @@ void FileSystem::update() | |||
208 | struct statfs fs; | 220 | struct statfs fs; |
209 | if ( !statfs( fspath.latin1(), &fs ) ) { | 221 | if ( !statfs( fspath.latin1(), &fs ) ) { |
222 | if( fspath.left(8) == "/mnt/ram") { //ugly hack openzaurus | ||
223 | blkSize = fs.f_bsize; | ||
224 | totalBlks = fs.f_blocks; | ||
225 | availBlks = fs.f_ffree; | ||
226 | } else { | ||
210 | blkSize = fs.f_bsize; | 227 | blkSize = fs.f_bsize; |
211 | totalBlks = fs.f_blocks; | 228 | totalBlks = fs.f_blocks; |
212 | availBlks = fs.f_bavail; | 229 | availBlks = fs.f_bavail; |
230 | } | ||
213 | } else { | 231 | } else { |
214 | blkSize = 0; | 232 | blkSize = 0; |