Changeset 11603


Ignore:
Timestamp:
Dec 28, 2010, 8:38:55 AM (11 years ago)
Author:
charles
Message:

(trunk libT) more fdlimit futzing

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r11602 r11603  
    7373
    7474static tr_bool
    75 preallocateFileSparse( int fd, uint64_t length )
     75preallocate_file_sparse( int fd, uint64_t length )
    7676{
    7777    const char zero = '\0';
     
    9595
    9696static tr_bool
    97 preallocateFileFull( const char * filename, uint64_t length )
     97preallocate_file_full( const char * filename, uint64_t length )
    9898{
    9999    tr_bool success = 0;
     
    376376
    377377    if( writable && !alreadyExisted && ( allocation == TR_PREALLOCATE_FULL ) )
    378         if( preallocateFileFull( filename, file_size ) )
     378        if( preallocate_file_full( filename, file_size ) )
    379379            tr_dbg( "Preallocated file \"%s\"", filename );
    380380
     
    409409
    410410    if( writable && !alreadyExisted && ( allocation == TR_PREALLOCATE_SPARSE ) )
    411         preallocateFileSparse( o->fd, file_size );
     411        preallocate_file_sparse( o->fd, file_size );
    412412
    413413    /* Many (most?) clients request blocks in ascending order,
     
    426426{
    427427    struct tr_cached_file * begin;
    428     struct tr_cached_file * end;
     428    const struct tr_cached_file * end;
    429429};
    430430
     
    458458    fileset_close_all( set );
    459459    tr_free( set->begin );
    460     set->begin = set->end = NULL;
     460    set->end = set->begin = NULL;
    461461}
    462462
     
    504504}
    505505
     506static int
     507fileset_get_size( const struct tr_fileset * set )
     508{
     509    return set ? set->end - set->begin : 0;
     510}
     511
    506512/***
    507513****
     
    556562                   const char             * filename,
    557563                   tr_bool                  writable,
    558                    tr_preallocation_mode    preallocation_mode,
     564                   tr_preallocation_mode    allocation,
    559565                   uint64_t                 file_size )
    560566{
     
    569575    if( !cached_file_is_open( o ) )
    570576    {
    571         const int err = cached_file_open( o, filename, writable, preallocation_mode, file_size );
     577        const int err = cached_file_open( o, filename, writable, allocation, file_size );
    572578        if( err ) {
    573579            errno = err;
     
    738744
    739745int
    740 tr_fdGetFileLimit( const tr_session * session )
    741 {
    742     const struct tr_fileset * set = session && session->fdInfo ? &session->fdInfo->fileset : NULL;
    743     return set ? set->end - set->begin : 0;
     746tr_fdGetFileLimit( tr_session * session )
     747{
     748    return fileset_get_size( get_fileset( session ) );
    744749}
    745750
  • trunk/libtransmission/fdlimit.h

    r11602 r11603  
    2525void tr_fdSetFileLimit( tr_session * session, int limit );
    2626
    27 int tr_fdGetFileLimit( const tr_session * session );
     27int tr_fdGetFileLimit( tr_session * session );
    2828
    2929void tr_fdSetGlobalPeerLimit( tr_session * session, int limit );
Note: See TracChangeset for help on using the changeset viewer.