diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-06-20 17:53:42 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2016-09-03 06:41:33 +0000 |
commit | 590ca436032cb828fc882fde9c0e99e0f450a061 (patch) | |
tree | 57deac0f3a730ca71b211f3b30405cfa661da99b /tests/manual | |
parent | 6cabb18bc2c983fc7013273841739a3490b55f55 (diff) |
QStorageInfo: Add support for obtaining subvolume names
[ChangeLog][QtCore][QStorageInfo] Added QStorageInfo::subvolume(), which
returns the name of the subvolume of a volume that was mounted, if one
was detected. This is currently implemented only for btrfs on Linux.
Change-Id: Ib57b52598e2f452985e9fffd1459f3145d733ce5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/qstorageinfo/printvolumes.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/manual/qstorageinfo/printvolumes.cpp b/tests/manual/qstorageinfo/printvolumes.cpp index 1b1660b433..31047c2fcd 100644 --- a/tests/manual/qstorageinfo/printvolumes.cpp +++ b/tests/manual/qstorageinfo/printvolumes.cpp @@ -48,11 +48,15 @@ void printVolumes(const QList<QStorageInfo> &volumes, int (*printer)(const char if (info.fileSystemType() != fsAndType) fsAndType += " (" + info.fileSystemType() + ')'; - printf("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W'); + printer("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W'); if (fsAndType.size() > 19) - printf("\n%23s", ""); + printer("\n%23s", ""); - printf("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize()); - printf("%-16s %s\n", qPrintable(info.name()), qPrintable(info.rootPath())); + printer("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize()); + if (!info.subvolume().isEmpty()) + printer("subvol=%-18s ", qPrintable(info.subvolume())); + else + printer("%-25s ", qPrintable(info.name())); + printer("%s\n", qPrintable(info.rootPath())); } } |