Ignore:
Timestamp:
Dec 27, 2012, 7:45:01 PM (8 years ago)
Author:
jordan
Message:

(trunk, libT) #3833 'freespace' argument for 'session-get' RPC method -- apply taem's 0003-Cache-download-dir-s-block-device-and-FS-type.patch​ to cache the download dir's block device and FS type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/platform.c

    r13697 r13698  
    889889
    890890static int64_t
    891 tr_getQuotaFreeSpace( const char * path )
     891tr_getQuotaFreeSpace( const char * path, char * device, char * fstype )
    892892{
    893893    int64_t ret=-1;
    894894#ifndef WIN32
    895     char *d, *device;
    896     char *fstype;
    897 
    898     if ((d = getblkdev(path)) == NULL)
    899     {
    900         return ret;
    901     }
    902     /* 'd' points to static area of memory, so copy it */
    903     device = tr_strdup(d);
    904 
    905     fstype = getfstype(device);
    906     if (fstype != NULL && strcasecmp(fstype, "xfs") == 0)
     895    char *d;
     896    char *fs;
     897
     898    if (strlen(device) == 0)
     899    {
     900        if ((d = getblkdev(path)) == NULL)
     901        {
     902            return ret;
     903        }
     904        /* Save device for future use */
     905        tr_strlcpy(device, d, PATH_MAX + 1);
     906    }
     907
     908    if (strlen(fstype) == 0)
     909    {
     910        if ((fs = getfstype(device)) != NULL)
     911        {
     912             /* Save FS type for future use */
     913             tr_strlcpy(fstype, fs, PATH_MAX + 1);
     914        }
     915    }
     916
     917    if (strcasecmp(fstype, "xfs") == 0)
    907918    {
    908919#ifdef HAVE_XQM
     
    913924    }
    914925
    915     tr_free(device);
    916926#endif /* WIN32 */
    917927    return ret;
     
    936946
    937947int64_t
    938 tr_getFreeSpace( const char * path )
    939 {
    940     int64_t i = tr_getQuotaFreeSpace( path );
     948tr_getFreeSpace( const char * path, char * device, char * fstype )
     949{
     950    int64_t i = tr_getQuotaFreeSpace( path, device, fstype );
    941951    if( i < 0 )
    942952        i = tr_getDiskFreeSpace( path );
Note: See TracChangeset for help on using the changeset viewer.