author | kergoth <kergoth> | 2003-03-28 07:50:40 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-03-28 07:50:40 (UTC) |
commit | 5088d775fe68ac0dd1b6b9923ab66d30ce1d848a (patch) (unidiff) | |
tree | b1c0a0330395bc1136715ad2b92dd5330379cba8 | |
parent | 827e06044df4df235912156c730baa3c87717526 (diff) | |
download | opie-5088d775fe68ac0dd1b6b9923ab66d30ce1d848a.zip opie-5088d775fe68ac0dd1b6b9923ab66d30ce1d848a.tar.gz opie-5088d775fe68ac0dd1b6b9923ab66d30ce1d848a.tar.bz2 |
Ensure StorageInfo picks up /dev/root
-rw-r--r-- | library/storage.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/storage.cpp b/library/storage.cpp index 912b22d..f4c1c02 100644 --- a/library/storage.cpp +++ b/library/storage.cpp | |||
@@ -98,33 +98,33 @@ void StorageInfo::update() | |||
98 | //qDebug("StorageInfo::updating"); | 98 | //qDebug("StorageInfo::updating"); |
99 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 99 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
100 | struct mntent *me; | 100 | struct mntent *me; |
101 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); | 101 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); |
102 | 102 | ||
103 | QStringList curdisks; | 103 | QStringList curdisks; |
104 | QStringList curopts; | 104 | QStringList curopts; |
105 | QStringList curfs; | 105 | QStringList curfs; |
106 | bool rebuild = FALSE; | 106 | bool rebuild = FALSE; |
107 | int n=0; | 107 | int n=0; |
108 | if ( mntfp ) { | 108 | if ( mntfp ) { |
109 | while ( (me = getmntent( mntfp )) != 0 ) { | 109 | while ( (me = getmntent( mntfp )) != 0 ) { |
110 | QString fs = me->mnt_fsname; | 110 | QString fs = me->mnt_fsname; |
111 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" | 111 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" |
112 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" | 112 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" |
113 | || fs.left( 14 ) == "/dev/mmc/part1" | 113 | || fs.left( 14 ) == "/dev/mmc/part1" |
114 | || fs.left(5)=="tmpfs" ) | 114 | || fs.left(5)=="tmpfs" || fs.left(9)=="/dev/root" ) |
115 | { | 115 | { |
116 | n++; | 116 | n++; |
117 | curdisks.append(fs); | 117 | curdisks.append(fs); |
118 | curopts.append( me->mnt_opts ); | 118 | curopts.append( me->mnt_opts ); |
119 | //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); | 119 | //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); |
120 | curfs.append( me->mnt_dir ); | 120 | curfs.append( me->mnt_dir ); |
121 | bool found = FALSE; | 121 | bool found = FALSE; |
122 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { | 122 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { |
123 | if ( (*i)->disk() == fs ) { | 123 | if ( (*i)->disk() == fs ) { |
124 | found = TRUE; | 124 | found = TRUE; |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | if ( !found ) | 128 | if ( !found ) |
129 | rebuild = TRUE; | 129 | rebuild = TRUE; |
130 | } | 130 | } |
@@ -152,32 +152,34 @@ void StorageInfo::update() | |||
152 | removable = TRUE; | 152 | removable = TRUE; |
153 | } else if ( disk.left( 14 ) == "/dev/mmc/part1" ) { | 153 | } else if ( disk.left( 14 ) == "/dev/mmc/part1" ) { |
154 | humanname = tr("MMC Card"); | 154 | humanname = tr("MMC Card"); |
155 | removable = TRUE; | 155 | removable = TRUE; |
156 | } else if ( disk.left(7) == "/dev/hd" ) | 156 | } else if ( disk.left(7) == "/dev/hd" ) |
157 | humanname = tr("Hard Disk") + " " + disk; | 157 | humanname = tr("Hard Disk") + " " + disk; |
158 | else if ( disk.left(7) == "/dev/sd" ) | 158 | else if ( disk.left(7) == "/dev/sd" ) |
159 | humanname = tr("SCSI Hard Disk") + " " + disk; | 159 | humanname = tr("SCSI Hard Disk") + " " + disk; |
160 | else if ( disk.left(14) == "/dev/mtdblock6" ) //openzaurus ramfs | 160 | else if ( disk.left(14) == "/dev/mtdblock6" ) //openzaurus ramfs |
161 | humanname = tr("Internal Memory"); | 161 | humanname = tr("Internal Memory"); |
162 | else if ( disk == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) | 162 | else if ( disk == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) |
163 | humanname = tr("Internal Storage"); | 163 | humanname = tr("Internal Storage"); |
164 | else if ( disk.left(14) == "/dev/mtdblock/" ) | 164 | else if ( disk.left(14) == "/dev/mtdblock/" ) |
165 | humanname = tr("Internal Storage") + " " + disk; | 165 | humanname = tr("Internal Storage") + " " + disk; |
166 | else if ( disk.left(13) == "/dev/mtdblock" ) | 166 | else if ( disk.left(13) == "/dev/mtdblock" ) |
167 | humanname = tr("Internal Storage") + " " + disk; | 167 | humanname = tr("Internal Storage") + " " + disk; |
168 | else if ( disk.left(9) == "/dev/root" ) | ||
169 | humanname = tr("Internal Storage") + " " + disk; | ||
168 | else if ( disk.left(5) == "tmpfs" ) //ipaqs /mnt/ramfs | 170 | else if ( disk.left(5) == "tmpfs" ) //ipaqs /mnt/ramfs |
169 | humanname = tr("Internal Memory"); | 171 | humanname = tr("Internal Memory"); |
170 | FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts ); | 172 | FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts ); |
171 | mFileSystems.append( fs ); | 173 | mFileSystems.append( fs ); |
172 | } | 174 | } |
173 | emit disksChanged(); | 175 | emit disksChanged(); |
174 | } else { | 176 | } else { |
175 | // just update them | 177 | // just update them |
176 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) | 178 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) |
177 | i.current()->update(); | 179 | i.current()->update(); |
178 | } | 180 | } |
179 | #endif | 181 | #endif |
180 | } | 182 | } |
181 | 183 | ||
182 | bool deviceTab( const char *device) { | 184 | bool deviceTab( const char *device) { |
183 | QString name = device; | 185 | QString name = device; |