Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rewrite FileSystemInfo #485

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
279dc22
filesysteminfo: eliminate MACROs to improve readability
ulmus-scott Nov 14, 2022
ef0519d
use FileSystemInfo instead of getDiskSpace()
ulmus-scott Nov 14, 2022
725ae15
StorageGroup::FindNextDirMostFree(): C++ modernization
ulmus-scott Jan 25, 2022
bc0aa1e
filesysteminfo: '#include's cleanup
ulmus-scott Jan 26, 2022
f7f8803
filesysteminfo: continue rewrite
ulmus-scott Jan 26, 2022
98e08c8
filesysteminfo: pass by value and std::move
ulmus-scott Jan 26, 2022
ec1b6d3
filesysteminfo.h: spaces and comment
ulmus-scott Jan 26, 2022
437536a
filesysteminfo.h: C++ does not require a void parameter
ulmus-scott Jan 26, 2022
843e5e1
mytharchivehelper/main.cpp: use FileSystemInfo
ulmus-scott Feb 16, 2022
7de1099
mythbackend/playbacksock: add TODOs
ulmus-scott Feb 22, 2022
9097306
create namespace FileSystemInfoManager
ulmus-scott Nov 14, 2022
aab6171
use FileSystemInfo::Consolidate()
ulmus-scott Feb 22, 2022
c08a851
use FileSystemInfoManager::ToStringList()
ulmus-scott Feb 22, 2022
d6a4ceb
use FileSystemInfo::ToStringList()
ulmus-scott Feb 22, 2022
30e637d
mythbackend: finish FileSystemInfoList conversion
ulmus-scott Mar 7, 2022
d1d4d48
mythfrontend: finish FileSystemInfoList conversion
ulmus-scott Mar 7, 2022
0c2e574
filesysteminfo: move Consolidate() into FileSystemInfoManager
ulmus-scott Mar 7, 2022
f83469e
filesysteminfo: rename RemoteGetInfo to FileSystemInfoManager::GetInf…
ulmus-scott Mar 7, 2022
0b35f4d
filesysteminfo: convert FileSystemInfoList to QVector
ulmus-scott Mar 7, 2022
9dfcff8
MainServer::GetFilesystemInfos(): use FileSystemInfoManager::FromStri…
ulmus-scott Mar 7, 2022
7442efd
filesysteminfo.cpp: move functions together
ulmus-scott Mar 8, 2022
9018fa2
bump MYTH_BINARY_VERSION
ulmus-scott Nov 14, 2022
3ccb82e
FileSystemInfo::refresh(): use QStorageInfo
ulmus-scott Jun 18, 2024
18edcf9
FileSystemInfo: remove unused set functions
ulmus-scott Jun 22, 2024
fc93c7d
libmythbase/storagegroup.cpp: reduce scope of variable and eliminate …
ulmus-scott Nov 17, 2024
c1fbbe8
FileServerHandler::HandleQueryFreeSpace(): use FileSystemInfoManager
ulmus-scott Nov 17, 2024
3a95702
move generation of totals into FileSystemInfoManager::Consolidate()
ulmus-scott Nov 17, 2024
b64dbce
use FileServerHandler::QueryFileSystems() in mythbackend/mainserver.cpp
ulmus-scott Nov 17, 2024
f2390bc
make PlaybackSock::GetDiskSpace() return a FileSystemInfoList
ulmus-scott Nov 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/VersionInformation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()
#

# See mythtv/libs/libmythbase/mythversion.h.in
set(MYTHTV_BINARY_CHANGED "20220913-1")
set(MYTHTV_BINARY_CHANGED "20250212-1")
set(MYTHTV_BINARY_VERSION "${PROJECT_VERSION_MAJOR}.${MYTHTV_BINARY_CHANGED}")

# See mythtv/bindings/python/MythTV/static.py.in
Expand Down
1 change: 0 additions & 1 deletion mythplugins/mytharchive/mytharchive/mytharchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

// mythtv
#include <libmythbase/mythcorecontext.h>
#include <libmythbase/mythcoreutil.h>
#include <libmythbase/mythlogging.h>
#include <libmythbase/mythplugin.h>
#include <libmythbase/mythpluginapi.h>
Expand Down
16 changes: 8 additions & 8 deletions mythplugins/mytharchive/mytharchive/selectdestination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <QKeyEvent>

// myth
#include <libmythbase/filesysteminfo.h>
#include <libmythbase/mythcorecontext.h>
#include <libmythbase/mythcoreutil.h>
#include <libmythbase/mythlogging.h>
#include <libmythbase/stringutil.h>
#include <libmythui/mythmainwindow.h>
Expand Down Expand Up @@ -241,9 +241,8 @@ void SelectDestination::setDestination(MythUIButtonListItem* item)
m_doBurnText->Show();
break;
case AD_FILE:
int64_t dummy = 0;
ArchiveDestinations[itemNo].freeSpace =
getDiskSpace(m_filenameEdit->GetText(), dummy, dummy);
FileSystemInfo(QString(), m_filenameEdit->GetText()).getFreeSpace();

m_filenameEdit->Show();
m_findButton->Show();
Expand Down Expand Up @@ -294,12 +293,11 @@ void SelectDestination::fileFinderClosed(const QString& filename)

void SelectDestination::filenameEditLostFocus()
{
int64_t dummy = 0;
m_archiveDestination.freeSpace = getDiskSpace(m_filenameEdit->GetText(), dummy, dummy);
auto fsInfo = FileSystemInfo(QString(), m_filenameEdit->GetText());

// if we don't get a valid freespace value it probably means the file doesn't
// exist yet so try looking up the freespace for the parent directory
if (m_archiveDestination.freeSpace == -1)
if (!fsInfo.refresh())
{
QString dir = m_filenameEdit->GetText();
int pos = dir.lastIndexOf('/');
Expand All @@ -308,16 +306,18 @@ void SelectDestination::filenameEditLostFocus()
else
dir = "/";

m_archiveDestination.freeSpace = getDiskSpace(dir, dummy, dummy);
fsInfo = FileSystemInfo(QString(), dir);
}

if (m_archiveDestination.freeSpace != -1)
if (fsInfo.refresh())
{
m_archiveDestination.freeSpace = fsInfo.getFreeSpace();
m_freespaceText->SetText(StringUtil::formatKBytes(m_archiveDestination.freeSpace, 2));
m_freeSpace = m_archiveDestination.freeSpace;
}
else
{
m_archiveDestination.freeSpace = -1;
m_freespaceText->SetText(tr("Unknown"));
m_freeSpace = 0;
}
Expand Down
25 changes: 2 additions & 23 deletions mythplugins/mytharchive/mytharchivehelper/mytharchivehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@
#include <iostream>
#include <unistd.h>

#include <QtGlobal>
#if defined(Q_OS_DARWIN) or defined(__FreeBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#elif defined(__linux__)
#include <sys/vfs.h>
#endif

// Qt headers
#include <QApplication>
#include <QDir>
Expand All @@ -53,8 +45,8 @@
#include <libmyth/mythavframe.h>
#include <libmyth/mythcontext.h>
#include <libmythbase/exitcodes.h>
#include <libmythbase/filesysteminfo.h>
#include <libmythbase/mythcommandlineparser.h>
#include <libmythbase/mythcoreutil.h>
#include <libmythbase/mythcorecontext.h>
#include <libmythbase/mythdate.h>
#include <libmythbase/mythdb.h>
Expand Down Expand Up @@ -2228,21 +2220,8 @@ static int isRemote(const QString& filename)
if (!QFile::exists(filename))
return 0;

// TODO replace with FileSystemInfo?
#ifdef Q_OS_DARWIN
struct statfs statbuf {};
if ((statfs(qPrintable(filename), &statbuf) == 0) &&
((!strcmp(statbuf.f_fstypename, "nfs")) || // NFS|FTP
(!strcmp(statbuf.f_fstypename, "afpfs")) || // ApplShr
(!strcmp(statbuf.f_fstypename, "smbfs")))) // SMB
return 2;
#elif defined(__linux__)
struct statfs statbuf {};
if ((statfs(qPrintable(filename), &statbuf) == 0) &&
((statbuf.f_type == 0x6969) || // NFS
(statbuf.f_type == 0x517B))) // SMB
if (!FileSystemInfo(QString(), filename).isLocal())
return 2;
#endif

return 1;
}
Expand Down
1 change: 0 additions & 1 deletion mythplugins/mythmusic/mythmusic/streamview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <QThread>

// MythTV
#include <libmythbase/mythcoreutil.h>
#include <libmythbase/mythdb.h>
#include <libmythbase/mythdbcon.h>
#include <libmythbase/mythdirs.h>
Expand Down
1 change: 0 additions & 1 deletion mythplugins/mythnetvision/mythnetvision/netbase.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <QDir>

#include <libmythbase/mythcorecontext.h>
#include <libmythbase/mythcoreutil.h>
#include <libmythbase/mythdate.h>
#include <libmythbase/mythdirs.h>
#include <libmythbase/mythlogging.h>
Expand Down
1 change: 0 additions & 1 deletion mythplugins/mythnetvision/mythnetvision/netsearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <QString>

// MythTV
#include <libmythbase/mythcoreutil.h>
#include <libmythbase/mythdb.h>
#include <libmythbase/mythdbcon.h>
#include <libmythbase/mythdirs.h>
Expand Down
1 change: 0 additions & 1 deletion mythplugins/mythnetvision/mythnetvision/nettree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

// MythTV
#include <libmythbase/mythcorecontext.h>
#include <libmythbase/mythcoreutil.h>
#include <libmythbase/mythdb.h>
#include <libmythbase/mythdirs.h>
#include <libmythbase/mythlogging.h>
Expand Down
2 changes: 1 addition & 1 deletion mythtv/configure
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
MYTHTV_VERSION_MAJMIN="36.0"
MYTHTV_LIBVERSION="36"
# See mythtv/libs/libmythbase/mythversion.h.in
MYTHTV_BINARY_VERSION="36.20220913-1"
MYTHTV_BINARY_VERSION="36.20250212-1"
# See bindings/python/MythTV/static.py.in
MYTHTV_PYTHON_OWN_VERSION="(36,0,-1,0)"
# See python/MythTV/services_api/send.py.in
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythbase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ set(LIBMYTHBASE_HEADERS
mythchrono.h
mythcommandlineparser.h
mythcorecontext.h
mythcoreutil.h
mythdate.h
mythdb.h
mythdbcheck.h
Expand Down Expand Up @@ -195,7 +194,6 @@ add_library(
mythcommandlineparser.cpp
mythconfig.h.in
mythcorecontext.cpp
mythcoreutil.cpp
mythdate.cpp
mythdb.cpp
mythdbcon.cpp
Expand Down
Loading
Loading