diff --git a/CMakeLists.txt b/CMakeLists.txt index ca374a4cbc84bb14d138d3dfafbd3fb23e110caa..f1bb1a59b3b00303a1335b8a22e043706dcfd5fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,8 +130,7 @@ set_package_properties(ACL PROPERTIES DESCRIPTION "LibACL" # Used by KMountPoint if (CMAKE_SYSTEM_NAME MATCHES "Linux") find_package(LibMount REQUIRED) - find_package(Blkid REQUIRED) - set(HAVE_LIBS_MOUNT_AND_BLKID ${LibMount_FOUND} AND ${Blkid_FOUND}) + set(HAVE_LIB_MOUNT ${LibMount_FOUND}) endif() if (ANDROID) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index be19e9b623e5ae4b331b2a23f94317807e3df4b9..67a1b1cf72623088f3f1470bf89fe16a705f7ffc 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -236,9 +236,8 @@ if(ACL_FOUND) target_link_libraries(KF5KIOCore PRIVATE ${ACL_LIBS}) endif() -if(HAVE_LIBS_MOUNT_AND_BLKID) - # libmount links against blkid anyway - target_link_libraries(KF5KIOCore PRIVATE LibMount::LibMount Blkid::Blkid) +if(HAVE_LIB_MOUNT) + target_link_libraries(KF5KIOCore PRIVATE LibMount::LibMount) endif() # this should be done by cmake, see bug 371721 diff --git a/src/core/config-kmountpoint.h.cmake b/src/core/config-kmountpoint.h.cmake index f824d40426a650ad2054c50bbed7121804a84989..3673eb14181998772f7a85d237aa1f134ed2e913 100644 --- a/src/core/config-kmountpoint.h.cmake +++ b/src/core/config-kmountpoint.h.cmake @@ -1,7 +1,7 @@ #cmakedefine01 HAVE_GETMNTINFO #cmakedefine01 GETMNTINFO_USES_STATVFS -#cmakedefine01 HAVE_LIBS_MOUNT_AND_BLKID +#cmakedefine01 HAVE_LIB_MOUNT #cmakedefine01 HAVE_SYS_MOUNT_H #cmakedefine01 HAVE_FSTAB_H diff --git a/src/core/kmountpoint.cpp b/src/core/kmountpoint.cpp index e2d32055c669033711b5bd841a6cbd48275ac6cf..f41cff5ee41ee95426c46a64387f0ee34367a79f 100644 --- a/src/core/kmountpoint.cpp +++ b/src/core/kmountpoint.cpp @@ -44,7 +44,7 @@ static const Qt::CaseSensitivity cs = Qt::CaseSensitive; #endif // Linux -#if HAVE_LIBS_MOUNT_AND_BLKID +#if HAVE_LIB_MOUNT #include #include #endif @@ -176,7 +176,7 @@ KMountPoint::List KMountPoint::possibleMountPoints(DetailsNeededFlags infoNeeded #ifdef Q_OS_WIN result = KMountPoint::currentMountPoints(infoNeeded); -#elif HAVE_LIBS_MOUNT_AND_BLKID +#elif HAVE_LIB_MOUNT if (struct libmnt_table *table = mnt_new_table()) { // By default parses "/etc/fstab" if (mnt_table_parse_fstab(table, nullptr) == 0) { @@ -202,23 +202,13 @@ KMountPoint::List KMountPoint::possibleMountPoints(DetailsNeededFlags infoNeeded // or some network mount if (const char *source = mnt_fs_get_source(fs)) { mp->d->m_mountedFrom = QFile::decodeName(source); - if (mp->d->m_mountedFrom.startsWith(QLatin1String("UUID")) || mp->d->m_mountedFrom.startsWith(QLatin1String("LABEL"))) { - // Use blkid to resolve UUID/LABEL to the device file - if (char *blkSource = blkid_evaluate_spec(source, nullptr)) { - mp->d->m_mountedFrom = QFile::decodeName(blkSource); - free(blkSource); - if ((infoNeeded & KMountPoint::NeedRealDeviceName) // - && mp->d->m_mountedFrom.startsWith(QLatin1String("/dev/"))) { - mp->d->m_device = mp->d->m_mountedFrom; - } - } - } } if (infoNeeded & NeedMountOptions) { mp->d->m_mountOptions = QFile::decodeName(mnt_fs_get_options(fs)).split(QLatin1Char(',')); } + mp->d->finalizePossibleMountPoint(infoNeeded); result.append(mp); } mnt_free_iter(itr); @@ -351,7 +341,7 @@ KMountPoint::List KMountPoint::currentMountPoints(DetailsNeededFlags infoNeeded) } } -#elif HAVE_LIBS_MOUNT_AND_BLKID +#elif HAVE_LIB_MOUNT if (struct libmnt_table *table = mnt_new_table()) { // By default, parses "/proc/self/mountinfo" if (mnt_table_parse_mtab(table, nullptr) == 0) {