summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/autodetection.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-11-22 14:29:22 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-11-22 14:29:22 +0000
commitde37ce51edaa09d9394d16fbb43445f9bd11c970 (patch)
treec38aa1081750061d89bbb358f22c6faa81eb97b2 /rbutil/rbutilqt/base/autodetection.cpp
parent6b06648239a8ef24623d4f27124ce738e27797fc (diff)
downloadrockbox-de37ce51edaa09d9394d16fbb43445f9bd11c970.tar.gz
rockbox-de37ce51edaa09d9394d16fbb43445f9bd11c970.tar.bz2
rockbox-de37ce51edaa09d9394d16fbb43445f9bd11c970.zip
OS X uses msdos as filesystem for vfat which is the same OpenBSD does. Fixes mountpoint resolving.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23701 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/autodetection.cpp')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp41
1 files changed, 11 insertions, 30 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 0526d8d9c9..332a16017f 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -265,6 +265,7 @@ QString Autodetection::resolveMountPoint(QString device)
if(QString(ent->mnt_fsname).startsWith(device)
&& QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)) {
endmntent(mn);
+ qDebug() << "[Autodetect] resolved mountpoint is:" << mntinf->nmt_dir;
return QString(ent->mnt_dir);
}
}
@@ -272,28 +273,17 @@ QString Autodetection::resolveMountPoint(QString device)
#endif
-#if defined(Q_OS_MACX)
- int num;
- struct statfs *mntinf;
-
- num = getmntinfo(&mntinf, MNT_WAIT);
- while(num--) {
- if(QString(mntinf->f_mntfromname).startsWith(device)
- && QString(mntinf->f_fstypename).contains("vfat", Qt::CaseInsensitive))
- return QString(mntinf->f_mntonname);
- mntinf++;
- }
-#endif
-
-#if defined(Q_OS_OPENBSD)
+#if defined(Q_OS_MACX) || defined(Q_OS_OPENBSD)
int num;
struct statfs *mntinf;
num = getmntinfo(&mntinf, MNT_WAIT);
while(num--) {
if(QString(mntinf->f_mntfromname).startsWith(device)
- && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive))
+ && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)) {
+ qDebug() << "[Autodetect] resolved mountpoint is:" << mntinf->f_mntonname;
return QString(mntinf->f_mntonname);
+ }
mntinf++;
}
#endif
@@ -334,6 +324,7 @@ QString Autodetection::resolveDevicename(QString path)
if(QString(ent->mnt_dir).startsWith(path)
&& QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)) {
endmntent(mn);
+ qDebug() << "[Autodetect] device name is" << ent->mnt_fsname;
return QString(ent->mnt_fsname);
}
}
@@ -341,31 +332,21 @@ QString Autodetection::resolveDevicename(QString path)
#endif
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_MACX) || defined(Q_OS_OPENBSD)
int num;
struct statfs *mntinf;
num = getmntinfo(&mntinf, MNT_WAIT);
while(num--) {
if(QString(mntinf->f_mntonname).startsWith(path)
- && QString(mntinf->f_fstypename).contains("vfat", Qt::CaseInsensitive))
+ && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)) {
+ qDebug() << "[Autodetect] device name is" << mntinf->f_mntfromname;
return QString(mntinf->f_mntfromname);
+ }
mntinf++;
}
#endif
-#if defined(Q_OS_OPENBSD)
- int num;
- struct statfs *mntinf;
-
- num = getmntinfo(&mntinf, MNT_WAIT);
- while(num--) {
- if(QString(mntinf->f_mntonname).startsWith(device)
- && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive))
- return QString(mntinf->f_mntfromname);
- mntinf++;
- }
-#endif
#if defined(Q_OS_WIN32)
DWORD written;
HANDLE h;
@@ -387,7 +368,7 @@ QString Autodetection::resolveDevicename(QString path)
qDebug() << "[Autodetect] resolving device name: volume spans multiple disks!";
return "";
}
- //qDebug() << "Disk:" << extents->Extents[0].DiskNumber;
+ qDebug() << "[Autodetect] device name is" << extents->Extents[0].DiskNumber;
return QString("%1").arg(extents->Extents[0].DiskNumber);
}
#endif