Lines 43-49
Link Here
|
43 |
#endif |
43 |
#endif |
44 |
|
44 |
|
45 |
// Linux |
45 |
// Linux |
46 |
#if HAVE_LIBS_MOUNT_AND_BLKID |
46 |
#if HAVE_LIBS_MOUNT |
47 |
#include <libmount/libmount.h> |
47 |
#include <libmount/libmount.h> |
48 |
#include <blkid/blkid.h> |
48 |
#include <blkid/blkid.h> |
49 |
#endif |
49 |
#endif |
Lines 155-161
Link Here
|
155 |
#ifdef Q_OS_WIN |
155 |
#ifdef Q_OS_WIN |
156 |
result = KMountPoint::currentMountPoints(infoNeeded); |
156 |
result = KMountPoint::currentMountPoints(infoNeeded); |
157 |
|
157 |
|
158 |
#elif HAVE_LIBS_MOUNT_AND_BLKID |
158 |
#elif HAVE_LIBS_MOUNT |
159 |
if (struct libmnt_table *table = mnt_new_table()) { |
159 |
if (struct libmnt_table *table = mnt_new_table()) { |
160 |
// By default parses "/etc/fstab" |
160 |
// By default parses "/etc/fstab" |
161 |
if (mnt_table_parse_fstab(table, nullptr) == 0) { |
161 |
if (mnt_table_parse_fstab(table, nullptr) == 0) { |
Lines 176-198
Link Here
|
176 |
// or some network mount |
176 |
// or some network mount |
177 |
if (const char *source = mnt_fs_get_source(fs)) { |
177 |
if (const char *source = mnt_fs_get_source(fs)) { |
178 |
mp->d->m_mountedFrom = QFile::decodeName(source); |
178 |
mp->d->m_mountedFrom = QFile::decodeName(source); |
179 |
if (mp->d->m_mountedFrom.startsWith(QLatin1String("UUID")) || mp->d->m_mountedFrom.startsWith(QLatin1String("LABEL"))) { |
|
|
180 |
// Use blkid to resolve UUID/LABEL to the device file |
181 |
if (char *blkSource = blkid_evaluate_spec(source, nullptr)) { |
182 |
mp->d->m_mountedFrom = QFile::decodeName(blkSource); |
183 |
free(blkSource); |
184 |
if ((infoNeeded & KMountPoint::NeedRealDeviceName) // |
185 |
&& mp->d->m_mountedFrom.startsWith(QLatin1String("/dev/"))) { |
186 |
mp->d->m_device = mp->d->m_mountedFrom; |
187 |
} |
188 |
} |
189 |
} |
190 |
} |
179 |
} |
191 |
|
180 |
|
192 |
if (infoNeeded & NeedMountOptions) { |
181 |
if (infoNeeded & NeedMountOptions) { |
193 |
mp->d->m_mountOptions = QFile::decodeName(mnt_fs_get_options(fs)).split(QLatin1Char(',')); |
182 |
mp->d->m_mountOptions = QFile::decodeName(mnt_fs_get_options(fs)).split(QLatin1Char(',')); |
194 |
} |
183 |
} |
195 |
|
184 |
|
|
|
185 |
mp->d->finalizePossibleMountPoint(infoNeeded); |
196 |
result.append(mp); |
186 |
result.append(mp); |
197 |
} |
187 |
} |
198 |
mnt_free_iter(itr); |
188 |
mnt_free_iter(itr); |
Lines 319-325
Link Here
|
319 |
} |
309 |
} |
320 |
} |
310 |
} |
321 |
|
311 |
|
322 |
#elif HAVE_LIBS_MOUNT_AND_BLKID |
312 |
#elif HAVE_LIBS_MOUNT |
323 |
if (struct libmnt_table *table = mnt_new_table()) { |
313 |
if (struct libmnt_table *table = mnt_new_table()) { |
324 |
// By default, parses "/proc/self/mountinfo" |
314 |
// By default, parses "/proc/self/mountinfo" |
325 |
if (mnt_table_parse_mtab(table, nullptr) == 0) { |
315 |
if (mnt_table_parse_mtab(table, nullptr) == 0) { |