Changeset 83a03aaae in mythtv


Ignore:
Timestamp:
Jan 27, 2012, 1:53:42 AM (13 years ago)
Author:
Raymond Wagner <rwagner@…>
Branches:
devel/2020-player, devel/ffmpeg-resync, devel/gpu-commflag, fixes/0.25, fixes/0.26, fixes/0.27, fixes/0.28, fixes/29, fixes/30, fixes/31, github-templates, master
Children:
6d4508255a
Parents:
f2d222c123
Message:

size_t type corrections within the scope of the autoexpirer

This standardizes several uses of size_t and long long to int64_t, for
the purposes of resolving a casting issue that occurs in the
autoexpiration code on 32-bit systems.

This bumps the library ABI version.

Location:
mythtv
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • mythtv/libs/libmythbase/filesysteminfo.cpp

    rf2d222c123 r83a03aaae  
    5959
    6060FileSystemInfo::FileSystemInfo(QString hostname, QString path, bool local,
    61         int fsid, int groupid, int blksize, long long total, long long used) :
     61        int fsid, int groupid, int blksize, int64_t total, int64_t used) :
    6262    m_hostname(hostname), m_path(path), m_local(local), m_fsid(fsid),
    6363    m_grpid(groupid), m_blksize(blksize), m_total(total), m_used(used)
     
    173173
    174174void FileSystemInfo::Consolidate(QList<FileSystemInfo> &disks,
    175                                  bool merge, size_t fuzz)
     175                                 bool merge, int64_t fuzz)
    176176{
    177177    int newid = 0;
     
    195195            int bSize = max(32, max(it1->getBlockSize(), it2->getBlockSize())
    196196                                        / 1024);
    197             long long diffSize = it1->getTotalSpace() - it2->getTotalSpace();
    198             long long diffUsed = it1->getUsedSpace() - it2->getUsedSpace();
     197            int64_t diffSize = it1->getTotalSpace() - it2->getTotalSpace();
     198            int64_t diffUsed = it1->getUsedSpace() - it2->getUsedSpace();
    199199
    200200            if (diffSize < 0)
     
    203203                diffUsed = 0 - diffUsed;
    204204
    205             if ((diffSize <= bSize) && ((size_t)diffUsed <= fuzz))
     205            if ((diffSize <= bSize) && (diffUsed <= fuzz))
    206206            {
    207207                it2->setFSysID(it1->getFSysID());
     
    225225void FileSystemInfo::PopulateDiskSpace(void)
    226226{
    227     long long total = -1, used = -1;
     227    int64_t total = -1, used = -1;
    228228    getDiskSpace(getPath().toAscii().constData(), total, used);
    229229    setTotalSpace(total);
  • mythtv/libs/libmythbase/filesysteminfo.h

    rf2d222c123 r83a03aaae  
    2020    FileSystemInfo(const FileSystemInfo &other);
    2121    FileSystemInfo(QString hostname, QString path, bool local, int fsid,
    22              int groupid, int blksize, long long total, long long used);
     22             int groupid, int blksize, int64_t total, int64_t used);
    2323    FileSystemInfo(QStringList::const_iterator &it,
    2424            QStringList::const_iterator end);
     
    3838    int         getGroupID(void)      const { return m_grpid; }
    3939    int         getBlockSize(void)    const { return m_blksize; }
    40     long long   getTotalSpace(void)   const { return m_total; }
    41     long long   getUsedSpace(void)    const { return m_used; }
     40    int64_t     getTotalSpace(void)   const { return m_total; }
     41    int64_t     getUsedSpace(void)    const { return m_used; }
    4242    int         getWeight(void)       const { return m_weight; }
    4343
    44     long long   getFreeSpace(void)    const { return m_total-m_used; }
     44    // reserved space could potentially result in this being negative
     45    int64_t     getFreeSpace(void)    const { return m_total-m_used; }
    4546
    4647    // information puts
     
    5152    void setGroupID(int id)                 { m_grpid = id; }
    5253    void setBlockSize(int size)             { m_blksize = size; }
    53     void setTotalSpace(long long size)      { m_total = size; }
    54     void setUsedSpace(long long size)       { m_used = size; }
     54    void setTotalSpace(int64_t size)        { m_total = size; }
     55    void setUsedSpace(int64_t size)         { m_used = size; }
    5556    void setWeight(int weight)              { m_weight = weight; }
    5657
     
    5960    static const QList<FileSystemInfo> RemoteGetInfo(MythSocket *sock=NULL);
    6061    static void Consolidate(QList<FileSystemInfo> &disks, bool merge=true,
    61                             size_t fuzz=14000);
     62                            int64_t fuzz=14000);
    6263    void PopulateDiskSpace(void);
    6364    void PopulateFSProp(void);
     
    7475    int m_grpid;
    7576    int m_blksize;
    76     long long m_total;
    77     long long m_used;
     77    int64_t m_total;
     78    int64_t m_used;
    7879    int m_weight;
    7980};
  • mythtv/libs/libmythbase/mythcoreutil.cpp

    rf2d222c123 r83a03aaae  
    3737 *  \param file_on_disk file on the file system we wish to stat.
    3838 */
    39 long long getDiskSpace(const QString &file_on_disk,
    40                        long long &total, long long &used)
     39int64_t getDiskSpace(const QString &file_on_disk,
     40                     int64_t &total, int64_t &used)
    4141{
    4242    struct statfs statbuf;
    4343    memset(&statbuf, 0, sizeof(statbuf));
    44     long long freespace = -1;
     44    int64_t freespace = -1;
    4545    QByteArray cstr = file_on_disk.toLocal8Bit();
    4646
  • mythtv/libs/libmythbase/mythcoreutil.h

    rf2d222c123 r83a03aaae  
    66#include "mythbaseexp.h"
    77
    8  MBASE_PUBLIC  long long getDiskSpace(const QString&,long long&,long long&);
     8 MBASE_PUBLIC  int64_t getDiskSpace(const QString&,int64_t&,int64_t&);
    99
    1010 MBASE_PUBLIC  bool extractZIP(const QString &zipFile, const QString &outDir);
  • mythtv/libs/libmythbase/mythversion.h

    rf2d222c123 r83a03aaae  
    1313/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
    1414/// libmythui class methods used by plug-ins.
    15 #define MYTH_BINARY_VERSION "0.25.20120123-2"
     15#define MYTH_BINARY_VERSION "0.25.20120126-1"
    1616
    1717/** \brief Increment this whenever the MythTV network protocol changes.
  • mythtv/libs/libmythbase/storagegroup.cpp

    rf2d222c123 r83a03aaae  
    656656{
    657657    QString nextDir;
    658     long long nextDirFree = 0;
    659     long long thisDirTotal;
    660     long long thisDirUsed;
    661     long long thisDirFree;
     658    int64_t nextDirFree = 0;
     659    int64_t thisDirTotal;
     660    int64_t thisDirUsed;
     661    int64_t thisDirFree;
    662662
    663663    LOG(VB_FILE, LOG_DEBUG, LOC + QString("FindNextDirMostFree: Starting"));
  • mythtv/libs/libmythbase/util.cpp

    rf2d222c123 r83a03aaae  
    733733    // swap it is using, and the dynamic_pager daemon doesn't even seem to be
    734734    // able to report what filesystem it is using for the swapfiles. So, we do:
    735     long long total, used, free;
     735    int64_t total, used, free;
    736736    free = getDiskSpace("/private/var/vm", total, used);
    737     totalVM = (int)(total/1024LL);
    738     freeVM = (int)(free/1024LL);
     737    totalVM = (int)(total >> 10);
     738    freeVM = (int)(free >> 10);
    739739
    740740#else
  • mythtv/programs/mythbackend/autoexpire.cpp

    rf2d222c123 r83a03aaae  
    135135 */
    136136
    137 size_t AutoExpire::GetDesiredSpace(int fsID) const
     137uint64_t AutoExpire::GetDesiredSpace(int fsID) const
    138138{
    139139    QMutexLocker locker(&instance_lock);
     
    164164    }
    165165
    166     size_t maxKBperMin = 0;
    167     size_t extraKB = gCoreContext->GetNumSetting("AutoExpireExtraSpace", 0) <<
     166    uint64_t maxKBperMin = 0;
     167    uint64_t extraKB = gCoreContext->GetNumSetting("AutoExpireExtraSpace", 0) <<
    168168                     20;
    169169
     
    190190
    191191        fsMap[fsit->getFSysID()] = 0;
    192         size_t thisKBperMin = 0;
     192        uint64_t thisKBperMin = 0;
    193193
    194194        // append unknown recordings to all fsIDs
     
    205205                .arg(fsit->getUsedSpace() / 1024.0 / 1024.0, 7, 'f', 1)
    206206                .arg(fsit->getFreeSpace() / 1024.0 / 1024.0, 7, 'f', 1));
    207 
    208207
    209208            vector<int>::iterator encit =
     
    225224                }
    226225
    227                 long long maxBitrate = enc->GetMaxBitrate();
     226                uint64_t maxBitrate = enc->GetMaxBitrate();
    228227                if (maxBitrate<=0)
    229228                    maxBitrate = 19500000LL;
    230                 thisKBperMin += (((size_t)maxBitrate)*((size_t)15))>>11;
     229                thisKBperMin += (((uint64_t)maxBitrate)*((uint64_t)15))>>11;
    231230                LOG(VB_FILE, LOG_INFO, QString("    Cardid %1: max bitrate "
    232231                        "%2 Kb/sec, fsID %3 max is now %4 KB/min")
     
    491490        }
    492491
    493         if ((size_t)max(0LL, fsit->getFreeSpace()) <
     492        if (max((int64_t)0LL, fsit->getFreeSpace()) <
    494493            desired_space[fsit->getFSysID()])
    495494        {
     
    520519            pginfolist_t::iterator it = expireList.begin();
    521520            while ((it != expireList.end()) &&
    522                    ((size_t)max(0LL, fsit->getFreeSpace()) <
     521                   (max((int64_t)0LL, fsit->getFreeSpace()) <
    523522                    desired_space[fsit->getFSysID()]))
    524523            {
     
    712711                    (found > *maxIter))
    713712                {
    714                     long long spaceFreed = query.value(5).toLongLong() >> 20;
     713                    uint64_t spaceFreed = query.value(5).toLongLong() >> 20;
    715714                    QString msg =
    716715                        QString("%1Expiring %2 MBytes for %3 at %4 => %5.  "
  • mythtv/programs/mythbackend/autoexpire.h

    rf2d222c123 r83a03aaae  
    7373    void PrintExpireList(QString expHost = "ALL");
    7474
    75     size_t GetDesiredSpace(int fsID) const;
     75    uint64_t GetDesiredSpace(int fsID) const;
    7676
    7777    void GetAllExpiring(QStringList &strList);
  • mythtv/programs/mythbackend/mainserver.cpp

    rf2d222c123 r83a03aaae  
    43104310{
    43114311    QString allHostList = gCoreContext->GetHostName();
    4312     long long totalKB = -1, usedKB = -1;
     4312    int64_t totalKB = -1, usedKB = -1;
    43134313    QMap <QString, bool>foundDirs;
    43144314    QString driveKey;
     
    44614461
    44624462    // Consolidate hosts sharing storage
    4463     size_t maxWriteFiveSec = GetCurrentMaxBitrate()/12 /*5 seconds*/;
    4464     maxWriteFiveSec = max((size_t)2048, maxWriteFiveSec); // safety for NFS mounted dirs
     4463    int64_t maxWriteFiveSec = GetCurrentMaxBitrate()/12 /*5 seconds*/;
     4464    maxWriteFiveSec = max((int64_t)2048, maxWriteFiveSec); // safety for NFS mounted dirs
    44654465    QList<FileSystemInfo>::iterator it1, it2;
    44664466    int bSize = 32;
     
    44794479            // or 32, whichever is greater
    44804480            bSize = max(32, max(it1->getBlockSize(), it2->getBlockSize()) / 1024);
    4481             long long diffSize = it1->getTotalSpace() - it2->getTotalSpace();
    4482             long long diffUsed = it1->getUsedSpace() - it2->getUsedSpace();
     4481            int64_t diffSize = it1->getTotalSpace() - it2->getTotalSpace();
     4482            int64_t diffUsed = it1->getUsedSpace() - it2->getUsedSpace();
    44834483            if (diffSize < 0)
    44844484                diffSize = 0 - diffSize;
     
    44874487
    44884488            if (it2->getFSysID() == -1 && (diffSize <= bSize) &&
    4489                 ((size_t)diffUsed <= maxWriteFiveSec))
     4489                (diffUsed <= maxWriteFiveSec))
    44904490            {
    44914491                if (!it1->getHostname().contains(it2->getHostname()))
Note: See TracChangeset for help on using the changeset viewer.