Changeset View
Changeset View
Standalone View
Standalone View
src/fs/filesystem.cpp
Show First 20 Lines • Show All 549 Lines • ▼ Show 20 Line(s) | 548 | ExternalCommand umountCmd( report, | |||
---|---|---|---|---|---|
550 | { QStringLiteral("--verbose"), | 550 | { QStringLiteral("--verbose"), | ||
551 | QStringLiteral("--all-targets"), | 551 | QStringLiteral("--all-targets"), | ||
552 | deviceNode }); | 552 | deviceNode }); | ||
553 | if ( umountCmd.run() && umountCmd.exitCode() == 0 ) | 553 | if ( umountCmd.run() && umountCmd.exitCode() == 0 ) | ||
554 | return true; | 554 | return true; | ||
555 | return false; | 555 | return false; | ||
556 | } | 556 | } | ||
557 | 557 | | |||
558 | bool FileSystem::isReadOnly() const | ||||
anthonyfieroni: Make the function with one parameter, found it in mount volumes then `return volume.isValid()… | |||||
559 | { | ||||
560 | for (const QStorageInfo& volume : QStorageInfo::mountedVolumes()) { | ||||
561 | if (!volume.isValid() || !volume.isReady()) { | ||||
562 | return false; | ||||
563 | } else { | ||||
564 | return volume.isReadOnly(); | ||||
I think the code does not yet do the correct thing. In this part of code you scan all volumes on the system. If there is any volume which is mounted read-only, then this isReadOnly function will return true for all filesystems, so you won't be able to resize any file system. What we wnat to look over is mount points for given volume, not all mount points on the system. stikonas: I think the code does not yet do the correct thing. In this part of code you scan all volumes… | |||||
565 | } | ||||
566 | } | ||||
567 | | ||||
568 | return true; | ||||
569 | } | ||||
570 | | ||||
558 | qint64 FileSystem::firstSector() const | 571 | qint64 FileSystem::firstSector() const | ||
559 | { | 572 | { | ||
560 | return d->m_FirstSector; | 573 | return d->m_FirstSector; | ||
561 | } | 574 | } | ||
562 | 575 | | |||
563 | qint64 FileSystem::lastSector() const | 576 | qint64 FileSystem::lastSector() const | ||
564 | { | 577 | { | ||
565 | return d->m_LastSector; | 578 | return d->m_LastSector; | ||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |
Make the function with one parameter, found it in mount volumes then return volume.isValid() && volume.isReady() && !volume.isReadOnly()